Find local extrema for $f(x)=\sin x+(1-2\sin x)\cos x$ I tried by solving $f'(x)=0$ and then plugging those values in the initial function. I also noticed that $f(x)=\sin x+\sin\left(x+\frac{\pi}{2}\right)-2\sin x\sin \left(x+\frac{\pi }{2} \right)$. Perhaps there’s a more efficient way to find local extrema than looking for critical points?
 A: HINT
To begin with, I would start with rearranging the proposed expression as follows:
\begin{align*}
\sin(x) + (1 - 2\sin(x))\cos(x) & = \sin(x) + \cos(x) - 2\sin(x)\cos(x)\\\\
& = \sin(x) + \cos(x) - (1 + 2\sin(x)\cos(x)) + 1\\\\
&  = \sin(x) + \cos(x) - (\sin(x) + \cos(x))^{2} + 1
\end{align*}
Now you can make the substitution $u = \sin(x) + \cos(x)$.
Can you take it from here?
A: I fully approve the expression of @APCorreia till
$$(\sin(x) + \cos(x)) - (\sin(x) + \cos(x))^{2} + 1$$
but I wouldn't advise to make the suggested substitution.
I think preferable to write the above expression under the form
$$f(x)=\tfrac54-((\cos x + \sin x)-\tfrac12)^2$$
$$f(x)=\tfrac54-(\sqrt{2}\cos(x-\tfrac{\pi}{4})-\tfrac12)^2$$
which is easy to differentiate
$$f'(x)=2(\sqrt{2}\cos(x-\tfrac{\pi}{4})-\tfrac12)\sqrt{2}\sin(x-\tfrac{\pi}{4})$$
Let $a=\operatorname{acos}\dfrac{\sqrt{2}}{4}.$
The derivative is zero for values:
$$x=\pi/4+a;x=\pi/4-a;x=\pi/4;x=5\pi/4;x=-3\pi/4$$
(red points on the graphic below). It remains to discuss the sign of $f'$ on an interval with length $2 \pi$, due to the periodicity of $f$.

