8.157. $\operatorname{ctg} x+\operatorname{tg} 2 x+1=4 \cos ^{2} x+\frac{\sin 3 x}{\sin x}-2 \cos 2 x$.

8.157. $\cot x + \tan 2x + 1 = 4 \cos^2 x + \frac{\sin 3x}{\sin x} - 2 \cos 2x$.
## Solution.

$$
\text { domain: }\left\{\begin{array}{l}
\cos 2 x \neq 0 \\
\sin x \neq 0
\end{array}\right.
$$

Using the formula $\sin 3 \alpha=3 \sin \alpha-4 \sin ^{3} \alpha$, we can rewrite the equation as

$$
\frac{\cos x}{\sin x}+\frac{\sin 2 x}{\cos 2 x}+1=4 \cos ^{2} x+\frac{3 \sin x-4 \sin ^{3} x}{\sin x}-2 \cos 2 x
$$

$$
\begin{aligned}
& \frac{\cos 2 x \cos x+\sin 2 x \sin x}{\sin x \cos 2 x}+1=4 \cos ^{2} x+\frac{\sin x\left(3-4 \sin ^{2} x\right)}{\sin x}-2 \cos 2 x \Leftrightarrow \\
& \Leftrightarrow \frac{\cos x}{\sin x \cos 2 x}+1=4 \cos ^{2} x+3-4 \sin ^{2} x-2 \cos 2 x \Leftrightarrow \\
& \Leftrightarrow \frac{\cos x}{\sin x \cos 2 x}=4\left(\cos ^{2} x-\sin ^{2} x\right)+2-2 \cos 2 x \Leftrightarrow \frac{\cos x}{\sin x \cos 2 x}=4 \cos 2 x+ \\
& +2-2 \cos 2 x \Leftrightarrow \frac{\cos x}{\sin x \cos 2 x}-2(\cos 2 x+1)=0, \frac{\cos x}{\sin x \cos 2 x}- \\
& -2\left(2 \cos ^{2} x-1+1\right)=0, \frac{\cos x}{\sin x \cos 2 x}-4 \cos ^{2} x=0, \\
& \cos x \cdot\left(\frac{1}{\sin x \cos 2 x}-4 \cos x\right)=0, \\
& \frac{\cos x(1-4 \sin x \cos x \cos 2 x)}{\sin x \cos 2 x}=0, \quad \cos x(1-\sin 4 x)=0 .
\end{aligned}
$$

From this:

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

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