Continuous Distributions (Uniform, Exponential, Gaussian & Beta)
Why density height is NOT probability, zooming histograms into smooth curves, mastering the 68-95-99.7 bell curve, competing clocks & Beta
Can a valid Probability Density Function f(x) ever have a height of f(x) = 5 (greater than 1)?
- Understand intuitively why P(X = exact number) = 0 for continuous measurements while PDF height f(x) can happily exceed 1.
- Turn ANY Gaussian bell curve into standard Z-scores ('how many standard deviations from average?') to estimate probabilities in your head.
- Use Exponential(λ) for continuous wait times and solve competing-clock puzzles in 1 line.
- Picture Beta(α, β) as a flexible 'probability over probabilities' on [0, 1] and understand Log-Normal skewed wealth/latencies.
Up until now we counted whole numbers (0, 1, 2, 3 heads). What about continuous measurements like your exact height, website load time (142.8391... ms), or stock returns? You can't list every decimal number because there are infinitely many! The big mental shift is simple: stop looking at bar HEIGHT and start looking at shaded AREA!
1. Why Probability Becomes AREA (Zooming Into a Histogram)
Suppose you measure the exact height of 10,000 adults. What is the probability someone is EXACTLY 175.000000000000... cm tall down to the last atom? ZERO! Because an exact point has zero width!
Instead, we always ask about a range: "What's the chance someone is between 174 cm and 176 cm?" Watch what happens below when we slice a histogram into thinner and thinner bars — each individual sliver's probability shrinks toward 0%, while the total shaded AREA between 0 and +1σ stays rock-solid at 34.1%!
The 3 Golden Rules of Continuous PDFs
- Single point = Zero probability: (which means and are identical!).
- Range probability = Shaded Area: .
- Uniform() = Flat Rectangle: Constant height across , mean , variance .
Drag the bin resolution slider below from 6 bins up to 60 bins and watch a discrete bar chart literally become a continuous PDF!
Slide the number of histogram bins from 6 up to 60. Watch each single bar's probability shrink toward 0.00% while the shaded green AREA between 0 and 1 stays rock-solid around 34.1%!
A bus arrives uniformly at random anywhere between 0 and 20 minutes from now: X ~ Uniform(0, 20). What is the PDF height f(x), and what is the probability you wait between 5 and 11 minutes?
2. The Bell Curve $N(\mu, \sigma^2)$ & Z-Scores in Your Head
Imagine comparing two exams: Alice scored 85 on a Math exam (class average 70, spread 5), while Bob scored 90 on a History exam (class average 85, spread 10). Who actually beat more of their classmates?
Don't compare raw scores — ask "How many standard deviations above average are they?"
- Alice: (top
0.15%— superstar!!) - Bob: (solid, around top
31%)
That universal ruler is the Z-score! It turns EVERY bell curve on Earth into the exact same Standard Normal !
The 68–95–99.7 Mental Ruler (Use It Everywhere!)
For ANY Normal bell curve :
- Within of average: ~68.3% of all data
- Within of average: ~95.4% (exact 95% is )
- Within of average: ~99.7% (only
0.3%— split0.15%left /0.15%right — lies outside!)
Why every Normal problem collapses into 1 simple subtraction and 1 division!
Subtract the mean μ to see how far ABOVE (+) or BELOW (−) average your value X sits.
Pause & Check: Test scores follow N(μ = 70, σ = 10). Roughly what percentage of students score HIGHER than 80?
Adult heights follow N(μ = 170 cm, σ = 8 cm). Roughly what percentage of adults are between 162 cm and 186 cm tall?
3. Exponential Wait Clocks, Log-Normal Wealth & Beta($\alpha, \beta$)
Imagine two rival food trucks — Taco Truck gets orders at rate 2 per minute, while Burger Truck gets orders at rate 3 per minute (both completely random Exponential clocks). Two natural questions:
- How long until EITHER truck gets the next order? Combined rate is
2 + 3 = 5 orders/minaverage wait is seconds! - What is the chance Taco Truck gets the next customer first? Simply its share of the total speed: ! Zero integrals needed!
Three Continuous Workhorses Worth Knowing by Heart
- Exponential() (Continuous twin of Geometric — also Memoryless!):
- Time between Poisson() arrivals: , average wait .
- Competing Clocks: and !
- Log-Normal (When random percentages MULTIPLY over time — stocks, incomes, session lengths!):
- If , then is always positive and right-skewed, with average (strictly higher than its median !).
- Beta() (A chameleon distribution over probabilities !):
- Think of as "successes" and as "failures": mean . At
(1, 1)it's flat uniform; at(20, 80)it's a laser-sharp spike at20%!
- Think of as "successes" and as "failures": mean . At
Competing Server Failures in 20 Seconds
Your app relies on two independent databases: Primary DB fails at Exponential rate λ₁ = 1/year, and Cache DB fails at Exponential rate λ₂ = 4/year. How long on average until the FIRST failure, and what's the chance Cache DB fails first?
Because the two failure clocks race independently, the combined rate until either one breaks is simply:
A Beta distribution models an ad's unknown click-through rate with parameters α = 6 and β = 14. What is its expected click-through rate E[p]?
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
Mind-bending, right?! In the continuous world, probability = 0 does NOT mean 'impossible' — it just means 'infinitely tiny slice compared to uncountably many other decimals'! Think of throwing a razor-thin dart at a dartboard: the dart MUST hit some exact point , even though any single pre-chosen geometric point has area 0!
VAE & Diffusion Reparameterization Trick
Stable Diffusion and VAEs sample latent vectors via z = μ + σ · ε with ε ~ N(0, 1) so gradients backpropagate cleanly!
He / Xavier Neural Network Initialization
Initializing weights from N(0, 2/n_in) stops deep networks from exploding or vanishing on layer 1.
Thompson Sampling Bandits (Beta)
Ad & recommendation engines store a Beta(α, β) curve per item and sample from it to balance exploring new items vs. exploiting winners.
Churn & Survival Modeling (Exponential)
Subscription businesses model customer lifetimes and competing cancellation reasons using Exponential & Weibull hazard rates.
import math
import numpy as np
# 1. Exact Normal CDF Φ(z) using built-in math.erf (zero SciPy needed!)
def normal_cdf(x: float, mu: float = 0.0, sigma: float = 1.0) -> float:
return 0.5 * (1.0 + math.erf((x - mu) / (sigma * math.sqrt(2.0))))
for k in (1, 2, 3):
print(f"Within ±{k}σ: {(normal_cdf(k) - normal_cdf(-k))*100:.2f}%")
# 2. Inverse Transform Trick: turn Uniform(0,1) into Exponential(lambda=2.5)!
rng = np.random.default_rng(42)
u = rng.uniform(0.0, 1.0, size=100_000)
waits = -np.log(1.0 - u) / 2.5
print(f"Simulated Exp(2.5) mean = {waits.mean():.4f} (exact = {1/2.5:.4f})")