Search

Search papers and lessons

Gaussian (Normal) Distribution

Level 2 · 14 min read

The bell curve: a distribution fully described by its mean and variance, and the default model for noise.

On this page

  • Colour = topic mix
  • Probability
  • Calculus
  • Discrete math
  • Sign in to see your progress

TL;DR

The Gaussian, or normal, distribution is the familiar bell curve. It is completely described by two numbers: where its centre is (the mean) and how spread out it is (the variance). Most values land close to the centre, and values far from it become rare very quickly.

It shows up everywhere because adding up many small, independent influences produces a bell shape, whatever those influences looked like on their own. That makes it the default model for measurement noise, and it is why "least squares" works.

Where you'll see it: in the noise that diffusion models add to an image at every step, in the error bars on a lab measurement, and in the weight initialisation of nearly every neural network.

Intuition

A bell made of many small pushes

Imagine a ball bearing dropped through a board of pegs (a Galton board). At each peg it bounces left or right with equal chance, a tiny nudge each time. After sixty pegs its final position is the sum of sixty tiny random nudges. Most bearings end up near the middle, because for the total to be far out, almost every nudge has to go the same way. Stack up many bearings and you get a bell.

That is the whole story of the Gaussian. A measurement error is rarely one big cause. It is thermal jitter, rounding, a slightly warm sensor, a vibrating table, all added together. Heights are shaped by many genes and many meals. When a quantity is the sum of lots of small independent effects, it is approximately Gaussian, and this holds even if each individual effect is lopsided or lumpy. This is the central limit theorem, and we will watch it happen with real numbers below.

−4−202400.20.40.60.8xdensity
  • σ = 0.5
  • σ = 1
  • σ = 2
Three Gaussians with mean 0. Smaller σ means a narrower, taller curve; each one still encloses total area 1.

Two knobs, one shape

Every Gaussian is the same bell, moved and stretched. The mean μ\mu slides it left or right. The standard deviation σ\sigma stretches it horizontally (and, to keep the area at 1, squashes it vertically). One "standard" bell and a conversion rule are enough for everything.

Why it is the default noise model

There are two reasons, and they reinforce each other.

  1. It is what the sum-of-many-causes argument predicts. If noise comes from many small sources, Gaussian is the right guess before you measure anything.
  2. It is the least presumptuous choice. Among all distributions with a given mean and variance, the Gaussian has the highest entropy: it assumes the least beyond those two numbers. If all you trust is a centre and a spread, the Gaussian is the honest model.

It is also very convenient. Add independent Gaussians and you get a Gaussian. Scale or shift one and you get a Gaussian. Condition one on another and you get a Gaussian. That closure is why Kalman filters, Gaussian processes and diffusion models are built on it.

flowchart LR
  A[Many small independent effects] --> B[Bell-shaped noise]
  B --> C[Gaussian noise model]
  C --> D[Maximum likelihood equals least squares]
  C --> E[Gaussian priors give weight decay]
  C --> F[Add noise step by step in diffusion models]

The math

Definition

Definition: Gaussian distribution

A random variable XX is Gaussian with mean μ\mu and variance σ2>0\sigma^2 \gt 0, written X∼N(μ,σ2)X \sim \mathcal{N}(\mu, \sigma^2), if its probability density function is

p(x)=1σ2πexp⁡ ⁣(−(x−μ)22σ2).p(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right).

Here xx is a value the variable might take, μ\mu is the centre of the bell, and σ\sigma is the standard deviation. The factor 1σ2π\frac{1}{\sigma\sqrt{2\pi}} is exactly what makes the total area equal to 1. Inside the exponential, (x−μ)2(x-\mu)^2 is the squared distance from the centre, so the density falls off with squared distance, fast. The parameters really are the mean and variance: E[X]=μ\mathbb{E}[X] = \mu and Var(X)=σ2\mathrm{Var}(X) = \sigma^2. The peak height is 1/(σ2π)1/(\sigma\sqrt{2\pi}), which is about 0.39890.3989 when σ=1\sigma = 1.

Standardisation

Subtract the mean and divide by the standard deviation to get a standard Gaussian:

Z=X−μσ∼N(0,1).Z = \frac{X - \mu}{\sigma} \sim \mathcal{N}(0, 1).

ZZ is the "z-score": how many standard deviations XX sits from its mean. Every Gaussian probability can be turned into a question about ZZ. We write Φ(z)=P(Z≤z)\Phi(z) = P(Z \le z) for the standard Gaussian cumulative distribution function (CDF). It has no closed form, so we look it up in a table or call a library. A few values: Φ(1)≈0.8413\Phi(1) \approx 0.8413, Φ(2)≈0.9772\Phi(2) \approx 0.9772, Φ(3)≈0.9987\Phi(3) \approx 0.9987.

The 68-95-99.7 rule

From those values, the probability of landing within kk standard deviations of the mean is Φ(k)−Φ(−k)\Phi(k) - \Phi(-k):

P(∣X−μ∣≤1σ)≈0.6827P(∣X−μ∣≤2σ)≈0.9545P(∣X−μ∣≤3σ)≈0.9973\begin{aligned} P(|X-\mu| \le 1\sigma) &\approx 0.6827 \\ P(|X-\mu| \le 2\sigma) &\approx 0.9545 \\ P(|X-\mu| \le 3\sigma) &\approx 0.9973 \end{aligned}
−4−3−2−10123400.10.20.30.4z (standard deviations from the mean)density
  • standard Gaussian
Markers at ±1, ±2, ±3. About 68% of the area lies between ±1, 95% between ±2, and 99.7% between ±3.

Sums of independent Gaussians

If X∼N(μ1,σ12)X \sim \mathcal{N}(\mu_1, \sigma_1^2) and Y∼N(μ2,σ22)Y \sim \mathcal{N}(\mu_2, \sigma_2^2) are independent, then

X+Y∼N(μ1+μ2, σ12+σ22).X + Y \sim \mathcal{N}(\mu_1 + \mu_2,\ \sigma_1^2 + \sigma_2^2).

Means add, and so do variances (not standard deviations). Scaling gives aX+b∼N(aμ+b, a2σ2)aX + b \sim \mathcal{N}(a\mu + b,\ a^2\sigma^2). Together these say the family is closed under linear operations, which is the property that makes Gaussians so tractable.

The multivariate form with a diagonal covariance

For a vector x∈Rd\mathbf{x} \in \mathbb{R}^d with mean vector μ\boldsymbol{\mu} and covariance matrix Σ\Sigma (a d×dd \times d matrix whose entries say how pairs of coordinates vary together), the density is

p(x)=1(2π)d/2det⁡(Σ)1/2exp⁡ ⁣(−12(x−μ)⊤Σ−1(x−μ)).p(\mathbf{x}) = \frac{1}{(2\pi)^{d/2} \det(\Sigma)^{1/2}} \exp\!\left(-\tfrac{1}{2} (\mathbf{x}-\boldsymbol{\mu})^\top \Sigma^{-1} (\mathbf{x}-\boldsymbol{\mu})\right).

The simplest case is a diagonal covariance, Σ=diag(σ12,…,σd2)\Sigma = \mathrm{diag}(\sigma_1^2, \dots, \sigma_d^2). The coordinates are then independent and the density factorises into dd one-dimensional Gaussians:

p(x)=∏i=1dN(xi; μi, σi2).p(\mathbf{x}) = \prod_{i=1}^{d} \mathcal{N}(x_i;\ \mu_i,\ \sigma_i^2).

When every coordinate has the same variance, Σ=σ2I\Sigma = \sigma^2 \mathbf{I}, where I\mathbf{I} is the identity matrix, and the contours of equal density are circles (spheres in higher dimensions). This isotropic form is the one used for image noise.

The reparameterisation trick

To sample x∼N(μ,σ2)x \sim \mathcal{N}(\mu, \sigma^2), draw a standard Gaussian ϵ∼N(0,1)\epsilon \sim \mathcal{N}(0, 1) and compute

x=μ+σ ϵ.x = \mu + \sigma\,\epsilon.

This is just the standardisation formula run backwards. It moves all the randomness into ϵ\epsilon, which does not depend on μ\mu or σ\sigma. The sample xx is now a smooth, differentiable function of the parameters: ∂x/∂μ=1\partial x / \partial \mu = 1 and ∂x/∂σ=ϵ\partial x / \partial \sigma = \epsilon. So gradients can flow through the sampling step. Variational autoencoders and diffusion models both rely on this. In a diffusion model, a noisy image is xt=αˉt x0+1−αˉt ϵ\mathbf{x}_t = \sqrt{\bar\alpha_t}\,\mathbf{x}_0 + \sqrt{1-\bar\alpha_t}\,\boldsymbol{\epsilon} with ϵ∼N(0,I)\boldsymbol{\epsilon} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}), which is this same trick with a data-dependent mean.

Watching the central limit theorem happen

Add up nn independent uniform random numbers, each between 0 and 1. One uniform has mean 1/21/2 and variance 1/121/12, so the sum of n=4n = 4 has mean 22 and variance 4/12=1/34/12 = 1/3. The exact density of that sum is piecewise cubic, and the plot compares it with the Gaussian of the same mean and variance. Even with only four terms the match is already close.

00.511.522.533.5400.20.40.60.8sum of four uniformsdensity
  • Gaussian, mean 2, variance 1/3
  • exact density of the sum of 4 uniforms
At x = 2 the exact density is 0.667 and the Gaussian gives 0.691; at x = 1 they are 0.167 and 0.154.

Worked examples

Example
Probabilities from a z-score

Adult heights in some population are roughly Gaussian with μ=170\mu = 170 cm and σ=10\sigma = 10 cm.

Question 1: what fraction are between 160 and 180 cm?

  1. Standardise both ends: z=(160−170)/10=−1z = (160-170)/10 = -1 and z=(180−170)/10=+1z = (180-170)/10 = +1.
  2. That is the "within one standard deviation" event, so the probability is Φ(1)−Φ(−1)=0.8413−0.1587=0.6827\Phi(1) - \Phi(-1) = 0.8413 - 0.1587 = 0.6827.
  3. About 68% of people.

Question 2: what fraction are taller than 190 cm?

  1. z=(190−170)/10=2z = (190-170)/10 = 2.
  2. P(Z>2)=1−Φ(2)=1−0.9772=0.0228P(Z \gt 2) = 1 - \Phi(2) = 1 - 0.9772 = 0.0228.
  3. About 2.3%, or roughly 1 person in 44.
Example
A test score in context

An exam has scores that are roughly Gaussian with μ=70\mu = 70 and σ=12.5\sigma = 12.5. You scored 85.

  1. The z-score is z=(85−70)/12.5=1.2z = (85 - 70)/12.5 = 1.2.
  2. From a table, Φ(1.2)≈0.8849\Phi(1.2) \approx 0.8849.
  3. You beat about 88.5% of test takers, so you are around the 88th percentile.
Example
Adding two noisy quantities

A commute has two independent legs. The bus leg takes X∼N(5,4)X \sim \mathcal{N}(5, 4) minutes and the walk takes Y∼N(3,9)Y \sim \mathcal{N}(3, 9) minutes. What is the chance the total exceeds 12 minutes?

  1. The total is Gaussian: mean 5+3=85 + 3 = 8, variance 4+9=134 + 9 = 13, so X+Y∼N(8,13)X + Y \sim \mathcal{N}(8, 13).
  2. The standard deviation is 13≈3.606\sqrt{13} \approx 3.606. Note it is not 2+3=52 + 3 = 5; variances add, not standard deviations.
  3. Standardise: z=(12−8)/3.606≈1.109z = (12 - 8)/3.606 \approx 1.109.
  4. P(Z>1.109)=1−Φ(1.109)≈1−0.8663=0.134P(Z \gt 1.109) = 1 - \Phi(1.109) \approx 1 - 0.8663 = 0.134.
  5. About a 13% chance of a commute longer than 12 minutes.
Example
Sampling with reparameterisation

We want a sample from N(2,32)\mathcal{N}(2, 3^2), so μ=2\mu = 2 and σ=3\sigma = 3. A random number generator gives ϵ=0.5\epsilon = 0.5 from N(0,1)\mathcal{N}(0, 1).

  1. x=μ+σϵ=2+3×0.5=3.5x = \mu + \sigma\epsilon = 2 + 3 \times 0.5 = 3.5.
  2. If a training loop nudges σ\sigma up from 3 to 3.1 with ϵ\epsilon held fixed, xx becomes 2+3.1×0.5=3.552 + 3.1 \times 0.5 = 3.55. The sample moved by 0.05=ϵ×0.10.05 = \epsilon \times 0.1, exactly as ∂x/∂σ=ϵ\partial x / \partial \sigma = \epsilon predicts.

Tradeoffs and failure modes

The Gaussian is a good default, and a dangerous one when you stop checking it. Its tails fall off as exp⁡(−x2)\exp(-x^2), which is extremely fast. A 5-sigma event under a Gaussian has probability about 6×10−76 \times 10^{-7}, but real data (financial returns, network traffic, incomes, file sizes) produces such events far more often.

SituationProblem with a GaussianBetter fit
Outliers and heavy tailsOne extreme value drags the mean and inflates the variance; tails are underestimatedStudent-t (power-law tails)
Robust regressionSquared error punishes outliers harshlyLaplace noise, which gives absolute error loss
Skewed data (incomes, response times)Gaussian is symmetricLog-normal, gamma
Bounded quantities (probabilities, proportions)Gaussian puts mass outside the allowed rangeBeta, or a transformed Gaussian
Counts of rare eventsGaussian is continuous and can go negativePoisson
Several clustersOne bell cannot have two humpsMixture of Gaussians

Some practical warnings:

  • Least squares is only optimal under Gaussian noise. Minimising squared error is maximum likelihood exactly when the noise is Gaussian. With heavy-tailed noise, a few bad points dominate the fit.
  • The central limit theorem is about sums, and about "enough" terms. Products compound instead of adding (that gives a log-normal), and if one term has enormous variance or infinite variance, the sum never becomes Gaussian.
  • Do not trust "looks bell-shaped". Check the tails with a quantile-quantile plot.

History

Abraham de Moivre found the curve in 1733 while approximating the binomial distribution: how likely is it to get, say, 60 or more heads in 100 coin flips? Computing binomial sums by hand was brutal, and he showed that for many trials the answer follows a smooth exponential curve. This was the first version of the central limit theorem.

Pierre-Simon Laplace picked it up in the 1770s and 1780s and proved far more general versions, showing that sums of many independent errors become bell-shaped. Carl Friedrich Gauss arrived from a different direction. In 1809, working out the orbit of the asteroid Ceres from noisy telescope readings, he asked which error law would make the arithmetic mean the best estimate. The answer was the exponential-of-squared-error curve, and the method that follows from it is least squares. (Legendre had published least squares in 1805; the priority dispute with Gauss was bitter.)

The curve got the name "normal" late in the 19th century from Karl Pearson, who later regretted it because it suggested other distributions were abnormal. It caught on because Gauss's and Laplace's arguments fit together neatly: errors are sums of many small causes, so they are Gaussian, so least squares is the right way to combine measurements. That bundle of ideas dominated statistics for two centuries and now sits underneath modern machine learning.

Check yourself

QuestionA Gaussian has mean 100 and standard deviation 15. Roughly what fraction of values fall between 70 and 130?Show answer

The interval is mean plus or minus 2 standard deviations (100 ± 30), so by the 68-95-99.7 rule about 95% (more precisely 95.45%).

QuestionIf X∼N(1,4)X \sim \mathcal{N}(1, 4) and Y∼N(2,5)Y \sim \mathcal{N}(2, 5) are independent, what is the distribution of X+YX + Y, and why is its standard deviation not 2 + √5?Show answer

X+Y∼N(3,9)X + Y \sim \mathcal{N}(3, 9), so its standard deviation is 3. Means and variances add for independent variables. Standard deviations are square roots of variances, so they combine as 4+5=3\sqrt{4 + 5} = 3, not 2+5≈4.242 + \sqrt{5} \approx 4.24.

QuestionYou need a sample from N(−1,4)\mathcal{N}(-1, 4) and your generator gives ϵ=1.5\epsilon = 1.5 from the standard Gaussian. What is the sample, and why is this form useful for training neural networks?Show answer

Here σ=2\sigma = 2, so x=μ+σϵ=−1+2×1.5=2x = \mu + \sigma\epsilon = -1 + 2 \times 1.5 = 2. It is useful because the randomness sits entirely in ϵ\epsilon, which does not depend on the parameters, so xx is a differentiable function of μ\mu and σ\sigma and gradients can pass through the sampling step.

QuestionA model of stock returns uses a Gaussian and says a 6-sigma daily drop should happen once in millions of years, yet it happens every few years. What went wrong, and what would you try instead?Show answer

Real returns have heavy tails, and the Gaussian tail decays as exp⁡(−x2)\exp(-x^2), which badly underestimates extreme events. A Student-t (or another heavy-tailed or mixture model) assigns far more probability to extremes. You would also check the tails with a quantile-quantile plot before trusting the model.

Sources