6. The range of the function $f(x)=2 \cos x+\sin 2 x(x \in \mathbf{R})$ is $\qquad$ .
6. $\left[-\frac{3 \sqrt{3}}{2}, \frac{3 \sqrt{3}}{2}\right]$.

Notice,
$$
\begin{array}{l}
f^{2}(x)=(2 \cos x+\sin 2 x)^{2} \\
=4 \cos ^{2} x(1+\sin x)^{2} \\
=\frac{4}{3}(3-3 \sin x)(1+\sin x)^{3} \\
\leqslant \frac{4}{3}\left[\frac{(3-3 \sin x)+3(1+\sin x)}{4}\right]^{4}=\frac{27}{4},
\end{array}
$$

Equality holds if and only if $3-3 \sin x=1+\sin x$, i.e., $\sin x=\frac{1}{2}$.

Thus, when $\sin x=\frac{1}{2}, \cos x=\frac{\sqrt{3}}{2}, f(x)$ achieves its maximum value $\frac{3 \sqrt{3}}{2}$;

When $\sin x=\frac{1}{2}, \cos x=-\frac{\sqrt{3}}{2}, f(x)$ achieves its minimum value $-\frac{3 \sqrt{3}}{2}$.
Therefore, the range of the function $f(x)$ is $\left[-\frac{3 \sqrt{3}}{2}, \frac{3 \sqrt{3}}{2}\right]$.