Mean And Variance Of Beta Distributions

By definition, the Beta function is $B(\alpha,\beta) = \int_0^1 x^{\alpha - 1} (1-x)^{\beta - 1}\ dx$ where $\alpha, \beta$ have real parts $ > 0$ (but in this case we're talking about real $\alpha, \beta > 0$). This is related to the Gamma function by $$ B(\alpha,\beta) = \dfrac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)}$$ Now if $X$ has the Beta distribution with parameters $\alpha, \beta$, $$\mu = E[X] = \dfrac{\int_0^1 x^{\alpha} (1-x)^{\beta-1}\ dx}{B(\alpha,\beta)} = \dfrac{B(\alpha+1,\beta)}{B(\alpha,\beta)} = \dfrac{\Gamma(\alpha+1) \Gamma(\beta)}{\Gamma(\alpha+\beta+1)} \dfrac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} = \dfrac{\alpha}{\alpha+\beta}$$ using the identity $\Gamma(t+1) = t \Gamma(t)$. Similarly $$ \sigma^2 + \mu^2 = E[X^2] = \dfrac{B(\alpha+2,\beta)}{B(\alpha,\beta)} = \dfrac{\alpha(\alpha+1)}{(\alpha+\beta)(\alpha+\beta+1)}$$ from which $$\sigma^2 = \dfrac{\alpha\beta}{(\alpha+\beta)^2 (\alpha+\beta+1)}$$


If you know that $$ \int_0^1 x^{\alpha-1}(1-x)^{\beta-1}\, dx = \frac{\Gamma(\alpha)\Gamma(\beta)}{\Gamma(\alpha+\beta)} $$ and if you also know that $$ \alpha\Gamma(\alpha)=\Gamma(\alpha+1), $$ then you've got what you need. It follows that $$ f(x) = \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}x^{\alpha-1}(1-x)^{\beta-1} $$ is a probability density on $[0,1]$.

Now suppose you want the expected value of the second power of a random variable with this distribution. That is $$ \begin{align} \int_0^1 x^2 f(x)\,dx & =\int_0^1 x^2\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}x^{\alpha-1}(1-x)^{\beta-1}\,dx \\[12pt] & = \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)} \int_0^1 x^{(\alpha+2)-1} (1-x)^{\beta-1} \,dx. \end{align} $$ Now you have the SAME integral whose value was mentioned earlier, except that it has $\alpha+2$ where $\alpha$ appeared earlier. So its value is $$ \frac{\Gamma(\alpha+2)\Gamma(\beta)}{\Gamma((\alpha+2)+\beta)}. $$ Now do the multiplication: $$ \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}\cdot\frac{\Gamma(\alpha+2)\Gamma(\beta)}{\Gamma((\alpha+2)+\beta)} = \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha+\beta+2)}\cdot\frac{\Gamma(\alpha+2)}{\Gamma(\alpha)} $$ $$ =\frac{1}{(\alpha+\beta)(\alpha+\beta+1)}\cdot\alpha(\alpha+1). $$

Now recall that $$ \operatorname{var}(X)=\operatorname E(X^2) - (\operatorname E X)^2 $$ and do the algebraic simplifications.

Remeber that if your bottom line is not symmetric in the two parameters $\alpha$ and $\beta$, then something's wrong.