Normal Distribution – PDF of the Square of a General Normal Random Variable

density functiondistributionsnormal distributionself-study

Given a known Gaussian distribution, $X \sim \mathcal N(\mu_x, \sigma_x^2)$, how does one determine the the distribution of $Y$ if $Y = X^2$?

Best Answer

You have stumbled upon one of the most famous results of probability theory and statistics. I'll write an answer, although I am certain this question has been asked (and answered) before on this site.

First, note that the pdf of $Y = X^2$ cannot be the same as that of $X$ as $Y$ will be nonnegative. To derive the distribution of $Y$ we can use three methods, namely the mgf technique, the cdf technique and the density transformation technique. Let's begin.

Moment generating function technique.

Or characteristic function technique, whatever you like. We have to find the mgf of $Y=X^2$. So we need to compute the expectation

$$E\left[e^{tX^2}\right]$$

Using the Law of the Unconscious Statistician, all we have to do is compute this integral over the distribution of $X$. Thus we need to compute

$$\begin{align} E\left[e^{tX^2}\right] = \int_{-\infty}^{\infty} \frac{1}{\sqrt{2 \pi}} e^{tx^2} e^{-\frac{x^2}{2}} dx &= \int_{-\infty}^{\infty} \frac{1}{\sqrt{2\pi}} \exp\left\{ - \frac{x^2}{2} \left( 1- 2t \right) \right\} dt \\ & = \int_{-\infty}^{\infty} \frac{\left( 1-2t \right)^{1/2}}{\left( 1-2t \right)^{1/2}} \frac{1}{\sqrt{2\pi}} \exp\left\{ - \frac{x^2}{2} \left( 1- 2t \right) \right\} dt \\ & = \left(1-2t\right)^{-1/2} , \quad t<\frac{1}{2} \end{align}$$

where in the last line we have compared the integral with a Gaussian integral with mean zero and variance $\frac{1}{\left(1-2t\right)}$. Of course this integrates to one over the real line. What can you do with that result now? Well, you may apply a very complex inverse transformation and determine the pdf that corresponds to this MGF or you may simply recognise it as the MGF of a chi-squared distribution with one degree of freedom. (Recall that a chi-squared distribution is a special case of a gamma distribution with $\alpha = \frac{r}{2}$, $r$ being the degrees of freedom, and $\beta = 2$).

CDF technique

This is perhaps the easiest thing you can do and it is suggested by Glen_b in the comments. According to this technique, we compute

$$F_Y (y) = P(Y\leq y) = P(X^2 \leq y) = P(|X|\leq \sqrt{y})$$

and since distribution functions define the density functions, after we get a simplified expression we just differentiate with respect to $y$ to get our pdf. We have then

$$ \begin{align} F_Y (y) = P\left( |X|\leq \sqrt{y} \right) = P\left(-\sqrt{y} < X <\sqrt{y} \right) = \Phi\left(\sqrt{y}\right) - \Phi \left(- \sqrt{y}\right) \end{align} $$

where $\Phi(.)$ denotes the CDF of a standard normal variable. Differentiating with respect to $y$ we get,

$$f_Y(y) = F_Y^{\prime} (y) = \frac{1}{2 \sqrt{y}} \phi \left( \sqrt{y} \right) + \frac{1}{2 \sqrt{y}} \phi \left( -\sqrt{y} \right) = \frac{1}{\sqrt{y}} \phi(\sqrt{y}) $$

where $\phi(.)$ is now the pdf of a standard normal variable and we have used the fact that it is symmetric about zero. Hence

$$f_Y (y) = \frac{1}{\sqrt{y}} \frac{1}{\sqrt{2\pi}} e^{-\frac{y}{2}}, \quad 0<y<\infty$$

which we recognize as the pdf of a chi-squared distribution with one degree of freedom (You might be seeing a pattern by now).

Density transformation technique

At this point you might wonder, why we do not simply use the transformation technique you are familiar with, that is, for a function $ Y = g(X)$ we have that the density of $Y$ is given by

$$f_Y (y) = \left| \frac{d}{dy} g^{-1} (y) \right| f_X \left( g^{-1} (y) \right)$$

for $y$ in the range of $g$. Unfortunately this theorem requires the transformation to be one-to-one which is clearly not the case here. Indeed, we can see that two values of $X$ result in the same value of $Y$, $g$ being a quadratic transformation. Therefore, this theorem is not applicable.

What is applicable, nevertheless, is an extension of it. Under this extension, we may decompose the support of $X$ (support means the points where the density is non-zero), into disjoint sets such that $Y= g(X)$ defines a one-to-one transformation from these sets into the range of $g$. The density of $Y$ is then given by the sum over all of these inverse functions and the corresponding absolute Jacobians. In the above notation

$$f_Y (y) = \sum \left| \frac{d}{dy} g^{-1} (y) \right| f_X \left( g^{-1} (y) \right)$$

where the sum runs over all inverse functions. This example will make it clear.

For $y = x^2$, we have two inverse functions, namely $x = \pm \sqrt{y}$ with corresponding absolute Jacobian $\displaystyle{ \frac{1}{2\sqrt{y}} }$ and so the corresponding pdf is found to be

$$f_Y (y) = \frac{1}{2\sqrt{y}} \frac{1}{\sqrt{2\pi} } e^{-y/2} + \frac{1}{2\sqrt{y}} \frac{1}{\sqrt{2\pi} } e^{-y/2} = \frac{1}{\sqrt{y}} \frac{1}{\sqrt{2\pi}} e^{-y/2}, \quad 0<y<\infty$$

the pdf of a chi-squared distribution with one degree of freedom. On a side note, I find this technique particularly useful as you no longer have to derive the CDF of the transformation. But of course, these are personal tastes.


So you can go to bed tonight completely assured that the square of a standard normal random variable follows the chi-squared distribution with one degree of freedom.

Related Question