identify local extrema of $2\cos x + \sin^2 x$ 
Identify local extrema of $2\cos x + \sin^2 x$.

I find the critical values as $n\pi$ and $2n\pi$, where $n$ is an integer. The second derivative test seems to fail as I get $y^{\prime\prime}=0$ at the critical values.
 A: hint
$$2\cos(x)+\sin^2(x)=$$
$$2\cos(x)+1-\cos^2(x)=$$
$$2-(1-\cos(x))^2$$
A: Hint: $2\cos x+\sin ^{2}x=2t+1-t^{2}$ where $t=\cos x$. So the local extrema of the given function can be found using local extrema of $2t+1-t^{2}$ in $[-1,1]$.
A: We don't need derivatives, we can use the theory of quadratic equations.
Render
$a=2\cos x+1-\cos^2x$
$\cos^2 x-2\cos x+(a-1)=0.$
Then the local maxima and minima must correspond to double roots for the quadratic equation or to the bounding values $\cos x=\pm1$. To check for double roots of the quadratic, render the discriminant equal to zero and find the corresponding double root for $\cos x$:
$(-2)^2-4(1)(a-1)=0; a=2$
$\cos^2 x-2\cos x+1=0;\cos x=1.$
The double root occurs at a bounding value $\cos x=1$, so the extrema can only be at both bounding values $\cos x=\pm1$. This corresponds $x=n\pi$ for all $n$, from which the maximum function value is $+2$ when $n$ is even and the minimum is $-2$ when $n$ is odd.

We can describe what happened to the second derivative test in terms of these results. The second derivative actually works out to
$2\cos 2x-2\cos x,$
which can be verified positive when $\cos x=-1, x=n\pi$ with $n$ odd (which the quadratic equation analysis identifies as a minimum); but zero when $\cos x=+1$, $x=n\pi$ with $n$ even (which the quadratic equation analysis still identifies as a maximum).
We get the zero second derivative in the latter case because the bounding condition $\cos x=+1,f(x)=+2$ matches a double root of the quadratic. We know that the bounding condition will give all odd derivatives equal to zero, so the extreme character for this root can be rendered from the fourth derivative. The reader can prove that the fourth derivative is negative consistent with a maximum.
A: Notice that $x\mapsto 2\cos x+\sin^{2}x$ is continuous over the closed interval $[0,2\pi]$ so by Extreme Value Theorem, then $f$ must attain a maximum and a minimum, each at least once.
Define the mapping $f: x\mapsto 2\cos x+\sin^{2}x$ over all $\Bbb{R}$ and notice that $f(x+2\pi)=f(x)$ so $f$ is $2\pi$-periodic function. So we can find the extrema over the domain of $f$ restricted to the interval $[0,2\pi[$.
As you noticed the critical points is obtained by setting $f'(x)=0$ that is solving $-2\sin(x)+2\sin x \cos x=\sin 2x-2\sin x=0$ give $x=0$ and $x=\pi$ and we need see in endpoints $x=2\pi^{-}$.
Evaluating the critical points in $f$, we have

*

*$f(0)=2$.


*$f(\pi)=-2$.


*$f(2\pi^{-})=2$.
Now $f''(x)=-2(\cos(x)-\cos 2x)$ and since $f''(\pi)=4>0$ so at $x=\pi$ we have a minimum and $f''(0)=0$ so indeed the test fails. However
we can use the first derivative test since $f'>0$ over $]-\pi,0[$ and $f'<0$ over $]0,\pi[$ so by first derivative test at $x=0$ we have a maximum. Remove the point $2\pi^{-}$ since the value of $f$ here is never achieved (remember that here $f|_{[0,2\pi[}$). Therefore maximum in $x=0$ and minimum in $x=\pi$.
Now add $2\pi n$ for each $n\in \mathbb{Z}$ for each extremum and we have

*

*$\min f(x)$ at $x=\pi+2\pi n$.

*$\max f(x)$ at $x=0+2\pi n$.

