5. If the function $f(x)=\lg \left(\sin ^{6} x+\cos ^{6} x+a \sin x \cos x\right)$ has the domain $\mathbf{R}$, then the range of the real number $a$ is $\qquad$ .
5. $\left(-\frac{1}{2}, \frac{1}{2}\right)$.

Let $t=\sin x \cos x$, then $-\frac{1}{2} \leqslant t \leqslant \frac{1}{2}$, thus
$$
\begin{aligned}
\sin ^{6} x+\cos ^{6} x+a \sin x \cos x & =\left(\sin ^{2} x+\cos ^{2} x\right)\left(\sin ^{4} x-\sin ^{2} x \cos ^{2} x+\cos ^{4} x\right)+a \sin x \cos x \\
& =\left(\sin ^{2} x+\cos ^{2} x\right)^{2}-3 \sin ^{2} x \cos ^{2} x+a \sin x \cos x \\
& =-3(\sin x \cos x)^{2}+a(\sin x \cos x)+1 \\
& =-3 t^{2}+a t+1
\end{aligned}
$$

Therefore, we only need to determine $a$ such that when $t \in\left[-\frac{1}{2}, \frac{1}{2}\right]$,
$$
-3 t^{2}+a t+1>0 \text {. }
$$
(1) When $t=0$, equation (1) always holds;
(2) When $t>0$, equation (1) $\Leftrightarrow a>3 t-\frac{1}{t}$. Let $f(t)=3 t-\frac{1}{t}$, at this time $f(t)$ is an increasing function on $(0,+\infty)$, and its maximum value on $\left(0, \frac{1}{2}\right]$ is $f\left(\frac{1}{2}\right)=-\frac{1}{2}$, i.e., $a>-\frac{1}{2}$.
(3) When $t<0$, equation (1) $\Leftrightarrow a<3 t-\frac{1}{t}$. Let $g(t)=3 t-\frac{1}{t}$, at this time $g(t)$ is an increasing function on $(-\infty, 0)$, and its minimum value is $g\left(-\frac{1}{2}\right)=-\frac{2}{3}+2=\frac{1}{2}$, i.e., $a<\frac{1}{2}$. In summary, the range of $a$ is $\left(-\frac{1}{2}, \frac{1}{2}\right)$.