Tutorials › Statistical Theory I - Probability and Distribution Theory › Squared Random Variables and Boundary Behavior

Many-to-One Transformations · Tutorial 424 of 994

Squared Random Variables and Boundary Behavior

Learn how squaring combines the positive and negative branches, when the transformed law has an atom at zero, and why its density may diverge there.

Intermediate 10 min read

What You'll Learn

  • Write the CDF of \(Y=X^2\) using the probability of an interval for \(X\).
  • Derive the density by summing contributions from both inverse branches.
  • Identify the support of a squared random variable from the support of \(X\).
  • Distinguish an atom at zero from a density that becomes large near zero.
  • Determine the boundary behavior of the density from the behavior of \(f\) near zero.
  • Recognize when squaring creates a gap in the continuous support.

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.

Definition: For a distribution function \(F_X\), write \(F_X(a-)=P(X<a)\) for its left limit at \(a\). The support of a probability distribution is the smallest closed set having probability one; equivalently, a point belongs to the support if every open neighborhood of it has positive probability.

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.

Theorem: For any real-valued random variable \(X\), the CDF of \(Y=X^2\) satisfies
$$ F_Y(y)= \begin{cases} 0, & y<0,\\[2mm] F_X(\sqrt{y})-F_X((-\sqrt{y})-), & y\geq0. \end{cases} $$

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

$$ F_Y(y)=P(-\sqrt y\leq X\leq\sqrt y) =\Phi(\sqrt y)-\Phi(-\sqrt y) =2\Phi(\sqrt y)-1. $$

Differentiating for \(y>0\), using \(\Phi'(x)=\phi(x)\), gives

$$ f_Y(y)=\frac{\phi(\sqrt y)}{\sqrt y} =\frac{1}{\sqrt{2\pi y}}e^{-y/2},\qquad y>0. $$

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.

Theorem: Suppose \(X\) is absolutely continuous with density \(f_X\). Then \(Y=X^2\) is absolutely continuous, has no atom at zero, and has density, for almost every \(y>0\),
$$ f_Y(y)=\frac{f_X(\sqrt y)+f_X(-\sqrt y)}{2\sqrt y}, \qquad y>0. $$

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

$$ \begin{aligned} P(Y\in B) &=\int_{\{x:x^2\in B\}} f_X(x)\,dx\\ &=\int_B \frac{f_X(\sqrt y)}{2\sqrt y}\,dy +\int_B \frac{f_X(-\sqrt y)}{2\sqrt y}\,dy. \end{aligned} $$

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

$$ F_Y(y)=P(-\sqrt y\leq X\leq\sqrt y) =\frac{2\sqrt y}{3}. $$

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

$$ F_Y(y)=\frac{1+\sqrt y}{3},\qquad 1<y\leq4. $$

The two CDF expressions agree at \(y=1\), where each equals \(2/3\). Differentiating within each interval, or applying the inverse-branch formula, gives

$$ f_Y(y)= \begin{cases} \dfrac{1}{3\sqrt y}, & 0<y<1,\\[2mm] \dfrac{1}{6\sqrt y}, & 1<y<4,\\[2mm] 0, & y>4. \end{cases} $$

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,

$$ \operatorname{supp}(Y) =\overline{\{x^2:x\in\operatorname{supp}(X)\}}. $$

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

$$ f_Y(y)=\frac{f_X(0)+o(1)}{\sqrt y}. $$

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

$$ f_Y(y)\sim \frac{c_++c_-}{2}\,y^{(\alpha-1)/2}. $$

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

$$ f_Y(y)=\frac{3/8+3/8}{2\sqrt y} =\frac{3}{8\sqrt y}. $$

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.

Key takeaway: The CDF identity handles arbitrary input distributions and reveals the atom at zero. For an absolutely continuous input, the density at positive \(y\) is the sum of the two inverse-branch contributions, divided by \(2\sqrt y\). Its boundary behavior depends on the input density near zero, not on whether zero itself has positive probability.

Check Your Understanding

Answer each question by applying the CDF or inverse-branch formula.

  1. If \(P(X=0)=0.12\), what is \(P(X^2=0)\)? Does the value of the density away from zero determine this probability?
  2. 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?
  3. For an absolutely continuous \(X\), explain why the density of \(X^2\) at \(y>0\) has two terms rather than one.
  4. If the support of \(X\) is \([-3,-2]\cup[1,2]\), what is the support of \(X^2\)?
  5. 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.