Why Start With the CDF?
When \(g\) is not monotone, a single inverse branch may not describe the event that the transformed variable is at most \(y\). Several separated regions of the input space can satisfy the same inequality. The distribution function handles this directly: identify all those regions, then add their probabilities. This approach works whether \(X\) is continuous, discrete, or a mixture, and it keeps endpoint probabilities visible.
For a nonmonotone function, \(A_y\) may be a union of disjoint intervals rather than one interval. The key calculation is therefore not “invert \(g\) once,” but “find every part of the input space where \(g(x)\le y\).” Once those parts are known, use the distribution of \(X\) to calculate their total probability.
Interval Probabilities and Endpoint Conventions
Write \(F(t)=P(X\le t)\) for the CDF of \(X\), and define its left limit by \(F(t-)=P(X<t)\). The left limit matters when \(X\) may have a point mass at an endpoint. For finite \(a<b\), the four possible interval conventions give:
For example, \((a,b]\) contains values counted by \(F(b)\) but not those counted by \(F(a)\), so its probability is their difference. Including \(a\) adds \(P(X=a)=F(a)-F(a-)\); excluding \(b\) replaces \(F(b)\) by \(F(b-)\). Thus the formulas follow directly from the definitions, without a continuity assumption on \(F\). If the input distribution is continuous, then \(F(t)=F(t-)\) at every \(t\), and endpoint choices do not change interval probabilities. For a distribution with atoms, they can change the answer.
Proof. By definition, \(F_Y(y)=P(X\in A_y)\). Write \(A_y=I_1\cup\cdots\cup I_k\), where the intervals and any singleton pieces are pairwise disjoint. Finite additivity of probability gives $$ F_Y(y)=P\left(X\in\bigcup_{j=1}^{k} I_j\right) =\sum_{j=1}^{k}P(X\in I_j). $$ Each term is given by the interval formulas, or by \(P(X=a)=F(a)-F(a-)\) for a singleton \(\{a\}\). This proves the claim. \(\square\)
This result gives a reliable procedure whenever the sublevel set has a manageable interval description. First solve the inequality \(g(x)\le y\), then write its solution as disjoint pieces with their endpoints specified, and finally calculate each piece’s probability. If the set has infinitely many pieces or a more complicated shape, its probability is still \(P(X\in A_y)\); the finite-union formula simply may not be the convenient way to evaluate it.
Worked CDF Calculations
Worked Example: A Piecewise Nonmonotone Map With a Flat Region
Let \(X\sim \operatorname{Uniform}(0,3)\), and define $$ g(x)= \begin{cases} x,&0\le x\le 1,\\ 2-x,&1<x<2,\\ \tfrac12,&2\le x\le 3. \end{cases} $$ Find the CDF of \(Y=g(X)\), including its value at \(y=\tfrac12\).
The input density is \(1/3\) on \([0,3]\), so an interval of length \(L\) within that support has probability \(L/3\). If \(y<0\), no input value satisfies \(g(x)\le y\), and hence \(F_Y(y)=0\).
For \(0\le y<\tfrac12\), the first branch contributes \(0\le x\le y\), an interval of length \(y\). The second branch contributes \(2-y\le x<2\), also of length \(y\). The constant branch contributes nothing because its value is \(\tfrac12>y\). Thus $$ F_Y(y)=\frac{y+y}{3}=\frac{2y}{3},\qquad 0\le y<\tfrac12. $$
At \(y=\tfrac12\), the first branch contributes \([0,\tfrac12]\), of length \(\tfrac12\), and the second contributes \([\tfrac32,2)\), also of length \(\tfrac12\). The entire constant region \([2,3]\), of length \(1\), is now included. Therefore $$ F_Y\left(\tfrac12\right)=\frac{\tfrac12+\tfrac12+1}{3}=\frac23. $$
For \(\tfrac12<y<1\), the two sloping branches contribute intervals of length \(y\) each, and the constant region remains included. Hence \(F_Y(y)=(2y+1)/3\). For \(y\ge1\), every possible value of \(Y\) is included. In full, $$ F_Y(y)= \begin{cases} 0,&y<0,\\ \tfrac{2y}{3},&0\le y<\tfrac12,\\ \tfrac{1+2y}{3},&\tfrac12\le y<1,\\ 1,&y\ge1. \end{cases} $$
The jump at \(\tfrac12\) is \(F_Y(\tfrac12)-F_Y(\tfrac12-)=\tfrac23-\tfrac13=\tfrac13\). Indeed, the entire interval \([2,3]\) maps to \(\tfrac12\), and \(P(2\le X\le3)=1/3\). The additional input \(x=\tfrac32\) also maps to \(\tfrac12\), but a single point has probability zero under this uniform distribution.
Worked Example: A Mixed Input Distribution and a Union of Intervals
Suppose \(X\) has probability \(0.2\) at \(-1\), probability \(0.3\) at \(1\), and its remaining probability \(0.5\) is distributed uniformly on \([0,2]\). Define $$ g(x)= \begin{cases} x+1,&-1\le x\le0,\\ 1-x,&0<x\le1,\\ x-1,&1<x\le2. \end{cases} $$ Find \(F_Y(0)\) and \(F_Y(0.5)\) for \(Y=g(X)\).
At level \(y=0\), the sublevel set within the support is \(\{-1,1\}\). The uniform component also assigns probability zero to \(x=1\), so it contributes no additional probability. The two point masses contribute \(0.2+0.3\), giving \(F_Y(0)=0.5\).
At \(y=0.5\), solve the inequality on each branch. The first branch gives \([-1,-0.5]\), the second gives \([0.5,1]\), and the third gives \((1,1.5]\). Within the uniform component’s support \([0,2]\), the union of these regions has length \(1\), namely the interval from \(0.5\) to \(1.5\), with endpoint inclusion immaterial for the uniform probability. Its probability under the uniform distribution on \([0,2]\) is \(1/2\), so its contribution to the mixture is \(0.5(1/2)=0.25\).
Both point masses are also included: \(g(-1)=0\) and \(g(1)=0\). Thus $$ F_Y(0.5)=0.2+0.3+0.25=0.75. $$ The jump at zero is \(0.5\), because the two input atoms at \(-1\) and \(1\) both map to zero. The continuous component’s preimage of zero contains only \(x=1\), which has probability zero under its uniform distribution.
Worked Example: Endpoint Jumps for a Discrete Input
Let \(X\) take the values \(-1,0,1,2\) with probabilities \(0.20,0.25,0.35,0.20\), respectively. Suppose \(g\) has values \(g(-1)=2\), \(g(0)=0\), \(g(1)=2\), and \(g(2)=1\). Find the CDF of \(Y=g(X)\).
The transformed values and their probabilities are: $$ P(Y=0)=P(X=0)=0.25,\qquad P(Y=1)=P(X=2)=0.20,\qquad P(Y=2)=P(X=-1)+P(X=1)=0.20+0.35=0.55. $$ The repeated value \(2\) receives the sum of the probabilities at both its preimages. Ordering the transformed values, the CDF is $$ F_Y(y)= \begin{cases} 0,&y<0,\\ 0.25,&0\le y<1,\\ 0.45,&1\le y<2,\\ 1,&y\ge2. \end{cases} $$
In particular, \(F_Y(2)=1\), not \(0.45\): the inequality defining a CDF is \(Y\le y\), so the mass at the endpoint \(2\) is included. Its jump there is \(1-0.45=0.55\).
Atoms and a General Check
Proof. The events \(\{Y=y\}\) and \(\{X\in g^{-1}(\{y\})\}\) are equal, because \(Y=g(X)\). Taking probabilities gives the stated identity. A point is an atom precisely when its probability is positive, which gives the final assertion. \(\square\)
This criterion distinguishes the size of a preimage from its probability. A level set can contain several points without creating an atom if each has probability zero; conversely, an interval on which \(g\) is constant creates an atom whenever \(X\) assigns positive probability to that interval. More generally, the level set need not be an interval: what matters is its probability under \(X\).
Common Mistake and Why the Method Matters
- Wrong reasoning: “Endpoints have probability zero, so I can always ignore them.” This is valid for an absolutely continuous input distribution, but not for a discrete or mixed input. An endpoint may carry positive probability, and changing an interval from open to closed can then change the result.
- Correction: Write the interval endpoints explicitly and use \(F(t)\) or \(F(t-)\) according to whether the endpoint is included. For a singleton, use \(F(t)-F(t-)\).
- Another pitfall: Counting only one inverse branch. If \(g(x)\le y\) holds in separated regions, all those regions belong in the event; their probabilities must be combined.
The CDF method is a direct way to preserve the whole distribution, including jumps, while handling multiple branches. It also provides a check on any density calculation: a proposed transformed law must have the same probabilities for the sublevel events. In practical calculations, sketching the graph of \(g\), marking where it crosses the level \(y\), and testing one point in each resulting interval can help verify that no branch has been missed.
Check Your Understanding
For each question, identify the relevant sublevel set before calculating its probability.
- If \(P(X\le b)=0.8\) and \(P(X<b)=0.65\), what is \(P(X=b)\)?
- A sublevel set is \((a,b]\cup[c,d)\), where \(a<b<c<d\). Write its probability in terms of \(F\) and left limits.
- Why can two distinct input points mapping to the same value fail to create an atom in the transformed distribution?
- If \(g\) is constant on an interval \(I\), what condition on \(X\) makes that constant value an atom of \(g(X)\)?
- For a discrete \(X\), why must a CDF include the probability mass at the value \(y\) when evaluating \(F_Y(y)\)?