Contents/ Part VII · Probability Distributions/ Chapter 39

Continuous Distributions

When a quantity can take any value on a scale, a height or a wait time or a temperature, probability stops being a sum and becomes an area under a curve. This chapter introduces densities, the uniform, exponential, normal, and gamma, and the all-important CDF.

⏱️ ~16 min read
🐍 Notebook included
📊 Chapter 39

The last chapter counted things, whole numbers of successes or events. But height, time, and temperature are not counts; they vary smoothly and can land on any value in a range. For these continuous random variables, the whole machinery shifts from mass to density.

A continuous distribution is described by a probability density function (PDF). The probability of landing in an interval is the area under the PDF over that interval, and the total area is always 1.
📐
Density is not probability

This is the one idea that trips everyone up. For a continuous variable, the PDF's height is not a probability, and the probability of any single exact value is zero (an interval of zero width has zero area). Only ranges carry probability, and you get it by measuring area, which is why the CDF in section 4 does so much work.

1

From Mass to Density

A discrete distribution stacks probability into bars (the PMF); a continuous one smears it into a smooth curve (the PDF). The probability that X falls between a and b is the shaded area beneath the curve from a to b.

Probability is the area under the density curve a b P(a < X < b) PDF f(x) total area = 1

A histogram of a large sample traces out the PDF, and the fraction of data in any window matches the area there. In the notebook, P(0.5 < X < 1.5) for a standard normal comes out to 0.2417, both from the area and from counting samples. The height alone tells you nothing; you must integrate, that is, measure area.

2

The Uniform and Exponential

Two simple continuous distributions cover a lot of ground. The uniform spreads probability evenly across an interval, every value equally likely. The exponential models the waiting time until a random event, and it has a famous quirk.

Uniform(a, b) ab flat: every value equally likely Exponential(λ) mean = 1/λ waiting times, long right tail

The exponential is the continuous cousin of the geometric: both answer "how long until the first event", and both are memoryless. Having already waited tells you nothing about the wait remaining, P(X > 3 | X > 2) = P(X > 1). Its mean is 1/λ, and like the geometric it has a long right tail, so unusually long waits are uncommon but never impossible.

3

The Normal (Gaussian) Distribution

The normal distribution, the bell curve, is the most important continuous distribution in all of statistics. It has two parameters: the mean μ sets where the bell sits, and the standard deviation σ sets how wide it spreads.

μ shifts the center, σ sets the spread small σ large σ shifted μ

Every normal curve is the same symmetric bell, relocated by μ and stretched by σ. A larger σ spreads the same total area of 1 over a wider range, lowering the peak. Its sweeping importance, and why it appears whenever many small effects add up, comes from the Central Limit Theorem in the Sampling Distributions & the Central Limit Theorem chapter. The Normal Distribution in Depth is devoted entirely to it.

4

The CDF, Quantiles, and the Gamma Family

Because probabilities are areas, we need a fast way to read them. The cumulative distribution function (CDF) gives P(X ≤ x), the area to the left of x. It climbs from 0 to 1, and running it backward turns a probability into a value, a quantile or percentile.

The CDF: area to the left, climbing from 0 to 1 1.0 0 P = 0.95 95th percentile

For the standard normal, P(X ≤ 1.5) = 0.9332, and reading across at 0.95 gives the 95th percentile, 1.645. One more family rounds out the toolkit: the gamma distribution (a sum of exponentials) flexes from sharply right-skewed to nearly bell-shaped as its shape parameter grows, which is why it models rainfall totals, insurance claims, and other positive, skewed quantities.

The gamma family: one shape knob, from exponential to near-bell shape k = 1 (exponential) k = 2 (skewed hump) k = 5 (near-bell) 0246 81012 As the shape parameter grows, the skew fades and the gamma approaches a normal bell.

With four continuous shapes in hand, the practical skill is picking the right one. This table is the quick map:

DistributionReach for it whenTell-tale sign in the data
Uniformevery value in a range is equally likelyflat histogram; a known hard min and max
Exponentialtime between random events, or memoryless lifetimesright-skewed, decays from zero; mean ≈ SD
Normal (Gaussian)sums or averages of many small effects; measurement errorsymmetric bell; the 68-95-99.7 rule holds
Gammapositive, right-skewed totals: rainfall, claims, waiting timesskewed with a hump; the shape sets how skewed
Log-normal (a common cousin)multiplicative growth: incomes, city sizes, stock returnsright-skewed, but the log of it looks normal
5

Continuous Distributions in Machine Learning & AI

Continuous distributions, and the Gaussian above all, are woven through machine learning. They model the data, the noise, the weights, and the uncertainty, and the one you assume quietly decides your loss function.

DistributionIn ML / AI it appears asConcrete example
Normal (Gaussian)The default for errors, noise, and weightsGaussian noise in diffusion models and VAEs; weight initialization
Normal likelihoodSquared-error (MSE) lossleast-squares regression is Gaussian maximum likelihood
UniformRandom initialization and samplinguniform weight init; sampling actions or seeds
Exponential / GammaTime-to-event and positive quantitiessurvival models; waiting times between events
Mixtures & densitiesDensity estimationGaussian mixture models; kernel density estimation
🤖
Why this matters for AI research

The Gaussian is the unofficial mascot of machine learning. Assume your model's errors are normal and minimizing squared error becomes maximum likelihood, which is why MSE is the default regression loss. Diffusion models generate images by gradually removing Gaussian noise; variational autoencoders place a Gaussian over a latent space; Gaussian processes put a distribution over entire functions; and sensible weight initialization (He, Xavier) draws from carefully scaled normals to keep signals stable through deep networks. Meanwhile the exponential and gamma drive survival analysis and event modeling. Knowing a distribution's shape, mean, and tails is what lets a researcher choose the right model, and the right loss, for the data at hand.

🐍

Explore densities in Python

The companion notebook overlays a PDF on a sample histogram and shades a probability as area, plots the uniform and exponential (and checks the memoryless property), shows how μ and σ reshape the normal, reads probabilities and the 95th percentile off the CDF, surveys the gamma family, and fits a Gaussian by maximum likelihood, the calculation behind least squares.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub

View opens the rendered notebook instantly (no setup). Open in Colab runs & edits it live in your browser. To run locally, install numpy, scipy, and matplotlib and launch jupyter notebook.

🎓 Key Takeaways

  • Continuous variables use a PDF; probability is the area under it over an interval, and the total area is 1.
  • Density is not probability: the height is not a probability, and P(X = exact value) = 0. Only ranges carry probability.
  • Uniform is flat; exponential models memoryless waiting times with mean 1/λ.
  • The normal has parameters μ (center) and σ (spread); the CDF gives P(X ≤ x) and its inverse gives quantiles.
  • In ML/AI, Gaussian noise, MSE = Gaussian likelihood, weight init, diffusion, VAEs, and Gaussian processes all rest on these curves.
6

Practice Challenges

Five short challenges, beginner to intermediate. Try them on paper or with SciPy before checking the solutions.

1

Uniform

A bus is equally likely to arrive at any minute in a 10-minute window, X ~ Uniform(0, 10). Find P(X < 3) and the mean wait.

Hint: probability is proportional to length; mean is the midpoint.
2

Exponential

Buses arrive on average every 10 minutes (exponential). Find P(wait > 15) and P(wait < 5).

Hint: P(X > t) = e−t/mean.
3

Normal

IQ scores follow Normal(100, 15). Find P(X < 115) and P(85 < X < 115).

Hint: 115 is one σ above the mean; 85 to 115 is μ ± 1σ.
4

Quantile

For the same N(100, 15), find the 90th percentile, the score 90% of people fall below.

Hint: use the inverse CDF (percent-point function).
5

Fit a Gaussian

Given a sample of measurements, estimate the normal's parameters by maximum likelihood.

Hint: μ̂ is the sample mean, σ̂ the sample standard deviation.
Check your work

A fully-worked solutions notebook walks through all five challenges, each verified in code. Try them yourself first, then compare.

📓 View Solutions ▶ Open Solutions in Colab ⬇ View / Download on GitHub
7

Quiz: Test Yourself

Eight quick questions on continuous distributions. Answer them, hit Check Answers, and keep refining until you score 100%. Your progress is saved, so you can hop back to the chapter and return anytime.