Đặt \(sinx+cosx=\sqrt{2}sin\left(x+\frac{\pi}{4}\right)=t\Rightarrow\left\{{}\begin{matrix}-\sqrt{2}\le t\le\sqrt{2}\\2sinx.cosx=t^2-1\end{matrix}\right.\)
\(\Rightarrow y=t+t^2-1-1=t^2+t-2\)
Xét hàm \(f\left(t\right)=t^2+t-2\) trên \(\left[-\sqrt{2};\sqrt{2}\right]\)
\(-\frac{b}{2a}=-\frac{1}{2}\in\left[-\sqrt{2};\sqrt{2}\right]\)
\(f\left(-\frac{1}{2}\right)=-\frac{9}{4}\) ; \(f\left(-\sqrt{2}\right)=-\sqrt{2}\) ; \(f\left(\sqrt{2}\right)=\sqrt{2}\)
\(\Rightarrow y_{max}=\sqrt{2}\) khi \(t=\sqrt{2}\)
\(y_{min}=-\frac{9}{4}\) khi \(t=-\frac{1}{2}\)