From pmf to cdf

The probability mass function (pmf) tells you how much probability sits at each value of a discrete random variable. The cumulative distribution function (cdf) tells you, for each $x$, the total probability of being $\leqslant x$. They carry the same information; the cdf is just the running sum of the pmf.

Below, you can build your own pmf by editing the $(x, p)$ table. The slider sweeps a “current $x$” across the axis: pmf lollipops at $x \leqslant$ current $x$ turn red, and their masses sum exactly to the height of the cdf curve at that $x$.

Interactive

$x$$p$
Total p = —
Cumulative mass $F(x)$ = . The red pmf lollipops sum to this; the cdf curve traces it.

What it shows

The cdf is a step function: flat between the pmf’s mass points, jumping straight up by $p_i$ at each $x = x_i$ where the pmf carries mass. Slide the current $x$ across some $x_i$ and the cdf jumps while one more pmf lollipop turns red — the same probability mass, viewed two ways.

Convention: this cdf is right-continuous. At each $x=x_i$, $F(x_i)=\mathbb{P}(X\leqslant x_i)$ already includes the jump.

The next demo replaces the discrete spikes with a smooth density (pdf). The construction is the same idea, but the running sum becomes a running integral, and the cdf turns from a staircase into a continuous curve.