Tutorials › Introduction to Statistics › Cumulative Distribution Functions for Discrete Variables

Random Variables and Expected Value · Tutorial 352 of 996

Cumulative Distribution Functions for Discrete Variables

Build and interpret cumulative distribution functions for discrete random variables, including their jumps, interval probabilities, and the distinction between finite and countable support.

Intermediate 10 min read

What You'll Learn

  • Define the cumulative distribution function for a discrete random variable.
  • Construct a CDF by accumulating probability mass from a pmf.
  • Read point probabilities from the jumps of a CDF.
  • Calculate interval probabilities while handling included and excluded endpoints.
  • Distinguish finite-support step graphs from countable-support CDFs with dense jumps.

Why Accumulate Probabilities?

A probability mass function (pmf) lists the probability assigned to each possible value of a discrete random variable. It answers questions about individual values directly, but a question such as “What is the probability of at most two alerts?” requires adding the probabilities of several values. A cumulative distribution function organizes all those sums in one function. Once it is known, probabilities for intervals can often be found by subtracting two cumulative probabilities.

The word “cumulative” means that probability is gathered from the left up through a chosen cutoff. The cutoff matters: the definition includes the value at the cutoff itself. That convention determines how jumps and interval endpoints must be handled.

Definition and Basic Properties

Definition: For a random variable \(X\), its cumulative distribution function (CDF) is the function \(F\) defined for every real number \(x\) by $$ F(x)=P(X\le x). $$ If \(X\) is discrete with pmf \(p_X(t)=P(X=t)\), then $$ F(x)=\sum_{t\le x}p_X(t), $$ where the sum is over the possible values \(t\) of \(X\). For a countably infinite support, this is a convergent sum of nonnegative probabilities.

The CDF is defined at every real number, not just at values in the support. Between support values, its value includes the probabilities of all support points at or below the argument. Since probabilities cannot be negative, \(F\) is nondecreasing: if \(a\le b\), then \(F(a)\le F(b)\). Also, \(0\le F(x)\le 1\).

At a value \(x\) with positive probability, the CDF increases by exactly that probability. To express this precisely, define the left limit \(F(x-)=\lim_{u\uparrow x}F(u)\). For a discrete random variable, \(F(x-)=P(X<x)\), so

$$ F(x)-F(x-)=P(X=x). $$

Thus values with positive probability are jumps of the CDF, and the jump size gives the point probability. A value outside the support has no jump. The CDF is right-continuous: its value at a cutoff includes any probability mass at that cutoff. This is why the jump at \(x\) is included in \(F(x)\), rather than first appearing just to its right.

Building a CDF From a PMF

To construct a CDF from a pmf, sort the possible values from smallest to largest and keep a running total. For a finite support, the result is constant between successive support values, then rises at each support value. It is therefore a step function in the usual sense. The following example shows how the point masses become horizontal levels and jumps.

Worked Example: Accumulating a Finite PMF

Suppose a hypothetical discrete random variable \(X\) has the pmf below. The probabilities sum to \(0.2+0.5+0.3=1.0\), as required.

\(x\)\(-1\)\(0\)\(2\)
\(P(X=x)\)0.20.50.3

For \(x<-1\), no possible value is at or below \(x\), so \(F(x)=0\). For \(-1\le x<0\), only the mass at \(-1\) has accumulated, giving \(F(x)=0.2\). For \(0\le x<2\), the masses at \(-1\) and \(0\) have accumulated: \(0.2+0.5=0.7\). At and above \(2\), all the mass has accumulated: \(0.2+0.5+0.3=1\). Therefore

$$ F(x)= \begin{cases} 0, & x<-1,\\ 0.2, & -1\le x<0,\\ 0.7, & 0\le x<2,\\ 1, & x\ge 2. \end{cases} $$

The graph would be horizontal at height \(0\) before \(-1\), then jump by \(0.2\) at \(-1\); it would jump by \(0.5\) at \(0\) and by \(0.3\) at \(2\). Each jump matches the corresponding pmf value. For example, \(F(0)=0.7\), not \(0.2\), because the definition includes \(P(X=0)\).

This CDF also gives interval probabilities. The event \(-1<X\le2\) includes \(X=0\) and \(X=2\), but excludes \(X=-1\). Thus \(P(-1<X\le2)=0.5+0.3=0.8\). Subtracting CDF values gives the same answer: \(F(2)-F(-1)=1-0.2=0.8\).

Finding Interval Probabilities From the CDF

Subtracting CDF values works because probabilities accumulated up to the lower cutoff are removed from those accumulated up to the upper cutoff. For any real \(a\le b\), the interval \((a,b]\) includes values greater than \(a\) and at most \(b\). The events \(\{X\le a\}\) and \(\{a<X\le b\}\) are disjoint, and together they make up \(\{X\le b\}\). Therefore:

$$ P(a<X\le b)=F(b)-F(a). $$

Other endpoint conventions require attention to the left limit. Since \(F(a-)=P(X<a)\), the four common forms are

$$ \begin{aligned} P(a<X\le b)&=F(b)-F(a),\\ P(a\le X\le b)&=F(b)-F(a-),\\ P(a<X<b)&=F(b-)-F(a),\\ P(a\le X<b)&=F(b-)-F(a-). \end{aligned} $$

These identities follow by subtracting the probability accumulated before the interval begins from the probability accumulated before or at its upper endpoint. The left limit is important when an endpoint may itself have positive probability. In particular, \(F(a)\) already includes \(P(X=a)\), whereas \(F(a-)\) does not.

Worked Example: Reading an Interval From CDF Values

Suppose a hypothetical count \(X\), the number of alerts recorded in a time window, has the following pmf:

Number of alerts \(x\)0134
\(P(X=x)\)0.100.200.400.30

The cumulative values are \(F(0)=0.10\), \(F(1)=0.10+0.20=0.30\), \(F(3)=0.30+0.40=0.70\), and \(F(4)=0.70+0.30=1.00\). Between these support values, the CDF retains the level from the most recent support value. For example, \(F(2)=0.30\).

Find the probability that more than one but no more than four alerts are recorded. The event is \(1<X\le4\), so

$$ P(1<X\le4)=F(4)-F(1)=1.00-0.30=0.70. $$

In context, the probability of recording two, three, or four alerts is \(0.70\). The pmf confirms this: there is no mass at \(2\), and \(P(X=3)+P(X=4)=0.40+0.30=0.70\).

Now find the probability of at least one but fewer than four alerts, \(P(1\le X<4)\). The upper endpoint is excluded and the lower endpoint is included, so \(F(4-)=0.70\) and \(F(1-)=0.10\). Hence

$$ P(1\le X<4)=F(4-)-F(1-)=0.70-0.10=0.60. $$

This agrees with adding the masses at 1 and 3: \(0.20+0.40=0.60\). The difference between the two interval answers is the endpoint handling: the first includes \(X=4\) and excludes \(X=1\), while the second excludes \(X=4\) and includes \(X=1\).

Why a Discrete CDF Is Not Always a Simple Step Graph

For a random variable with finite support, there are only finitely many jumps, so the CDF consists of horizontal stretches separated by jumps. A discrete random variable can also have countably infinitely many possible values. Its CDF still jumps by \(P(X=x)\) at each support value \(x\), but if those values are dense in an interval, the jumps can be dense there too. In that case, there need not be a horizontal stretch between successive jumps.

Worked Example: Dense Jumps From Countable Support

List the rational numbers in \([0,1]\), without repetition, as \(q_1,q_2,q_3,\ldots\). Define a discrete random variable \(X\) by \(P(X=q_k)=2^{-k}\) for each positive integer \(k\). These probabilities are valid because \(\sum_{k=1}^{\infty}2^{-k}=1\).

At \(q_k\), the CDF has a jump of size \(2^{-k}\), since \(P(X=q_k)=2^{-k}>0\). Every nonempty open interval inside \([0,1]\) contains a rational number, and each such rational is some \(q_k\) with positive probability. If \(u<v\) lie in \([0,1]\), choose a rational \(q_k\) with \(u<q_k<v\). Then

$$ F(v)-F(u)=P(u<X\le v)\ge P(X=q_k)=2^{-k}>0. $$

So \(F\) cannot be constant on any nonempty interval inside \([0,1]\). The jumps are dense, even though the support is countable. The CDF is nondecreasing and has a jump at every support value, but it is not a step function with horizontal sections between successive jumps in the usual finite-support sense. This distinction prevents an overly broad claim about all discrete CDFs.

A Short Justification of the Jump Rule

The jump rule follows directly from how the CDF accumulates probability. Values strictly below \(x\) contribute to both \(F(x-)\) and \(F(x)\); the value \(x\) itself contributes only to \(F(x)\). Values above \(x\) contribute to neither. In event notation, \(\{X\le x\}\) is the disjoint union of \(\{X<x\}\) and \(\{X=x\}\), so

$$ F(x)=P(X<x)+P(X=x)=F(x-)+P(X=x). $$

Rearranging gives \(F(x)-F(x-)=P(X=x)\). This reasoning also explains why a CDF cannot decrease: increasing the cutoff can only add possible outcomes to the event \(\{X\le x\}\), never remove them.

Common Mistake: Ignoring Which Endpoints Are Included

A common error is to calculate \(P(a<X\le b)\) as \(F(b)-F(a-)\). That subtraction removes only values strictly below \(a\), so it leaves the probability at \(a\) in the result. It therefore calculates \(P(a\le X\le b)\), not \(P(a<X\le b)\). For the interval that excludes \(a\), subtract \(F(a)\), which already includes its mass.

The reverse error is also possible: using \(F(a)\) when the event includes \(a\) removes the mass at \(a\) unnecessarily. Before subtracting, write the event with its inequality signs. Then use \(F(c)=P(X\le c)\) for an included upper cutoff and \(F(c-)=P(X<c)\) for an excluded upper cutoff. At the lower cutoff, subtract \(F(a)\) if it is excluded and \(F(a-)\) if it is included.

Key takeaway: A CDF gives the probability accumulated up to and including its argument. Its jump at \(x\) is \(P(X=x)\). Interval probabilities are differences of cumulative probabilities, with left limits used wherever an endpoint is excluded.

Check Your Understanding

Use the definitions and endpoint conventions from this tutorial.

  1. A pmf assigns probabilities 0.25, 0.50, and 0.25 to the values 0, 2, and 5. Find \(F(2)\), \(F(4)\), and \(P(2<X\le5)\).
  2. In general, write \(P(a\le X\le b)\) using \(F\) and a left limit. Explain why the left limit is needed at \(a\).
  3. If \(F(3)=0.82\) and \(F(3-)=0.67\), what is \(P(X=3)\)?
  4. A discrete random variable has countably many support values that are dense in \([0,1]\), each with positive probability. Must its CDF have a horizontal section inside that interval? Explain.
  5. For the alert-count pmf in the tutorial, calculate \(P(X\ge3)\) by adding pmf values and by using a CDF left limit.