8.159. $2 \cos ^{2} \frac{x}{2}-1=\sin 3 x$.

8.159. $2 \cos ^{2} \frac{x}{2}-1=\sin 3 x$. 

The above text is already in a mathematical equation format, which is the same in both Chinese and English. Therefore, the translation is identical to the original text.
## Solution.

We have

$$
\begin{aligned}
& \cos x - \cos \left(\frac{\pi}{2} - 3 x\right) = 0 \Leftrightarrow \sin \left(\frac{\pi}{4} - x\right) \sin \left(\frac{\pi}{4} - 2 x\right) = 0 \\
& \sin \left(x - \frac{\pi}{4}\right) \sin \left(2 x - \frac{\pi}{4}\right) = 0
\end{aligned}
$$

From this:

1) $\sin \left(x - \frac{\pi}{4}\right) = 0, \quad x - \frac{\pi}{4} = \pi k, \quad x_{1} = \frac{\pi}{4} + \pi k = \frac{\pi}{4}(4 k + 1), k \in \mathbb{Z}$;
2) $\sin \left(2 x - \frac{\pi}{4}\right) = 0, 2 x - \frac{\pi}{4} = \pi n, \quad x_{2} = \frac{\pi}{8} + \frac{\pi n}{2} = \frac{\pi}{8}(4 n + 1), n \in \mathbb{Z}$.

Answer: $\quad x_{1} = \frac{\pi}{4}(4 k + 1) x_{2} = \frac{\pi}{8}(4 n + 1), \quad k, n \in \mathbb{Z}$.