# Variance Derivation of Chi-Squared Distribution

If we find the MGF of $$Z^2$$ where $$Z \sim N(0,1)$$ we find that $$M_{Z^2}(t) = (1-2t)^{-.5}$$ for $t < .5.$

Consider that a chi squared distributed variable $X$ with $r$ degrees of freedom is the sum of $r$ iid standard normal variables squared.

ie: $$X \sim \chi^2(r) = \sum_{j=0}^r Z_j^2$$ where $$Z_j \sim N(0,1)$$ are independent

therefore the mgf of chi squared is $$M_X(t) = (1-2t)^{-r/2}$$ Then $$M'_X(t) = -r/2\cdot-2r(1-2t)^{-r/2-1} = r(1-2t)^{-r/2-1}$$ so $$E(X) = r(1) =r$$

And then $$M''_X(t) = r\cdot-r/2\cdot-2r(1-2t)^{-r/2-2} = r^2 (1-2t)^{-r/2-2}$$ so $$E(X^2) = r^2$$ But this implies that $$Var(X) = E(X^2) - (E(X))^2 = r^2 - r^2 = 0$$ Which is obviously false as the variance of chi squared depends on $r.$

Where is the mistake in my derivation?

• $E(X^2) = r(r+2).$ Look for your mistake there. Then $Var(X) = r(r+2) - r^2 = 2r,$ which is correct. – BruceET Jan 26 '18 at 21:00
• @BruceET Oh thank you! I keep doing derivations wrong everytime I have to use the moment generating function. It's such a simple mistake too. – Matthew Ciaramitaro Jan 26 '18 at 21:03
• Generally, as you use MGFs to fine $E(X^k)$ for large $k,$ the successive derivatives get ever messier. See my Comment on your Answer as a potential way to simplify this particular problem. – BruceET Jan 26 '18 at 21:20

I fixed the proof based on BruceET's comment on the question. It is correct as follows.

If we find the MGF of $$Z^2$$ where $$Z \sim N(0,1)$$ we find that $$M_{Z^2}(t) = (1-2t)^{-.5}$$ for $t < .5.$

Consider that a chi squared distributed variable $X$ with $r$ degrees of freedom is the sum of $r$ iid standard normal variables squared.

ie: $$X \sim \chi^2(r) = \sum_{j=0}^r Z_j^2$$ where $$Z_j \sim N(0,1)$$ are independent

therefore the mgf of chi squared is $$M_X(t) = (1-2t)^{-r/2}$$ Then $$M'_X(t) = -r/2\cdot-2r(1-2t)^{-r/2-1} = r(1-2t)^{-r/2-1}$$ so $$E(X) = r(1) =r$$

And then $$M''_X(t) = r\cdot -(r/2 + 1) \cdot -2r(1-2t)^{-r/2-2} = (r^2 + 2r) (1-2t)^{-r/2-2}$$ so $$E(X^2) = r^2 +2r$$ And this implies that $$Var(X) = E(X^2) - (E(X))^2 = r^2 + 2r - r^2 = 2r$$ Which is the correct result.

• (+1) But it may be easier to let $Y=Z^2$ has $E(Y) = 1, Var(Y)=2.$ Then use $X = Y_1 + \cdots Y_r \sim \mathsf{Chisq}(r)$ and conclude $E(X) = r$ and $Var(X) = 2r.$ – BruceET Jan 26 '18 at 21:12