An interesting problem involving recursion Given a continuous function $f:[0, 1] \rightarrow [0, 1]$. Here we denote $f^n(x) = f(f^{n-1}(x))$. For every $x_0 \in [0, 1]$ there exists $n \in \mathbb{N}$ such that $f^n(x_0) = 0$. Prove that $f^N(x) \equiv 0$ for some $N$.
I've only managed to show that $f(0) = 0$ ($f$ must have a fixed point but then it couldn't be anything than zero), hence all zeroes of $f^n(x)$ are also zeroes of $f^{n+1}(x)$. Using Baire Theorem I concluded that there exists such $n_0 \in \mathbb{N}$ and a non-trivial open interval $(a, b)$ such that $\forall x \in (a, b) \ \ f^{n_0}(x) = 0$ (Let $A_n =$ $\{x \in [0,1] \mid f^n(x) = 0\}$, then $\bigcup\limits_{i=1}^{\infty} A_{i} = [0, 1]$ and $[0, 1]$ is of second category) but I've no idea what to do next.
How should I go about proving this statement?
 A: I think you can proceed as follows. Let $g(x)=f(x)-x$. Then
$g$ cannot change signs on $(0,1)$ (if $g(a)g(b) \lt 0$, then by the ITV (intermediate value theorem) between $a$ and $b$ you would have a nonzero fixed point of $f$, which is impossible).
So $g$ is either always positive or always negative on $(0,1)$. If $g$ were always positive, for $x\in (0,1)$ the sequence $x \lt f(x) \lt f(f(x)) \lt ...$ would be increasing and could never be eventually zero. So $g$ is always negative on $(0,1)$ :
$$
f(x) \lt x, (x\in (0,1)) \tag{1}
$$
Because $f$ is continuous, we deduce
$$
f(x) \leq x, (x\in [0,1]) \tag{2}
$$
Now, put $h(x)=\max(f(t), t\in [0,x])$ for $x\in [0,1]$. Because $f$ is continuous, we have a $\xi(x) \in [0,x]$ such that $f(\xi(x))=h(x)$. By (2), we deduce $h(x) \lt x$ for $x\in (0,1)$. This inequality is still true for $x=1$, by a slightly different argument (otherwise $1$ would be a fixed point of $f$), so
$$
h(x) \lt x, (x\in (0,1]) \tag{3}
$$
Denote by $\alpha(x)$  the closest zero of $f$ below $\xi(x)$ and let $I_{1}(x)=[\alpha(x),\xi(x)]$. Then, by the ITV again, $f(I_1(x))=[0,h(x)]$, and $f$ is positive on the interior of $I_1(x)$ (note that this interior is non-empty iff $h(x)\gt 0$). But we can iterate this process : the image interval contains $I_1(h(x))$, so there is a subinterval of the domain, $I_2(x)\subseteq I_1(x)$, such that $f(I_2(x))=I_1(h(x))$ and $f^2$ is positive on the interior of $I_2(x)$.
By induction, we can thus construct a decreasing sequence of intervals $I_1(x) \supseteq I_2(x) \supseteq \ldots $ such that $f^n$ is positive on $I_n(x)$, and $I_n(x)$ has non-empty interior iff $h^{n}(x) \gt 0$.
If $h^{n}(1)\gt 0$ for every $n$, each $I_n(1)$ has non-empty interior, so there is a limit point $l\in \bigcap_{n\geq 1} I_n(1)$, and $f^{n}(l) \gt 0$ for every $n$, contradicting the hypothesis on $f$.
So we must have a $n_1$ such that $h^{n_1}(1)=0$. It easily follows that $f^{n_1}=0$, which finishes the proof.
