Pdf of the square of a general normal random variable

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$$?

• The pdf of $Y = X^2$ cannot be the same as that of $X$ as $Y$ is will be nonegative. Commented Jan 27, 2016 at 22:27
• Well I am exercising for a test so no, it's not homework. I'm trying to solve them by myself but I can't figure this one out Commented Jan 27, 2016 at 22:29
• One way to start would be $P(Y\leq y) = P(X^2 \leq y) = P(|X|\leq \sqrt{y}) ...$ and then write two terms that relate to the cdf of $X$, which can then be differentiated to produce a pdf. Commented Jan 27, 2016 at 22:35
• ctd ... on the other hand, if you're seeking answers to a general question of this type (like "how do I obtain the pdf of a transformed random variable?'), that's a perfectly good question, which has already been answered on the site a few times. Commented Jan 27, 2016 at 23:51

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

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

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.

• We typically don't provide complete answers to self study questions, but only hints. The fact that the OP has not added the tag or attempted to adhere to our policies means this thread should be closed. You can find our policy on self study questions here. Commented Jan 28, 2016 at 1:10
• @gung I am certain that the OP could have found the answer anywhere, this is not exactly groundbreaking :) Commented Jan 28, 2016 at 8:20
• That will pretty much always be true with self study questions. We nonetheless do not typically provide complete answers to people's homework for them, but just hints to help them figure it out for themselves. Commented Jan 28, 2016 at 12:49
• @JohnK, thanks for the answer. Just a question on what you have written on the CDF technique: Shouldn't it be $f_Y(y) = \frac{1}{2}F_Y^{\prime}$. The reason is: $f_Y(y) = \frac{d}{dy} \mathbb{P}(-y \leqslant Y \leqslant y) = f_Y(y)-(-f_Y(y))= 2\cdot f_Y(y)$. I learned this here (see last comment by 'Reinstate Monica'). Thanks
– DomB
Commented Nov 29, 2019 at 8:01
• There is a typo in the cdf technique: when expressing P(X>-sqrt(y)) it should be 1-P(X<-sqrt(y)) not -P(X<-sqrt(y)) Commented Nov 9, 2021 at 1:27