Cumulative Distribution Function (CDF)

When analyzing data, we often need to know the probability that a random variable falls within a certain range, or below a specific value. While Probability Density Functions (PDFs) and Probability Mass Functions (PMFs) tell us the likelihood at a single point or interval, they don't directly give us cumulative information. This is where the Cumulative Distribution Function (CDF) becomes indispensable, providing a complete picture of the probability distribution up to any given point.

What is the Cumulative Distribution Function (CDF)?

The CDF, denoted as FX(x)F_X(x), quantifies the probability that a random variable XX will take a value less than or equal to a specific value xx. It essentially accumulates the probabilities from the lowest possible value up to xx. This function provides a comprehensive view of the distribution's shape, showing how probabilities accumulate across the variable's range.

📐 General CDF Definition

For any random variable XX, the Cumulative Distribution Function (CDF) is defined as:

FX(x)=P(X≤x)F_X(x) = P(X \le x)

where P(X≤x)P(X \le x) is the probability that XX takes a value less than or equal to xx.

CDF for Continuous Random Variables

For a continuous random variable XX, the CDF is derived by integrating its Probability Density Function (PDF), fX(t)f_X(t), from negative infinity up to the point xx. This integral represents the area under the PDF curve, which is the accumulated probability. The CDF for continuous variables is always a continuous function itself.

📐 Continuous CDF Formula

If XX is a continuous random variable with PDF fX(t)f_X(t), its CDF is:

FX(x)=∫−∞xfX(t)dtF_X(x) = \int_{-\infty}^{x} f_X(t) dt

For example, for a Uniform distribution U(a,b)U(a,b), the PDF is fX(t)=1b−af_X(t) = \frac{1}{b-a} for a≤t≤ba \le t \le b, and 0 otherwise.

pythonCalculating CDF for a Continuous Uniform Distribution

CDF for Discrete Random Variables

For a discrete random variable XX, the CDF is calculated by summing its Probability Mass Function (PMF), fX(t)f_X(t), for all values tt less than or equal to xx. This summation accumulates the probabilities of individual outcomes. The CDF for discrete variables is a step function, meaning it increases in discrete jumps at each possible value of XX.

📐 Discrete CDF Formula

If XX is a discrete random variable with PMF fX(t)f_X(t), its CDF is:

FX(x)=∑t≤xP(X=t)=∑t≤xfX(t)F_X(x) = \sum_{t \le x} P(X=t) = \sum_{t \le x} f_X(t)

For example, for a fair six-sided die, the PMF is fX(t)=16f_X(t) = \frac{1}{6} for t∈{1,2,3,4,5,6}t \in \{1, 2, 3, 4, 5, 6\}.

pythonCalculating CDF for a Discrete Die Roll
Check Your Understanding
What is the maximum possible value a CDF can take?

Key Properties of CDFs

CDFs possess several fundamental properties that make them predictable and useful. First, they are monotonically non-decreasing, meaning FX(x1)≤FX(x2)F_X(x_1) \le F_X(x_2) if x1<x2x_1 < x_2. This makes sense, as accumulating more probability can only increase or keep the cumulative sum the same. Second, the CDF always starts at 0 and ends at 1, reflecting that the probability of a variable being less than negative infinity is 0, and less than positive infinity is 1.

✨ CDF Boundary Conditions

Every valid CDF FX(x)F_X(x) must satisfy these conditions:

  1. 0≤FX(x)≤10 \le F_X(x) \le 1 for all xx.
  2. FX(−∞)=lim⁡x→−∞FX(x)=0F_X(-\infty) = \lim_{x \to -\infty} F_X(x) = 0.
  3. FX(∞)=lim⁡x→∞FX(x)=1F_X(\infty) = \lim_{x \to \infty} F_X(x) = 1.
  4. FX(x)F_X(x) is non-decreasing: if x1<x2x_1 < x_2, then FX(x1)≤FX(x2)F_X(x_1) \le F_X(x_2).

Using CDF to Calculate Probabilities

The primary utility of the CDF is to easily calculate probabilities for various ranges. To find the probability that XX is less than or equal to a value xx, we directly use FX(x)F_X(x). If we need the probability that XX is greater than xx, we use the complement rule: 1−FX(x)1 - F_X(x). For a range a<Xleba < X le b, we subtract the CDF values: FX(b)−FX(a)F_X(b) - F_X(a). This makes CDFs incredibly versatile for practical probability calculations.

📐 CDF Probability Rules

Using the CDF, we can calculate various probabilities:

  • P(X≤x)=FX(x)P(X \le x) = F_X(x)
  • P(X>x)=1−FX(x)P(X > x) = 1 - F_X(x)
  • P(a<X≤b)=FX(b)−FX(a)P(a < X \le b) = F_X(b) - F_X(a)
  • For continuous variables, P(X<x)=P(X≤x)=FX(x)P(X < x) = P(X \le x) = F_X(x) and P(X=x)=0P(X=x) = 0.
  • For discrete variables, P(X<x)=FX(x−)P(X < x) = F_X(x^-) (where x−x^- is the largest value less than xx) and P(X=x)=FX(x)−FX(x−)P(X=x) = F_X(x) - F_X(x^-).

pythonCalculating Probabilities with Normal CDF
Try It Yourself
Using the standard normal distribution (mean=0, std_dev=1), calculate the probability that a random variable XX falls between -2 and 2 (i.e., P(−2<X≤2)P(-2 < X \le 2)).
python
Check Your Understanding
If FX(5)=0.8F_X(5) = 0.8, what does P(X>5)P(X > 5) equal?

Visualizing the CDF

A CDF plot typically forms an S-shaped curve for continuous distributions, or a series of steps for discrete ones. The curve starts at 0 on the left (negative infinity) and smoothly rises to 1 on the right (positive infinity). The steepness of the curve indicates regions where the probability accumulates rapidly, corresponding to higher probability densities (or masses). A flatter section means less probability is accumulating in that range.

Cumulative Distribution Function (CDF) of a Standard Normal Distribution
This chart displays the CDF of a standard normal distribution (mean=0, standard deviation=1). The y-axis represents the cumulative probability FX(x)F_X(x), while the x-axis represents the value xx. The curve starts near 0, rises smoothly, and approaches 1, forming a characteristic S-shape.
Loading chart...
Key Insight: The S-shape of the CDF visually represents how probability accumulates across the range of a continuous random variable, with steeper sections indicating higher probability density.

Relationship with PDF/PMF

The CDF, PDF, and PMF are intrinsically linked. For continuous variables, the PDF is the derivative of the CDF, meaning fX(x)=ddxFX(x)f_X(x) = \frac{d}{dx} F_X(x). Conversely, the CDF is the integral of the PDF. For discrete variables, the PMF at a point xx can be found by taking the difference between the CDF at xx and the CDF just before xx (i.e., fX(x)=FX(x)−FX(x−)f_X(x) = F_X(x) - F_X(x^-)). Understanding these relationships allows us to move between different representations of a probability distribution.

CDF vs. PDF/PMF
FeatureCumulative Distribution Function (CDF)Probability Density/Mass Function (PDF/PMF)
What it measuresCumulative probability P(X≤x)P(X \le x)Probability at a point (discrete) or density at a point (continuous)
Range of values[0, 1]Non-negative (can be > 1 for PDF, but integral is 1)
Function type (continuous)Continuous, non-decreasingContinuous, non-negative
Function type (discrete)Step function, non-decreasingDiscrete values at specific points
Derivation from otherIntegral of PDF; sum of PMFDerivative of CDF (continuous); difference of CDF (discrete)
Use caseCalculating P(X≤x)P(X \le x), P(X>x)P(X > x), P(a<X≤b)P(a < X \le b)Understanding likelihood at specific points/intervals, shape of distribution
A comparison highlighting the distinct roles and properties of CDFs and PDF/PMFs.
Key Takeaways
  • The Cumulative Distribution Function (CDF), FX(x)=P(X≤x)F_X(x) = P(X \le x), gives the probability that a random variable XX takes a value less than or equal to xx.

  • For continuous variables, the CDF is the integral of the PDF: FX(x)=∫−∞xfX(t)dtF_X(x) = \int_{-\infty}^{x} f_X(t) dt.

  • For discrete variables, the CDF is the sum of the PMF: FX(x)=∑t≤xfX(t)F_X(x) = \sum_{t \le x} f_X(t).

  • CDFs are always non-decreasing and range from 0 to 1, with FX(−∞)=0F_X(-\infty)=0 and FX(∞)=1F_X(\infty)=1.

  • Use CDFs to calculate probabilities for ranges: P(a<X≤b)=FX(b)−FX(a)P(a < X \le b) = F_X(b) - F_X(a) and P(X>x)=1−FX(x)P(X > x) = 1 - F_X(x).

  • The visual representation of a continuous CDF is typically an S-shaped curve, while a discrete CDF is a step function.

← All lessons in Data Distributions

Ready to keep this from fading?

Bitelrn turns lessons like this into a full course — quizzes, a knowledge map, and spaced review.

Get started free