I have a question concerning the maximum value of $y = \sin{x} + \cos^2x$.
I computed the derivative of $y'=\cos{x}(2\sin{x} - 1)$. Then I computed the extremums $x = \pi/6 + 2/3\pi k$ and $x = \pi/2 + \pi k$. Also I computed the values of the function at the extremums $y(\pi/6) = 1.25$ and $y(\pi/2) = 1$. Now I want to observe how the derivative behaves around the extremums and here is the thing I don't understand. It seems to be the case, that in the interval from $0$ to $5 \pi/6$ of $y$: $y'$ is negative for $x < \pi /6$, positive for $\pi/2 > x > \pi/6$ and negative for $x > \pi/2$. However, one can see from the graph of the function that $y$ is increasing in $x < \pi/6$, decreasing in $\pi/2 > x > \pi/6$ and increasing from $\pi/2$ to the $5 \pi /6$.
So, to sum up, my question is: Why is the function increasing though the derivative is negative in the given interval?
Your computation of $y'$ is not correct. We have$$y'(x)=\cos(x)-2\sin(x)\cos(x)=\cos(x)\bigl(1-2\sin(x)\bigr).$$And this explaind why the sign of $y'$ doesn't seem to match the intervals at which $y$ is increasing or decreasing.