4.1. Given the function $f(x)=|x+1|-2$. How many roots does the equation $f(f(\ldots f(f(x)) \ldots))=\frac{1}{2}$ have, where the function $f$ is applied 2013 times?
Answer: 4030. Solution. Considering the graph of the function $f$ (see Fig. 1), we conclude that $|f(x)+1|=f(x)+1$ and $|f(x)+1|-2=f(x)-1$. Therefore, the graph of the function $f(f(x))$

![](https://cdn.mathpix.com/cropped/2024_05_06_adf4a392ca1a490a8c79g-04.jpg?height=417&width=671&top_left_y=1528&top_left_x=316)

has the form as in $p and c$.

![](https://cdn.mathpix.com/cropped/2024_05_06_adf4a392ca1a490a8c79g-04.jpg?height=454&width=740&top_left_y=1498&top_left_x=1069)

Fig. 1

Fig. 2

The equation $f(f(x))=\frac{1}{2}$ has 8 solutions. Note that between the rays $y=-x-4$, $x \leq-4$ and $y=x-3, x \geq 3$ there are exactly three triangles, the lengths of the bases of which are 2, and the heights are 1. The next substitution $f(f(f(x)))$ changes the graph of the function as follows: the rays $y=-x-4, x \leq-4$ and $y=x-3, x \geq 3$ will transition to the rays $y=-x-5, x \leq-5$ and $y=x-4, x \geq 4$, and another triangle will appear between them, the length of the base of which is 2, and the height is 1. Therefore, the equation $f(f(f(x)))=\frac{1}{2}$ has 10 solutions. Each subsequent substitution $f(\ldots)$ changes the graph of the function similarly: it shifts the extreme rays to the left and right by 1, respectively, and adds another triangle between the rays, the length of the base of which is 2, and the height is 1. Thus, starting from the function $f(f(x))$, each subsequent substitution $f(\ldots)$ increases the number of solutions of the previous equation by two. We get that if the function is applied 2013 times, then the number of roots of such an equation is $8+2 \cdot 2011=4030$.