Maximum of $f(x) =(1+\cos x)\cdot \sin(\frac{x}{2})$ on $x \in (0, \pi)$ I've attempted to solve this question by using $$f(x) = 2\sin\frac{x}{2}\cos^2\frac{x}{2} \leq \frac{(2\sin\frac{x}{2}+\cos^2\frac{x}{2})^2}{2}$$ but it results in the wrong answer every time. Is there another way to solve this question and is there anything I can do to change my method to make it work.

Since $\cos x = 1-2\sin^2 \frac{x}{2}$,
$$
f(x)=\left(2-2\sin^2\frac{x}{2}\right)\sin \frac{x}{2} = 2\sin \frac{x}{2} - 2\sin^3\frac{x}{2}.
$$
Thus you can find the maximum of $f(x)$ by finding the maximum of $g(x)=2x-2x^3$ defined on $(0,1)$.
