# From boring to puzzling in 30 iterative steps

The function ${f(x)=2\cos x }$ may be nice and important as a part of trigonometric basis, but there is nothing exciting in its graph:

Let’s look at its iterations ${f^n=f\circ f\circ \dots \circ f}$ where ${n }$ is the number of iterations, not an exponent. Here is the graph of ${f^{14}}$:

A rectangular pattern is already visible above; further iterations only make it stronger. For example, ${f^{30} }$:

It may be impossible to see on the graph, but the rectangles are slightly apart from one another (though of course they are connected by the graph of continuous function). This is easier to see on the histogram of the values ${f^{n}(0) }$ for ${n=0,\dots, 10000 }$, which contains two small gaps in addition to a large one:

What goes on here? The range of ${f}$ on ${[-2,2]}$, as well as the range of any of its iterates, is of course connected: it is the closed interval ${[f^{2}(0),f(0)] = [2 \cos 2, 2]}$. But the second iterate ${f^2=f\circ f}$ also has two invariant subintervals, marked here by horizontal lines:

Namely, they are ${I_1=[f^{2}(0), f^{4}(0)]}$ and ${I_2=[f^{3}(0),2]}$. It is easy to see that ${f(I_1)=I_2}$ and ${f(I_2)=I_1}$. The gap between ${I_1}$ and ${I_2}$ contains the repelling fixed point of ${f}$, approximately ${x=1.03}$. Every orbit except for the fixed point itself is pushed away from this point and is eventually trapped in the cycle between ${I_1}$ and ${I_2}$.

But there is more. A closer look at the fourth iterate reveals smaller invariant subintervals of ${f^4}$. Here is what it does on ${I_2}$:

Here the gap contains a repelling fixed point of ${f^2}$, approximately ${1.8}$. The invariant subintervals of ${I_2}$ are ${I_{21}=[f^{3}(0), f^{7}(0)]}$ and ${I_{22}=[f^9(0), 2]}$. Also, ${I_1}$ contains invariant subintervals ${I_{11}=[f^{2}(0), f^{6}(0)]}$ and ${I_{12}=[f^8(0), f^4(0)]}$. These are the projections of the rectangles in the graph of ${f^{30}}$ onto the vertical axes.

No more such splitting occurs. The histogram of the values of iterates of ${f}$ indeed consists of four disjoint intervals. Can one get a Cantor-type set in this way, starting from some boring function?