From a CDF to a Density
A cumulative distribution function records how probability accumulates as the value of a random variable increases. If that accumulation is smooth in the appropriate sense, its rate of change describes the density: steeper growth means more probability per unit of the variable’s scale. This makes differentiation a natural way to recover a density from a CDF.
There is an important qualification. For a distribution with a density, differentiating its CDF recovers the density almost everywhere, not necessarily at every point. The exact condition is absolute continuity. Ordinary differentiability at each point, by itself, is not a substitute for that condition.
The formula says that a density accumulates into the CDF by integration. The fundamental theorem of calculus for Lebesgue integrals says that the derivative of an indefinite integral equals its integrand at almost every point. Thus, for an absolutely continuous CDF, $$ F'(x)=f(x) \quad \text{for almost every } x. $$ At points where the derivative does not exist, or where the chosen version of \(f\) has been assigned a different value, this equality need not hold pointwise. Those exceptional points do not change probabilities or the density’s integrals.
The Density-Recovery Theorem
Justification. On any bounded interval \([a,b]\), the fundamental theorem for absolutely continuous functions states that an absolutely continuous function has an integrable derivative almost everywhere and satisfies $$ F(b)-F(a)=\int_a^b F'(t)\,dt. $$ Apply this to an absolutely continuous CDF. Since \(F\) is nondecreasing, its derivative is nonnegative wherever it exists. Let \(f=F'\) at points where the derivative exists, and set \(f=0\) on the exceptional null set. Taking intervals \([a,b]\), then sending \(a\) to \(-\infty\) and \(b\) to \(x\), gives \(F(x)=\int_{-\infty}^{x} f(t)\,dt\). The limits of a CDF at \(-\infty\) and \(+\infty\) are 0 and 1, respectively, so \(\int_{-\infty}^{\infty} f(t)\,dt=1\). Conversely, the indefinite integral of an integrable function is absolutely continuous on every bounded interval; if \(f\geq 0\) and its full integral is 1, that integral defines a CDF. The Lebesgue differentiation theorem gives \(F'=f\) almost everywhere. This also explains why changing \(f\) on a null set cannot change \(F\) or the distribution. \(\square\)
For common piecewise formulas, the theorem has a convenient elementary form. If \(F\) is continuous, nondecreasing, constant outside a bounded interval, and continuously differentiable on each of finitely many subintervals, then its derivative on those subintervals is a density, provided the derivative is nonnegative and the total increase of \(F\) is 1. Derivatives at the finitely many join points are irrelevant to the density.
Worked Examples
Worked Example: A Uniform Density From a Linear CDF
Suppose $$ F(x)= \begin{cases} 0, & x<1,\\ \dfrac{x-1}{2}, & 1\leq x\leq 3,\\ 1, & x>3. \end{cases} $$ Recover a density and state where it is positive.
On the interval \(1<x<3\), differentiate the middle formula: $$ F'(x)=\frac{d}{dx}\left(\frac{x-1}{2}\right)=\frac12. $$ On \(x<1\) and \(x>3\), \(F\) is constant, so its derivative is zero. The join points do not affect the density. One valid version is $$ f(x)= \begin{cases} \dfrac12, & 1<x<3,\\ 0, & \text{otherwise}. \end{cases} $$ The total integral is \(\int_1^3 \frac12\,dx=\frac12(3-1)=1\), as required. The density is positive between 1 and 3 and zero outside that interval; its support, understood as the closure of the region where the density is positive, is \([1,3]\).
Worked Example: A Piecewise CDF With a Change in Slope
Let $$ F(x)= \begin{cases} 0, & x<0,\\ \dfrac{x}{4}, & 0\leq x\leq 1,\\ \dfrac14+\dfrac34(x-1), & 1<x\leq 2,\\ 1, & x>2. \end{cases} $$ Find a density and verify that the pieces join to form a valid CDF.
At \(x=0\), the middle piece has value 0, matching the left-hand piece. At \(x=1\), the first formula on the interval gives \(1/4\), and the next formula approaches \(1/4+\frac34(1-1)=1/4\). At \(x=2\), the second formula gives \(\frac14+\frac34=1\), matching the final constant value. Both slopes, \(1/4\) and \(3/4\), are nonnegative, so the CDF is nondecreasing.
Differentiate within each interval: $$ f(x)= \begin{cases} \dfrac14, & 0<x<1,\\ \dfrac34, & 1<x<2,\\ 0, & \text{otherwise}. \end{cases} $$ Check its total integral: $$ \int_{-\infty}^{\infty} f(x)\,dx =\frac14(1-0)+\frac34(2-1) =\frac14+\frac34 =1. $$ The density has one constant height on \((0,1)\) and a larger height on \((1,2)\). The kink at \(x=1\) reflects the change in slope; it does not prevent the CDF from being absolutely continuous.
Worked Example: Recovering a Density With a Flat Region
Consider the CDF $$ F(x)= \begin{cases} 0, & x<0,\\ \dfrac25 x, & 0\leq x\leq 1,\\ \dfrac25, & 1<x\leq 2,\\ \dfrac25+\dfrac35(x-2), & 2<x\leq 3,\\ 1, & x>3. \end{cases} $$ Find its density and describe the density’s support.
The first increasing piece has derivative \(2/5\). The CDF is flat from 1 to 2, so its derivative there is zero: no probability accumulates across that stretch. On \(2<x<3\), the derivative is \(3/5\). Therefore one density version is $$ f(x)= \begin{cases} \dfrac25, & 0<x<1,\\ 0, & 1<x<2,\\ \dfrac35, & 2<x<3,\\ 0, & \text{otherwise}. \end{cases} $$ Its integral is \(\frac25(1-0)+0(2-1)+\frac35(3-2)=1\). The density is positive on the two intervals \((0,1)\) and \((2,3)\); its support is their closure, \([0,1]\cup[2,3]\). The flat CDF stretch corresponds to a gap in the density support.
Worked Example: An Exponential CDF
For a rate-2 exponential distribution, the CDF is $$ F(x)= \begin{cases} 0, & x<0,\\ 1-e^{-2x}, & x\geq 0. \end{cases} $$ Differentiate it and verify the result.
For \(x>0\), $$ F'(x)=\frac{d}{dx}(1-e^{-2x})=2e^{-2x}. $$ For \(x<0\), \(F'(x)=0\). The two one-sided derivatives at 0 differ, but a single point has no effect on the density, so a valid version is \(f(x)=2e^{-2x}\) for \(x>0\) and \(f(x)=0\) for \(x<0\). The density is positive for \(x>0\), giving support \([0,\infty)\). Its integral is $$ \int_0^\infty 2e^{-2x}\,dx =\left[-e^{-2x}\right]_0^\infty =0-(-1)=1. $$ The CDF is absolutely continuous even though its derivative is not defined at the join point \(x=0\).
Piecewise Differentiation and Its Checks
When a CDF is supplied by cases, recover its density one formula at a time. First locate the intervals on which the formula changes. Then differentiate within each interval, and use the constant CDF regions to identify where the density is zero. Finally check that the resulting function is nonnegative and integrates to 1. The values assigned at finitely many breakpoints can be chosen conveniently because densities are defined only up to changes on sets of measure zero.
Proof. On each smooth piece \([c_{j-1},c_j]\), the ordinary fundamental theorem of calculus gives the integral of \(F'\) as the change in \(F\) across that piece. Add those changes across the finitely many pieces. The intermediate values cancel, leaving the total change \(F(b)-F(a)=1-0=1\). Since \(F\) is nondecreasing, its derivative is nonnegative on each piece’s interior. The same telescoping argument up to any \(x\) shows that integrating this derivative from \(-\infty\) to \(x\) gives \(F(x)\). Thus the derivative is a nonnegative function with total integral 1 whose integral CDF is \(F\). \(\square\)
Why Absolute Continuity Matters
A frequent mistake is to differentiate a CDF wherever possible and assume that the result must account for its entire probability distribution. That conclusion is valid only when the CDF is absolutely continuous. A derivative can miss probability behavior that is not represented by integration against a density. The derivative-recovery rule therefore has two parts: establish absolute continuity, then differentiate almost everywhere.
For the piecewise formulas in this tutorial, continuity at the joins and ordinary smoothness between finitely many joins make the integral calculation direct. In a more general setting, merely knowing that \(F\) is differentiable is not enough to conclude that \(F(x)=\int_{-\infty}^x F'(t)\,dt\). Do not replace the absolute-continuity condition with a pointwise differentiability check.
- Do not require a derivative at every point. A finite number of corners or join points does not prevent an absolutely continuous CDF from having a density.
- Do not read density height as point probability. A density describes accumulated probability through integration, not the probability at a single value.
- Do check the full integral. If the derivative formula integrates to something other than 1, it is not a density for a probability distribution as stated.
- Do not treat flat stretches as positive-density regions. A constant CDF has derivative zero on the interior of that stretch.
Check Your Understanding
Try these questions using the definition and examples above.
- Why is the density recovered from an absolutely continuous CDF specified only almost everywhere?
- A CDF has slope \(1/3\) on \((0,1)\), is flat on \((1,2)\), and has slope \(2/3\) on \((2,3)\). What density does this suggest, and what is its total integral?
- In a continuous piecewise CDF, what should you do if the left and right derivatives differ at a join point?
- Explain why checking that a proposed derivative is nonnegative is not enough to establish that it is a density.
- What condition, in addition to differentiability, ensures that a CDF can be recovered by integrating its derivative?