iLovePDFConvert your PDF now
How-To

CDF vs PDF: How to Derive a CDF from a PDF

Learn what is CDF and PDF, then see how to calculate CDF from PDF using integration. Includes formulas, examples, and when to use each.

By Editorial TeamJune 04, 20265 min read
CDF vs PDF: How to Derive a CDF from a PDF

Understanding PDF and CDF Basics

If you know a probability density function (PDF) for a continuous random variable, you can derive the cumulative distribution function (CDF) by integrating the PDF. Most people ask this as “how to find cdf from pdf” or “how to calculate cdf from pdf,” and the key tool is the area under the curve. The CDF tells you the probability that the variable is less than or equal to a chosen value.

Formally, let X be a continuous random variable with PDF fX(x). The PDF is defined so that probabilities come from areas: the probability that X lies in an interval equals the area under the curve over that interval. That requirement forces PDFs to be normalized, meaning their total area is 1.

The CDF is written as FX(x) and is defined as the probability that X is at most x. For continuous random variables, this means FX(x) accumulates probability mass from the far left up to x. It is the “running total” of probability.

  • PDF: fX(x) describes the relative likelihood of values near x.
  • CDF: FX(x) = P(X ≤ x) accumulates that likelihood up to x.

Relationship Between PDF and CDF

The relation between cdf and pdf is a calculus connection. The PDF is the derivative of the CDF when the CDF is differentiable. In the other direction, the CDF is an integral of the PDF because it accumulates probability from minus infinity to x.

For continuous random variables, the normalization of the PDF makes the CDF approach limits correctly. As x goes to negative infinity, the accumulated area goes to 0. As x goes to positive infinity, the accumulated area goes to 1.

This is also why the “area under the curve” idea is not just intuition. Probability theory defines probabilities through integrals for continuous variables, and the CDF is built from those same integrals.

Two plots showing a density curve and an increasing cumulative curve
How derivative and integral connect

Calculating CDF from PDF (The Core Integration Formula)

The central formula for “how to get a cdf from a pdf” is:

FX(x) = ∫-∞x fX(t) dt

Here, the dummy variable t keeps the notation clean. You integrate the PDF from the lowest possible value up to x, and the result is the CDF at x.

Once you have the CDF, you can recover the PDF by differentiating: fX(x) = d/dx FX(x). This is the “go from cdf to pdf” step, but it requires that the CDF is smooth enough for differentiation.

  • Start with a valid PDF fX(x).
  • Integrate it from −∞ to x.
  • Use boundary behavior to check your work.

Normalization matters. If the area under fX(x) is not 1, the “CDF from PDF” calculation will not end at 1. For example, if your PDF is missing a factor, then the computed CDF might approach 0.9 instead of 1.

Another key limitation is the nature of continuous random variables. Even if fX(x) is positive at some point, P(X = x) = 0. The CDF still makes sense because it represents probability over ranges, not point masses.

Shaded accumulation from minus infinity to a cutoff on a curve
CDF as accumulated area

Examples of Finding CDF from PDF

Example 1: Uniform distribution on [a, b]. The PDF is fX(x) = 1/(b−a) for a ≤ x ≤ b and 0 otherwise. To calculate the CDF, integrate that constant over the matching range.

So for x < a, the integral covers no probability mass and FX(x) = 0. For a ≤ x ≤ b, you get FX(x) = ∫ax 1/(b−a) dt = (x−a)/(b−a). For x > b, the CDF reaches the total area, so FX(x) = 1.

Example 2: Exponential distribution with rate λ > 0. Its PDF is fX(x) = λe−λx for x ≥ 0 and 0 for x < 0. “How to find cdf from pdf” becomes a simple integration in this case.

For x < 0, the CDF is 0. For x ≥ 0, compute FX(x) = ∫0x λe−λt dt. The integral evaluates to 1 − e−λx, so the CDF is FX(x) = 1 − e−λx.

Example 3: Normal distribution (brief but practical). The normal PDF has a closed form, but its CDF usually uses a special function or a numerical approximation. This does not change the relationship: the CDF is still the integral of the PDF, just not one that simplifies nicely.

So when someone asks “when to use normal cdf and pdf,” the answer is usually about whether they need probabilities up to a threshold (CDF) or local density near a value (PDF). The math relationship stays the same even if the computation uses tables or software.

Distribution PDF fX(x) CDF FX(x)
Uniform(a, b) 1/(b−a) for a ≤ x ≤ b 0, then (x−a)/(b−a), then 1
Exponential(λ) λe−λx for x ≥ 0 0 for x < 0, then 1 − e−λx
Normal(μ, σ) bell-shaped density integral of PDF; computed numerically
Uniform and exponential shapes with matching cumulative curves
Examples of PDFs and their CDFs

When to Use PDF and CDF

Use a PDF when you want to compare relative likelihoods of nearby values or when you need densities for calculus-based probability. The PDF is most directly useful for computing probabilities over intervals by integrating. It also helps with modeling, because many statistical distributions are defined in terms of density functions.

Use a CDF when you need probabilities of the form P(X ≤ x) for one or many thresholds. That makes the CDF a natural tool for decision rules and for reading off cumulative probabilities. In software, CDF functions often power quantiles and percentile computations.

Be careful with discrete distributions. A “binomial cdf and pdf” framing can confuse people because the binomial distribution is discrete. For discrete X, the CDF is still defined as FX(x) = P(X ≤ x), but “PDF” is replaced by a probability mass function (PMF). You can still “integrate” in an added-up sense, but it becomes a sum rather than an integral.

  1. Continuous case: PDF integrates to a CDF.
  2. Discrete case: PMF sums to a CDF.
  3. Conditional checks: always verify CDF stays between 0 and 1.

If you want a quick practical rule for “when to use cdf and pdf,” ask what probability statement you need. For probabilities up to a threshold, use the CDF. For densities and interval probabilities, use the PDF plus an integral.

Finally, remember the point-mass limitation. For continuous random variables, you do not get point probabilities from the PDF. You get them from integrating over a tiny interval, and as the interval shrinks, the probability goes to zero.

Common checks when you compute CDF from PDF

Even simple examples can go wrong if a constant factor is off. One strong check is the normalization: your PDF should integrate to 1 over its support. Another check is monotonicity: your CDF must never decrease as x increases.

If you derive a CDF symbolically, test a couple values. Try a value well below the support to ensure you get 0. Try a value well above the support to ensure you get 1.

These checks are exactly what answer people mean when they search for “how to calculate cdf from pdf” and want confidence the math is correct.

FAQ

What is CDF and PDF for a continuous random variable?
A PDF describes density fX(x). A CDF is FX(x) = P(X ≤ x), the running total probability up to x.
How to find cdf from pdf using integration?
Integrate the PDF from −∞ to x. That gives FX(x) = ∫−∞ to x fX(t) dt.
How to calculate cdf from pdf when the PDF is piecewise?
Integrate only over the region where the PDF is nonzero. Use boundary points to switch formulas and ensure the CDF stays between 0 and 1.
How to get a cdf from a pdf for the exponential distribution?
Integrate λe−λt from 0 to x for x ≥ 0. You get FX(x) = 1 − e−λx, and FX(x)=0 for x < 0.
When to use normal cdf and pdf?
Use the PDF for local density and interval probabilities. Use the normal CDF when you need probabilities up to a cutoff, like P(X ≤ x).
When to use cdf and pdf for binomial distributions?
The binomial uses a PMF, not a PDF. Its CDF is found by summing PMF values up to x.
#how to find cdf from pdf#how to calculate cdf from pdf#what is cdf and pdf#how to get a cdf from a pdf#relation between cdf and pdf#how to go from cdf to pdf#when to use cdf and pdf
ShareXFacebookLinkedInWhatsAppTelegram