Nonlinear Dynamics

Logistic Map

One line of arithmetic, one knob to turn — and the simplest known doorway from order into chaos

The logistic map x → r·x(1−x) is the simplest equation that becomes chaotic — a fixed point that period-doubles into chaos past r = 3.5699.

  • Equationxn+1 = r·xn(1 − xn)
  • First bifurcation2-cycle at r = 3
  • Cascade4-cycle r ≈ 3.449, 8-cycle r ≈ 3.544 …
  • Onset of chaosr ≈ 3.5699
  • Feigenbaum δ4.6692 (universal)
  • Popularised byRobert May, Nature 1976

Interactive visualization

Press play, or step through manually. Watch the cobweb settle, split, and shatter — then see the bifurcation diagram draw itself as r sweeps right.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

Definition

The logistic map is a single equation, iterated:

x_{n+1} = r · x_n · (1 − x_n)

Here x_n is a number between 0 and 1 — read it as a population expressed as a fraction of the maximum the environment can support. The parameter r (between 0 and 4) is the growth rate. The term r·x is unchecked exponential growth; the factor (1 − x) is the brake — as the population approaches its ceiling, crowding cuts reproduction. You pick a starting value x₀, compute x₁, feed it back to get x₂, and so on forever.

That is the whole model. No randomness, no hidden terms, one parameter. And yet, as you slide r from 0 up toward 4, the long-run behaviour passes through extinction, a stable equilibrium, oscillating cycles, and finally chaos. This is why the logistic map is the canonical first example in every course on nonlinear dynamics — it is the smallest possible equation that does something genuinely complicated.

How it works — the cobweb picture

The cleanest way to see what an iteration does is the cobweb diagram. Plot two curves on the same axes:

  • The parabola y = r·x(1 − x) — the map itself, a single hump peaking at x = 0.5.
  • The diagonal y = x — the line where output equals input.

Start at your seed x₀ on the diagonal. Draw a vertical line to the parabola: its height is x₁. Draw a horizontal line back to the diagonal: now your x-coordinate is x₁, ready to feed in again. Repeat. The zig-zag trail is the orbit.

  • Stable fixed point. Where the parabola crosses the diagonal, output equals input — the orbit stops there. If the parabola crosses with a shallow enough slope (|slope| < 1), the cobweb spirals into that crossing. This happens for 1 < r < 3.
  • 2-cycle. Once the slope at the fixed point steepens past −1 (at r = 3), the point goes unstable. The cobweb can no longer settle — instead it traces a closed rectangle, hopping between two values. The population now alternates high, low, high, low.
  • Chaos. Past r ≈ 3.5699 the cobweb never closes. It fills the unit square with a dense, never-repeating thatch — visually, the "cobweb" earns its name.

The fixed-point analysis is exact. The nonzero fixed point is x* = 1 − 1/r, and the derivative of the map there is f′(x*) = 2 − r. A fixed point is stable when |f′| < 1, i.e. when |2 − r| < 1, which means 1 < r < 3. At r = 3 the derivative hits exactly −1 — the precise moment the fixed point loses stability and the first period-doubling occurs.

A worked example — by hand and to the cliff edge

Take r = 2.8, x₀ = 0.1. The fixed point should be x* = 1 − 1/2.8 = 0.6429. Iterating:

x0 = 0.1000
x1 = 2.8 · 0.1 · 0.9          = 0.2520
x2 = 2.8 · 0.2520 · 0.7480    = 0.5278
x3 = 2.8 · 0.5278 · 0.4722    = 0.6978
x4 = 2.8 · 0.6978 · 0.3022    = 0.5904
x5 = 2.8 · 0.5904 · 0.4096    = 0.6771
...                            → 0.6429  (converges)

It homes in on 0.6429, exactly as predicted. Now nudge r up to 3.2 — just past the first bifurcation. The orbit refuses to settle; instead it locks onto a 2-cycle, bouncing between 0.7995 and 0.5130 forever. Push to r = 3.5 and you get a clean 4-cycle (0.8750, 0.3828, 0.8269, 0.5009). Each of these is perfectly periodic and perfectly predictable.

Now the dramatic part. Set r = 3.9 — deep in chaos — and run two seeds that differ by one part in a million: x₀ = 0.300000 and x₀ = 0.300001.

n      seed A          seed B          gap
0      0.300000        0.300001        1e-6
10     0.347588        0.347601        ~1e-5
20     0.872913        0.880117        ~7e-3
30     0.512100        0.092432        ~0.42
40     0.736...        0.901...        order 1 — totally different

By iteration 40 the two trajectories share nothing. The error grows roughly exponentially, multiplying by about e^λ per step where λ (the Lyapunov exponent) is around 0.5 here and approaches ln 2 ≈ 0.693 as r → 4. A one-in-a-million uncertainty becomes total uncertainty in a few dozen steps. That is the butterfly effect in one equation you can compute on paper.

The period-doubling cascade and Feigenbaum universality

Sweep r upward and tabulate where each doubling happens. The bifurcation points r_n (where the period jumps from 2ⁿ to 2ⁿ⁺¹) are:

Cycle periodBifurcation rnGap to previousRatio of gaps
1 → 23.00000
2 → 43.449490.44949
4 → 83.544090.094604.751
8 → 163.564410.020324.656
16 → 323.568760.004354.668
32 → 643.569690.000934.669
∞ (chaos onset)3.569946→ 0→ 4.6692

Two things jump out. First, the gaps shrink geometrically, so the infinitely many doublings squeeze into a finite stretch of r and accumulate at r∞ ≈ 3.5699456 — the onset of chaos. Second, the ratio of successive gaps converges to a definite number: δ = 4.66920160910299…, the Feigenbaum constant.

The astonishing discovery Mitchell Feigenbaum made in 1975 is that δ is universal. Run the same experiment on the sine map x → r·sin(πx), or on any smooth map with a single quadratic-like maximum, and you get the same 4.6692. The specific equation does not matter; the route to chaos has a fixed geometric structure, governed by δ in the r-direction and a second constant α ≈ 2.5029 in the x-direction. This universality is the deep reason chaos is studied as a subject in its own right rather than equation-by-equation, and it is mathematically the same renormalization-group machinery that explains critical exponents in phase transitions.

The regimes of r, from extinction to full chaos

Range of rLong-run behaviourWhat you see in the cobweb
0 < r < 1Extinction — orbit → 0Cobweb walks down into the origin
1 < r < 3Single stable fixed point x* = 1 − 1/rSpirals into one crossing
3 < r < 3.449Stable 2-cycleClosed rectangle, two values
3.449 < r < 3.544Stable 4-cycleFour-corner loop
3.544 < r < 3.56998, 16, 32-cycle cascadeDoubling loops, ever finer
3.5699 < r ≤ 4Chaos, pierced by periodic windowsDense thatch filling the square
r ≈ 3.8284Stable 3-cycle (a window inside chaos)Order returns abruptly, then re-doubles
r = 4Fully chaotic, fills [0,1]Ergodic; conjugate to a tent map

The r ≈ 3.8284 entry is worth dwelling on. Chaos is not a monotone "more r, more disorder" story. Inside the chaotic band sit periodic windows — narrow ranges of r where a stable cycle suddenly reappears. The widest is a period-3 window, and by Sharkovskii's theorem the existence of a period-3 orbit implies orbits of every period exist (the famous "period three implies chaos" result of Li and Yorke, 1975). Each window itself contains a miniature period-doubling cascade with the same δ — the bifurcation diagram is self-similar, a fractal.

JavaScript — iterate, detect cycles, estimate δ

// The map itself — one line.
const f = (r, x) => r * x * (1 - x);

// Iterate and return the long-run attractor (the values it settles onto).
function attractor(r, { warmup = 1000, sample = 64, x0 = 0.5 } = {}) {
  let x = x0;
  for (let i = 0; i < warmup; i++) x = f(r, x);   // discard transient
  const vals = [];
  for (let i = 0; i < sample; i++) { x = f(r, x); vals.push(x); }
  return vals;
}

// Detect the period by counting distinct settled values (rounded).
function period(r) {
  const vals = attractor(r).map(v => v.toFixed(5));
  return new Set(vals).size;   // 1 = fixed point, 2 = 2-cycle, ... large = chaos
}

console.log(period(2.8));   // 1   — fixed point
console.log(period(3.2));   // 2   — 2-cycle
console.log(period(3.5));   // 4   — 4-cycle
console.log(period(3.9));   // 64  — chaotic (no repeat in the sample)

// Lyapunov exponent: average log|f'(x)|. Positive ⇒ chaos.
function lyapunov(r, n = 100000) {
  let x = 0.5, sum = 0;
  for (let i = 0; i < n; i++) {
    x = f(r, x);
    sum += Math.log(Math.abs(r * (1 - 2 * x)));
  }
  return sum / n;
}
console.log(lyapunov(3.2).toFixed(3));  // negative — stable cycle
console.log(lyapunov(3.9).toFixed(3));  // ~ +0.49 — chaos
console.log(lyapunov(4.0).toFixed(3));  // ~ +0.693 = ln 2 — maximal chaos

The Lyapunov exponent is the rigorous test for chaos: it measures the average exponential rate at which nearby trajectories separate. It is negative in any periodic window (errors shrink, the system is predictable) and positive in the chaotic band (errors blow up). At r = 4 it equals exactly ln 2, meaning the system loses one bit of information about the initial condition with every single iteration.

Where the logistic map shows up

  • Population biology. Its original home. Insect populations with non-overlapping generations (one breeding season per year) genuinely period-double and go chaotic as fertility rises — observed in lab cultures of flour beetles.
  • Fluid turbulence. The period-doubling route to chaos was confirmed experimentally in Rayleigh–Bénard convection (Libchaber, 1979), where the measured cascade ratio matched Feigenbaum's δ — a stunning lab confirmation of universality.
  • Cardiology. Period-doubling of heartbeats (alternans) is a documented precursor to fibrillation; the logistic map is a teaching model for cardiac chaos.
  • Electronics and lasers. Driven nonlinear circuits and certain laser cavities follow the same cascade as a control parameter is turned up — engineers use δ to predict where instability sets in.
  • Cryptography and PRNGs. The chaotic regime at r = 4 produces sequences that pass many randomness tests, used in lightweight chaos-based pseudo-random generators (with care — they have exploitable structure).
  • Pedagogy. It is the universal first lesson in chaos theory, fractals, and the fundamental limits of long-term forecasting.

Common pitfalls and misconceptions

  • "Chaotic means random." No. The logistic map has zero randomness — it is perfectly deterministic. It only looks random because of sensitive dependence on initial conditions. Same seed, same r ⇒ same sequence to the last digit.
  • "More r always means more chaos." False. Periodic windows interrupt the chaos — the period-3 window near r ≈ 3.8284 is a sudden island of perfect order surrounded by chaos.
  • Letting x leave [0,1] or r exceed 4. For r > 4 the map can throw x outside [0,1], after which it diverges to −∞. The interesting dynamics live strictly in 0 ≤ r ≤ 4, 0 ≤ x ≤ 1.
  • Not discarding the transient. The first few hundred iterations are a transient that has not yet settled onto the attractor. Plotting them muddies a bifurcation diagram — always warm up (discard) before sampling.
  • Trusting floating-point in the chaotic regime. Because errors grow exponentially, a double-precision orbit at r = 3.9 has lost all accuracy after ~50 steps — your computed trajectory is not the true one. The statistical distribution is reliable; the exact path is not (this is the "shadowing" subtlety).
  • Confusing the cobweb with the bifurcation diagram. The cobweb shows one orbit at one fixed r. The bifurcation diagram plots the attractor (settled values) for every r along the axis — two completely different pictures.

Why the constant is universal — a sketch

The deep result is that δ does not depend on the equation. The argument, made rigorous by Feigenbaum and later by Lanford with computer-assisted proof, is a renormalization one. Look at the map near its peak, after two iterations (the "second iterate" f(f(x))). Near a period-doubling, that doubled map, when you rescale x by α and r appropriately, looks just like the original single map. The doubling operation is therefore a transformation on the space of functions, and that transformation has a fixed point. The constant δ is the dominant eigenvalue of the linearisation of this doubling operator at its fixed point; α is the rescaling factor.

Because the fixed point in function-space attracts a whole neighbourhood, any map with a generic quadratic maximum flows toward the same universal limit — so they all share δ = 4.6692 and α = 2.5029. This is the very same renormalization-group logic that explains why utterly different physical systems (a magnet near its Curie point, a fluid near its critical point) share identical critical exponents. The logistic map is, in that sense, the cheapest possible laboratory for one of the most profound ideas in modern physics: that the route to complexity has a universal geometry.

Frequently asked questions

What is the logistic map?

The logistic map is the discrete-time equation xn+1 = r·xn·(1 − xn), where x is a population fraction between 0 and 1 and r is a growth rate between 0 and 4. You pick a starting value, plug it in, and feed the output back as the next input. Despite having no randomness and only one parameter, it produces stable equilibria, repeating cycles, and full-blown chaos depending only on r. It was popularised by ecologist Robert May in a 1976 Nature paper as the simplest model of deterministic chaos.

At what values of r does the logistic map period-double?

For r below 3 the map settles to a single fixed point. At r = 3 it bifurcates into a stable 2-cycle (the population alternates between two values). At r ≈ 3.449 it doubles again to a 4-cycle, at r ≈ 3.544 to an 8-cycle, then 16, 32, and so on. The bifurcations come faster and faster, accumulating at r ≈ 3.5699, the onset of chaos. Each window of stability is shorter than the last by a factor approaching 4.6692.

Where does the logistic map become chaotic?

Chaos begins at the Feigenbaum accumulation point r ≈ 3.5699456. Past that value the period-doubling cascade has completed and the orbit no longer settles into any finite cycle — it wanders aperiodically and shows sensitive dependence on initial conditions (the butterfly effect). Chaos is not uniform, though: embedded in the chaotic region are "periodic windows," the widest being a stable 3-cycle that appears near r ≈ 3.8284.

What is the Feigenbaum constant δ?

δ = 4.66920160910299… is the ratio of the widths of successive period-doubling intervals: δ = lim (rn − rn−1) / (rn+1 − rn). Mitchell Feigenbaum discovered in 1975 that this number is universal — it is the same for the logistic map, the sine map, and essentially any smooth one-dimensional map with a single quadratic-like hump. A second constant, α ≈ 2.5029, describes how the branches shrink in the x-direction. Universality means the route to chaos has a structure independent of the specific equation.

Is the logistic map deterministic or random?

Fully deterministic — there is no random number anywhere in x → r·x(1 − x). Given the same r and the same starting x, the entire infinite sequence is fixed. What makes the chaotic regime look random is sensitive dependence: two starting values differing by 10⁻¹⁵ diverge to completely different trajectories within about 50 iterations (the Lyapunov exponent is positive, roughly ln 2 per step near r = 4). Determinism plus sensitivity is the defining signature of deterministic chaos.

What is a cobweb diagram?

A cobweb (or Verhulst) diagram is a graphical way to iterate a 1-D map. You plot the curve y = r·x(1 − x) and the diagonal y = x on the same axes. Starting at some x₀ on the diagonal, you draw a vertical line to the curve (that gives the next value), then a horizontal line back to the diagonal (that feeds it in again), and repeat. The trajectory spirals into the fixed point when it is stable, settles onto a rectangle for a 2-cycle, and fills the square densely in the chaotic regime.

What does the logistic map model in the real world?

It started as a population model: x is the population as a fraction of carrying capacity, r·x is the growth and the (1 − x) factor is the crowding penalty that limits unbounded growth. The same mathematics appears in fluid turbulence onset (the Feigenbaum scenario was confirmed in Rayleigh–Bénard convection experiments), laser dynamics, cardiac arrhythmia models, and electronic oscillators. It is also the textbook teaching tool for chaos, fractals, and the limits of long-term prediction.