How to Animate the Central Limit Theorem | QuantumSketch

Animate the central limit theorem by drawing sample means for growing n and watching their histogram converge to a bell curve, even from a skewed source.

By Shihab
2 min read

Animate the central limit theorem (CLT) by repeatedly drawing sample means and watching their histogram converge to a bell curve โ€” even when the source distribution is skewed. That convergence, regardless of the source shape, is the whole surprise.

What the CLT says

The distribution of the sample mean approaches a normal distribution as the sample size n grows, no matter what distribution you sampled from (given finite variance).

A static sentence. The animation makes it click.

The animation, beat by beat

  1. Show a non-normal source โ€” e.g. a skewed or uniform distribution.
  2. Draw one sample of size n, compute its mean, drop a dot in a histogram.
  3. Repeat fast โ€” means pile up into bins.
  4. Increase n: 5 โ†’ 30 โ†’ 100. The histogram narrows and symmetrizes.
  5. Overlay the Gaussian โ€” it fits beautifully, surprising the viewer.

Why growing n matters

| n | Histogram of means | |---|---| | 1 | Looks like the source (skewed) | | 5 | Starting to symmetrize | | 30 | Clearly bell-shaped | | 100 | Tight, near-perfect normal |

Watching the source's skew "wash out" as n grows is the moment students understand the CLT.

Manim building blocks

BarChart / custom rectangles for the histogram, Dot animations for falling samples, axes.plot for the overlaid normal curve, and a counter for n. Driven by a prompt, not by hand-written NumPy.

The prompt

"Sample from a skewed distribution, compute sample means, and build a histogram of those means as n grows 5 โ†’ 30 โ†’ 100, overlaying the normal curve it approaches."

โ†’ Animate it at quantumsketch.app. See also Animate Bayes' Theorem.


Written by Shihab Shahriar Antor ยท Shahriar Labs

FAQ

Q.What's the best way to show the central limit theorem visually?

Show many sample means piling up into a histogram. Start with any source distribution โ€” even a lopsided or uniform one โ€” then repeatedly draw a sample of size n, compute its mean, and drop that mean onto a histogram. As you increase n from, say, 1 to 5 to 30 to 100, the histogram of sample means gets narrower and more symmetric, converging to a normal bell curve regardless of the source shape. Animating the means accumulating makes the abstract statement 'the sampling distribution of the mean tends to normal' concrete and surprising.

Q.How do I animate the central limit theorem without statistics software?

Describe it as a prompt: 'Draw samples from a skewed distribution, compute each sample's mean, and build a histogram of those means as the sample size grows from 5 to 30 to 100, showing it approach a normal curve.' QuantumSketch renders this as a narrated Manim animation. Manim can plot the source distribution, animate dots falling into histogram bins, and overlay the fitted Gaussian โ€” all driven by your prompt rather than by you writing NumPy sampling loops and matplotlib code.

Tags:#math#animation#statistics
S

Shihab Shahriar

AI Engineer & Founder of Shahriar Labs. Exploring the intersection of design, cognition, and machine learning.