3. The maximum value of the function $y=\sin 2x-2(\sin x+\cos x)$ is $\qquad$ .
3. $1+2 \sqrt{2}$.

From the condition, we know that the period of the function is $2 \pi$.
Also, $y^{\prime}=2 \cos 2 x-2 \cos x+2 \sin x$, so the function is monotonically increasing in the interval $\left[0, \frac{\pi}{4}\right]$, monotonically decreasing in the interval $\left[\frac{\pi}{4}, \frac{\pi}{2}\right]$, monotonically increasing in the interval $\left[\frac{\pi}{2}, \frac{5 \pi}{4}\right]$, and monotonically decreasing in the interval $\left[\frac{5 \pi}{4}, 2 \pi\right]$.
When $x=\frac{\pi}{4}$, $y=1-2 \sqrt{2}$;
When $x=\frac{5 \pi}{4}$, $y=1+2 \sqrt{2}$.
Therefore, $y_{\max }=1+2 \sqrt{2}$.