HomeArticlesChaos Theory

Double Pendulum — Chaos and Sensitivity to Initial Conditions

A second rod bolted to the end of the first is all it takes to turn clockwork determinism into genuine unpredictability.

mysimulator teamUpdated July 2026≈ 11 min read▶ Open the simulation

Four numbers, one unpredictable curve

A single pendulum is one of the tamest systems in physics — regular, periodic, solvable by hand. Attach a second pendulum to the end of the first, and the system becomes one of the simplest ways to produce genuine chaos. Two massless rods of length l₁ and l₂ carry bobs of mass m₁ and m₂; the first rod pivots from a fixed point, the second pivots from the end of the first. The entire state of the system at any instant is captured by just four numbers — the two angles from vertical and their two angular velocities, (θ₁, θ₂, ω₁, ω₂) — a point moving through a four-dimensional phase space. Nothing about the physics is random. And yet past roughly 20° of initial deflection, no amount of computing power lets you predict where the pendulum will be in ten seconds.

live demo · nearby trajectories diverging over time● LIVE

Deriving the motion with Lagrange, not Newton

Writing Newton's second law directly for this system means tracking the tension in both rods as unknowns — solvable, but tedious. The Lagrangian approach sidesteps that entirely: express kinetic energy T and potential energy U in terms of the generalized coordinates θ₁ and θ₂, form L = T − U, and the rod tensions cancel out automatically because they do no work along the coordinates you chose.

Positions:
  x1 = l1 sinθ1                  y1 = -l1 cosθ1
  x2 = x1 + l2 sinθ2             y2 = y1 - l2 cosθ2

Lagrangian L = T - U:
  T = ½(m1+m2) l1² ω1² + ½ m2 l2² ω2² + m2 l1 l2 ω1 ω2 cos(θ1-θ2)
  U = -(m1+m2) g l1 cosθ1 - m2 g l2 cosθ2

Apply Euler-Lagrange: d/dt(∂L/∂ωi) - ∂L/∂θi = 0
  → solve the resulting 2x2 linear system for α1 = dω1/dt, α2 = dω2/dt

Working through the algebra (setting Δθ = θ₁ − θ₂ for brevity) produces two coupled expressions for the angular accelerations that depend on both angles and both angular velocities simultaneously — there is no way to solve for α₁ without also knowing ω₂, and vice versa. That coupling is the seed of everything that follows: it means the four state variables cannot be advanced independently, and it is precisely the kind of nonlinearity that makes simple numerical shortcuts fail.

Why RK4 and not Leapfrog

Leapfrog integration is the workhorse for gravity and springs because it splits neatly into a position half-step and a velocity half-step and stays numerically stable over huge numbers of steps. It works so well precisely because those systems' acceleration usually depends only on position, not velocity. The double pendulum's acceleration is a nonlinear function of angle and angular velocity at the same time, which breaks that clean split. RK4 handles this by treating the whole four-component state vector S = [θ₁, θ₂, ω₁, ω₂] as a single object and evaluating the derivative function four times per step — at the start, twice at the midpoint with trial updates, and once at the projected endpoint — then combining the four estimates into a weighted average that is accurate to fourth order in the timestep.

function deriv([θ1, θ2, ω1, ω2]) {
  // ... compute α1, α2 from the Lagrangian equations above ...
  return [ω1, ω2, α1, α2];               // dS/dt as a 4-vector
}

function rk4Step(state, dt) {
  const k1 = deriv(state);
  const k2 = deriv(add(state, scale(k1, dt/2)));
  const k3 = deriv(add(state, scale(k2, dt/2)));
  const k4 = deriv(add(state, scale(k3, dt)));
  return add(state, scale(add(k1, add(scale(k2,2), add(scale(k3,2), k4))), dt/6));
}
// 4 substeps of dt/4 per animation frame gives 16 deriv() calls/frame —
// enough precision to trust the trajectory through the regular regime.

Measuring the chaos: the Lyapunov exponent

Chaos here means something specific: deterministic unpredictability, quantified by the Lyapunov exponent λ. Take two trajectories starting an infinitesimal distance δS(0) apart in phase space and track how that separation δS(t) grows:

λ = lim(t→∞) (1/t) · ln( |δS(t)| / |δS(0)| )

λ > 0  →  trajectories diverge exponentially — chaotic
λ ≈ 0  →  trajectories stay close — regular / quasi-periodic

For large initial deflections: λ ≈ 3-7 s⁻¹
A difference of θ = 0.001° grows to a total mismatch (~57°) in
roughly ln(57.3/0.001) / λ ≈ 1-3 seconds.

That number gives the three qualitative regimes you actually see if you nudge the starting angle. Below about 15° the two pendulums behave like a pair of weakly coupled harmonic oscillators — quasi-periodic, effectively λ ≈ 0. Between roughly 15° and 60° the motion is intermittent chaos, alternating between stretches of regular-looking swinging and sudden bursts of erratic motion. Beyond 60° the system is fully chaotic and the upper pendulum routinely flips over its own pivot — and once θ₂ passes through π (straight up, the unstable equilibrium), which way it falls next becomes impossible to call more than about a second in advance at any realistic measurement precision.

Seeing the four dimensions: Poincaré sections

Nobody can visualize a four-dimensional trajectory directly, so chaos researchers use a Poincaré section: take a snapshot of (θ₁, ω₁) every time the trajectory crosses a fixed condition — here, every time θ₂ passes through zero moving upward. Plot thousands of these snapshots and the structure of the phase space appears at a glance. Regular motion produces points that fall on closed curves, called invariant tori, because the underlying motion really is confined to a lower-dimensional surface. Chaotic motion instead scatters points across a diffuse "chaotic sea," sometimes with small closed islands of leftover regular motion still embedded inside it — a direct, visual signature of the transition from order to chaos that a time-series plot alone would never reveal.

Frequently asked questions

Is the double pendulum really unpredictable, or just hard to compute?

It is deterministic — the same starting state always produces the same trajectory in principle — but practically unpredictable because it has a positive Lyapunov exponent. Any tiny difference in the starting angle, even far smaller than you could ever measure, grows exponentially, so no finite-precision simulation or measurement can predict its state more than a few seconds ahead.

Why use RK4 instead of a simpler integrator like Euler or Leapfrog?

The double pendulum's angular acceleration depends nonlinearly on both angle and angular velocity at once, which breaks the position/velocity split that makes Leapfrog cheap and stable. Euler's method accumulates error too quickly at any reasonable frame rate. RK4 evaluates the derivative four times per step to get fourth-order accuracy, which is enough to trust the simulation through the system's regular regime and up to the point chaos genuinely takes over.

What does a Poincaré section actually show?

It is a 2D snapshot of the 4D phase space, plotting (theta1, omega1) every time the second pendulum passes through vertical moving upward. Regular motion traces closed curves (invariant tori); chaotic motion scatters points across a diffuse region called the chaotic sea, sometimes with small closed "islands" of regular motion embedded inside it.

Try it live

Everything above runs in your browser — open Double Pendulum — Chaos and Sensitivity to Initial Conditions and launch two nearly identical pendulums side by side to watch them diverge in real time.

▶ Open Double Pendulum simulation

What did you find?

Add reproduction steps (optional)