8.349. $\operatorname{tg}^{4} x+\operatorname{tg}^{2} x+\operatorname{ctg}^{4} x-\operatorname{ctg}^{2} x=\frac{106}{9}.$
## Solution.

Domain of definition: $\left\{\begin{array}{l}\cos x \neq 0, \\ \sin x \neq 0 .\end{array}\right.$

Since $\operatorname{tg}^{2} \frac{\alpha}{2}=\frac{1-\cos \alpha}{1+\cos \alpha}$ and $\operatorname{ctg}^{2} \frac{\alpha}{2}=\frac{1+\cos \alpha}{1-\cos \alpha}$, we get

$$
\begin{aligned}
& \left(\frac{1-\cos 2 x}{1+\cos 2 x}\right)^{2}+\left(\frac{1+\cos 2 x}{1-\cos 2 x}\right)^{2}+\frac{1-\cos 2 x}{1+\cos 2 x}-\frac{1+\cos 2 x}{1-\cos 2 x}-\frac{106}{9}=0 \Leftrightarrow \\
& \Leftrightarrow\left(\frac{1-\cos 2 x}{1+\cos 2 x}+\frac{1+\cos 2 x}{1-\cos 2 x}\right)^{2}-2 \frac{1-\cos 2 x}{1+\cos 2 x} \cdot \frac{1+\cos 2 x}{1-\cos 2 x}+
\end{aligned}
$$

$$
\begin{aligned}
& +\frac{(1-\cos 2 x)^{2}-(1+\cos 2 x)^{2}}{(1+\cos 2 x)(1-\cos 2 x)}-\frac{106}{9}=0 \Leftrightarrow \\
& \Leftrightarrow\left(\frac{(1-\cos 2 x)^{2}+(1+\cos 2 x)^{2}}{1-\cos ^{2} 2 x}\right)^{2}-2-\frac{4 \cos 2 x}{1-\cos ^{2} 2 x}-\frac{106}{9}=0 \Leftrightarrow \\
& \Leftrightarrow\left(\frac{2+2 \cos ^{2} 2 x}{1-\cos ^{2} 2 x}\right)^{2}-\frac{4 \cos 2 x}{1-\cos ^{2} 2 x}-\frac{124}{9}=0, \\
& \left(\frac{1+\cos ^{2} 2 x}{1-\cos ^{2} 2 x}\right)^{2}-\frac{\cos 2 x}{1-\cos ^{2} 2 x}-\frac{31}{4}=0 \Leftrightarrow \\
& \Leftrightarrow 22 \cos ^{4} 2 x-9 \cos ^{3} 2 x-80 \cos ^{2} 2 x+9 \cos 2 x+22=0 .
\end{aligned}
$$

Let $\cos 2 x=y$. Then the equation becomes

$$
\begin{aligned}
& 22 y^{4}-9 y^{3}-80 y^{2}+9 y+22=0 \\
& 22 y^{2}-9 y-80+\frac{9}{y}+\frac{22}{y^{2}}=0 \Leftrightarrow 22\left(y^{2}+\frac{1}{y^{2}}\right)-9\left(y-\frac{1}{y}\right)-80=0 \\
& 22\left(\left(y-\frac{1}{y}\right)^{2}+2\right)-9\left(y-\frac{1}{y}\right)-80=0,22\left(y-\frac{1}{y}\right)^{2}-9\left(y-\frac{1}{y}\right)-36=0
\end{aligned}
$$

Solving this equation as a quadratic in $y-\frac{1}{y}$, we find

$$
\left(y-\frac{1}{y}\right)_{1}=-\frac{12}{11} \text { and }\left(y-\frac{1}{y}\right)_{2}=\frac{33}{22}
$$

After simplifications, we get

$$
\begin{aligned}
& 11 y^{2}+12 y-11=0 \text { and } 22 y^{2}-33 y-22=0 ; y_{1}=\frac{-6-\sqrt{157}}{11} \\
& y_{2}=\frac{-6+\sqrt{157}}{11}, y_{3}=-\frac{1}{2}, y_{4}=2
\end{aligned}
$$

Then

$$
\cos 2 x=\frac{-6-\sqrt{157}}{11}<-1, \varnothing ; \cos 2 x=\frac{-6+\sqrt{157}}{11}
$$

$2 x= \pm \arccos \frac{-6+\sqrt{157}}{11}+2 \pi k, x_{1}= \pm \frac{1}{2} \arccos \frac{-6+\sqrt{157}}{11}+\pi k, k \in Z ;$ $\cos 2 x=-\frac{1}{2}, 2 x= \pm \frac{2}{3} \pi+2 \pi n, x_{2}= \pm \frac{\pi}{3}+\pi n=\frac{\pi}{3}(3 n \pm 1), n \in Z$; $\cos 2 x=2, \varnothing$.

Answer: $x_{1}= \pm \frac{1}{2} \arccos \frac{-6+\sqrt{157}}{11}+\pi k ; x_{2}=\frac{\pi}{3}(3 n \pm 1)$, where $k$ and $n \in Z$.