2. Solve the equation $\frac{1}{2}\left|\cos 2 x-\frac{1}{2}\right|=\cos ^{2} 3 x+\cos x \cos 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}
\cos ^{2} 3 x+\cos x \cos 3 x=\cos 3 x(\cos x+\cos 3 x)=\cos 3 x \cdot 2 \cos 2 x \cos x=\cos 2 x \cdot(2 \cos x \cos 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(\cos 2 x+1)(2 \cos 2 x-1)
\end{gathered}
$$

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

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

b) $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 suitable.

c) $t<\frac{1}{2}$. We get $-\frac{1}{4}=t^{2}+t, t^{2}+t+\frac{1}{4}=0, t=-\frac{1}{2}$.

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}$.