# If $f(x)=x^2-x-1$ and $f^n(x)=f(f(\cdots f(x)\cdots))$, find all $x$ for which $f^{3n}(x)$ converges.

Let $f:\mathbb{R}\to\mathbb{R}$ be the polynomial defined by $$f(x)=x^2-x-1$$ and let $$g_0(x)=f(x),\quad g_1(x)=f(f(x)),\quad\ldots\quad g_n(x)=f(f(f(\cdots f(x)\cdots)))$$ The positive root of $f(x)$ is the famous golden ratio $$\varphi=\frac{1+\sqrt{5}}{2}.$$

Problem: Find all $x\in\mathbb{R}$ for which the limit $$\lim_{n\to\infty}g_{3n}(x)$$ exists.

The answer appear to be not at all trivial. Based on numerical computations, I conjecture that the limit exists if and only if $$x\in[-\sqrt{2},1+\sqrt{2}]-\mathbb{N}.$$ But for some $x$, the convergence is very strange. For example, look at this plot of the sequence $\{g_{3n}(0.18)\}$ for $0\leq n\leq 200$:

EDIT: As pointed out by Zach Effman, there seem to be a fractal structure emerging from this problem. To better visualize it, I looked at the boundedness of the sequence $\{g_n(z)\}$ for $z\in\mathbb{C}$. More precisely, I made a grid of points $z\in\mathbb{C}$, colored black if $\{|g_n(z)|\}$ is bounded at $z$ and the more quickly $\{|g_n(z)|\}$ diverges to infinity the more white the pixel is. A dramatic fractal structure emerges: Does anybody recognize this fractal? Is this a known fractal?

The center of this picture reveals a very nice structure:

• ‘And over here, Piet Mondrian argues with Jackson Pollock.’ – Brian M. Scott Dec 26 '14 at 5:01
• My guess was the erraticness of your plot was an artifact of machine number rounding error. I upped the precision very high and got different plots from yours. They were also a bit erratic in the middle though. I tried recreating your table with the exact rational number 18/100, but after the 6th iteration, the numerator and denominator were both 890750 digits long! – Chip Hurst Dec 26 '14 at 5:44
• The $3$-cycle of $f$ is simply $2\cos(\frac{2\pi}{14}) \mapsto 2\cos(\frac{6\pi}{14}) \mapsto 2\cos(\frac{10\pi}{14}) \mapsto \ldots$ . Also, en.wikipedia.org/wiki/Sharkovskii%27s_theorem implies that there are (repulsive ?) $3n$-cycles for any $n > 1$, and so there are countably many points that don't generate converging sequences. For example we have $1 \mapsto -1 \mapsto 1 \mapsto \ldots$ I'm not sure if there are some points generating a chaotic (dense in the interval) trajectory. – mercio Jan 2 '15 at 17:11
• The fractal is a Julia set, with parameter $c = -7/4$. I have a feeling that this $c$ is on the boundary of the Mandelbrot set, more precisely it's a singular point of the boundary of the bulb corresponding to attractive $3$-cycles, because this is when the two $3$-cycles collapse into each other. – mercio Jan 4 '15 at 0:16
• putting $y = x-1/2$, the transformation is given by $y \mapsto y' = x'-1/2 = x^2-x-3/2 = (x^2-x+1/4)-7/4 = y^2-7/4$. (in his earlier comment, I assume Alex Ravsky made a miscalculation, this is what he meant to say) – mercio Jan 4 '15 at 0:22

As noted by mercio, your function $f(x)=x^2-x-1$ has a three-cycle $$2 \cos \left(\frac{\pi }{7}\right) \mapsto 2 \sin\left(\frac{\pi }{14}\right) \mapsto -2 \sin\left(\frac{3 \pi }{14}\right) \mapsto 2 \cos \left(\frac{\pi }{7}\right).$$ Put another way, these points are fixed points of $F(x)=f(f(f(x)))$. Let us denote these points by $x_F^1$, $x_F^2$, and $x_F^3$. The cycle is neutral because $F'(x_F^i)=1$ for each $i$.

Now, suppose that $x_0>1+\sqrt{2}$. Then, \begin{align} f(x_0) &= x_0^2 - x_0 - 1 \\ &= \left(1+\sqrt{2}\right)+\left(x_0 - (\sqrt{2}+1)\right) \left(x_0+\sqrt{2}\right). \end{align} As a result, the orbit of $x_0$ diverges to $\infty$. Furthermore, if $x_0<-\sqrt{2}$, then $x_1=f(x_0)>1+\sqrt{2}$ so (again) the orbit diverges to $\infty$.

Thus, let $I=[-\sqrt{2},1+\sqrt{2}]$. We certainly know that every initial seed outside of $I$ diverges to $\infty$. As it turns out, almost every point inside $I$ converges to the fixed neutral orbit. The exceptional set of points forms a Cantor set $C$ in $I$ and the dynamics of $f$ are chaotic on $C$. It's not particularly easy to see this, however, without some fairly high powered (but famous) theorems.

To get a better grip on this, let's plot the function together with the line $y=x$.

We see quite clearly that the function maps $[-\sqrt{2},1+\sqrt{2}]$ into itself and there are a couple of fixed points which cross the line $y=x$ with slope larger than one in absolute value so that the will be repulsive. Since, we have an orbit of period 3, let's include a plot of $F(x)=f(f(f(x)))$.

Note that there are 3 points where the line $y=x$ is tangent to the graph of $F(x)$. These are exactly the points in the neutral orbit of period 3. Each of these is the left hand endpoint of an interval of points that converge to that fixed point under iteration of $F$. I've highlighted one such interval containing $1/2$ in red. Furthermore, the inverse image of this interval under $F$ consists of 6 more such intervals that map into the red interval. The inverses of these yield more points that converge to the middle fixed point under iteration of $F$, etc. The same can be done for the other fixed points. The complement of all these open intervals containing points converging to one of those fixed points is exactly the Cantor set of points that do not converge to any of those fixed points.

As mercio and Sheldon have both pointed out, the groovy fractal image is exactly the Julia set of $z^2-z-1$. To emphasize the relationship between this fact and my answer, let's look at the Julia set together with the red interval from my last image.

Thus, those intervals span the components of the Julia set with simply connected interior. The yellow point is your initial seed $x_0=0.18$. As it is not contained in any of the larger components of the Julia set, I would certainly expect it to jump around before it eventually settles down to an orbit.

It might also be worth pointing out that the true fractal Julia set is the boundary of the black region - thus, it looks something like so:

And here's a zoom onto the main component.

Finally, we have here a period $3$ orbit of the real map $f$ and there is a very famous paper entitled "Period three implies chaos". The theorems of that paper are exactly what one needs to definitely prove that $f$ is chaotic on a Cantor set $C$. I believe that $C$ has measure zero; it is certainly nowhere dense. That explains why it is hard to find point in $C$ by experiment. A randomly chosen point in $I$ generically and (I think) almost surely converges to the neutral period 3 orbit.

On the other hand, it is (in principle) feasible to find orbits of large prime period. Here's Mathemetica code that finds an orbit of period 41.

Clear[f];
f[x_] := x^2 - x - 1;
f[n_Integer, x_?NumericQ] := Nest[f, x, n];
per41 = x /. FindRoot[f[41, x] == x, {x, 0.1},
WorkingPrecision -> 300]

(* Out:
0.09997111618903433899874853864417001759319794189148766236421781597929\
2721939448495289732175832121442601846472892582352497849991420790365107\
4378578596438323899498328663812648206777989645187097865648459105422784\
2754855914820032740936983665825718876082741645285990326028932997157116\
60320676920709780319319
*)


Note that high precision is necessary, since there will be points arbitraryily near by with other periods. Here's a sanity check:

Nest[f, per41, 41] - per41
(* Out: 0.*10^-283 *)

• Nice answer Mark. Since the points are a Cantor dust, there's an uncountable number of them. The Op's point, 0.18, is actually in a very small "bug". Iterating points in any small bug eventually maps to a 3-cycle with the main three bugs, and the main three attracting (parabolic) fixed points. Using polynomial equations, I can compute examples of repelling fixed 2,4,5, and 7-cycles, that would be points that be examples of points that don't go to the 3-cycle parabolic attracter. But I can't actually find any examples by "random" computation... they seem sparse, and hard to find – Sheldon L Jan 5 '15 at 10:25
• @SheldonL Thanks! I added a little bit in response to your comment. – Mark McClure Jan 5 '15 at 12:09
• Thanks Mark; compare your comments with an earlier question I had about the linear measure of the Cantor dust at the real axis, for the Mandelbrot set itself... For the m-set, the probability of randomly finding a point on the real axis, not in the interior is actually pretty reasonable. math.stackexchange.com/questions/483392/… – Sheldon L Jan 5 '15 at 14:24
• um yeah "almost all" is rather vague as the cantor dust is uncountable. My gut says that the measure of the exceptional points is nonzero, I'll try to work on it in a few days. Also I don't think it's possible to find a chaotic trajectory just by "experiment" because of the rounding errors. – mercio Jan 5 '15 at 14:50

Here are some partial results. I show below that there are only three possible limits (when the sequence is nonconstant), and for each limit I find an interval such that if the initial value is in that interval then it converges to that limit.

Applying Zach Effman’s method to $g=f^3$ rather than to $f$, we have

$$g(x)-x=(x^2-2x-1)(x^3-x^2-2x+1)^2 \tag{1}$$

The roots of $x^2-2x-1$ are

$$\alpha_1=1-\sqrt{2},\ \ \alpha_2=1+\sqrt{2} \tag{2}$$

While the roots of $x^3-x^2-2x+1$ are

$$\beta_1 \approx -1.246,\ \ \beta_2 \approx 0.445, \ \ \beta_3 \approx 1.801 \tag{3}$$

We have

$$g'(\alpha_1)=25-22\sqrt{2}\approx -6.11, \ \ g'(\alpha_2)=25+22\sqrt{2}\approx 56.11 \tag{4}$$

So both those fixed points are repulsive. On the other hand,

$$g'(\beta_1)=g'(\beta_2)=g'(\beta_3)=1$$

(because of the identity $g'(x)-1=(x^3-x^2-2x+1)(8x^4 - 20x^3 - 4x^2 + 18x + 2)$)

There is a unique $\gamma_1<\beta_1$ such that $g(\gamma_1)=\beta_1$. It is easy to see then that the interval $I_1=[\gamma_1,\beta_1]$ is stable by $g$, and if $x\in I_1$ then the sequence converges to $\beta_1$.

Similarly : there is a unique $\gamma_2\in (\beta_2,\beta_3)$ such that $g(\gamma_2)=\beta_2$, and then the interval $I_2=[\beta_2,\gamma_2]$ is stable by $g$, and if $x\in I_2$ then the sequence converges to $\beta_2$, and there is a $\gamma_3>\beta_3$ such that the interval $I_3=[\beta_3,\gamma_3]$ is stable by $g$, and if $x\in I_3$ then the sequence converges to $\beta_3$.

Not a complete answer, but this is what I can determine right away:

What you're describing is an iterated function. If the sequence $f^n(x)$ converges, then we must have $f(L) = L$ for the limit point. This gives $x^2-x-1=x$ with roots $1\pm\sqrt{2}$. At a fixed point, the absolute value of the derivative of our function, $|f'(x)|$ determines the local behavior of the iterated sequence. If the absolute value of the derivative is less than one, the fixed point is an attractor and starting points nearby converge to it. For the function here, $f'(x) = 2x-1$ giving $|f'(1-\sqrt{2})| = 2\sqrt{2}-1 \approx 1.8$ and $|f'(1+\sqrt{2}) = 1+2\sqrt{2} \approx 3.8$. Unfortunately, both are greater than one. This means the fixed points are repellors: starting points arbitrarily close to them are pushed away.

All I can say, then, is that the iterated function definitely converges for starting points $x_0 = 1\pm \sqrt{2}$ because in these cases the sequence is constant. Actually, that's not quite true: any sequence that hits those points will stay constant. So we could ask, what are the points $x$ such that $f(x) = 1 \pm \sqrt{2}$? They're $1\pm \sqrt{2}$ (of course) as well as $\pm\sqrt{2}$. Repeating this, these are the points I get:

I imagine there's some sort of fractal structure here.

• Note the OP actually looks at $f^{3n}$ (something I initially missed myself). You may want to look at $f^3$. – lcv Dec 26 '14 at 17:38
• I'm meaning to look at that when I get the chance – Zach Effman Dec 27 '14 at 4:50

This answer is inspired by comments with Mercio. First we map the problem to an equivalent $z \mapsto z^2+c\;$ Mandelbrot problem. And then we can use all of the known tools for analyzing the Mandelbrot set to analyze the Op's problem. For example, see Wolf Jung's mandelbrot link, which includes a Mandelbrot program with landing ray's.

$$z \mapsto z^2-\frac{7}{4}$$

This is a conjugation of the original problem with z=x-1/2, and $g(x)=f(x)-1/2$ For clarity, call the new function $g(z)=z^2-7/4$. We calculate the polynomial roots of $g^{o3}(z)-z=0$, which factors into a product of two identical cubic equations, and a quadratic. Here we show the parabolic 3-cyclic attracting fixed points, which are the roots of the cubic equation, followed by the roots of the 1-cyclic quadratic equation.

$$8z^3 + 4z^2 - 18z - 1=0\; \left(r_1= -1.7469796037; r_2=-0.054958132087; r_3= 1.3019377358\right)$$ $$4z^2 - 4z - 7\; z=\left(r_4= -0.914213562373, r_5=1.91421356237 \right)$$

If we iterate $z \mapsto g(z)$ an infinite number of times, every point that remains bounded is in the Julia set for $c=-7/4$. Points that are completely inside a bug will eventually you get to a 3-cyclic attracting period 3-cycling towards the three parabolic fixed points mentioned above. Otherwise, if there are point that escape to $\infty$ arbitrarily close to your point, then the point you picked is on the boundary of the Julia set. And then we need to figure out the rotation angle for the landing ray which lands at your point, perhaps using the Bottcher function.

But the simplest way to handle points exactly on the Julia set boundary is to look at values of $g^{on}(z)$ for finite values of n. If $g^{on}(z)=r_1,r_2,r_3, r_4, r_5$ for some finite value of n, then the 3-cycle converges, since once you land on one of these five points, iterating $g^{o3}(z)$ does not change the point. Other than these five cases, the function $g^{o3}(z)$ will not eventually repeat, nor will it attract towards a repeating point. The three cycle parabolic attracting points are only attracting for points in a connected region; in other words inside a Julia set bug, and not on the boundary.

One can also use the Bottcher function to put iterating $z \mapsto z^2$ into correspondence with iterating $z \mapsto z^2-7/4$, as both functions iterate to infinity. There will be an analytic Bottcher function mapping $\infty$ to zero. And then we generate the Bottcher function for $g(z)$

$$\beta\left(\frac{1}{g(1/z)}\right) = \beta(z)^2$$

The Bottcher function maps the unit circle to the boundary of the Julia set for $c=-7/4$. So if we have a point on the boundary of the Julia set, then the point corresponds to a particular number in the Boettcher set of the form $$\exp^{2\pi i r}$$ Where r is the rotation angle of the point z. We are particularly interested in these rotation angles: $$r = \left( \frac{\pm 1}{7}, \frac{\pm 2}{7}, \frac{\pm 4}{7}, \frac{\pm 1}{3}, 1 \right)$$

Since landing rays with these three rotation angles correspond to the three parabolic fixed points mentioned above. r=1 corresponds to the solution z=1.91421356237, and r=$\pm 1/3$ corresponds to -0.914213562373. Notice that iterating $z \mapsto z^2$ will double the rotation angle r. And if we start with r=1/7, then iterating $z^2-7/4$ will go through a 3-cycle iterating (1/7,2/7,4/7. There are two landing rays for each of the parabolic cusps; so (-1/7,-2/7,-4/7) is identical. In addition, we have the rotation angles for $r=(\pm 1/3, 1)$, which correspond to the two solutions for the primary fixed point.

If we look at the rational number for the rotation angle, $\frac{p}{q}$, for the point z, then we can tell how it will repeat. In particular, if $q=7\cdot 2^n$ or $q=3\cdot2^n$, or $q=2^n$ then the point is a pre-periodic point, and after the appropriate number of iterations, $g^{o3}(n)$ will repeat exactly. All other rotation angles will upon iterating $z \mapsto z^2 - 7/4$ will not go to one of these five points.

• Thanks a lot, this is very nice! I will definitively read more carefully very soon. But for now, unless I am missing something, I am not sure what is your final answer. Are you able to give a complete answer to the Problem mentioned in my question? – Simon Parker Jan 4 '15 at 16:16
• Obviously, determining whether or not a point is in a region, or on the boundary of the Julia set for an arbitrary real number isn't trivial, and my answer assumes that. And then if the point is on the boundary, then there is no simple algorithm to calculate the rotation angle, even if it is in principle a well defined operation. But yeah, the answer is: interior region, converges. rotation angle is a rational number of the correct form, converges. Otherwise, it doesn't converge to a 3-cycle. Wolf Jung's program will calculate the point from the rational rotation angle, but not irrational. – Sheldon L Jan 4 '15 at 16:19

I only attempted computational results as of now.

I first noticed one $x$ value out of your interval that gave a convergent sequence, which lead me to numerically test myself. Here is that value:

Let $\alpha$ be the root of $x^3 - x^2 - 2x + 1$ near $-1.24698$. Then for all $n$, $g_{3n}(\alpha) = \beta$, where $\beta$ is the root of $x^3 - x^2 - 2x + 1$ near $1.80194$.

From my own testing, I conjecture that the limit exists if and only if

$$x \in [-\sqrt{2}, \; 1+\sqrt{2}] - S,$$

where $S$ is the set of points that form a cycle, i.e.

$$S = \{x \in \mathbb{R} \mid g_{3k}(x) = g_0(x) \text{ for some } k, \; g_3(x) \neq g_0(x)\}.$$

The members of $S$ that correspond to $k = 2$ are approximately

$$\{-1.118, -1.09847, -1, -0.962622, -0.677575, -0.601782, -0.496701, -0.367928, -0.30512, -0.256588, -0.0360765, 0, 0.110737, 0.136684, 0.863316, 0.889263, 1, 1.03608, 1.25659, 1.30512, 1.36793, 1.4967, 1.60178, 1.67758, 1.96262, 2, 2.09847, 2.118\}.$$

My methodology was for a fixed $x$, make a table of the first 2000 values of $g_{3n}$, find the power function of best fit, and assume the sequence converges if and only if the exponent of the fitted function is negative.

If you're curious, here is the Mathematica code I used:

f[x_] := x^2 - x - 1
g3n[n_, x_] := g3n[n, x] = f[f[f[g3n[n - 1, x]]]]
g3n[0, x_] := f[x]

SequenceTable[z_] := Table[
If[# === Overflow[], Throw[False], #]&[g3n[n, z]],
{n, 0, 2000}
]

NegativeExponentQ[z_?NumericQ] := Catch@Quiet[
Negative[b /. {
FindFit[N@Differences@SequenceTable[z], a x^b, {a, b}, x]]
},
{General::ovfl, FindFit::sszero}
]

BinarySearch[l_, h_, {err_, dir_}] := Block[{lo = l, mid, hi = h, GoodResultQ},
GoodResultQ = If[dir < 0, Not, Identity];
mid = (lo + hi)/2;
While[hi - lo > err,
If[GoodResultQ[NegativeExponentQ[mid]],
lo = mid,
hi = mid
];
mid = (lo + hi)/2;
];
mid
]


And here are the commands I ran and their outputs:

Monitor[
BinarySearch[-2.120, 0.120, {10^-10., -1}],
{lo, mid, hi}
]


-1.4142134775087470189

Monitor[
BinarySearch[0.120, 2.520, {10^-10., 1}],
{lo, mid, hi}
]


2.4142135623493231833