Lời giải:
Ta có:
\(y=\cos ^2x-\sin x=1-\sin ^2x-\sin x\)
\(=\frac{5}{4}-(\sin ^2x+\sin x+\frac{1}{4})\)
\(=\frac{5}{4}-(\sin x+\frac{1}{2})^2\)
Thấy rằng \((\sin x+\frac{1}{2})^2\geq 0, \forall x\in\mathbb{R}\)
\(\Rightarrow y=\frac{5}{4}-(\sin x+\frac{1}{2})^2\leq \frac{5}{4}\Rightarrow y_{\max}=\frac{5}{4}\)
Dấu bằng xảy ra khi \(\sin x=\frac{-1}{2}\Rightarrow x=\frac{-\pi}{6}+2k\pi \) or \(x=\frac{7\pi}{6}+2k\pi \) (tất nhiên với $k$ nguyên)