Tutorials › VEE Mathematical Statistics › Absolute Values and Squares of Continuous Variables

VEE Mathematical Statistics · Functions of a Random Variable · Tutorial 249 of 880

Absolute Values and Squares of Continuous Variables

Learn to combine the contributions of positive and negative inverse branches to find the distributions of absolute values and squares.

Intermediate 10 min read

What You'll Learn

  • Find the support of an absolute value or square transformation.
  • Combine the density contributions from positive and negative inverse branches.
  • Derive density formulas for the absolute value and square of a continuous variable.
  • Apply the formulas to symmetric, asymmetric, and shifted-normal distributions.
  • Check transformed densities by integrating over their supports.
  • Avoid losing a branch or applying the derivative factor incorrectly.

Why Absolute Values and Squares Need Care

The transformations \(Y=|X|\) and \(Z=X^2\) are not one-to-one: a positive output can come from a positive or a negative value of \(X\). The density of the transformed variable must therefore account for every input value that produces that output. Counting only one inverse value can give a density with too little probability, even when the algebra for that branch is correct.

The key tasks are to map the support, identify all inverse branches that lie in the support of \(X\), and include the appropriate rate-of-change factor when converting density. These steps apply whether the original density is symmetric or not. This material is aligned with the SOA VEE Mathematical Statistics syllabus.

Definition: Let \(X\) be a continuous random variable with density \(f_X\). For \(Y=|X|\), each possible value \(y>0\) can arise from \(X=y\), \(X=-y\), or just one of those values if the other is outside the support. For \(Z=X^2\), a possible value \(z>0\) can arise from \(X=\sqrt z\), \(X=-\sqrt z\), or just one of those values. The transformed density sums the density contributions from all inverse values in the support of \(X\).

General Density Formulas

First consider \(Y=|X|\). For \(y\geq 0\), the event \(Y\leq y\) is the event \(-y\leq X\leq y\). Because \(X\) is continuous, endpoint probabilities are zero, so

$$ F_Y(y)= \begin{cases} 0, & y<0,\\ F_X(y)-F_X(-y), & y\geq 0. \end{cases} $$

Differentiating for \(y>0\) gives the density. A term is included only when the corresponding input is in the support of \(X\):

$$ f_Y(y)=f_X(y)+f_X(-y), \qquad y>0. $$

For \(Z=X^2\), the support is nonnegative. When \(z\geq 0\), \(Z\leq z\) is equivalent to \(-\sqrt z\leq X\leq\sqrt z\), giving

$$ F_Z(z)= \begin{cases} 0, & z<0,\\ F_X(\sqrt z)-F_X(-\sqrt z), & z\geq 0. \end{cases} $$

For \(z>0\), differentiating both terms requires the chain rule. Each square-root branch contributes a factor \(1/(2\sqrt z)\):

$$ f_Z(z)=\frac{f_X(\sqrt z)+f_X(-\sqrt z)}{2\sqrt z}, \qquad z>0. $$

Both formulas are understood to hold wherever the density exists, and a density is only relevant on the transformed support. If one inverse value is outside the support of \(X\), its contribution is zero. The formulas do not create probability at a single point: if \(X\) has a continuous distribution, then \(P(X=0)=0\), so \(P(|X|=0)=P(X^2=0)=0\). A density may nevertheless become large near zero; that does not imply a point mass there.

Worked Examples

Worked Example: Absolute Value and Square of a Symmetric Uniform Variable

Suppose \(X\sim\operatorname{Uniform}(-2,2)\), so \(f_X(x)=1/4\) for \(-2<x<2\) and zero otherwise. Find the densities of \(Y=|X|\) and \(Z=X^2\), and calculate \(P(1<Z\leq 4)\).

Method and support. The support of \(Y\) is \(0\leq y\leq2\), while the support of \(Z\) is \(0\leq z\leq4\). For every interior \(y\) or \(z\), both inverse values are in the support of \(X\).

For \(Y\), add the two density contributions:

$$ f_Y(y)=f_X(y)+f_X(-y)=\frac14+\frac14=\frac12,\qquad 0<y<2. $$

For \(Z\), use both square-root branches and the derivative factor:

$$ f_Z(z)=\frac{1/4+1/4}{2\sqrt z} =\frac{1}{4\sqrt z},\qquad 0<z<4. $$

The probability calculation can be made from the transformed density:

$$ P(1<Z\leq4)=\int_1^4\frac{1}{4\sqrt z}\,dz =\left[\frac{\sqrt z}{2}\right]_1^4 =\frac{2-1}{2} =\frac12. $$

Check. The absolute-value density integrates to \((1/2)(2)=1\). The square density integrates to \([\sqrt z/2]_0^4=1\). The probability also agrees with \(P(1<|X|\leq2)\), which covers total interval length \(2\) in an original interval of length \(4\). The common mistake to avoid is keeping only \(f_X(\sqrt z)\); here that would omit half the density.

Worked Example: An Asymmetric Density with Different Branch Ranges

Let \(X\) have density \(f_X(x)=1/4\) for \(-1<x<0\), \(f_X(x)=3/8\) for \(0<x<2\), and zero elsewhere. Find the densities of \(Y=|X|\) and \(Z=X^2\), then calculate \(P(1/4<Z\leq9/4)\).

Check the model. The density integrates to \((1)(1/4)+(2)(3/8)=1/4+3/4=1\). The negative branch exists only for absolute values below 1. Thus the branch count changes at \(y=1\), and the square-root branch count changes at \(z=1\).

For \(Y\), both branches contribute when \(0<y<1\), while only the positive branch contributes when \(1<y<2\):

$$ f_Y(y)= \begin{cases} \frac14+\frac38=\frac58, & 0<y<1,\\ \frac38, & 1<y<2,\\ 0, & \text{otherwise}. \end{cases} $$

For \(Z\), the density contributions must also be divided by \(2\sqrt z\):

$$ f_Z(z)= \begin{cases} \frac{1/4+3/8}{2\sqrt z}=\frac{5}{16\sqrt z}, & 0<z<1,\\ \frac{3/8}{2\sqrt z}=\frac{3}{16\sqrt z}, & 1<z<4,\\ 0, & \text{otherwise}. \end{cases} $$

The requested interval for \(Z\) corresponds to \(1/2<|X|\leq3/2\). In terms of \(Y\), its probability is

$$ \begin{aligned} P(1/4<Z\leq9/4) &=\int_{1/4}^{1}\frac{5}{16\sqrt z}\,dz +\int_{1}^{9/4}\frac{3}{16\sqrt z}\,dz\\ &=\frac{5}{8}\left(1-\frac12\right) +\frac{3}{8}\left(\frac32-1\right)\\ &=\frac{5}{16}+\frac{3}{16} =\frac12. \end{aligned} $$

Check. The two pieces of the square density integrate to \(5/8\) and \(3/8\), respectively, for a total of 1. In the probability calculation, the interval \(1/2<Y\leq1\) contributes \(5/16\), and \(1<Y\leq3/2\) contributes \(3/16\). The common mistake is to use both inverse branches throughout the full transformed support; the negative branch ends at \(|X|=1\).

Worked Example: Squaring a Shifted Normal Variable

Suppose \(X\sim N(1,1)\), where the second parameter is the variance. Find the density of \(Z=X^2\), calculate \(P(Z\leq4)\), and find \(P(|X|\leq1)\). Use \(\phi\) and \(\Phi\) for the standard normal density and distribution function.

Method. The normal distribution has support on the entire real line, so for every \(z>0\), both \(\sqrt z\) and \(-\sqrt z\) are valid inverse values. Since the standard deviation is 1, \(f_X(x)=\phi(x-1)\). Therefore

$$ f_Z(z)=\frac{\phi(\sqrt z-1)+\phi(-\sqrt z-1)}{2\sqrt z},\qquad z>0. $$

For example, at \(z=1\), the two original inputs are \(1\) and \(-1\). Their standard normal arguments are 0 and \(-2\), respectively:

$$ f_Z(1)=\frac{\phi(0)+\phi(-2)}{2} =\frac{0.3989+0.0540}{2} =0.2265. $$

For the first probability, \(Z\leq4\) is equivalent to \(-2\leq X\leq2\). Standardizing with mean 1 and standard deviation 1 gives

$$ P(Z\leq4)=P(-2\leq X\leq2) =\Phi(1)-\Phi(-3) \approx0.8413-0.0013 =0.8400. $$

For the absolute-value probability, \(|X|\leq1\) means \(-1\leq X\leq1\):

$$ P(|X|\leq1)=\Phi(0)-\Phi(-2) \approx0.5000-0.0228 =0.4772. $$

Probabilities are rounded to four decimal places and the density value to four decimal places. Check. The interval for \(Z\leq4\) includes both sides of the mean and has standard-normal bounds \(-3\) and \(1\); the interval for \(|X|\leq1\) has bounds \(-2\) and \(0\). The common mistake is to treat the two probabilities as symmetric about the mean. The transformation is symmetric about zero, but this normal distribution is centered at 1, not at zero.

Why the Formulas Work

The density formulas can be justified by looking at a small interval around a transformed value. For \(Y=|X|\) and \(y>0\), the event \(y<Y\leq y+h\) consists of two thin intervals for \(X\): one near \(y\) and one near \(-y\). For small positive \(h\), their probabilities are approximately \(f_X(y)h\) and \(f_X(-y)h\). Dividing their sum by the transformed interval width \(h\), then taking the limit as \(h\) approaches zero, gives \(f_Y(y)=f_X(y)+f_X(-y)\).

For \(Z=X^2\), an interval \(z<Z\leq z+k\), with \(z>0\) and small \(k>0\), corresponds to intervals near \(\sqrt z\) and \(-\sqrt z\). The width of either interval in the \(X\)-scale is approximately

$$ \sqrt{z+k}-\sqrt z =\frac{k}{\sqrt{z+k}+\sqrt z} \approx\frac{k}{2\sqrt z}. $$

The probabilities near the positive and negative roots are therefore approximately \(f_X(\sqrt z)k/(2\sqrt z)\) and \(f_X(-\sqrt z)k/(2\sqrt z)\). Dividing by \(k\) and taking the limit gives the square-density formula. This also explains why the factor \(1/(2\sqrt z)\) is essential: equal-width intervals on the \(Z\)-scale correspond to progressively narrower intervals on the \(X\)-scale as the positive value of \(z\) increases.

Support, Symmetry, and Common Traps

The support of a transformed variable is the set of outputs actually attainable from the support of \(X\). For example, if \(X\) is supported only on positive values, \(X^2\) has only the positive-root contribution. If the support includes positive and negative values, both contributions may apply, but their ranges need not be the same. Identify those ranges before simplifying the formula.

Symmetry can simplify a calculation, but it is not an assumption of the general results. If \(f_X(x)=f_X(-x)\) wherever both arguments are in the support, then \(f_Y(y)=2f_X(y)\) when both branches exist. The same doubling can be used in the square formula. For an asymmetric density, simply adding a branch twice is incorrect.

  • Dropping an inverse branch: include every inverse value that lies in the original support.
  • Adding an unavailable branch: do not use \(f_X(-y)\) or \(f_X(-\sqrt z)\) when that input is outside the support.
  • Omitting the square-root derivative factor: the density of \(X^2\) includes \(1/(2\sqrt z)\); the density of \(|X|\) does not.
  • Assuming the transformed density must be finite at zero: the square density can diverge as \(z\) approaches zero while remaining integrable. A divergence in density is not a point mass.
  • Forgetting the output support: \(|X|\) and \(X^2\) cannot be negative, and their upper limits depend on the original support.
Key takeaway: For absolute values and squares, list all inverse branches and restrict them to the support of \(X\). Add their density contributions, and for \(X^2\) divide the sum by \(2\sqrt z\). Finally, integrate the result over its support to check that the total probability is 1.

Check Your Understanding

For each problem, identify the relevant inverse branches and check how the original support limits them.

  1. Let \(X\sim\operatorname{Uniform}(-5,1)\). Find the density of \(Y=|X|\) on each part of its support and calculate \(P(Y\leq2)\). (Answer: \(f_Y(y)=1/3\) for \(0<y<1\), \(f_Y(y)=1/6\) for \(1<y<5\), zero otherwise; \(P(Y\leq2)=1/2\).)
  2. Let \(X\sim\operatorname{Uniform}(-2,3)\). Find the density of \(Z=X^2\) on each part of its support, and calculate \(P(1<Z\leq4)\). (Answer: \(f_Z(z)=1/(5\sqrt z)\) for \(0<z<4\), \(f_Z(z)=1/(10\sqrt z)\) for \(4<z<9\), zero otherwise; \(P(1<Z\leq4)=2/5\).)
  3. A continuous variable has density \(1/3\) on \((-1,1)\), density \(1/6\) on \((1,3)\), and zero elsewhere. Find the density of \(Z=X^2\) on its support and calculate \(P(1/4<Z\leq4)\). (Answer: \(f_Z(z)=1/(3\sqrt z)\) for \(0<z<1\), \(f_Z(z)=1/(12\sqrt z)\) for \(1<z<9\), zero otherwise; \(P(1/4<Z\leq4)=1/2\).)
  4. Suppose \(X\sim N(-1,4)\). Express \(f_Y(y)\) for \(Y=|X|\), and calculate \(P(Y\leq1)\). (Answer: \(f_Y(y)=\bigl[\phi((y+1)/2)+\phi((1-y)/2)\bigr]/2\) for \(y>0\); \(P(Y\leq1)=\Phi(1)-\Phi(0)=0.3413\).)
Clinical Biostats