From Density to Quantile
A density describes how probability is distributed locally, but a quantile asks a cumulative question: how far along the number line must we go to collect a specified probability? Connecting these views requires integration. First accumulate the density up to a candidate value to obtain the CDF; then solve for the value at which that cumulative probability reaches the desired level.
For a continuous distribution, this often reduces to an equation of the form “integral of the density equals \(p\).” The important details are choosing the correct integration limits, respecting the support, and splitting the integral wherever the density formula changes.
The CDF as an Integral
The density determines probabilities by integration. In particular, the event \(X\leq x\) corresponds to the interval \((-\infty,x]\), so its probability is the integral of the density over that interval.
This identity follows directly from the definition of a density: \(F(x)=P(X\in(-\infty,x])\), and probabilities of sets are obtained by integrating \(f\) over those sets. Since a single point has integral zero, the choice to include or exclude the endpoint \(x\) does not change the value.
To find a quantile, set the CDF equal to the target probability and solve for \(x\). When the CDF is continuous and strictly increasing across the relevant range, the solution is unique and agrees with the generalized-inverse definition. A convenient sufficient condition on an interval is that every subinterval of positive length has positive integral of \(f\). A density can be zero at some points and still satisfy this condition; what matters is that it does not assign zero probability to an entire interval.
For completeness, when \(F\) is continuous and strictly increasing from 0 to 1 on its support, the intermediate value theorem gives a unique \(q_p\) such that \(F(q_p)=p\). Strict increase ensures that no smaller point has CDF at least \(p\), so \(\inf\{x:F(x)\geq p\}=q_p\). Substituting the integral expression for \(F\) gives the quantile equation above. This argument also explains why the density itself is not set equal to \(p\): the probability level is reached by accumulating density across an interval.
Worked Quantiles
Worked Example: A Uniform Density
Let \(X\) be uniform on \([0,4]\), with density \(f(x)=1/4\) for \(0\leq x\leq4\) and zero otherwise. Find the 30th percentile.
The density is normalized because \(\int_0^4 (1/4)\,dt=1\). For \(0\leq x\leq4\), integrate from the left endpoint of the support:
The 30th percentile is the value \(q_{0.30}\) for which \(F(q_{0.30})=0.30\). Thus
This value lies in \([0,4]\), as required. Checking it in the integral gives \(\int_0^{1.2}(1/4)\,dt=1.2/4=0.30\).
Worked Example: An Exponential Density
Suppose \(X\) has an exponential density with rate \(2\): \(f(x)=2e^{-2x}\) for \(x\geq0\), and \(f(x)=0\) otherwise. Find its 80th percentile.
The density integrates to one since \(\int_0^\infty 2e^{-2t}\,dt=1\). For \(x\geq0\), its CDF is
Set this accumulated probability equal to \(0.80\), then solve:
The solution is positive, as it must be because the support is \([0,\infty)\). Substitution verifies it: \(e^{-2q_{0.80}}=0.20\), so \(F(q_{0.80})=1-0.20=0.80\).
When the Density Is Piecewise
If the density changes formula at a point, the integral must be split at that point whenever the interval of integration crosses it. The CDF remains an accumulated probability: probability gathered before the change point must be carried forward, rather than discarded when the second formula begins.
Worked Example: A Quantile Across a Density Change
Let \(X\) have density
Find the 60th percentile. First check the total probability: \(\int_0^1 (1/4)\,dt+\int_1^2 (3/4)\,dt=1/4+3/4=1\). The probability accumulated by \(x=1\) is \(1/4\). Because \(0.60>0.25\), the desired quantile lies in the second interval, so both pieces contribute:
Now set this expression equal to \(0.60\) and solve:
The result is in \((1,2)\), which confirms that the correct piece of the density was used. Substitution gives \(F(22/15)=1/4+(3/4)(7/15)=1/4+7/20=12/20=0.60\).
A reliable approach is to identify which part of the support contains the desired quantile before solving an equation. For a piecewise density, compute the cumulative probability at each change point. These values divide the probability levels into ranges. Once the relevant range is known, integrate all earlier pieces and then the current piece.
Record where the density is nonzero and the desired probability \(p\).
Integrate from the left edge of the support, splitting at every change in the density formula that the integration crosses.
Set the accumulated probability equal to \(p\), solve for the candidate, and verify that it lies in the interval where the chosen formula applies.
When an Integral Equation Has No Closed-Form Solution
Not every density leads to an algebraic formula for a quantile. For example, for \(X\sim N(0,1)\), the \(p\)-quantile satisfies \(\int_{-\infty}^{q_p}(1/\sqrt{2\pi})e^{-t^2/2}\,dt=p\). That equation defines the quantile precisely even though the integral does not simplify to an elementary expression. A numerical method or a table may be used to approximate its solution.
Whatever method is used, the defining check is the same: the probability to the left of the proposed value should be \(p\). For a numerical answer, this is assessed by evaluating the CDF at the candidate and checking that it is sufficiently close to the target probability.
Common Pitfalls
- Setting the density equal to the probability level. The equation \(f(q_p)=p\) is generally not the quantile equation. A density is a local rate of probability per unit of \(x\), while the quantile is found by solving \(\int_{-\infty}^{q_p}f(t)\,dt=p\).
- Starting from the wrong lower limit. If the support begins at \(a\), integrate from \(a\), not from zero unless \(a=0\). In an unrestricted formula the lower limit is \(-\infty\), with the density zero wherever the variable cannot occur.
- Forgetting earlier pieces. In the piecewise example, the integral on \((1,x]\) alone is not \(F(x)\). It omits the probability \(1/4\) already accumulated on \([0,1]\).
- Using a formula outside its interval. A solution obtained from one piece is valid only if it lies in that piece's interval. Check the location after solving.
- Confusing density height with probability. A density value can exceed one; probabilities come from areas, that is, integrals over intervals or sets.
Check Your Understanding
Use the integral definition of the CDF to answer each question. Check any proposed quantile by substituting it back into the accumulated probability.
- If a density is supported on \([2,5]\), what are the appropriate integration limits for \(F(x)\) when \(2\leq x\leq5\)?
- A uniform density on \([0,10]\) is \(1/10\). Set up and solve the integral equation for its 25th percentile.
- For a density that changes formula at \(x=1\), why must an integral for \(F(x)\), with \(x>1\), include the contribution from values below 1?
- In the piecewise example, which interval contains the 20th percentile, and what equation determines it?
- Explain why solving \(f(q_p)=p\) does not, in general, find a \(p\)-quantile.