Tutorials › Statistical Theory I - Probability and Distribution Theory › Solving Quantiles from CDF Formulas

Support, Quantiles, and Tails · Tutorial 82 of 994

Solving Quantiles from CDF Formulas

Solve for quantiles from continuous CDF formulas, using the support and piece boundaries to select and verify the correct answer.

Beginner 9 min read

What You'll Learn

  • Define a quantile using the generalized inverse of a CDF.
  • Solve explicit continuous CDF pieces for a requested probability level.
  • Check candidate quantiles against the support and piece boundaries.
  • Handle probability levels that fall on a flat CDF interval.
  • Verify a proposed quantile by evaluating the CDF at the answer.

From a Probability Level to a Location

A quantile answers a location question: for a chosen probability level \(p\), where does the cumulative probability reach \(p\)? When a CDF is given by an explicit formula, solving \(F(x)=p\) can seem immediate. The important work is checking that the equation was solved on the correct piece, that the answer lies in that piece’s stated range, and that the resulting CDF value really is \(p\).

This tutorial considers \(p\) strictly between 0 and 1 and CDFs that are continuous. A continuous CDF may still have flat intervals, so solving the equation alone need not identify a unique \(x\). The generalized-inverse definition specifies which solution is the quantile.

Definition: For a CDF \(F\) and \(0<p<1\), the \(p\)-quantile is \(Q(p)=\inf\{x\in\mathbb{R}:F(x)\ge p\}\). If \(F\) is strictly increasing where it reaches level \(p\), the quantile is the unique solution of \(F(x)=p\). If \(F\) is flat at level \(p\), the quantile is the leftmost point where \(F\) reaches that level.

A formula for a CDF is often piecewise. Each piece comes with a domain, and that domain is part of the formula. After solving for \(x\), compare the answer with the piece’s endpoints. If it does not belong to the proposed piece, it cannot be accepted as a solution from that piece; another piece or a boundary must be checked.

A Reliable Inversion Procedure

For a continuous, piecewise-defined CDF, use the following sequence. This is especially useful when the CDF changes formula at support endpoints or has flat sections.

1
Locate the target level.
Use the endpoint values of the CDF pieces to determine which piece or boundary can contain probability level \(p\).
2
Solve the relevant equation.
Set the formula for that piece equal to \(p\) and solve for \(x\).
3
Check the candidate.
Verify that the result lies in the piece’s stated domain and within the support. Include endpoints when the piece includes them.
4
Verify the probability level.
Substitute the candidate into the CDF and check that \(F(x)=p\). If there is a flat interval at level \(p\), take its left endpoint for the quantile.

Why the CDF Value at the Quantile Is \(p\)

The defining formula for a quantile uses an infimum, so it is useful to know when solving \(F(x)=p\) is justified. For a continuous CDF, the quantile always attains the requested level exactly. Continuity is important to this conclusion.

Theorem: If \(F\) is a continuous CDF and \(0<p<1\), then \(Q(p)=\inf\{x:F(x)\ge p\}\) is finite and \(F(Q(p))=p\).

Proof. Since a CDF satisfies \(\lim_{x\to-\infty}F(x)=0\) and \(\lim_{x\to\infty}F(x)=1\), there are real numbers \(a\) and \(b\) such that \(F(a)<p\) and \(F(b)>p\). Thus the set \(A=\{x:F(x)\ge p\}\) is nonempty and bounded below, so \(q=\inf A\) is finite.

By the definition of an infimum, for every positive integer \(n\) there is an \(a_n\in A\) with \(q\le a_n<q+1/n\). Hence \(a_n\to q\). Continuity gives \(F(q)=\lim_{n\to\infty}F(a_n)\ge p\), since each \(F(a_n)\ge p\). Also, every \(x<q\) is outside \(A\), so \(F(x)<p\). Taking \(x_n=q-1/n\) and using continuity again gives \(F(q)=\lim_{n\to\infty}F(x_n)\le p\). Combining the inequalities yields

$$ F(Q(p))=F(q)=p. $$

This theorem verifies the target CDF value, but it does not say that the solution is unique. If \(F\) is constant at \(p\) over an interval, every point there solves the equation; the generalized inverse chooses the leftmost one.

Result: If a continuous CDF has exactly one real solution \(r\) to \(F(r)=p\), then \(Q(p)=r\). Indeed, the theorem shows that \(Q(p)\) itself solves the equation, so uniqueness forces \(Q(p)=r\). Strict increase across the level \(p\) is a common way to ensure uniqueness.

Worked Inversions

Worked Example: Inverting a CDF on a Bounded Support

Let \(X\) have CDF

$$ F(x)= \begin{cases} 0, & x<0,\\ x^2/4, & 0\le x\le 2,\\ 1, & x>2. \end{cases} $$

Find the \(0.36\)-quantile. The only piece that can attain a value strictly between 0 and 1 is \(0\le x\le2\), where \(F(x)=x^2/4\). Set this expression equal to the target:

$$ \frac{x^2}{4}=0.36 \quad\Longrightarrow\quad x^2=1.44 \quad\Longrightarrow\quad x=\pm1.2. $$

The piece requires \(0\le x\le2\), so \(-1.2\) is not a candidate. The remaining solution \(x=1.2\) is within the support. Substitution verifies it:

$$ F(1.2)=\frac{(1.2)^2}{4}=\frac{1.44}{4}=0.36. $$

Therefore \(Q(0.36)=1.2\). The negative algebraic root illustrates why checking the domain is essential, even when solving the equation correctly.

Worked Example: A Probability Level on a Flat CDF Interval

Suppose half the probability is spread uniformly over \([0,1]\), and half uniformly over \([3,4]\). The CDF is

$$ F(x)= \begin{cases} 0, & x<0,\\ x/2, & 0\le x\le1,\\ 1/2, & 1\le x\le3,\\ (x-2)/2, & 3\le x\le4,\\ 1, & x>4. \end{cases} $$

Find \(Q(0.5)\). On the first rising piece, \(x/2=0.5\) gives \(x=1\). On the flat piece, every \(x\in[1,3]\) also satisfies \(F(x)=0.5\). On the second rising piece, \((x-2)/2=0.5\) gives \(x=3\). Thus the equation has more than one solution: the full set of solutions is \([1,3]\).

The generalized inverse selects the leftmost solution, so \(Q(0.5)=1\). At the selected value, \(F(1)=1/2\), as required. The plateau corresponds to a gap in the support: increasing \(x\) from 1 to 3 adds no probability. Selecting \(x=2\) would give the right CDF value but would not give the quantile under the generalized-inverse convention.

For comparison, find \(Q(0.75)\). The first rising piece reaches at most \(1/2\), and the plateau stays at \(1/2\), so the relevant piece is \(3\le x\le4\):

$$ \frac{x-2}{2}=0.75 \quad\Longrightarrow\quad x-2=1.5 \quad\Longrightarrow\quad x=3.5. $$

The answer is in \([3,4]\), and substitution gives \(F(3.5)=(3.5-2)/2=0.75\). Hence \(Q(0.75)=3.5\).

Worked Example: Choosing Between Two Increasing Pieces

Consider the continuous CDF

$$ F(x)= \begin{cases} 0, & x<0,\\ x/4, & 0\le x\le2,\\ (x+2)/8, & 2\le x\le6,\\ 1, & x>6. \end{cases} $$

At the joining point, the formulas agree: \(2/4=1/2\) and \((2+2)/8=1/2\). At the right support endpoint, the second formula gives \((6+2)/8=1\). Find \(Q(0.65)\).

The first increasing piece reaches only from 0 to \(1/2\); the second reaches from \(1/2\) to 1. Since \(0.65>0.5\), use the second piece:

$$ \frac{x+2}{8}=0.65 \quad\Longrightarrow\quad x+2=5.2 \quad\Longrightarrow\quad x=3.2. $$

The candidate satisfies \(2\le3.2\le6\), so it belongs to the selected piece. Finally,

$$ F(3.2)=\frac{3.2+2}{8}=\frac{5.2}{8}=0.65. $$

The CDF increases strictly through this level, so there is no other solution to \(F(x)=0.65\). Therefore \(Q(0.65)=3.2\).

Boundary Checks and Common Mistakes

CDF pieces connect at boundaries, and the boundary can itself be the quantile. If \(F(c)=p\), check whether the formula is defined at \(c\), and evaluate the CDF there. For a continuous CDF the formulas on adjacent pieces must agree at a shared endpoint. A target level equal to that shared CDF value may be reached at the endpoint even when neither interior calculation is the most convenient way to find it.

The following errors are easy to make when working from a formula:

  • Ignoring the domain of a piece. Algebra can produce roots outside the interval where the formula applies. Reject those roots for that piece and check the other pieces or boundaries.
  • Choosing a piece from the shape of the formula alone. Compare \(p\) with the CDF values at the piece’s endpoints. Those values show which levels the piece can attain.
  • Treating any solution as the quantile. On a flat interval, several points can satisfy \(F(x)=p\). The quantile is the leftmost such point.
  • Stopping after solving. Evaluate the CDF at the proposed answer. This catches algebra errors and incorrect piece choices.
Key takeaway: For an explicit continuous CDF, solve \(F(x)=p\) on a piece that can reach level \(p\), check the candidate against that piece’s support and endpoints, and substitute it back into \(F\). If the level is flat over an interval, use its left endpoint as the quantile.

Check Your Understanding

For each question, use the generalized-inverse convention and check the proposed answer against the CDF formula.

  1. For \(F(x)=0\) when \(x<0\), \(F(x)=x/3\) when \(0\le x\le3\), and \(F(x)=1\) when \(x>3\), find \(Q(0.4)\).
  2. In Worked Example 1, why must the solution \(-1.2\) be rejected even though it satisfies the algebraic equation \(x^2/4=0.36\)?
  3. In Worked Example 2, what is \(Q(0.5)\), and why is it not the midpoint of the flat interval?
  4. In Worked Example 3, which CDF piece should be used to find \(Q(0.25)\)? Find and verify the quantile.
  5. State why substituting a candidate back into the CDF is a necessary check in a piecewise inversion.