One thing the people above me forgot to point out is that once you differentiate, you need to equate that to 0 and then find the value for p so that you are finding the value of p for which the function is at its max
One thing the people above me forgot to point out is that once you differentiate, you need to equate that to 0 and then find the value for p so that you are finding the value of p for which the function is at its max