Simplifying the proof of a beta distribution variance

beta functionprobabilityprobability distributions

I would have thought this was a common question but I couldn't find an existing question, so sorry for duplicates.

I'm trying to do a "show that" question on the variance, but I noticed I can't really simplify my answer so there's gotta be somewhere in my approach where i missed a step.

Note $a=\alpha, b=\beta$

I'm using $Var(X) = E(X^2) – E(X)^2$ with $E(X^2) = \frac{\Gamma(a+b)\Gamma(a+b+2)}{\Gamma(a)\Gamma(b)\Gamma(a+2)\Gamma(b)}$ simplified to $\frac{\Gamma(a+b)(a+b+1)(a+b)\Gamma(a+b)}{\Gamma(a)\Gamma(b)\Gamma(b)(a+1)(a)\Gamma(a)}$and $E(X)^2 = (\frac{\Gamma(a+b)(a+b+1)(a+b)\Gamma(a+b)}{\Gamma(a)\Gamma(b)\Gamma(b)(a+1)(a)\Gamma(a)})^2$ so my answer is basically to factor one of those out (call it Z since it's so hard to write) so $Var(X)= Z(1-Z)$ but it's still a ridiculously large equation considering the mean was $\frac{a}{a+b}$

Best Answer

Something is not correct with your calculation. Note that for a beta distribution with shape parameters $a, b > 0$, we have $$\int_{x=0}^1 \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} x^{a-1} (1-x)^{b-1} \, dx = 1.$$ Then $$\begin{align*} \operatorname{E}[X^2] &= \int_{x=0}^1 \frac{\color{red}{\Gamma(a+b)}}{\color{red}{\Gamma(a)\Gamma(b)}} x^2 x^{a-1} (1-x)^{b-1} \, dx \\ &= \frac{\color{red}{\Gamma(a+b)}\color{blue}{\Gamma(a+2)}}{\color{blue}{\Gamma(a+b+2)}\color{red}{\Gamma(a)}} \int_{x=0}^1 \frac{\color{blue}{\Gamma(a+b+2)}}{\color{blue}{\Gamma(a+2)}\color{red}{\Gamma(b)}} x^{(a+2)-1} (1-x)^{b-1} \, dx \\ &= \frac{\Gamma(a+b)\Gamma(a+2)}{\Gamma(a+b+2)\Gamma(a)}, \end{align*}$$ since the integrand in the second step is simply a beta density with shape parameters $a+2$ and $b$, thus the integral evaluates to unity. Note I have color coded the gamma function factors so that you can see how they are moved around. The blue factors were introduced in such a way as to maintain the original equality (they cancel out) and their values were chosen so that the integrand would integrate to $1$, and the red factors are from the original beta density.

Your result does not match because you seem to have improperly factored out the gamma functions.

Further calculation yields $$\frac{\Gamma(a+b)\Gamma(a+2)}{\Gamma(a+b+2)\Gamma(a)} = \frac{(a+1)a}{(a+b+1)(a+b)},$$ and from here the variance calculation is straightforward.