Show solutionHide solution
We need the absolute maximum and minimum of
\[ f(x)=\cos^2 x+\sin x,\qquad x\in[0,\pi]. \]Step 1: Rewrite in one trigonometric function. Since \(\cos^2 x=1-\sin^2 x\),
\[ f(x)=1-\sin^2 x+\sin x. \] Let \(t=\sin x\). As \(x\) runs over \([0,\pi]\), \(\sin x\) runs over \([0,1]\). Thus the problem becomes finding the extreme values of \[ g(t)=1-t^2+t,\qquad t\in[0,1]. \]Step 2: Critical point.
\[ g'(t)=-2t+1. \] Setting \(g'(t)=0\) gives \(t=\tfrac12\), which lies in \([0,1]\).Step 3: Evaluate at the critical point and endpoints.
\[ g(0)=1,\qquad g\!\left(\tfrac12\right)=1-\tfrac14+\tfrac12=\tfrac54,\qquad g(1)=1-1+1=1. \]Therefore the largest value is \(\tfrac54\) and the smallest value is \(1\).
Step 4: Return to \(x\). The value \(t=\tfrac12\) corresponds to \(\sin x=\tfrac12\) on \([0,\pi]\), namely \(x=\tfrac{\pi}{6}\) or \(x=\tfrac{5\pi}{6}\). The value \(t=0\) corresponds to \(x=0\) or \(x=\pi\), and \(t=1\) corresponds to \(x=\tfrac{\pi}{2}\).
Hence
\[ \boxed{\text{absolute maximum value }=\frac54\ \text{at }x=\frac{\pi}{6},\frac{5\pi}{6}} \] \[ \boxed{\text{absolute minimum value }=1\ \text{at }x=0,\frac{\pi}{2},\pi.} \]