# Understanding the connection between the chi-square and the gamma distribution

If $$Z_1,\ldots, Z_n$$ are independent standard normal random variables, then the random variable $$X = \sum_i Z_i^2$$ is said to have a chi-square distribution with $$n$$ degrees of freedom.

If you compute the moment generating function of $$X$$, you find (after a fair amount of calculation) that it is the moment generating function of a gamma random variable with parameters $$(n/2,1/2)$$. This shows that the chi-square distribution with $$n$$ degrees of freedom is the gamma distribution with parameters $$n/2$$ and $$1/2$$.

However, this result seems like a complete surprise to me. I did not see that coming. Is there any reason to expect this result to be the case, or any way to more directly or intuitively understand this connection between chi-square and gamma random variables?

Let $$\Phi(x)$$ be a CDF of the standard normal distribution. If you calculate the PDF of $$Z_1^2$$ you will get $$f_{Z_1^2}(t)=\left(\Phi(\sqrt{t})-\Phi(-\sqrt{t})\right)'=\frac{1}{2\sqrt{t}}\left(f_{Z_1}(\sqrt{t})+f_{Z_1}(-\sqrt{t})\right)=\frac{f_{Z_1}(\sqrt{t})}{\sqrt{t}}$$ due to the symmetry of distribution. Note that this is a PDF of Gamma distribution with parameters $$\frac12$$ and $$\frac12$$.
Therefore, it is not surprising that the sum of independent $$Z_1^2,\ldots,Z_n^2$$ again has a Gamma distribution. When we sum up independent r.v.'s that have Gamma distributions with the same second parameter, the result is still Gamma distributed and the first parameters are summed up. So, $$Z_1^2+\ldots+Z_n^2 \sim \textrm{Gamma}\biggl(\underbrace{\frac12+\ldots+\frac12}_n,\,\,\frac12\biggr)=\textrm{Gamma}\left(\frac{n}{2},\frac12\right)$$