Visualizations
442 / 500

442 · Math

Bertrand's Paradox

One question about a random chord, three honest recipes, three different answers.

Is a random chord of a circle longer than a side of the inscribed triangle? Bertrand (1889) picked chords three natural ways: two random endpoints on the circle, a random point on a random radius, or a random midpoint in the disk, and got 1/3, 1/2 and 1/4. Each panel samples one recipe from its own seeded generator and rains thousands of chords into a float density grid that is tone mapped with auto exposure, so the chalk density shows where each recipe likes to put them and never saturates. Histograms of chord length fill in against the exact densities, and a shared log-scale plot shows the three running estimates settling onto three different limits. The midpoint view makes the reason plain: a chord is long exactly when its midpoint lands inside radius 1/2, and the three recipes spread midpoints differently.

Try it. Hover (or touch) a circle to pick one chord by its midpoint and see how much more or less likely each recipe makes it. Click outside the circles or press M to switch between chords and midpoints. Space pauses, the arrow keys change speed, R starts over.

  • Monte Carlo sampling
  • Auto-exposed density grids
  • Exact probability densities
  • Procedural chalk rendering

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build an interactive demonstration of Bertrand's paradox with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

The question: pick a chord of a circle at random. How likely is it to be longer than a side of the inscribed equilateral triangle (sqrt(3) for a unit circle)?

Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens. Draw three circles side by side, each with its inscribed triangle.
- Give each circle one sampling recipe. Random endpoints: two uniform angles on the circle. Random radius: a uniform angle, then a uniform distance d along that radius, and the chord perpendicular to it there. Random midpoint: a uniform point inside the disk (use sqrt of a uniform for the radius), and the chord with that midpoint.
- Each frame, add a few new chords to every circle. Draw long chords (length above sqrt(3)) in one color and short ones in another, and keep a running count of the fraction that are long.
- Speed up over time so thousands of chords pile up, and draw them with low opacity so the density shows.

Once that works, make it beautiful:
- Style it as a chalkboard: a dark green slate with faint smudges, chalky lines (a few slightly offset passes with a broken dash), and hand-lettered labels.
- Under each circle, add a histogram of chord lengths with the exact density drawn over it: 2 / (pi sqrt(4 - L^2)) for endpoints, L / (2 sqrt(4 - L^2)) for radius, and L / 2 for midpoint.
- Show each running estimate next to its limit: 1/3, 1/2 and 1/4.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a view that plots chord midpoints instead of chords, a hover that compares how likely one chord is under each recipe, or Jaynes' argument for why the random radius answer is the natural one.
PreviousSelf-Replicating LoopsLangton's 1984 loops copy their own genome and tile the plane with a glass colony. NextWeaving LoomA floor loom weaves shaded yarn cloth live from historical drafts you can edit.

Related visualizations

  • Bad Random NumbersMath RANDU looks random until you turn it, then 24,000 points snap into 15 planes.
  • Chord OrbifoldMath Tymoczko's geometry of chords: a twisted prism and a Mobius strip you can hear.
  • Road to ChaosMath The logistic map's bifurcations, Mandelbrot bulbs and a cobweb, linked in one picture.
  • String ArtType and image One black thread, thousands of straight chords, and a face appears on the loom.
  • Ford CirclesMath A circle for every fraction, and a dive into why the golden ratio is the most irrational.
  • TonnetzSound Euler's lattice of tones, where chords flip like cards and the plane folds into a torus.
  • BuddhabrotFractals Escaping Mandelbrot orbits stacked into a deep-space nebula by Metropolis-Hastings.
  • Anamorphic Chalk3D Pavement chalk that snaps into a chasm, a stairway or floating cubes from one spot.
  • Triangle CentersMath Drag a triangle: 46 Kimberling centers, the Euler line and Morley's triangle follow.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs