📈 Normal Distribution

The normal (Gaussian) distribution with mean μ and standard deviation σ arises naturally wherever many small independent effects add up. The Central Limit Theorem (CLT) guarantees that the average of n independent draws from any distribution converges to a normal distribution as n → ∞ — the most powerful theorem in statistics. 🇺🇦 Українська

Mode

Distribution

Statistics

Mean
Std Dev
Area [x₁,x₂]
Samples

Why the Normal Distribution?

The 68–95–99.7 rule: about 68% of data falls within ±1σ, 95% within ±2σ, and 99.7% within ±3σ. In the CLT demo, roll n dice and sum their faces — even though each die is uniform, the distribution of sums quickly approaches a bell curve. Applications include: measurement errors, financial returns, height distributions, IQ scores, noise in electronics, and as the limiting distribution in countless statistical tests (z-tests, t-tests, ANOVA).

About this simulation

This simulation lets you explore the normal (Gaussian) distribution and watch the Central Limit Theorem unfold live. In PDF/CDF mode you shape a bell curve directly by dragging its mean μ and standard deviation σ, and shade any interval to read off its probability. In CLT mode you roll a configurable set of virtual dice thousands of times and watch the histogram of their sums morph from a blocky uniform shape into a smooth Gaussian, exactly as the theorem predicts. The CDF is computed with a closed-form erf approximation rather than a lookup table, so every curve updates instantly as you drag a slider.

🔬 What it shows

In PDF/CDF mode, the green curve is the probability density function N(μ,σ²) and the translucent blue curve is its cumulative distribution function; the shaded green region between x₁ and x₂ is the probability mass in that interval. In CLT mode, the pink curve overlays the theoretical normal approximation (mean n·(sides+1)/2, variance n·(sides²−1)/12) on top of a live histogram built from actual simulated dice rolls.

🎮 How to use

Switch between the PDF/CDF and CLT Demo buttons to change mode. In PDF/CDF mode, drag Mean μ, Std Dev σ, and the x₁/x₂ shading sliders to see the area readout update. In CLT mode, set Dice count n and Dice sides, then press +1, +100, or +1000 to add rolled sums to the histogram, or Reset to clear it and start over.

💡 Did you know?

The Central Limit Theorem works no matter how lopsided the original distribution is. Even a single uniform die (values 0–5) has a flat, rectangular distribution, but the sum of just five or six dice already looks convincingly bell-shaped — a hint of why so many natural measurements end up approximately normal.

Frequently asked questions

What do μ and σ control in this simulation?

μ (mu) is the mean, which shifts the entire bell curve left or right along the x-axis without changing its shape. σ (sigma) is the standard deviation, which controls how wide or narrow the curve is: a small σ produces a tall, narrow peak concentrated near the mean, while a large σ spreads the probability mass over a wider range of values.

What does the shaded area between x₁ and x₂ actually mean?

It represents the probability that a random value drawn from this normal distribution falls between x₁ and x₂. It is computed as the difference of the CDF at the two points, Φ(x₂) − Φ(x₁), and is displayed as a percentage. This is the same calculation behind the well-known 68-95-99.7 rule for ±1σ, ±2σ, and ±3σ intervals.

How does the CLT Demo actually simulate dice rolls?

Each "roll" draws n independent random integers uniformly from 0 to (sides−1) using JavaScript's Math.random() and sums them. Pressing +1, +100, or +1000 repeats this process that many times and adds each sum to a running histogram, so you can watch the empirical distribution build up sample by sample or in large batches.

Why does the histogram start blocky and then look smooth?

With few samples, the histogram bars are noisy because each bin only holds a handful of counts, so random fluctuations are clearly visible. As you add hundreds or thousands more rolls, the law of large numbers averages out that noise and the bars settle into the smooth bell shape predicted by the Central Limit Theorem, matching the pink theoretical curve increasingly closely.

Is the CDF curve computed exactly or approximated?

It uses a well-known closed-form numerical approximation to the error function (erf), accurate to about 1.5×10⁻⁷, rather than an exact analytic formula, since the normal CDF has no elementary closed form. This approximation is fast enough to recompute on every slider movement while remaining indistinguishable from the true CDF for practical and educational purposes.