# Relationship between gamma and chi-squared distribution

If $$Y=\sum_{i=1}^{N}X_i^2$$ where $X_i \sim \mathcal{N}(0,\sigma^2)$, i.e. all $X_i$ are i.i.d. normal random variables of zero mean with same variances, then $$Y \sim \Gamma\left(\frac{N}{2},2\sigma^2\right).$$

I know the chi-squared distribution is a special case of the gamma distribution, but could not derive the chi-squared distribution for random variable $Y$. Any help, please?

## Some background

The $\chi^2_n$ distribution is defined as the distribution that results from summing the squares of $n$ independent random variables $\mathcal{N}(0,1)$, so: $$\text{If }X_1,\ldots,X_n\sim\mathcal{N}(0,1)\text{ and are independent, then }Y_1=\sum_{i=1}^nX_i^2\sim \chi^2_n,$$ where $X\sim Y$ denotes that the random variables $X$ and $Y$ have the same distribution (EDIT: $\chi_n^2$ will denote both a Chi squared distribution with $n$ degrees of freedom and a random variable with such distribution). Now, the pdf of the $\chi^2_n$ distribution is $$f_{\chi^2}(x;n)=\frac{1}{2^\frac{n}{2}\Gamma\left(\frac{n}{2}\right)}x^{\frac{n}{2}-1}e^{-\frac{x}{2}},\quad \text{for } x\geq0\text{ (and 0 otherwise).}$$ So, indeed the $\chi^2_n$ distribution is a particular case of the $\Gamma(p,a)$ distribution with pdf $$f_\Gamma(x;a,p)=\frac{1}{a^p\Gamma(p)}x^{p-1}e^{-\frac{x}{a}},\quad \text{for } x\geq0\text{ (and 0 otherwise).}$$ Now it is clear that $\chi_n^2\sim\Gamma\left(\frac{n}{2},2\right)$.

The difference in your case is that you have normal variables $X_i$ with common variances $\sigma^2\neq1$. But a similar distribution arises in that case: $$Y_2=\sum_{i=1}^nX_i^2=\sigma^2\sum_{i=1}^n\left(\frac{X_i}{\sigma}\right)^2\sim\sigma^2\chi_n^2,$$ so $Y$ follows the distribution resulting from multiplying a $\chi_n^2$ random variable with $\sigma^2$. This is easily obtained with a transformation of random variables ($Y_2=\sigma^2Y_1$): $$f_{\sigma^2\chi^2}(x;n)=f_{\chi^2}\left(\frac{x}{\sigma^2};n\right)\frac{1}{\sigma^2}.$$ Note that this is the same as saying that $Y_2\sim\Gamma\left(\frac{n}{2},2\sigma^2\right)$ since $\sigma^2$ can be absorbed by the Gamma's $a$ parameter.

## Note

If you want to derive the pdf of the $\chi^2_n$ from scratch (which also applies to the situation with $\sigma^2\neq1$ under minor changes), you can follow the first step here for the $\chi_1^2$ using standard transformation for random variables. Then, you may either follow the next steps or shorten the proof relying in the convolution properties of the Gamma distribution and its relationship with the $\chi^2_n$ described above.

• Nice description (+1). But I am doubtful when you say that $Y_2\sim\sigma^2\chi_n^2,$ probably it should be $Y_2=\sigma^2U,$ where $U\sim\chi_n^2.$ And finally, $f_{\sigma^2 U}(x;n)=f_{\chi^2}\left(\frac{x}{\sigma^2};n\right)\frac{1}{\sigma^2}.$
– kaka
Oct 12, 2014 at 2:24
• Thanks @kaka. On the first point, actually with the notation $\sigma^2\chi_n^2$ I am referring to the random variable that arises when you multiply a $\chi^2_n$ variable by $\sigma^2$, so both of us are saying the same... On the second point, recall that $f_{\chi^2}(x;n)$ is the notation I used to refer to the density of a $\chi^2_n$ (the parameter $n$ appears as a second argument). With your notation, the density of $\sigma^2\chi^2_n$ will read as $f_{\chi_n^2}(x;n)$, which is also OK, but you are repeating twice the $n$. Oct 12, 2014 at 2:33
• But in the very first equation you defined $\mathcal{X}_n^2$ as a distribution of $\sum_{i=1}^N X_i^2.$
– kaka
Oct 12, 2014 at 3:12
• Yes, and in the equation for $Y_2$ the $X_i$'s have variance $\sigma^2$, so $\frac{X_i}{\sigma}$ is like $X_i$ in the first equation. Oct 12, 2014 at 3:16
• $\chi_n^2$ denotes the Chi squared distribution function with $n$ degrees of freedom and also a random variable that follows such distribution. This is maybe an abuse of notation, but the meaning should be clear. I will edit the answer to clarify it nevertheless. Oct 12, 2014 at 3:36