4.9.3 · D2Probability Theory & Statistics

Visual walkthrough — Discrete random variables — PMF, CDF

2,182 words10 min readBack to topic

We use one running example the whole way: toss a fair coin 3 times, count the heads. Everything else is scenery.


Step 1 — Start with the raw outcomes (no numbers yet)

WHAT. Before any "random variable," we just have the list of things that can physically happen. Toss a coin 3 times: each toss is Heads (H) or Tails (T). There are equally likely sequences.

WHY. We must earn every symbol. The letter (a hollow "O", read "omega") is just a name for the box holding all 8 sequences — the sample space. Nothing mathematical yet; it's a bag of tickets.

PICTURE. Each of the 8 tickets is drawn as a little card. They are equally likely, so each carries a probability of .

Figure — Discrete random variables — PMF, CDF

Step 2 — The random variable turns each card into a number

WHAT. Define "number of Heads on the card." This is our random variable. It reads a card and outputs a plain number.

  • — the rule (a function, i.e. a machine: one input card, one output number).
  • — the input box from Step 1.
  • — the only numbers that can come out (you can't get 4 heads in 3 tosses).

WHY this tool? We don't want to do algebra on the word "" — we want a number so we can add, compare, and total probabilities. is the translator. Because its output list is finite (hence countable), we are allowed to put probability on each individual number and simply add — that is the whole meaning of discrete.

PICTURE. Arrows carry each of the 8 cards to its head-count. Notice several cards land on the same number — that piling-up is what creates unequal probabilities.

Figure — Discrete random variables — PMF, CDF

Step 3 — Count how many cards land on each number → the PMF

WHAT. For each output value , gather the arrows that landed there and add up their weights. That total is the probability mass on , written .

Working the four buckets:

  • because three cards () have exactly one head, each worth .
  • The subscript just says "this PMF belongs to the variable ."
  • reads "the probability that the output equals ."

WHY. These are the heights of our bars. And they must obey two rules — not because a textbook says so, but because they are counts of the same 8 cards:

  1. — a count of cards can't be negative. (Probability axiom: .)
  2. — every card lands somewhere, so all 8 are accounted for exactly once. (Countable additivity over disjoint buckets → .)

PICTURE. A bar (stick) at each value; its height is the mass. The four heights sum to a full 1 — the total ink is the same as the 8 cards we started with.

Figure — Discrete random variables — PMF, CDF

Step 4 — Walk left-to-right and accumulate → the CDF is born

WHAT. Now imagine dragging a marker from far left () toward the right, and every time you step over a bar you scoop its mass into a bucket. The amount in the bucket when your marker sits at position is the CDF:

  • — the running total collected up to and including .
  • — "output is at most "; the (less-than-or-equal) matters, as Step 6 shows.
  • — add masses of every value at or to the left of .

WHY sum, not integrate? Because the mass sits on isolated points, not spread over a region. There is nothing between the points to integrate. Adding sticks is the natural operation — that's the payoff of "discrete."

PICTURE. The marker moves; the bucket level rises in flat stretches broken by sudden lifts. Between values you scoop nothing (flat); crossing a value you scoop its whole stick (a jump).

Figure — Discrete random variables — PMF, CDF

Evaluating a few points:


Step 5 — Why the graph is a staircase (read every property off it)

WHAT. Plot for all real , not just the four values. We get a step function: horizontal treads and vertical risers.

WHY each feature is forced:

  • Non-decreasing. Moving right can only add non-negative sticks; the bucket never drains. So the staircase only ever climbs or stays level — never drops.
  • Flat between values. Between, say, and there is no mass to scoop, so the total is unchanged — a horizontal tread at height .
  • Limits. Far left, before any bar, the bucket is empty: . Far right, after the last bar, everything is collected: . The top tread is exactly because the masses summed to in Step 3.

PICTURE. The full staircase over the number line, with each riser's height labelled by the mass it swallowed.

Figure — Discrete random variables — PMF, CDF

Step 6 — The degenerate corner: which endpoint owns the jump?

WHAT. Zoom into a single riser, at . Question: at exactly , is the bucket at the low tread or the high tread ? Answer: the high one. Because uses , the point itself is included, so the mass is already scooped the instant the marker reaches .

WHY it matters. This is right-continuity: as you approach from the right you get and stay there — the value at agrees with the right side. But approaching from the left you get only . We name that left-limit ("just left of 1"). The gap between the two sides is exactly the mass:

  • — top of the riser (mass included, closed dot ●).
  • — bottom, the value just to the left (mass not yet included, open dot ○).
  • Their difference hands the PMF back to us — the CDF secretly stores every mass in its jumps.

PICTURE. One riser, drawn with a filled dot on top (value belongs here) and a hollow dot at the bottom (value does not belong to the left tread), and a bracket measuring the jump .

Figure — Discrete random variables — PMF, CDF

Step 7 — Interval probabilities: reading a range off the staircase

WHAT. Suppose we want — "more than 0, at most 2 heads." Read two tread heights and subtract:

WHY this exact bracketing. counts everything ; counts everything . Subtracting cancels the shared part and leaves the values — the left end is thrown out, the right end is kept. That is precisely the bracket: open on the left, closed on the right.

Check by masses: the values strictly above and at most are and , so . ✓

PICTURE. The staircase with the two treads and highlighted and their difference shaded — literally the vertical height captured between the two levels.

Figure — Discrete random variables — PMF, CDF

The one-picture summary

Everything on one canvas: the 8 cards fold into 4 sticks (the PMF); those sticks, scooped left-to-right, stack into the staircase (the CDF); each riser's height equals its stick; the top tread is ; and any interval is a difference of two tread heights.

Figure — Discrete random variables — PMF, CDF
Recall Feynman retelling — the whole walkthrough in plain words

Play a game: flip a coin three times, count the heads. Write every possible flip-sequence on its own card — there are 8, all equally likely, so each card is worth one-eighth of a liter of "probability water." Now sort the cards into buckets labelled 0, 1, 2, 3 by how many heads they show. Bucket 0 gets 1 card, bucket 1 gets 3, bucket 2 gets 3, bucket 3 gets 1. The height of water in each bucket is the PMF — and since we poured exactly 1 liter total and never lost a drop, the heights add to 1. Next, carry an empty jug and walk from bucket 0 rightward, dumping each bucket's water into the jug as you pass it. The jug's level is the CDF: it sits flat while you walk between buckets, then jumps the moment you pass one. Because "" means the bucket counts the instant you reach it, the jump belongs to the value on the right — that's why we draw a solid dot on top and a hollow dot below. The size of each jump is exactly that bucket's water, so the staircase secretly remembers the whole PMF. Finally, to find the chance of landing in some range, just read the jug level at the two ends and subtract — the water you gained in between is your answer. Flat treads, sudden risers, topping out at a full liter: that staircase is the story.


Active recall

What are the three drawings the whole derivation passes through, in order?
The 8 equally-likely outcome cards, the four PMF sticks (heights), and the CDF staircase.
Why can we add point masses for a discrete RV instead of integrating?
The values are countable/isolated points, so mass sits on individual points with nothing in between to integrate.
On the staircase, what does the height of one riser equal?
The probability mass on that value: .
Why is the CDF non-decreasing, read off the picture?
Walking right only scoops non-negative sticks into the bucket; nothing is ever removed, so the level never drops.
At exactly , is the low or high tread, and why?
The high tread, because uses , so the mass at is already included (right-continuous; solid dot on top).
Compute for 3 coin tosses and say which endpoints are in/out.
; excludes , includes (values ).

Connections

  • Parent topic — PMF, CDF — this page is its visual derivation.
  • Probability Axioms — "heights " and "heights sum to 1" are the axioms drawn as pictures.
  • Continuous random variables — PDF, CDF — replace sticks by a smooth density; the staircase becomes a smooth curve.
  • Expectation and Variance of Discrete RVs — weight each value by its stick height to get .
  • Binomial Distribution — these 3-coin-toss masses are .
  • Poisson Distribution, Conditional Probability — same stick-and-staircase machinery, new masses.