Intuition What this page is
The parent note Probability mass and density functions taught you the machinery : a PMF gives exact probabilities of discrete outcomes, a PDF gives densities you must integrate to get probabilities. This page is a shooting range . We list every kind of situation these functions can throw at you, then knock each one down with a full worked example.
A PMF is p X ( x ) = P ( X = x ) — a real probability at each point. A PDF is f X ( x ) — a probability per unit length ; the probability lives in the area ∫ f X d x . Keep that one sentence in your head and every example below is just careful bookkeeping.
Before we start, three plain-word reminders so no symbol sneaks in undefined:
Definition The three symbols we lean on
P ( X = x ) ::: "the probability that the random variable X lands exactly on the number x ."
∫ a b f X ( x ) d x ::: "the area under the density curve between x = a and x = b " — and that area is the probability of landing in [ a , b ] .
F X ( x ) = P ( X ≤ x ) ::: the CDF , "probability of landing at x or anywhere to its left." See 1.3.07-Cumulative-distribution-functions .
Every problem this topic can throw at you falls into one of these cells. The right column names the example that kills it.
#
Case class
What makes it tricky
Killed by
A
Discrete, finite, uniform
just count
Ex 1
B
Discrete, non-uniform (weighted)
outcomes have different weights
Ex 2
C
Discrete, find missing mass so ∑ = 1
normalization on a PMF
Ex 3
D
Continuous, find the constant c
normalization on a PDF
Ex 4
E
Continuous, probability of an interval
integrate the density
Ex 5
F
Degenerate : single point of a continuous variable
P ( X = c ) = 0
Ex 5 (part b)
G
Continuous, go PDF ↔ CDF
differentiate / integrate
Ex 6
H
Limiting behaviour : tail probability, x → ∞
improper integral
Ex 7
I
Density that exceeds 1
density ≠ probability
Ex 8
J
Real-world word problem
translate words → math
Ex 9
K
Exam twist: mixed / piecewise
glue two pieces, check continuity
Ex 10
Worked example Example 1 — Cell A: finite uniform
Statement. A fair 8-sided die shows X ∈ { 1 , … , 8 } . Find p X ( 5 ) and P ( X ≥ 6 ) .
Forecast: guess both numbers before reading on.
Count the equally-likely outcomes. There are 8 faces, each with the same chance.
Why this step? "Fair" means every outcome has weight 1/8 — the definition of a uniform PMF.
Read off p X ( 5 ) . Exactly one face equals 5, so p X ( 5 ) = 8 1 .
P ( X ≥ 6 ) covers { 6 , 7 , 8 } — three outcomes. Add their masses: 8 1 + 8 1 + 8 1 = 8 3 .
Why this step? By countable additivity , probabilities of disjoint outcomes just add.
Verify: ∑ x = 1 8 8 1 = 1 ✓, and 8 3 = 0.375 , a valid probability in [ 0 , 1 ] .
Worked example Example 2 — Cell B: weighted (non-uniform) PMF
Statement. A loaded coin has P ( heads ) = 0.7 . Let X = 1 for heads, 0 for tails (a Bernoulli variable, see 1.3.09-Common-probability-distributions ). Using p X ( x ) = p x ( 1 − p ) 1 − x , compute p X ( 1 ) and p X ( 0 ) .
Forecast: which is bigger?
Plug x = 1 : p 1 ( 1 − p ) 0 = 0.7 ⋅ 1 = 0.7 .
Why this step? Anything to the power 0 is 1 , so the ( 1 − p ) factor vanishes and only p survives.
Plug x = 0 : p 0 ( 1 − p ) 1 = 1 ⋅ 0.3 = 0.3 .
Why this step? Now p 0 = 1 kills the head-term, leaving the tail probability.
Verify: 0.7 + 0.3 = 1 ✓ — the two masses exhaust all outcomes.
Worked example Example 3 — Cell C: solve for missing mass
Statement. X takes values { 0 , 1 , 2 , 3 } with p X ( 0 ) = 0.1 , p X ( 1 ) = 0.3 , p X ( 2 ) = k , p X ( 3 ) = 0.25 . Find k , then P ( X ≤ 2 ) .
Forecast: is k closer to 0.1 or 0.5 ?
Impose ∑ p X = 1 . 0.1 + 0.3 + k + 0.25 = 1 .
Why this step? Property 2 of any PMF: the total mass is exactly 1 , no more, no less.
Solve: k = 1 − 0.65 = 0.35 .
P ( X ≤ 2 ) = p X ( 0 ) + p X ( 1 ) + p X ( 2 ) = 0.1 + 0.3 + 0.35 = 0.75 .
Why this step? "≤ 2 " is the disjoint union of the outcomes 0 , 1 , 2 ; add their masses.
Verify: all four masses are in [ 0 , 1 ] ✓ and sum to 0.1 + 0.3 + 0.35 + 0.25 = 1 ✓.
Worked example Example 4 — Cell D: find the normalizing constant
Statement. A density is f X ( x ) = c x for x ∈ [ 0 , 2 ] and 0 elsewhere. Find c .
Forecast: bigger or smaller than 1 ?
Impose ∫ − ∞ ∞ f X d x = 1 . Only [ 0 , 2 ] contributes, so ∫ 0 2 c x d x = 1 .
Why this step? Total area under any PDF must be exactly 1 (total probability). We use an integral, not a sum , because X is continuous — outcomes are packed with no gaps.
Integrate: ∫ 0 2 c x d x = c [ 2 x 2 ] 0 2 = c ⋅ 2 4 = 2 c .
Why this step? The antiderivative of x is x 2 /2 ; evaluate top minus bottom.
Solve 2 c = 1 ⇒ c = 2 1 .
Verify: ∫ 0 2 2 1 x d x = 2 1 ⋅ 2 = 1 ✓. Note f X is ≥ 0 on [ 0 , 2 ] ✓.
Worked example Example 5 — Cells E & F: interval probability & a single point
Statement. Using f X ( x ) = 2 1 x on [ 0 , 2 ] from Ex 4: (a) find P ( 1 ≤ X ≤ 2 ) ; (b) find P ( X = 1.4 ) .
Forecast: part (a) — more or less than half? Part (b) — guess it exactly.
(a) Set up the area: P ( 1 ≤ X ≤ 2 ) = ∫ 1 2 2 1 x d x .
Why this step? For a PDF, probability of an interval = area under the curve over that interval.
Integrate: 2 1 [ 2 x 2 ] 1 2 = 2 1 ( 2 4 − 2 1 ) = 2 1 ⋅ 2 3 = 4 3 .
(b) A single point has zero width: P ( X = 1.4 ) = ∫ 1.4 1.4 f X d x = 0 .
Why this step? This is the degenerate case F : an integral over zero width is zero area, so any exact value has probability 0 — even though its density f X ( 1.4 ) = 0.7 is nonzero.
Verify: 4 3 = 0.75 ∈ [ 0 , 1 ] ✓. And since P ( X = 1 ) = 0 , the boundary doesn't matter: P ( 1 ≤ X ≤ 2 ) = P ( 1 < X < 2 ) ✓.
Worked example Example 6 — Cell G: PDF ↔ CDF both directions
Statement. X is uniform on [ 0 , 1 ] so f X ( x ) = 1 there. (a) Build F X ( x ) . (b) Recover f X by differentiating.
Forecast: what shape is F X — flat, straight, or curved?
(a) Integrate the density from the left: F X ( x ) = ∫ 0 x 1 d t = x for x ∈ [ 0 , 1 ] .
Why this step? The CDF is "area accumulated up to x ." Integrating a flat height-1 slab of width x gives area x — a straight ramp.
Handle the ends: F X ( x ) = 0 for x < 0 (no area yet) and F X ( x ) = 1 for x > 1 (all area collected).
Why this step? Cover all cases — a CDF must run from 0 up to 1 .
(b) Differentiate: d x d ( x ) = 1 = f X ( x ) on ( 0 , 1 ) .
Why this step? By the Fundamental Theorem of Calculus, the density is the slope of the CDF; a straight ramp of slope 1 gives constant density 1.
Verify: F X ( 1 ) − F X ( 0 ) = 1 − 0 = 1 = total probability ✓, and slope = 1 matches f X = 1 ✓.
Worked example Example 7 — Cell H: limiting / tail behaviour
Statement. An exponential waiting time has f X ( x ) = λ e − λ x for x ≥ 0 with λ = 2 . Find P ( X > 1 ) (the "long-wait tail").
Forecast: small (< 0.5) or large?
Set up the improper integral: P ( X > 1 ) = ∫ 1 ∞ 2 e − 2 x d x .
Why this step? "X > 1 " stretches to + ∞ ; we need the whole right tail's area.
Integrate: antiderivative of 2 e − 2 x is − e − 2 x . Evaluate [ − e − 2 x ] 1 ∞ .
Why this step? As x → ∞ , e − 2 x → 0 , so the top limit contributes 0 — that's why the improper integral converges (the tail has finite area).
Result: 0 − ( − e − 2 ) = e − 2 ≈ 0.1353 .
Verify: the whole density integrates to 1 : ∫ 0 ∞ 2 e − 2 x d x = 1 ✓, so a tail probability of 0.135 < 1 is sane ✓.
Worked example Example 8 — Cell I: density that exceeds 1
Statement. X is uniform on [ 0 , 0.25 ] . Find f X and confirm P ( 0 ≤ X ≤ 0.25 ) = 1 .
Forecast: can a density legally be bigger than 1?
Constant density on a length-0.25 interval: call it c . Normalize: ∫ 0 0.25 c d x = 0.25 c = 1 .
Why this step? Same normalization rule as always — area must be 1.
Solve: c = 1/0.25 = 4 . So f X ( x ) = 4 on [ 0 , 0.25 ] .
Why this step? To fit area 1 into a narrow interval, the curve must stand tall — height 4, well above 1.
Check the area: 4 × 0.25 = 1 .
Why this step? This is the whole lesson of cell I: f X = 4 is a density, not a probability ; only its area is capped at 1. (Compare a PMF, where each value must be ≤ 1 .)
Verify: f X = 4 ≥ 0 ✓ and total area = 1 ✓, yet f X > 1 — perfectly legal.
Worked example Example 9 — Cell J: real-world translation
Statement. A support-line's call durations (minutes) follow f X ( x ) = 3 1 e − x /3 for x ≥ 0 (exponential with mean 3 min). What fraction of calls last between 2 and 5 minutes ?
Forecast: roughly a quarter, a half, or three-quarters?
Translate words → math: "between 2 and 5 minutes" = P ( 2 ≤ X ≤ 5 ) = ∫ 2 5 3 1 e − x /3 d x .
Why this step? Interval question ⇒ area under the density. Units: x in minutes, f X in "probability per minute", so f X d x is dimensionless probability ✓.
Integrate: antiderivative of 3 1 e − x /3 is − e − x /3 . Evaluate [ − e − x /3 ] 2 5 .
Compute: − e − 5/3 + e − 2/3 = e − 2/3 − e − 5/3 ≈ 0.5134 − 0.1889 = 0.3245 .
Verify: result ≈ 0.325 ∈ [ 0 , 1 ] ✓. Cross-check with the CDF F X ( x ) = 1 − e − x /3 : F X ( 5 ) − F X ( 2 ) = ( 1 − e − 5/3 ) − ( 1 − e − 2/3 ) = e − 2/3 − e − 5/3 ✓ same number.
Worked example Example 10 — Cell K: piecewise / mixed twist
Statement. A density rises then is flat: f X ( x ) = x on [ 0 , 1 ] and f X ( x ) = k on [ 1 , 2 ] , else 0 . (a) Find k . (b) Find P ( X ≤ 1.5 ) .
Forecast: does the piece-2 height k come out ≥ or < the peak x = 1 of piece 1?
(a) Total area = area of triangle + area of rectangle = 1. Triangle on [ 0 , 1 ] : ∫ 0 1 x d x = 2 1 . Rectangle on [ 1 , 2 ] : ∫ 1 2 k d x = k .
Why this step? Normalization applies to the whole piecewise curve; add the pieces.
Solve: 2 1 + k = 1 ⇒ k = 2 1 .
(b) P ( X ≤ 1.5 ) = ∫ 0 1 x d x + ∫ 1 1.5 2 1 d x = 2 1 + 2 1 ( 0.5 ) = 2 1 + 4 1 = 4 3 .
Why this step? Split the interval at the join x = 1 ; integrate each piece with its own rule.
Verify: total area 2 1 + 2 1 = 1 ✓, both pieces ≥ 0 ✓, and P ( X ≤ 1.5 ) = 0.75 ∈ [ 0 , 1 ] ✓.
Recall One-line trap: density vs probability
Can a valid PDF have f X ( x ) = 4 ? ::: Yes — density can exceed 1; only its area is capped at 1 (Ex 8).
Recall Degenerate continuous case
For continuous X , what is P ( X = 1.4 ) ? ::: Exactly 0 — zero width means zero area (Ex 5b).
Recall Which rule normalizes?
PMF vs PDF total-probability condition? ::: ∑ x p X ( x ) = 1 (discrete) vs ∫ − ∞ ∞ f X ( x ) d x = 1 (continuous).
Mnemonic "Sum discretely, integrate continuously; density gives area, mass gives probability."
Connections. Normalizing constants here reappear when you fit models by 1.4.02-Maximum-likelihood-estimation ; the discrete PMF over classes is exactly what 2.1.05-Softmax-activation produces; the Gaussian density underlies 3.2.04-Gaussian-processes . Expected values built from these functions live in 1.3.08-Expected-value-and-variance , and the underlying objects in 1.3.01-Random-variables-and-distributions .