Continuous RVs: PDF, CDF & Uniform
Ask how long someone waited for the bus and they say 'about eight minutes', never 8.0000 — an exact instant has no chance, because a range holds infinitely many. So chance stops living at points and spreads out as area under a density curve. The gateway to every continuous distribution.
What you'll learn
- A PDF f(x) ≥ 0 with total area 1; probability is area under it
- P(a ≤ X ≤ b) is the area from a to b; P(X = a) = 0 for continuous X
- The CDF F(x) is the area up to x, and f = F prime
- Continuous uniform(a,b): f = 1/(b−a), mean (a+b)/2, variance (b−a)²/12
Before you start
Ask a friend how long they waited for the bus. “About eight minutes,” they say — not
8.0000 minutes, and not 8.0001. The bus arriving at one exact instant has, in a
real sense, no chance at all, because there are infinitely many instants packed into
any single minute. So how can we speak of the probability of something that lands
anywhere in a range? The trick is to stop pinning chance to single points and start
spreading it out as area.
Density, not probability
The curve we spread the chance along is the probability density function, f(x).
It only has to obey two rules, both echoes of the axioms: the density is never
negative, f(x) ≥ 0, and the total area under the whole curve is one. Chance for
a continuous variable is then read as the area over an interval:
P(a ≤ X ≤ b) = area under f(x) between a and b
Two things about this trip people up, and both come straight from “chance is area”. A
single point has zero width, so it encloses zero area — P(X = a) = 0 for a
continuous variable. (That is why P(a ≤ X ≤ b) and P(a < X < b) are equal: the
endpoints add nothing.) And f(x) is a density, not a probability — it can rise
above 1, because what must stay capped at one is the area, not the height. A
density of 2 over an interval of width 0.5 is perfectly valid; its area is just
1.
The running total, again
Just as before, the cumulative distribution function F(x) = P(X ≤ x)
accumulates chance from the left — now the area under f up to x. It still climbs
from 0 to 1 and never falls. Going the other way, since F adds up f, the
density is the slope of the CDF: f(x) = F prime(x). PDF and CDF are an
integrate-and-differentiate pair — hand me either and I can recover the other.
Drag the two handles below to bracket a region, and the shaded area is the chance
P(a < X < b) — no integration by hand. Flip between Normal, Exponential, and
Uniform to watch the same idea, chance-is-area, hold for every continuous shape you
will meet.
Drag the handles to read off a probability
The simplest continuous shape
The flat one. X is uniform on [a, b] when its density is constant across the
interval. To enclose an area of 1 over a width of b − a, that constant height
must be 1/(b − a):
f(x) = 1/(b − a)forxin[a, b], and0outside,- mean
= (a + b)/2(the midpoint, by symmetry), - variance
= (b − a)²/12.
For uniform(0, 10): density 1/10, mean 5, variance 100/12 ≈ 8.33.
A worked example
Find the constant
cthat makesf(x) = c·xon[0, 2](and0elsewhere) a valid PDF. Then computeP(X ≤ 1).
A valid PDF must enclose total area 1. The region under c·x from 0 to 2 is a
triangle of base 2 and height 2c:
area = ½ · base · height = ½ · 2 · 2c = 2c
set 2c = 1 ⟹ c = 0.5
Now the chance up to 1 is the smaller triangle, base 1 and height 0.5·1 = 0.5:
P(X ≤ 1) = ½ · 1 · 0.5 = 0.25
So c = 0.5 and P(X ≤ 1) = 0.25. Notice f(2) = 0.5·2 = 1 here — a density
brushing up against 1 — and it could even rise past 1 on a narrower interval; only
the total area is pinned.
A question to carry forward
The flat uniform was the easy case — every value equally dense. But the bus-wait we opened with is not flat at all: short waits are common, very long ones rare, so its density slopes down from the start. Here is the thread onward: what is the density of a pure waiting time, and what strange “the bus is no more due now than a minute ago” property does it have?
In one breath
- For a continuous RV, probability is area under the density
f:P(a ≤ X ≤ b)is that area, withf ≥ 0and total area1. - A single point has zero chance (
P(X=a)=0), so≤and<agree; andfis a density that can exceed 1 — only the area is capped. - CDF
F(x) = P(X ≤ x)= area up tox; converselyf = F′. PDF and CDF are an integrate/differentiate pair. - Continuous uniform[a,b]:
f = 1/(b−a), mean(a+b)/2, variance(b−a)²/12. - GATE moves: find the constant (set total area
= 1), a probability (area over the interval), or a median (solveF(m)=0.5).
Practice
Quick check
Practice this in an interview
All questionsEach distribution has a natural generative story: Bernoulli is a single coin flip; Binomial sums Bernoullis; Poisson counts rare arrivals; Normal emerges from sums of many small effects; Exponential models waiting times between Poisson events; Uniform assigns equal probability across a range. Choosing correctly comes from matching that story to the data-generating process.
Binomial counts successes in a fixed number of independent trials with a fixed success probability. Poisson counts events in a continuous interval when events are rare and arrive independently at a constant average rate. Poisson is the limiting case of Binomial as n → ∞ and p → 0 with np = λ fixed.
The joint distribution P(X, Y) fully specifies two random variables together. Marginals P(X) and P(Y) are obtained by summing (or integrating) the joint over the other variable. Conditionals P(X|Y=y) are the joint sliced at a fixed y value, renormalized by the marginal P(Y=y).
The Normal distribution is justified by the Central Limit Theorem — averages of large i.i.d. samples converge to Normal regardless of the underlying distribution. It is fully characterized by mean and variance, enabling closed-form inference. It fails for heavy-tailed data, skewed outcomes, bounded quantities, and rare extreme events.