<s>[INST] Finding maximum of a given function 
Show that $f(x)=\sin x(1+\cos x)$ attains its maximum at $x= \pi/3$.

I differentiated the function $f$ and got $f'(x)=\cos x(1+2\cos x)$. After equating with $0$, I got $x=\pi/2$ and $x =\pi/3 + n\pi$ with $n\neq 0$. So I did not get $x= \pi/3$ even as an extreme value.
 [/INST] $$\cos x(1+2\cos x)=0$$
$$\cos x=0\ \ \ \text{or} \ \ 1+2\cos x=0$$
$$x=\frac{(2n+1)\pi}{2}\ \ \ \text{or} \ \ \cos x=-\frac12$$
$$x=\frac{(2n+1)\pi}{2}\ \ \ \text{or} \ \ \cos x=\cos\frac{2\pi}{3}$$
$$x=\frac{(2n+1)\pi}{2}\ \ \ \text{or} \ \ \ x=2n\pi\pm\frac{2\pi}{3}$$
$$x=\ldots, -\frac{\pi}{2}, \frac{\pi}{2}, \frac{3\pi}{2}\ldots \ \ \ \text{or} \ \ \ x=\ldots, -\frac{4\pi}{3}, -\frac{2\pi}{3}, \frac{2\pi}{3}, \frac{4\pi}{3}, \ldots $$
</s>