How many zeros does the function defined by the following assignment have depending on the parameter $a$?

$$
f(x)= \begin{cases}\sqrt{x^{2}+4 x+4}-a, & \text { if } x \leq 0 \\ x^{2}-4 x+a, & \text { if } x>0\end{cases}
$$
# Solution.

$$
\begin{aligned}
\sqrt{x^{2}+4 x+4}-a & =\sqrt{(x+2)^{2}}-a=|x+2|-a= \\
& = \begin{cases}x+2-a, & \text { if }-2 \leq x \leq 0 \\
-(x+2)-a, & \text { if } x>0 \text{. Therefore, }

$$
f(x)= \begin{cases}(x-2)^{2}-4+a, & \text { if } x>0 \\ x+2-a, & \text { if }-2 \leq x \leq 0 \\ -(x+2)-a, & \text { if } x>0 \text{ on the interval } x>0$.

The image of the function on the interval $x \leq 0$ is shifted $a$ units downward along the $y$-axis, while on the interval $x>0$ it is shifted $a$ units upward. Based on this,

| Value of $a$ | Number of zeros on the interval $x \leq 0$ |
| :---: | :---: |
| $a \leq 0$ | 1 |
| $0 < a < 2$ | 2 |
| $a = 2$ | 1 |
| $a > 2$ | 0 |


| Value of $a$ | Number of zeros on the interval $x > 0$ |
| :---: | :---: |
| $a \leq 0$ | 1 |
| $0 < a < 4$ | 2 |
| $a = 4$ | 1 |
| $a > 4$ | 0 |

According to the two tables, the number of zeros depends on the parameter $a$ as follows:

| Value of $a$ | Number of zeros |
| :---: | :---: |
| $a \leq 0$ | 2 |
| $0 < a < 2$ | 4 |
| $a = 2$ | 3 |
| $2 < a < 4$ | 2 |
| $a = 4$ | 1 |
| $a > 4$ | 1 |