Why Squaring Needs Both Signs
Squaring sends \(x\) and \(-x\) to the same value. Consequently, the distribution of \(X^2\) depends on the probability contributed by both sides of zero. The point zero also deserves special attention: it is the only input whose square is zero, and the derivative of the squaring map vanishes there. These facts affect the CDF, the density, and the behavior at the boundary of the transformed support.
Write \(Y=X^2\), where \(X\) is a real-valued random variable. A formula for the density of \(Y\) requires care if \(X\) has point masses: a density describes only the continuous part of a distribution. We first give a CDF identity that applies without assuming a density, then derive the density formula under an absolute-continuity assumption.
The CDF and the Possible Atom at Zero
Since squares are nonnegative, \(P(Y\leq y)=0\) for \(y<0\). For \(y\geq0\), put \(r=\sqrt{y}\). Then \(Y\leq y\) holds exactly when \(-r\leq X\leq r\). In particular, the endpoint at \(-r\) is included, so the left limit of \(F_X\), not \(F_X(-r)\), appears in the general formula.
At \(y=0\), this identity gives \(F_Y(0)=F_X(0)-F_X(0-)=P(X=0)\). Thus \(Y\) has an atom at zero precisely when \(X\) does, and the mass of that atom is \(P(X=0)\). If \(X\) is absolutely continuous, then \(P(X=0)=0\), so the transformed distribution has no atom at zero, even if its density becomes unbounded as \(y\) decreases to zero.
More generally, if \(X\) has atoms at \(a\) and \(-a\), for \(a>0\), their probabilities combine into an atom of \(Y\) at \(a^2\). The density formula below describes the continuous part when there is one; it does not absorb any such point masses.
Worked Example: A Standard Normal Square
Let \(X\sim N(0,1)\), and set \(Y=X^2\). The normal distribution is continuous and has support \(\mathbb{R}\), so \(Y\) has no atom at zero and has support \([0,\infty)\). For \(y\geq0\), symmetry gives
Differentiating for \(y>0\), using \(\Phi'(x)=\phi(x)\), gives
This density is unbounded near zero, but it is integrable there: \(\int_0^\epsilon y^{-1/2}\,dy=2\sqrt{\epsilon}\). Its divergence therefore does not imply an atom at zero.
The Inverse-Branch Density
For \(y>0\), the equation \(x^2=y\) has two inverse values, \(x=\sqrt y\) and \(x=-\sqrt y\). Each branch contributes its input density, adjusted by the reciprocal absolute derivative. On either branch, \(|d(x^2)/dx|=2|x|=2\sqrt y\). The two contributions must be added.
The density is zero for \(y<0\). Its value at the single point \(y=0\) can be assigned arbitrarily without changing the distribution. The formula is an almost-everywhere statement because densities themselves are defined only up to changes on sets of Lebesgue measure zero.
To derive it without differentiating at the boundary, take any Borel set \(B\subseteq(0,\infty)\). Splitting the integral over positive and negative \(x\), then substituting \(y=x^2\) on each half-line, yields
The point \(x=0\) has probability zero under absolute continuity, so it contributes no additional term. The resulting integrand is exactly the stated density. This change of variables also shows why a zero derivative at the input value zero does not invalidate the formula: the two substitutions are made on the open half-lines, and the omitted point has probability zero.
Worked Example: A Uniform Input With Unequal Branch Contributions
Suppose \(X\sim\operatorname{Uniform}(-2,1)\), with density \(f_X(x)=1/3\) on \([-2,1]\) and zero elsewhere. The image of the support under squaring is \([0,4]\). For \(0\leq y\leq1\), both inverse values lie in \([-2,1]\), so
For \(1<y\leq4\), the positive inverse value exceeds 1 and is outside the support of \(X\); the allowable input interval is \([-\sqrt y,1]\). Thus
The two CDF expressions agree at \(y=1\), where each equals \(2/3\). Differentiating within each interval, or applying the inverse-branch formula, gives
For \(0<y<1\), both input branches contribute \(1/(6\sqrt y)\). For \(1<y<4\), only the negative branch contributes. There is no atom at zero because the uniform input is continuous. The density integrates to one: its two interval integrals are \(2/3\) and \(1/3\), respectively.
Support and Boundary Behavior
For a continuous map such as \(x\mapsto x^2\), the support of the transformed distribution is the closure of the image of the original support. In this case,
Indeed, if a neighborhood of \(y\) misses the image of the support, its preimage under squaring misses the support of \(X\), and so has probability zero. Conversely, if \(y\) is in the closure of that image, every neighborhood of \(y\) contains the square of some support point; continuity ensures its preimage contains a neighborhood of that point, which has positive probability. The closure matters because a continuous image of a closed set need not itself be closed in general.
If \(f_X\) is continuous at zero, the inverse-branch formula describes the boundary behavior directly. For \(y\downarrow0\), continuity gives \(f_X(\sqrt y)=f_X(0)+o(1)\) and \(f_X(-\sqrt y)=f_X(0)+o(1)\), so
When \(f_X(0)>0\), the density therefore diverges at rate \(y^{-1/2}\). This singularity is integrable: for \(c>0\), \(\int_0^\epsilon c y^{-1/2}\,dy=2c\sqrt{\epsilon}\), which tends to zero with \(\epsilon\). A density can be unbounded near a point while assigning probability zero to that point.
A useful refinement is to suppose, as \(r\downarrow0\), that \(f_X(r)\sim c_+r^\alpha\) and \(f_X(-r)\sim c_-r^\alpha\), where \(c_+,c_-\geq0\), \(c_++c_+>0\) is replaced by \(c_++c_->0\), and \(\alpha>-1\). Then
The exponent is greater than \(-1\), so this boundary behavior is locally integrable. For example, if the input density vanishes linearly on both sides, then \(\alpha=1\) and the transformed density approaches a finite positive limit. If the input distribution has no support near zero, the transformed distribution has no continuous mass near zero either.
Worked Example: A Zero Atom and a Gap in the Continuous Support
Let \(X\) equal zero with probability \(1/4\). With the remaining probability \(3/4\), let its conditional distribution be uniform on \([-2,-1]\cup[1,2]\), with density \(1/2\) on each interval. Squaring maps both intervals onto \([1,4]\), while the point mass at zero remains at zero. Thus the support of \(Y\) is \(\{0\}\cup[1,4]\), and \(P(Y=0)=1/4\).
The unconditional density of \(X\) on each interval is \((3/4)(1/2)=3/8\). For \(1<y<4\), both inverse values are in the continuous support, so
For \(0<y<1\), neither inverse value is in the continuous support, so the density is zero. The continuous part has total mass \(\int_1^4 3/(8\sqrt y)\,dy=(3/8)\,2(2-1)=3/4\). Together with the atom of mass \(1/4\), the total probability is one.
Common Mistake: Confusing a Large Density With an Atom
A frequent error is to see \(f_Y(y)\to\infty\) as \(y\downarrow0\) and conclude that \(Y\) has positive probability at zero. That conclusion confuses a density value with point probability. For an absolutely continuous \(Y\), every singleton has probability zero; a density that behaves like \(y^{-1/2}\) still gives \(\lim_{\epsilon\downarrow0}P(0<Y\leq\epsilon)=0\). An atom at zero instead requires \(P(X=0)>0\), as the CDF identity shows.
A second error is to keep only the positive inverse branch. Unless the input support excludes the negative branch, the density must include both \(f_X(\sqrt y)\) and \(f_X(-\sqrt y)\). The unequal-branch uniform example shows that the number of contributing branches can also change across the support.
Check Your Understanding
Answer each question by applying the CDF or inverse-branch formula.
- If \(P(X=0)=0.12\), what is \(P(X^2=0)\)? Does the value of the density away from zero determine this probability?
- Suppose \(X\) has a density continuous at zero with \(f_X(0)=0.4\). What is the leading behavior of \(f_{X^2}(y)\) as \(y\downarrow0\), and is that behavior integrable?
- For an absolutely continuous \(X\), explain why the density of \(X^2\) at \(y>0\) has two terms rather than one.
- If the support of \(X\) is \([-3,-2]\cup[1,2]\), what is the support of \(X^2\)?
- Can a distribution have an atom at zero and also have a density that is unbounded just to the right of zero? Explain which part of the law each feature describes.