\(y=1-cos^2x-6cosx+1=-cos^2x-6cosx+2\)
\(y=-cos^2x-6cosx-5+7\)
\(y=7-\left(cosx+1\right)\left(cosx+5\right)\)
Do \(cosx\ge-1\Rightarrow\left\{{}\begin{matrix}cosx+1\ge0\\cosx+5>0\end{matrix}\right.\)
\(\Rightarrow\left(cosx+1\right)\left(cosx+5\right)\ge0\)
\(\Rightarrow7-\left(cosx+1\right)\left(cosx+5\right)\le7-0=7\)
\(\Rightarrow y_{max}=7\) khi \(cosx=-1\Leftrightarrow x=\pi+k2\pi\)