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.
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.
Use the endpoint values of the CDF pieces to determine which piece or boundary can contain probability level \(p\).
Set the formula for that piece equal to \(p\) and solve for \(x\).
Verify that the result lies in the piece’s stated domain and within the support. Include endpoints when the piece includes them.
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.
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
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.
Worked Inversions
Worked Example: Inverting a CDF on a Bounded Support
Let \(X\) have CDF
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:
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:
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
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\):
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
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:
The candidate satisfies \(2\le3.2\le6\), so it belongs to the selected piece. Finally,
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.
Check Your Understanding
For each question, use the generalized-inverse convention and check the proposed answer against the CDF formula.
- 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)\).
- In Worked Example 1, why must the solution \(-1.2\) be rejected even though it satisfies the algebraic equation \(x^2/4=0.36\)?
- In Worked Example 2, what is \(Q(0.5)\), and why is it not the midpoint of the flat interval?
- In Worked Example 3, which CDF piece should be used to find \(Q(0.25)\)? Find and verify the quantile.
- State why substituting a candidate back into the CDF is a necessary check in a piecewise inversion.