BM · 05 Beauty of Math

The Logistic Map: How Order Turns to Chaos

The Logistic Map: How Order Turns to Chaos

One rule, x → r·x(1 − x), with one knob. Turn the knob and a steady population starts to bounce between two values, then four, then eight, faster and faster, until it tips into chaos. We build it from a population of rabbits: watching it settle, the cobweb picture, why the steady state breaks at r = 3, period doubling, the bifurcation diagram, the butterfly effect, why the chaos at r = 4 is just doubling an angle, windows of order inside the chaos, Feigenbaum's universal number 4.669, and where the whole picture hides inside the Mandelbrot set.

Chapters

Cheat sheet

Sources

Transcript

This is one rule, with one knob. Turn the knob slowly, and watch where the rule settles. One steady value. Then two. Then four, eight, and then, this: chaos.

And then, out of the chaos, three. By the end of this video, you'll know why order breaks down like this, the number four point six six nine that turns up far beyond this one rule, why the chaos is the doubling from our times tables episode, and where this whole picture is hiding inside the Mandelbrot set.

This is Just Known. From unknown, to known. Beauty of Math, episode five: the logistic map, how order turns to chaos. Imagine a population of rabbits, measured as a fraction of the most the land can hold: x, between zero and one. Each year, the rabbits multiply by a factor r.

But crowding holds them back: the more there are, the less room is left, a factor of one minus x. So next year's population is r, times x, times one minus x. That's the logistic map. A smooth version of this idea goes back to Pierre-François Verhulst, in eighteen thirty-eight. In nineteen seventy-six, the ecologist Robert May showed how wildly this simple step-by-step version can behave.

With r below one, the rabbits always die out. So let's turn the knob to two point eight, and start at a fifth. Next year: zero point four five. Then zero point six nine, then zero point six, overshooting and undershooting, closing in on zero point six four. There's a neat way to see this.

Draw the rule as a curve, a hump, and draw the diagonal line where next year equals this year. From any x, go up to the curve to get next year, then across to the line to make it this year, and repeat. The path spirals into the crossing point: the one population that exactly replaces itself. That crossing point is at one minus one over r. Whether the population settles there depends on how steep the curve is where it crosses.

If the slope is between minus one and one, each year shrinks the gap. Steeper than that, and each year makes the gap bigger. The slope there works out to two minus r. At r equals three, it reaches minus one. Past three, the steady state still exists, but it can't hold the population any more.

It breaks. Turn the knob past three, to three point two. Now the population can't settle. It bounces between two values, a boom year at zero point eight, and a bust year at zero point five, forever. On the cobweb, the path closes into a square.

Plot where the population ends up in the long run against the knob, and at r equals three, the line splits in two. Turn it a little more, and each value splits again. At three point four five, there are four. At three point five four, eight. Then sixteen, thirty-two, sixty-four, each split coming faster than the last, until at about three point five seven, the cycle is infinitely long.

The pattern never repeats. Now do that for every setting of the knob at once. For each r, run the rule for a while to forget where it started, then plot where the population lands, year after year. This is the bifurcation diagram. On the left, one steady line.

Then the fork, forks of forks, and then a storm of dots: chaos. But inside the storm, there are clear gaps, windows where order comes back. In German, it's called the fig tree diagram, and you'll see why soon. In the chaos, a typical population never repeats and never settles. Worse, it can't be predicted for long.

Turn the knob all the way to four, and start two populations just a ten-millionth apart. For about twenty years, they move together. Then they split, and soon they have nothing to do with each other. On average, the tiny difference doubles every year. Edward Lorenz ran into the same thing in a weather model, and published it in nineteen sixty-three.

It became known as the butterfly effect. At the knob's top setting, four, there's an exact answer. Write the population as the sine of an angle, squared. Then the rule just doubles the angle. That's the same doubling that drew our heart in the times tables episode.

Now write the angle, as a fraction of a full turn, in binary. Doubling it shifts every digit one place to the left, and the leading digit falls away. So each year, the population is set by digits one place deeper than the year before. After twenty years, it depends on digits no census could ever measure. That's the chaos.

But chaos isn't the end. At one plus the square root of eight, about three point eight three, the storm suddenly clears, and the population cycles through just three values. Zoom into that window, and you find the whole diagram again, in miniature: forks, forks of forks, and chaos. In nineteen seventy-five, Tien-Yien Li and James Yorke proved that if a rule like this has a cycle of three, it has cycles of every length, most of them unstable and unseen. They called it chaos, and the name stuck.

Oleksandr Sharkovsky had found an even stronger result eleven years earlier. Now measure the gaps between the splits. Each gap is about four point six six nine times shorter than the one before. Mitchell Feigenbaum found this ratio in nineteen seventy-five, with a pocket calculator, at Los Alamos. Then he tried a different rule, built from a sine wave instead of a parabola, and got the same number.

Any rule whose hump is rounded like a parabola at the top gives four point six six nine two, and a second number, two point five oh three, for how fast the forks shrink in height. Experiments with heated fluids and electric circuits found numbers close to it. It's a universal constant, like π, but for the road to chaos. And his name, Feigenbaum, means fig tree. And last episode's set has been hiding this all along.

Slide the knob, and the same rule can be rewritten as z squared plus c, with c running along the set's spine, from one quarter down to minus two. The steady state is the heart. Period two is the round bulb on the left, starting exactly at minus three quarters, where r is three. Period four is the next bulb, and the bulbs keep shrinking, by a ratio that closes in on that same four point six six nine. And the window of three?

It lines up with a tiny copy of the whole Mandelbrot set, sitting on its antenna at minus one point seven five. And the knob's top setting, four, is the antenna's very tip, at minus two. You can draw the whole thing in about a dozen lines of code. For each column of pixels, pick a knob setting r. Start anywhere, run the rule two hundred times to forget the start, then run it eight hundred more, and drop a faint dot for every value.

That's the bifurcation diagram. The code is in the description. Let's recap. One rule: r, times x, times one minus x. Turn the knob, and the steady state breaks into two, then four, then eight, faster and faster, by a ratio of four point six six nine, until it tips into chaos, where tiny differences snowball.

And inside the chaos, windows of order, including a tiny copy of the Mandelbrot set. Next time, we leave the line for three dimensions, and follow Edward Lorenz's weather model to the shape of chaos itself: the Lorenz attractor. This is Just Known. From unknown, to known.

Note: every diagram, cobweb and orbit is computed from the rule, and the Mandelbrot set is drawn on the GPU. Pictures marked "illustration" (the rabbits, the butterfly, the calculator and the experiment icons) are schematic.
Narration voice generated with Google Gemini text-to-speech.