TITLE: On the functional square root of $x^2+1$
QUESTION [55 upvotes]: There are some math quizzes like:
find a function $\phi:\mathbb{R}\rightarrow\mathbb{R}$ 
such that $\phi(\phi(x)) = f(x) \equiv x^2 + 1.$

If such $\phi$ exists (it does in this example), $\phi$ can be viewed as a "square root" of $f$ in the sense of function composition because $\phi\circ\phi = f$.  Is there a general theory on the mathematical properties of this kind of square roots? (For instance, for what $f$ will a real analytic $\phi$ exist?)

REPLY [3 votes]: Using the same approach as in this answer, it is possible to produce the functional square root by using:
$$\phi_0(x)=|x|^{\sqrt2}$$
$$\phi_{n+1}(x)=f^{-1}(\phi_n(f(x)))=\sqrt{\phi_n(x^2+1)-1}$$
which converges uniformly to a function $\phi$ satisfying $\phi(\phi(x))=f(x)$, which can be seen by noting that
$$\phi_n(\phi_n(x))=f^{-n}(|f^n(f^{-n}(|f^n(x)|^{\sqrt2}))|^{\sqrt2})=f^{-n}(f^n(x)^2)$$
is nearly equal to
$$\phi_n(\phi_n(x))\simeq f^{-n}(f^n(x)^2+1)=f(x)$$
with the error decreasing with each application of $f^{-n}$ since $|f^{-1}(a+\epsilon)-f^{-1}(a)|\simeq\epsilon/\sqrt a\ll\epsilon/2$ implies that
$$|\phi_n(\phi_n(x))-f(x)|\ll1/2^n$$
and in fact the error tends to zero much faster, since initially $a=f^n(x)^2\gg f^2(x)^{2^{n-1}}$ is insanely large.

There is the additional caveat that technically this requires us to compute iterations of $f$ since we have
$$\phi_n(x)=f^{-n}(|f^n(x)|^{\sqrt2})$$
where $f^n(x)$ is far too large to compute. We note two things at this point:

The convergence is at least quadratic, so one should not need to use very large $n$ anyways.
If one does need to use larger $n$, it is better to use an improved $\phi_0$. Expanding on what is shown in the linked question, we can use the improved$$\phi_0(x)=|x|^{\sqrt2}+\frac1{\sqrt2}|x|^{\sqrt2-2}-\frac12|x|^{-\sqrt2}$$to get faster convergence. Note that we only care about the behavior as $x\to\infty$ since $f^n(x)$ is large.