2B. Solve the equation

$$
\sin 2 x=\sqrt{2} \sin ^{2} x+(2-\sqrt{2}) \cos ^{2} x
$$
Solution. If $\cos x=0$, then $\sin ^{2} x=1, \sin 2 x=2 \sin x \cos x=0$, so the equation has no solution. We divide the given equation by $\cos ^{2} x$ and get

$$
\begin{aligned}
& \sqrt{2} \operatorname{tg}^{2} x-2 \operatorname{tg} x+2-\sqrt{2}=0 \\
& (\operatorname{tg} x-1)(\sqrt{2} \operatorname{tg} x+\sqrt{2}-2)=0
\end{aligned}
$$

Thus $\operatorname{tg} x=1$ or $\operatorname{tg} x=\sqrt{2}-1$. The solutions to these two equations are: $x_{1}=\frac{\pi}{4}+k \pi$, $x_{2}=\frac{\pi}{8}+m \pi,(k, m \in \mathbb{Z})$.