Each ball is a sum of many small random steps. The Central Limit Theorem says such sums become Gaussian once you add enough of them โ nearly whatever the steps look like.
A ball falls through n peg rows, going left/right with
probability ยฝ. Its slot counts the rights: k ~ Binomial(n, ยฝ),
mean n/2, variance n/4 โ a bell as n grows.
Pegs only add ยฑ1 steps, so this mode drops them and sums n draws
from a source you pick. Each draw uses inverse-transform sampling:
U ~ Uniform(0,1), then X = Fโปยน(U) (shown in the inset).
The standardized sum z = (S โ nฮผ)/(ฯโn) still lands on the same bell.
Each step is now a vector Xแตข โ โยฒ with mean ฮผ and
covariance ฮฃ: two independent, standardized draws from the source,
mixed by the Cholesky factor of ฮฃ = [[1, ฯ], [ฯ, 1]]. (Ring
puts the step uniformly on a circle โ uncorrelated, but far from independent.)
A ball traces the partial sums of (Xแตข โ ฮผ)/โn and lands at
z = (S โ nฮผ)/โn, which approaches Nโ(0, ฮฃ): the
heat map fills the black contour ellipses. The inset shows the cloud of single
steps โ same ฮฃ, anything but normal.
The bivariate mode opens on a Galton board in three dimensions. Each peg sends
the ball to one of four diagonal neighbours: zโ and zโ each
step ยฑ1, the same way with probability (1 + ฯ)/2 โ so the step again has
covariance ฮฃ. After n levels the ball hits the
zโโzโ plane (a ripple marks the impact) and joins a bar
on the lattice (2i โ n, 2j โ n)/โn. The bars grow into a bivariate
binomial; the wireframe is the CLTโs prediction,
N ยท (2/โn)ยฒ ยท ฯฮฃ(z) per cell. Drag to rotate. (As on the flat
quincunx, the lattice makes dยฒ discrete, so the KS test notices for
small n โ add rows.)
In the bivariate mode the histogram is of the squared Mahalanobis distance
dยฒ = zแตฮฃโปยนz, compared with the ฯยฒโ density it has under
Nโ(0, ฮฃ). The black ellipses are d = 1, 2, 3, holding
39%, 86% and 99% of the mass; the orange one is d = 2 for the
sample mean and covariance.
The CDF view shades the gap between the empirical and
normal CDFs. D is the largest gap; the p-value comes from the
Kolmogorov distribution at โNยทD. We standardize with the
known ฮผ, ฯ, so the test is valid. (The quincunx is discrete, so for
small n, D settles above zero โ use more rows.)
In the bivariate mode the test runs on dยฒ against ฯยฒโ
โ a necessary check on normality, not a sufficient one.
Space pause ยท R reset ยท V board โ CDF ยท F full-screen ยท H help ยท drag the 3-D board to rotate it.
Univariate, for $x \in \mathbb R$ โ written so that it already has the shape of the general case, with the variance as a 1 ร 1 covariance matrix:
Bivariate, for $\mathbf x = (x_1, x_2)^{\top} \in \mathbb R^2$, with mean vector and covariance matrix
Written out, the quadratic form in the exponent is
Both are the cases $d = 1, 2$ of the density of $\mathcal N_d(\mu, \Sigma)$ on $\mathbb R^d$,
whose contours of constant density are the ellipses (for $d = 2$) $(\mathbf x-\mu)^{\top}\Sigma^{-1}(\mathbf x-\mu) = c^2$.
And the theorem, once per mode โ for i.i.d. steps with finite (co)variance:
so $P(d \le c) = 1 - e^{-c^2/2}$ โ which is where the 39/86/99% of the contours come from.