2. Solve the equation $\frac{1}{2}\left|\cos 2 x+\frac{1}{2}\right|=\sin ^{2} 3 x-\sin x \sin 3 x$.
Answer. $x= \pm \frac{\pi}{6}+\frac{k \pi}{2}, k \in \mathrm{Z}$.

Solution. Transform the right side of the equation:

$$
\begin{gathered}
\sin ^{2} 3 x-\sin x \sin 3 x=\sin 3 x(\sin 3 x-\sin x)=\sin 3 x \cdot 2 \cos 2 x \sin x=\cos 2 x \cdot(2 \sin x \sin 3 x)=\cos 2 x \cdot(\cos 2 x-\cos 4 x)= \\
=\cos 2 x\left(-2 \cos ^{2} 2 x+\cos 2 x+1\right)=\cos 2 x(2 \cos 2 x+1)(1-\cos 2 x)
\end{gathered}
$$

Let $\cos 2 x=t$. Then the equation takes the form $\frac{1}{4} \cdot|2 t+1|=t(2 t+1)(1-t)$. There are three cases.

a) $t=-\frac{1}{2}$ is a root of the equation.

b) $t>-\frac{1}{2} \cdot$ We get $\frac{1}{4}=-t^{2}+t, t^{2}-t+\frac{1}{4}=0, t=\frac{1}{2}$.

c) $t<-\frac{1}{2}$. We get $-\frac{1}{4}=-t^{2}+t, t^{2}-t-\frac{1}{4}=0, t=\frac{1 \pm \sqrt{2}}{2}$. Both roots do not satisfy the condition $t<-\frac{1}{2}$, so they are not valid.

In total: $t= \pm \frac{1}{2}, \cos 2 x= \pm \frac{1}{2}, 2 x= \pm \frac{\pi}{3}+k \pi, x= \pm \frac{\pi}{6}+\frac{k \pi}{2}, k \in \mathrm{Z}$.