2. In the interval $0 \leq x \leq \pi$ find the solutions to the equation

$$
\frac{1}{\sin x}-\frac{1}{\cos x}=2 \sqrt{2}
$$
Solution. The number $x$ is a solution to the above equation if and only if $x$ is a solution to the system

$$
\begin{aligned}
& \left(\frac{1}{\sin x}-\frac{1}{\cos x}\right)^{2}=8 \\
& \frac{1}{\sin x}-\frac{1}{\cos x} \geq 0
\end{aligned}
$$

From equation (1) we have

$$
\begin{aligned}
& \frac{1}{\sin ^{2} x}+\frac{1}{\cos ^{2} x}-\frac{2}{\sin x \cos x}=8 \\
& \frac{1}{\sin ^{2} x \cos ^{2} x}-\frac{2}{\sin x \cos x}=8 \\
& \frac{4}{\sin ^{2} 2 x}-\frac{4}{\sin 2 x}=8 \\
& 2 \sin ^{2} 2 x+\sin 2 x-1=0
\end{aligned}
$$

Substituting $y=\sin 2 x$ we get a quadratic equation in $y$ whose solutions are $y_{1}=-1$, $y_{2}=\frac{1}{2}$. Solutions to the equation $\sin 2 x=-1$ in the interval $[0, \pi]$ are $x=\frac{3 \pi}{4}$ and $x=\frac{\pi}{12}$, and for the equation $\sin 2 x=\frac{1}{2}$ it is $x=\frac{5 \pi}{12}$. It remains to check whether for these values the inequality (2) is satisfied, i.e.,

$$
\frac{1}{\sin x} \geq \frac{1}{\cos x}
$$

Since on the interval $[0, \pi], \sin x \geq 0$, inequality (2) is always satisfied for $\cos x > 0$, then the inequality transforms into $\cos x \geq \sin x$, which is satisfied for all $x \in\left[0, \frac{\pi}{4}\right]$.

Finally, solutions to the original equation are the solutions to (1) that lie in $\left(0, \frac{\pi}{4}\right] \cup\left(\frac{\pi}{2}, \pi\right]$, i.e., $x=\frac{3 \pi}{4}$ and $x=\frac{\pi}{12}$.