Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

This question is of course inspired by the question How to solve f(f(x))=cosx and Joel David Hamkins' answer, which somehow gives a formal trick for solving equations of the form $f(f(x))=g(x)$ on a bounded interval. [EDIT: actually he can do rather better than this, solving the equation away from a bounded interval (with positive measure)].

I've always found such questions ("solve $f(f(x))=g(x)$") rather vague because I always suspect that solutions are highly non-unique, but here are two precise questions which presumably are both very well-known:

Q1) Say $g:\mathbf{R}\to\mathbf{R}$ is an arbitrary function. Is there always a function $f:\mathbf{R}\to\mathbf{R}$ such that $f(f(x))=g(x)$ for all $x\in\mathbf{R}$?

Q2) If $g$ is as above but also assumed continuous, is there always a continuous $f$ as above?

The reason I'm asking is that these questions are surely standard, and perhaps even easy, but I feel like I know essentially nothing about them. Apologies in advance if there is a well-known counterexample to everything. Of course Q1 has nothing to do with the real numbers; there is a version of Q1 for every cardinal and it's really a question in combinatorics.

EDIT: Sergei Ivanov has answered both of these questions, and Gabriel Benamy has raised another, which I shall append to this one because I only asked it under an hour ago:

Q3) if $g$ is now a continuous function $\mathbf{C}\to\mathbf{C}$, is there always continuous $f$ with $f(f(x))=g(x)$ for all $x\in\mathbf{C}$?

EDIT: in the comments under his answer Sergei does this one too, and even gives an example of a continuous $g$ for which no $f$, continuous or not, can exist.

Related MO questions: f(f(x))=exp(x) and other functions just in the middle between linear and exponential, and Does the exponential function has a square root.

share|improve this question
Obviously, if g (x) = x*<sup>2</sup>, then *f (x) = x*<sup>sqrt(2)</sup>. But what if *g (x) = *x*<sup>2</sup> - 1? I can't think of a function that would satisfy Q1. –  Gabriel Benamy Mar 9 '10 at 16:23
@Gabriel: in some sense I suspect that the whole point of Q1 is that you aren't meant to think of a function satisfying Q1, you're just supposed to give some stupid abstract construction, possibly starting with "let's well-order the reals" or "let's define an equivalence relation on the reals like this, and then let's now choose a bijection between R and R disjoint union R and get a new induced equivalence relation and blah blah blah". That was how I was envisaging a solution to Q1 going. As for Q2 I was sort-of expecting a classical counterexample. –  Kevin Buzzard Mar 9 '10 at 16:39
Given a set $E$ and a function $g \colon E \to E$, does there exist $f$ with $f(f(x)) = g(x)$? (No topology, no continuity.) To answer this for a particular $g$, examine the Ulm invariants of $g$. –  Gerald Edgar Mar 9 '10 at 17:58
Kevin, my trick actually works off a measure zero set, if you use a Cantor set instead of an interval. That is, for every function g on the reals, there is a function f:R to R, such that f(f(x)) = g(x) for almost all x, that is, for all x except in a measure zero set. –  Joel David Hamkins Mar 9 '10 at 18:49
Anonymous, in the tiny interval version, the function f is fully continuous, if g is continuous. In the measure 0 version, my function f is mapping R-I into the Cantor set I, and such a function cannot be continuous (since I is totally disconnected), but it is almost-everywhere continuous. –  Joel David Hamkins Mar 11 '10 at 2:05

9 Answers 9

up vote 80 down vote accepted

Q1: No. Let g(0)=1, g(1)=0 and g(x)=x for all $x\in\mathbb R\setminus\{0,1\}$. Assuming $f\circ f=g$, let a=f(0), then f(a)=1 and f(1)=g(a)=a since $a\notin\{0,1\}$. Then g(1)=f(f(1))=f(a)=1, a contradiction.

Q2: No. Let $g(x)=-x$ or, in fact, any decreasing function $\mathbb R\to\mathbb R$. Then f must be injective and hence monotone. Whether f is increasing or decreasing, $f\circ f$ is increasing.

share|improve this answer
A counter-example for C: let g be a quadratic polynomial such that $g(z)-z$ has distinct roots, e.g. $g(z)=z^2$. Then there are four solutions of $g(g(z))=z$: two roots of g and two points a,b such that g(a)=b and g(b)=a. But if g(z)=f(f(z)), then the point z=f(a) must be another solution to g(g(z))=z. This works for non-continuous f as well. –  Sergei Ivanov Mar 9 '10 at 17:43
I had just logged on to this site to edit my quetsion and add Q4: what about g:C-->C continuous but no restriction on f, and I see you've answered it before I even asked it! Talk about efficient ;-) Thanks for your most excellent answers Sergei. –  Kevin Buzzard Mar 9 '10 at 18:40
Sure, for example let $g(x)=x^2-2x$. –  Sergei Ivanov Mar 11 '10 at 7:56
Sergei, this function $f(x)=2 \cos \left(\sqrt{2} \arccos \left(\frac{x-1}{2}\right)\right)+1$ is a half-iterate of $g(z)=x^2-2x$ –  Anixx Nov 5 '10 at 4:43
It is defined on the whole real line, it is just non-real at some arguments. From the comment by Kevin it is not evident that he asks about the solution f:R-->R –  Anixx Dec 1 '10 at 3:49

Q2) has a negative answer. Namely, if, e.g., $g(x)=-x$ for all $x\in\mathbb{R}$, then there is no continuous $f:\mathbb{R\rightarrow\mathbb{R}}$ such that $f\circ f=g$.

As to Q3, see, e.g., Theorem 3 in http://yaroslavvb.com/papers/rice-when.pdf.

share|improve this answer
Problem 6 of the Vietnam Team Selection Test (for the IMO) of 1985 states: Suppose a function $f: \mathbb R\to \mathbb R$ satisfies $f(f(x)) = - x$ for all $x\in \mathbb R$. Prove that $f$ has infinitely many points of discontinuity. Check the following link for the whole test if you're curious: mathlinks.ro/… –  Anonymous Mar 9 '10 at 16:58
Thanks Ady. Sorry---I accepted Sergei's answer because he did the first part too, but you get +1. Note that I added a Q3 now! And now $g(x)=-x$ doesn't work because $f(x)=ix$ is allowed. –  Kevin Buzzard Mar 9 '10 at 17:08
Passing remark: continuity is "not on the syllabus" at the IMO and so we never mention its definition to the British team during training. –  Kevin Buzzard Mar 9 '10 at 21:54
That's a surprise, since real analysis is part of the high school curriculum in many countries. On the other hand, the restriction on the syllabus seems to reflect on the facts that many of the recent IMO problems are rather puzzle-like, which is quite depressing. –  Anonymous Mar 9 '10 at 22:28

Ulm invariants.

Surely someone still knows this? Given $f \colon A \to A$ and $g \colon B \to B$, is there a bijection $\phi \colon B \to A$ such that $f(\phi(x))=\phi(g(x))$? There is a system of cardinal numbers, the Ulm invariants, associated with $f$ so that the answer is ``yes'' if and only if $f$ and $g$ have the same invariants.

If $f$ is bijective, then the Ulm invariants are just counts of how many cycles of each size there are (including the infinite cycle size modeled by the integers with $n \mapsto n+1$).

But when not bijective, the system of invariants is more complicated. You need to count how many points map to each fixed point, and how many points map to each of them, and so on. And similarly for cycles of other sizes. But I cannot tell you the details, and this box is probably not the right place to do it anyway.

So for a solution to the problem, consider what the Ulm invariants of $f(f(x))$ are in terms of those of $f$. Then compare to the Ulm inveriants of $\cos$. Or whatever you want to get.

Ulm himself may have originally done this to study isomorphism of abelian groups. Taking products, reduce to the case of a $p$-group for a given prime $p$, then your map for study is $x \mapsto x^p$. Or something like that. Ulm invariants may also be given to characterize up to isomorphism linear transformations (on possibly infinite-dimensional vector space).

share|improve this answer
Thanks Gerald. So, because I knew your comment was visibly of some value, I tried to find out about Ulm invariants, knowing only that (a) they were called Ulm invariants and (b) they would no doubt be something to do with describing invariants of orbits under iterates of f, and how they meet. Wikipedia gave me nothing. Google gave me that there are Ulm invariants of an abelian group measuring sizes of a certain filtration, but nothing about sets. I then gave in and asked the question in a thread somewhere on this site, hoping you'd spot it :-) Thanks! –  Kevin Buzzard Mar 11 '10 at 15:28
Gerald: So if you construct the directed graph G with vertex set A and an arrow from a to b iff f(a) = b, then the "Ulm rank" of a point a in A must be something like the (ordinal-valued) foundation rank of a in this graph? Probably we should first collapse any finite cycles in the graph G before computing this rank to make it interesting. And Ulm invariants must have something to do with counting the number of points in this graph with Ulm rank alpha (for various values of alpha)? This could be interesting... –  John Goodrick Mar 11 '10 at 16:35
Ulm references ... $$ $$ > H. Ulm, Elementarteilertheorie unendlicher Matrizen, Math. Ann. 114 (1937) 483--505 $$ $$ > I. Kaplansky, Infinite Abelian Groups $$ $$ Ulm originally studied a linear transformation on an arbitrary vector space (strictly an algebraic question, no topology). $$ $$ Kaplansky extracts the useful part for classifying abelian groups. $$ $$ And both of these are more complicated than the case of a map of a set to itself. So hasn't that special case been written down somewhere? –  Gerald Edgar Nov 3 '10 at 17:52

I don't have a full answer, but I can offer here a small improvement on my other answer. Namely, what was important was not that it worked on a bounded interval, but rather, that it works outside a bounded interval.

Theorem. For any function g on the reals, there are numerous functions f such that f(f(x)) = g(x), for all x except those in a given fixed tiny interval.

Proof. Suppose g is a function on the reals and that I is a given interval, no matter how small. Let h be a bijection of R - I with I. Let f(x) = h(x), if x is outside I, and f(x) = g(h-1(x)), if x is in I. Thus, f first translates x into I, if it is outside I, and otherwise, untranslates and computes g, if it is in I. It follows that f(f(x)) = g(x) for all x outside I. There are 2|R| many such h's, and hence also this many f's.QED

If g is continuous, then this f can be chosen also to be continuous.

By using a Cantor set instead of an interval, one can find a function f that solves f(f(x)) = g(x) except on a set of measure zero.

share|improve this answer
@Joel: point taken. I'll edit. –  Kevin Buzzard Mar 9 '10 at 16:40

This type of equation is an "iterative functional equation." A good starting point for the literature on this subject is the book Iterative Functional Equations by Kuczma, Choczewski, and Ger, Cambridge University Press, 1990.

The most frequently asked question of this type has $g(x) = e^x$. A real-analytic solution in this case was constructed by H. Kneser, "Reelle analytische Lösungen der Gleichung $\varphi(\varphi(x))=e^x$ und verwandter Funktional-gleichungen", J. Reine Angew. Math. 187 (1949), 56-67.

Other useful keywords include "fractional iteration" and "iterative square root" (or more generally "iterative root").

share|improve this answer

This is a repost, and partial rewrite of an earlier deleted answer by Anixx. If you want to discuss the wisdom of that deletion, take it to the meta thread; let's keep this post focused on math only. This answer is community wiki, so that others can improve it.

If $a_k$ is any sequence of real numbers, indexed by the nonnegative integers, then define $\Delta^m(a) = \sum_{k=0}^{m} (-1)^k \binom{m}{k} a_k$. Then, for integer $n$, we have $a_n = \sum_{m=0}^{\infty} \binom{n}{m} \Delta^m(a)$. Note that the sum is finite, because all but finitely many binomial coefficients vanish. One can then try defining $$A(x) = \sum_{m=0}^{\infty} \binom{x}{m} \Delta^m(a).$$ If this sum converges, it defines a function $A$ which interpolates $a_n$. This is sometimes called Newton's interpolation formula.

Anixx points out that, $a_n = \sin^{[n]}(x)$ this method appears to give a good answer, but for $\cos^{[n]}(x)$, it appears not to.

share|improve this answer
What does "appears to" mean here? Are we talking small error? Pointwise convergence in small intervals? –  Andres Caicedo Nov 3 '10 at 16:26
In my case, I mean that numerical data which Anixx presented, without stating how many terms he was using or precisely what he computed, appear to my naked eye to be converging to a solution in a fairly large interval around $0$. –  David Speyer Nov 3 '10 at 16:29
The function is indeed periodic. –  Anixx Nov 3 '10 at 18:55
I have re-posted the extended answer here: mathoverflow.net/questions/17605/how-to-solve-ffx-cosx/… –  Anixx Nov 3 '10 at 21:31

I could have sworn that there was an old Monthly article that discussed precisely this question in some detail, but the closest that I could find in a few minutes on Mathscinet is the following article addressing the case $g(x) = 1/x$:

MR1641972: Cheng et al, “When does $f^{-1} = 1/f$?”, Amer. Math. Monthly 105, number 8.

share|improve this answer

A variant of the question is: Suppose that $g$ is a diffeomorphism. Can you embed $g$ into a flow? If yes, then there is $f$ with $f\circ f\circ\dots\circ f=g$ ($n$ times for any $n$).

So let $Diff_c(M)$ be the regular Lie group of all diffeomorphisms of a smooth manifold $M$. Its Lie algebra is the space $\mathfrak X_c(M)$ of all smooth vector fields with compact support, with the negative of the usual Lie bracket. The exponential mapping is the flow mapping which maps a vector field $X$ to its flow $t\mapsto Fl^X_t\in Diff_c(M)$. It satisfies $T_0\exp = Id$ but:

It is not locally surjective near $Id_M$. This has been shown by Freifeld 1967 and by Koppell 1970. The strongest result is by Grabowski, 1988, who showed the following: Suppose that $\dim M\ge 2$. Then there exists a smooth curve through $Id$ in $Diff_c(M)$ such that the points of this curve (sauf the identity) are free generators for a free subgroup of $Diff_c(M)$ (on $2^{\aleph_0}$ generators) which meets the image of the exponential mapping only at the identity. This free subgroup is arcwise connected.

See page 456 of (here), also for exact references.

share|improve this answer

The following is inspired by the chapter Partition Polynomials in Riordan's Combinatorial Identities where $g(x)$ is analytic and $g(0)=0$. Find the Taylor series of $f(x)$ at zero by evaluating the derivatives of $f(f(x))=g(x)$ at $0$ in succession.

Set $f(0)=0$, giving $f(f(0))=g(0)=0$.

The first derivative gives $f'(x) f'(f(x))=g'(x)$, therefore $f'(0)=\sqrt{g'(0)}$ and $f'(0)=-\sqrt{g'(0)}$. Set $f'(0)=\sqrt{g'(0)}$ for this example.

The second derivative $f'(x)^2 f''(f(x))+f'(f(x)) f''(x)=g''(x)$ produces $f''(0)=\frac{g''(0)}{g'(0)+\sqrt{g'(0)}}$.

The first few term of the Taylor series are

$f(x)=\sqrt{g'(0)}x+\frac{ g''(0)}{2 \left(g'(0)+\sqrt{g'(0)}\right)}x^2$ $+\frac{ \left(-3 g''(0)^2+g^{(3)}(0) g'(0)^{3/2}+2 g^{(3)}(0) g'(0)+g^{(3)}(0) \sqrt{g'(0)}\right)}{6 \left(\sqrt{g'(0)}+1\right)^2 g'(0) \left(g'(0)+1\right)}x^3+O(4)$.

This solution is based on $g(x)$ having a fixed point. Technically the question stated is whether there is always a solution and is focused on counter examples instead of a broad general answer as I have provided. But it does raise the question of whether there is a connection between $g(x)$ not having a fixed point and the counter examples that the other authors have provided.

share|improve this answer
Riordan refers to this technique as finding the inverse of a Bell polynomial. –  Daniel Geisler Mar 16 '13 at 11:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.