Example 17. For all $a$ solve the inequality

$$
\left|x^{2}-5 x+4\right|<a
$$
Solution. Since $\left|x^{2}-5 x+4\right| \geqslant 0$ for any $x$, the inequality (14) has no solutions when $a \leqslant 0$.

Let $a>0$. Since $x^{2}-5 x+4=(x-1)(x-4)$, the number line (domain of the inequality (14)) is divided into three intervals: $x<1$, $1 \leqslant x \leqslant 4$, and $x>4$.

We will solve the inequality (14) in each of these intervals.

If $x<1$, then $x^{2}-5 x+4>0$, and in this case, the inequality (14) is equivalent to the system

$$
\left\{\begin{array}{l}
x^{2}-5 x+4-a<0, \\
x^{2}-5 x+4+a>0
\end{array}\right.
$$

The solution to the inequality $x^{2}-5 x+4-a<0$ is $x \in \left(\frac{1}{2}(5-\sqrt{9+4 a}), \frac{1}{2}(5+\sqrt{9+4 a})\right)$. The solution to the inequality $x^{2}-5 x+4+a>0$ is $x \in \left(-\infty, \frac{1}{2}(5-\sqrt{9-4 a})\right) \cup \left(\frac{1}{2}(5+\sqrt{9-4 a}), +\infty\right)$. Therefore, the solution to the system is $x \in \left(\frac{1}{2}(5-\sqrt{9+4 a}), 1\right)$, which is non-empty for $a>0$. Therefore, for $a>0$ there is a solution to the inequality (14).

If $1 \leqslant x \leqslant 4$, then the inequality (14) on this set is equivalent to the inequality

$$
x^{2}-5 x+4+a>0
$$

The discriminant of the quadratic trinomial $x^{2}-5 x+4+a$ is $9-4 a$. Thus, the inequality (16) holds for any real $x$ if $a>9 / 4$, and for $0< a \leqslant 9 / 4$ the inequality (16) holds for $x \in \left(\frac{1}{2}(5-\sqrt{9-4 a}), \frac{1}{2}(5+\sqrt{9-4 a})\right)$. Therefore, for $a>9 / 4$ the solution to the inequality (14) is the interval $1 \leqslant x \leqslant 4$, and for $0< a \leqslant 9 / 4$ the solution is $x \in \left(1, \frac{1}{2}(5+\sqrt{9-4 a})\right)$.

If $x>4$, then $x^{2}-5 x+4>0$, and in this case, the inequality (14) is equivalent to the system

$$
\begin{aligned}
& \left\{\begin{array}{l}
x>4, \\
x^{2}-5 x+4-a<0, \\
x^{2}-5 x+4+a>0
\end{array}\right.
\end{aligned}
$$

The solution to the inequality $x^{2}-5 x+4-a<0$ is $x \in \left(\frac{1}{2}(5-\sqrt{9+4 a}), \frac{1}{2}(5+\sqrt{9+4 a})\right)$. The solution to the inequality $x^{2}-5 x+4+a>0$ is $x \in \left(-\infty, \frac{1}{2}(5-\sqrt{9-4 a})\right) \cup \left(\frac{1}{2}(5+\sqrt{9-4 a}), +\infty\right)$. Therefore, the solution to the system is $x \in \left(4, \frac{1}{2}(5+\sqrt{9+4 a})\right)$, which is non-empty for $a>0$. Therefore, for $a>0$ there is a solution to the inequality (14).

In summary, for $a>9 / 4$ the solution to the inequality (14) is $x \in \left(\frac{1}{2}(5-\sqrt{9+4 a}), \frac{1}{2}(5+\sqrt{9+4 a})\right)$, and for $0< a \leqslant 9 / 4$ the solution is $x \in \left(1, \frac{1}{2}(5+\sqrt{9-4 a})\right) \cup \left(4, \frac{1}{2}(5+\sqrt{9+4 a})\right)$.