Back to the on-screen lesson ·

The cumulative distribution function

Accumulating mass from the left, the staircase it makes, and reading probabilities and quantiles off it.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

You will build the cumulative distribution function of a discrete variable by accumulating its mass function from the left, evaluate it at any real number including points the variable never takes, and use differences of it to find the probability of an interval. You will also run it backwards to find a median or another quantile.

2. What the mass function gave you

The mass function says how much probability sits on each value. Accumulating it from the left gives a second description of the same variable — one that works for continuous variables too, where there is no mass to sit on a point at all.

3. Words for this lesson

$F(x) = P(X \le x)$ is the cumulative distribution function. A jump of $F$ at a value is that value's own probability, and between the jumps $F$ is flat. $F$ is right-continuous because the value $x$ itself belongs to the event $\{X \le x\}$. A quantile is a value at which $F$ first reaches a stated level; the median is the quantile at a half.

4. Everything to the left, accumulated

The cumulative distribution function of $X$ is $$F(x) = P(X \le x),$$ defined for every real $x$ and not only for the values $X$ takes.

Four properties hold for every random variable, and each one is an axiom in disguise. $F$ never decreases, because enlarging the event can only add probability. $F(x) \to 0$ as $x \to -\infty$ and $F(x) \to 1$ as $x \to \infty$. $F$ stays in $[0, 1]$. And $F$ is right-continuous: the value $x$ itself is inside the event $\{X \le x\}$, so a lump sitting at $x$ is added the moment $x$ is reached, not just after.

For a discrete variable $F$ is a staircase: flat between the values, jumping at each one by exactly that value's mass. The two descriptions are interchangeable — $p(x)$ is the size of the jump at $x$, and $F$ is the running total of $p$.

The one formula to keep is $$P(a < X \le b) = F(b) - F(a),$$ with the lower end open and the upper end closed. For a discrete variable those inequality signs change the answer.

Another way: picture

A staircase climbing from $0$ on the far left to $1$ on the far right. Each tread is a stretch where the variable takes no value; each riser is a value, and its height is that value's probability. The staircase never goes down, and the risers add to the full climb of one.

Another way: steps

  1. List the values and their masses.
  2. Form the running totals, left to right.
  3. For a probability between two points, subtract two values of $F$.
  4. For a quantile, read the running totals upward until the level is first reached, and report the value there.

5. The mass function and the staircase, side by side

A spinner showing $1$, $2$, $3$ or $4$.

$x$$p(x)$$F(x)$
10.10.1
20.20.3
30.30.6
40.41.0

$F(2.5) = 0.3$, because nothing happens between $2$ and $3$. $P(1 < X \le 3) = 0.6 - 0.1 = 0.5$. The median is $3$, the first value whose running total reaches $0.5$ — and $F$ never actually equals $0.5$, which is why the median is defined by reaches rather than by equals.

6. Where this goes wrong

Reading $F(x)$ as $P(X = x)$. $F$ accumulates; the mass function does not. For a discrete variable $p(x)$ is the jump in $F$ at $x$.

Getting the inequality signs the wrong way round. $F(b) - F(a)$ is $P(a < X \le b)$. If you want $P(a \le X \le b)$, put the mass at $a$ back in.

Thinking $F$ is only defined at the values. It is defined everywhere, and flat between them. $F(2.5)$ is a perfectly good number.

Expecting $F$ to equal a half at the median. A staircase usually steps straight over the level, which is why the median is the first value that reaches it.

7. Building the staircase

  1. Two fair coins, $X$ the number of heads: $p(0) = 0.25$, $p(1) = 0.5$, $p(2) = 0.25$.

    Start from the mass function.

  2. Running totals: $F(0) = 0.25$, $F(1) = 0.75$, $F(2) = 1$.

    Accumulate left to right.

  3. And $F(-3) = 0$, $F(0.5) = 0.25$, $F(17) = 1$: defined everywhere.

    Flat between the jumps.

8. Why the signs matter

  1. With that staircase, $P(0 < X \le 2) = F(2) - F(0) = 0.75$.

    The lower end is excluded.

  2. $P(0 \le X \le 2) = 1$, because the mass at $0$ is back in.

    A difference of $0.25$, from one inequality sign.

  3. For a continuous variable the two would agree, because no point carries mass.

    Which is the next lesson but one.

9. Your turn: $p(1) = 0.2$, $p(2) = 0.5$, $p(3) = 0.3$; find $F(2)$ and the median

  1. $F(1) = 0.2$ and $F(2) = 0.2 + 0.5 = 0.7$.

    Running totals.

  2. The first running total to reach $0.5$ is $F(2)$.

    Read upward.

  3. Your turn: work this step out. Its working is at the end of the packet.

    So the median is $2$.

10. Guided practice

A spinner shows $1$, $2$, $3$ or $4$ with probabilities $3/20$, $3/20$, $1/5$ and $1/2$. Give the cumulative distribution function at the four values.

Value
$F(1)$
$F(2)$
$F(3)$
$F(4)$

11. Guided practice

The same spinner has $F(1) = 1/4$ and $F(3) = 3/4$. What is $P(1 < X \le 3)$?

Answer:

12. Practice

A variable takes the values $1$, $2$, $3$, $4$. Which of these lists of $F(1), F(2), F(3), F(4)$ could be its cumulative distribution function?

13. Practice

The spinner shows $1$, $2$, $3$, $4$ with probabilities $1/4$, $1/4$, $1/4$, $1/4$. Give $F(2.5)$ and $P(X > 2)$.

$F(2.5)$ is p and $P(X > 2)$ is q.

14. Somewhere new

The spinner shows $1$, $2$, $3$, $4$ with probabilities $1/20$, $1/10$, $1/4$ and $3/5$. Put the marker at the median — the smallest value whose accumulated probability reaches a half.

0 |——————————| 5

Mark the position with a cross, then write the value:

15. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

16. Test question

For the same spinner, give the set of real numbers $x$ at which $F(x) = 7/10$, as an interval.

This task has no paper form; do it on a device.

17. What you can do now

You can build a staircase from a mass function, read a probability as a difference of two of its values, and find a median from the running totals. Say in your own words why the function is flat between the values the variable takes, and why it jumps exactly at them.

Working for the steps left to you

9. Your turn: $p(1) = 0.2$, $p(2) = 0.5$, $p(3) = 0.3$; find $F(2)$ and the median, step 3