Example 1. Solve the equation

$$
x^{2}-5|x|+6=0
$$
Solution. The original equation is equivalent to the following systems:

$$
\left\{\begin{array} { l } 
{ x ^ { 2 } - 5 x + 6 = 0 , } \\
{ x \geqslant 0 }
\end{array} \quad \left\{\begin{array}{l}
x^{2}+5 x+6=0 \\
x<0
\end{array}\right.\right.
$$

The equation $x^{2}-5 x+6=0$ has two solutions: $x_{1}=2, x_{2}=3$, each of which is non-negative; therefore, the numbers 2 and 3 are solutions to the first system of the set. The equation $x^{2}+5 x+6=0$ has solutions $x_{3}=-2$ and $x_{4}=-3$, which are solutions to the second system of the set, since $x_{3}<0$ and $x_{4}<0$.

Therefore, the set of all solutions to the given equation consists of four numbers: $-2,2,-3,3$.

Note that the given equation can be solved using the method of substitution. Let $t=|x|$. Then the given equation can be written as follows: $t^{2}-5 t+6=0$ (since $x^{2}=\left|x^{2}\right|=|x|^{2}$). The solutions to this equation are two positive numbers: 2 and 3; therefore, the original equation is equivalent to the set of two equations: $|x|=2,|x|=3$, solving which we obtain the solution to the original equation.