TITLE: Maximum value of a function. I am not able to check double derivative.
QUESTION [16 upvotes]: Can someone explain me how $\sin^p x \cos^q x$ attains maximum at $\tan^2 x = \frac pq$.
I am not able to check whether double derivative is positive or negative.

Question
Show that $$\sin^p\theta\cos^q\theta$$ attains a maximum when $$\theta=\tan^{-1}\sqrt{(p/q)}$$
Solution
Ley $y=\sin^p\theta\cos^q\theta$. For a maximum or minimum of $y$, we have $\frac{\text dy}{\text dx}=0$
\begin{align}p\sin^{p-1}\theta\cos^{q+1}\theta-q\sin^{p+1}\theta\cos^{q-1}\theta&=0\\
\sin^{p-1}\theta\cos^{q-1}\theta(p\cos^2\theta-q\sin^2\theta)&=0\end{align}
Therefore \begin{align}\sin\theta&=0\\
&\Downarrow\\
\theta&=0\\
\text{or } \cos\theta&=0\\
&\Downarrow\\
\theta&=\frac \pi 2\\
\text{or }\tan^2\theta&=\frac pq\\
&\Downarrow\\
\theta&=\tan^{-1}\sqrt{p/q}\end{align}
Now $y=0$ at $\theta=0$ and also at $\theta=\frac\pi2$
When $0<\theta<\frac\pi2$, $y$ is positive
Also, $\tan^{-1}\sqrt{p/q}$ is the only value of $\theta$ lying between $0$ and $\frac \pi2$ at which $\frac{\text d}{\text dx}=0$.
Hence $y$ is maximum when $$\theta=\tan^{-1}\sqrt{p/q}$$
This can be seen from the graph of $y$

REPLY [3 votes]: You don't have to check the second derivate. What you use is:
$$y(0) = \sin^p(0)\cos^q(0) = 0$$
$$y(\pi/4) = \sin^p(\pi/4)\cos^q(pi/4) = 2^{-p/2-q/2} > 0$$
$$y(\pi/2) = \sin^p(\pi/2)\cos^q(pi/2) = 0$$
So you see that $y$ must have a maximum for some $c\in[0,\pi]$ and it has to be at least $2^{-(p+q)/2}>0$ so it's not at the end points which means that $y'(c) = 0$ and there's only one point where this holds so there must be the maximum.