Video 4, chapter 8

Barnsley's Fern

How Barnsley's fern arises from four affine transformations, why it is a self-affine set, and how the map probabilities of the chaos game change where the points pile up but not the shape itself.

  • Video 4, chapter 8
  • Different recipes, the same structure

A fern frond looks far too detailed to describe with a few numbers. Yet a point that jumps around the plane by one of four short coordinate rules, chosen at random at each step, leaves behind dots that fill in a convincing frond with a stem, a curling tip and leaflets on every scale. How can four rules do that? This page lists the four affine maps, shows what each one contributes, and separates what the maps decide from what the probabilities of choosing them decide.

Key terms

Barnsley fern

Definition Barnsley’s fern is the attractor of the iterated function system made of the four maps in the table. Each map sends a point (x,y)(x, y) to the point with the new coordinates shown.

MapNew xxNew yyProbability
f1f_1000.16y0.16y0.010.01
f2f_20.85x+0.04y0.85x + 0.04y−0.04x+0.85y+1.6-0.04x + 0.85y + 1.60.850.85
f3f_30.20x−0.26y0.20x - 0.26y0.23x+0.22y+1.60.23x + 0.22y + 1.60.070.07
f4f_4−0.15x+0.28y-0.15x + 0.28y0.26x+0.24y+0.440.26x + 0.24y + 0.440.070.07

It is usually drawn with the chaos game. Start at the point (0,0)(0, 0). At each step choose one of the four maps at random, with the probabilities in the last column and independently of all earlier choices, apply it to the current point, and plot the result. All four maps are contractions, with ratios of about 0.160.16, 0.850.85, 0.340.34 and 0.380.38, so by Hutchinson’s theorem exactly one nonempty, closed and bounded set AA satisfies

A=f1(A)∪f2(A)∪f3(A)∪f4(A),\begin{aligned} A &= f_1(A) \cup f_2(A) \\[0.4em] &\quad \cup f_3(A) \cup f_4(A), \end{aligned}

and that set is the fern. The fixed point of each map lies on the attractor, because applying that map again and again to a point of the attractor stays on the attractor and approaches the fixed point, which the closed attractor must then contain. The point (0,0)(0, 0) is the fixed point of f1f_1, so every plotted point lies on the fern. With probability 11 the plotted points come arbitrarily close to every point of it. The probabilities only affect how quickly and how evenly its parts fill in. The fern is a geometric model that resembles a plant, not a description of how a living fern grows, which involves cells, light, water and genes that appear nowhere in these maps. Michael Barnsley presented it in his 1988 book Fractals Everywhere.

In plain words The map f1f_1 flattens the whole fern onto a short vertical segment, the stem at its base. The map f2f_2 shrinks the whole fern to about 85 percent of its size, turns it slightly clockwise and lifts it by 1.61.6, which gives the rest of the frond above the base stem and the lowest pair of leaflets. The maps f3f_3 and f4f_4 make small, squashed and turned copies of the whole fern, which become the lowest leaflet on the left and the lowest leaflet on the right. The leaflets higher up are copies of these two carried up the frond by repeated uses of f2f_2, and every leaflet has smaller leaflets of its own for the same reason.

Example Start at (0,0)(0, 0) and suppose the first three choices are f2f_2, f2f_2 and f3f_3. The point moves

(0,0)→(0,1.6)→(0.064,2.96)→(−0.7568,2.26592).\begin{aligned} (0, 0) &\to (0, 1.6) \\[0.4em] &\to (0.064, 2.96) \\[0.4em] &\to (-0.7568, 2.26592). \end{aligned}

The second step uses 0.85⋅0+0.04⋅1.6=0.0640.85 \cdot 0 + 0.04 \cdot 1.6 = 0.064 and −0.04⋅0+0.85⋅1.6+1.6=2.96-0.04 \cdot 0 + 0.85 \cdot 1.6 + 1.6 = 2.96. The two uses of f2f_2 climb the central stem, and f3f_3 then carries the point to the left, into the lowest left leaflet. The side map does not start a separate leaf. It moves the current point by the same fixed rule as always, and the next map acts on the new position in turn.

Affine transformation

Definition An affine transformation of the plane is a map that sends (x,y)(x, y) to the point (x′,y′)(x', y') with

x′=ax+by+s,y′=cx+dy+t,\begin{aligned} x' &= ax + by + s, \\[0.4em] y' &= cx + dy + t, \end{aligned}

for fixed numbers aa, bb, cc, dd, ss and tt. The numbers aa, bb, cc, dd form its linear part, which keeps the origin in place, and (s,t)(s, t) is the shift applied afterward. When ad−bc≠0ad - bc \ne 0 the map sends straight lines to straight lines, parallel lines to parallel lines and squares to parallelograms, and it multiplies every area by ∣ad−bc∣\lvert ad - bc \rvert. A negative value of ad−bcad - bc means the map also flips the picture over, like a mirror. When ad−bc=0ad - bc = 0 it flattens the whole plane onto a line or a single point. The map is a similarity, which stretches or shrinks every segment by the same factor, exactly when a=da = d and b=−cb = -c, or a=−da = -d and b=cb = c.

In plain words An affine transformation first turns, stretches, squashes, shears or flips the plane around the origin, and then slides the result to a new place. Straight lines stay straight or collapse to points, so a square becomes a parallelogram, a segment or a point.

Example The map f3f_3 sends the corners (0,0)(0, 0), (1,0)(1, 0), (0,1)(0, 1) and (1,1)(1, 1) of the unit square to

(0,1.6),(0.2,1.83),(−0.26,1.82),(−0.06,2.05),\begin{gathered} (0, 1.6), \quad (0.2, 1.83), \\[0.4em] (-0.26, 1.82), \quad (-0.06, 2.05), \end{gathered}

the corners of a small parallelogram leaning to the left. Its area is 0.20⋅0.22−(−0.26)⋅0.23=0.10380.20 \cdot 0.22 - (-0.26) \cdot 0.23 = 0.1038. For f4f_4 the same number is (−0.15)⋅0.24−0.28⋅0.26=−0.1088(-0.15) \cdot 0.24 - 0.28 \cdot 0.26 = -0.1088, so its parallelogram has area 0.10880.1088 and is a mirror image, which is why the right leaflet is a flipped copy of the fern. For f1f_1 the number is 00, and the square is flattened onto the segment from (0,0)(0, 0) to (0,0.16)(0, 0.16).

Self-affine set

Definition A set is self-affine when it is the attractor of an iterated function system whose maps are affine transformations and contractions, so that it is made of finitely many affine copies of itself. It is self-similar when all of those maps are similarities, each shrinking every segment by the same factor and possibly turning or flipping. Every self-similar set is self-affine, but not every self-affine set is self-similar. Barnsley’s fern is self-affine, since it is the union of its four affine copies f1(A)f_1(A), f2(A)f_2(A), f3(A)f_3(A) and f4(A)f_4(A). Its four maps are not all similarities, so the fern is not described here as made of exact scaled copies of itself. The simple dimension formula for sets built from similar copies, all shrunk by the same ratio, does not apply to it, and this page gives no value for the fern’s dimension.

In plain words Each leaflet is a squashed and turned copy of the whole fern rather than an exact miniature of it. The fern repeats itself at every scale, but with distortions.

Example An affine map stretches segments by a factor that can depend on their direction. For f3f_3 that factor lies between about 0.300.30 and 0.340.34, and for f4f_4 between about 0.290.29 and 0.380.38, so the two lowest leaflets are copies of the fern with changed proportions. The map f2f_2 is a similarity, since its coefficients satisfy a=d=0.85a = d = 0.85 and b=−c=0.04b = -c = 0.04. It shrinks every segment by the factor 0.852+0.042=0.7241≈0.851\sqrt{0.85^2 + 0.04^2} = \sqrt{0.7241} \approx 0.851, so f2(A)f_2(A) is an exact copy of the whole fern, turned clockwise by about 2.72.7 degrees. Each leaflet anywhere on the fern is the image of the whole fern under a chain of the four maps, applied one after another, and a chain of affine maps is again affine.

Map probabilities

Definition In the chaos game for an iterated function system f1,…,fkf_1, \ldots, f_k, the map probabilities are numbers p1,…,pkp_1, \ldots, p_k with every pi>0p_i > 0 and

p1+p2+⋯+pk=1.p_1 + p_2 + \cdots + p_k = 1.

At each step the map fif_i is chosen with probability pip_i, independently of the earlier steps. For the fern they are 0.010.01, 0.850.85, 0.070.07 and 0.070.07. Whichever positive values are used, with probability 11 the plotted points come arbitrarily close to every point of the same attractor. The probabilities decide how often each map is used, since over a long run the fraction of steps that use fif_i approaches pip_i, and so they decide how densely the points cover each part of the attractor. If some pip_i is 00, that map is never used, and the points fall on the attractor of the remaining maps instead, which can be a different set.

In plain words The maps decide the shape, and the probabilities decide where the dots pile up while it is being drawn. A part that is rarely visited looks faint in a finite picture, but it is still part of the shape.

Example Give all four maps probability 0.250.25. Then one step in four uses f1f_1, whose points lie on the vertical segment from (0,0)(0, 0) to (0,1.6)(0, 1.6), so about a quarter of all dots pile up on the short base stem. At the other end, ten choices of f2f_2 in a row put the point into the set f210(A)f_2^{10}(A), the image of the fern under f2f_2 applied ten times. It is a copy of the fern shrunk by the factor 0.85110≈0.1990.851^{10} \approx 0.199 that forms the tip of the frond. With the usual probabilities this happens on about 2020 percent of the steps, since 0.8510≈0.1970.85^{10} \approx 0.197. With equal probabilities it happens on only about one step in a million, since 0.2510≈0.000000950.25^{10} \approx 0.00000095. So the upper frond stays faint for a long time, although the shape being drawn is exactly the same.

Check yourself

  1. Find the image of the unit square under f2f_2. Show that it is again a square, and find its side and its area.
Show the answer

The corners (0,0)(0, 0), (1,0)(1, 0), (0,1)(0, 1) and (1,1)(1, 1) go to

(0,1.6),(0.85,1.56),(0.04,2.45),(0.89,2.41).\begin{gathered} (0, 1.6), \quad (0.85, 1.56), \\[0.4em] (0.04, 2.45), \quad (0.89, 2.41). \end{gathered}

The two sides leaving (0,1.6)(0, 1.6) are the vectors (0.85,−0.04)(0.85, -0.04) and (0.04,0.85)(0.04, 0.85). Both have length 0.7241≈0.851\sqrt{0.7241} \approx 0.851, and their dot product is 0.85⋅0.04+(−0.04)⋅0.85=00.85 \cdot 0.04 + (-0.04) \cdot 0.85 = 0, so they are perpendicular. The image is a square with side about 0.8510.851 and area 0.72410.7241, which equals ad−bc=0.852+0.042ad - bc = 0.85^2 + 0.04^2. Compared with the unit square it is turned clockwise by the angle whose tangent is 0.04/0.850.04/0.85, about 2.72.7 degrees, and moved so that the corner (0,0)(0, 0) lands at (0,1.6)(0, 1.6).

  1. Change the probabilities to 0.250.25 for each map. Does the fern change? What happens instead if the stem map gets probability 00 and the other three get 0.850.85, 0.0750.075 and 0.0750.075?
Show the answer

With all four probabilities positive the attractor does not change, because it is fixed by the maps alone. Only the density of the dots changes. About a quarter of them now land on the base stem and the upper frond fills in very slowly, so a picture with a limited number of points looks uneven.

With probability 00 for f1f_1 the condition that every probability be positive fails. The stem map is never used, and the dots fall on the attractor BB of the three maps f2f_2, f3f_3 and f4f_4. This set lies inside the fern, because the fern is mapped into itself by those three maps, but it is a different set. Every point of BB lies higher than 0.50.5, while the fern contains (0,0)(0, 0), so the bottom of the stem is missing from the new picture. The new probabilities add up to 11, so the problem is not the sum but the zero.

  1. In f2f_2, change the coefficient of yy in the new xx from 0.040.04 to 0.080.08 and keep everything else, including the probabilities. Is the new map still a contraction? Its fixed point is where the central stem ends, because the copies of the stem made by repeated uses of the map shrink toward it. Where is that point before and after the change?
Show the answer

Take two points whose difference is the vector v=(vx,vy)v = (v_x, v_y). The new map sends them to two points whose difference is 0.85v+w0.85v + w with w=(0.08vy,  −0.04vx)w = (0.08v_y, \; -0.04v_x), since the shift cancels. The length of ww is at most 0.080.08 times the length of vv, so the image of every segment is at most 0.85+0.08=0.930.85 + 0.08 = 0.93 times as long. The map is still a contraction, and Hutchinson’s theorem still applies. It is no longer a similarity, because b=0.08b = 0.08 while −c=0.04-c = 0.04.

The fixed point solves x=0.85x+0.08yx = 0.85x + 0.08y and y=−0.04x+0.85y+1.6y = -0.04x + 0.85y + 1.6. The first equation gives x=815yx = \tfrac{8}{15}y, and the second then gives 0.15y+0.3215y=1.60.15y + \tfrac{0.32}{15}y = 1.6, so

y=2400257≈9.34,x=1280257≈4.98.\begin{aligned} y &= \tfrac{2400}{257} \approx 9.34, \\[0.4em] x &= \tfrac{1280}{257} \approx 4.98. \end{aligned}

The same steps with 0.040.04 give x=415yx = \tfrac{4}{15}y, then y=2400241≈9.96y = \tfrac{2400}{241} \approx 9.96 and x=640241≈2.66x = \tfrac{640}{241} \approx 2.66. The end of the central stem moves from about (2.66,9.96)(2.66, 9.96) to about (4.98,9.34)(4.98, 9.34), so the frond leans much farther to the right. Here the probabilities did not change at all, yet the shape did, because a map changed.

How this lesson connects