Square of a standard normal variable
A simple transformation of a standard normal random variable has a distribution called a chi-squared distribution.
Definition
If a random variable, \(Z\), has a standard normal distribution,
\[ Z \;\;\sim\;\; \NormalDistn(0, 1) \]then we say that its square, \(Y = Z^2\), has a chi-squared distribution with 1 degree of freedom,
\[ Y \;\;\sim\;\; \ChiSqrDistn(1\;\text{df}) \]This also means that if \(X \sim \NormalDistn(\mu, \sigma^2)\) then, since \(Z = \frac {X-\mu}{\sigma}\) has a standard normal distribution,
\[ \frac{(X - \mu)^2}{\sigma^2} \;\;\sim\;\; \ChiSqrDistn(1\;\text{df}) \]We will now derive the probability density function of this distribution.
Probability density function
The random variable \(Y \sim \ChiSqrDistn(1\;\text{df})\) has probability density function
\[ f(y) \;=\; \frac 1 {\sqrt{2\pi}} y^{\large{-\frac 1 2}}e^{\large{-\frac y 2}} \qquad\text{if } y \gt 0 \]The probability density function of a standard normal variable, \(Z \sim \NormalDistn(0, 1)\), is
\[ f_Z(z) \;\;=\;\; \frac 1{\sqrt{2\pi}} e^{- \frac{\large z^2}{\large 2}} \qquad \text{for } -\infty \lt x \lt \infty \]The cumulative distribution functions of \(Y = Z^2\) is
\[ F_Y(y) \;=\; P(Y \lt y) \;\;=\;\; P(Z \lt -\sqrt{y}) + P(Z \gt \sqrt{y}) \]Writing the cumulative distribution function of \(Z\) as \(F_Z(z)\) and using the fact that its distribution is symmetric around zero,
\[ F_Y(y) \;\;=\;\; 2 \times P(Z \lt -\sqrt{y}) \;\;=\;\; 2 \times F_Z(-\sqrt{y}) \]Since a continuous random variable's probability density function is the derivative of its cumulative distribution function,
\[ \begin{align} f_Y(y) \;\;=\;\; \frac{d\;F_Y(y)}{dy} \;\;&=\; 2 \times \frac{d\;F_Z(-\sqrt{y})}{dy} \\ &=\; 2 \times f_Z(-\sqrt{y}) \times \frac{d\;\sqrt{y}}{dy} \\ &=\; 2 \times \frac 1{\sqrt{2\pi}} e^{- \frac{\large y}{\large 2}} \times \frac{d\;\sqrt{y}}{dy} \\ &=\; 2 \times \frac 1{\sqrt{2\pi}} e^{- \frac{\large y}{\large 2}} \times \frac 1 {2\sqrt{y}} \\ &=\; \frac 1 {\sqrt{2\pi}} y^{\large{-\frac 1 2}}e^{\large{-\frac y 2}} \end{align} \]The Chi-squared distribution is actually a special case from the family of Gamma distributions.
Relationship to gamma distribution
The \(\ChiSqrDistn(1\;\text{df})\) distribution is identical to a \(\GammaDistn(\frac 1 2, \frac 1 2)\) distribution.
The Gamma distribution has pdf
\[ f(x) \;\;=\;\; \dfrac {\beta^\alpha }{\Gamma(\alpha)} x^{\alpha - 1} e^{-x\beta} \qquad \text{if }x \gt 0 \]This is the same as the Chi-squared distribution's pdf if \(\alpha = \frac 1 2\) and \(\beta = \frac 1 2\).