How do you find the second moment of the beta distribution? I'm required to show $ E(Y^2) = \dfrac{\alpha(\alpha + 1)}{(\alpha + \beta + 1)(\alpha + \beta)} $ for the beta distribution using the definition of expectation.
Now so far I have $ \int\limits_0^1 {y^2  \dfrac{\Gamma\left( \alpha + \beta \right)}{\Gamma \left( \alpha \right)\Gamma \left( \beta \right)} y^{\alpha-1}(1-y)^{\beta-1} dy} $ and I simplified it so that I pulled the gamma constants out front of the integral and combined $ y^2y^{\alpha-1} $ to be $ y^{\alpha+1} $. I'm not too sure where to continue from here... can anyone help me out?
 A: Try looking at the kernel of the integral - in other words, ignore all the constant factors, focus on the bits involving the variable you are integrating with respect to.
Do you recognise it?
It's a good idea whenever you see the PDF of a distribution to pay attention to what its kernel is too. So forget about its normalization factor. Now, if a PDF can be written as the product of a normalizing factor $N$ and a kernel $k(x)$, then because I know:
$$\int_{-\infty}^{\infty}f_X(x)dx=N\int_{-\infty}^{\infty}k(x)dx=1$$
I also know that:
$$\int_{-\infty}^{\infty}k(x)dx=\frac{1}{N}$$
So, learn to recognize your PDF kernels! If you see an integral with the same kernel, but a different constant factor, then you can easily evaluate it:
$$\int_{-\infty}^{\infty}A\cdot k(x)dx=\frac{A}{N}$$
Extra hint: the beta distribution has support [0, 1] so we only need our integrals to have those limits. If $X \sim Beta (\alpha,\, \beta)$ then $f_X(x)=\frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha)\Gamma(\beta)}x^{\alpha -1}(1-x)^{\beta -1}$ so the kernel is just $x^{\alpha -1}(1-x)^{\beta -1}$.
You have $ \int\limits_0^1 {y^2  \dfrac{\Gamma\left( \alpha + \beta \right)}{\Gamma \left( \alpha \right)\Gamma \left( \beta \right)} y^{\alpha-1}(1-y)^{\beta-1} dy} $ which has kernel $y^{\alpha+1}(1-y)^{\beta-1} $. Which PDF is this the kernel of, and with what parameters?
A: You need to know the "beta function integral":
$$ \int_0^1 y^{a-1}(1-y)^{b-1}\,dy = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}. $$
This is also exactly how the normalization factor for the beta distribution is calculated, and also why the distribution is called the beta distribution.
A: If you want also to calcualate it when you applied the function between xmax and , xmin; e.g: a grain distribution
delta= xmax-xmin
gross moment = (delta^2) B(a+2,b)/B(a,b) +2*delta*xmin B(a+1,b)/B(a,b) + (xmin^2)= M20.
If you want to calculate the baricentric  2nd order moment; Variance; then
M10= delta* B(a+1)/B(a,b) +xmin =µ is the first gross moment
Then Variance (V) you could calculate it with the Pitagoric relationship or the Steiner law of Inertial Moment
V= M20 -µ^2 
For the nth gross moment you have to arrange the Integral expression as we do with the Gamma distribution.
But now we have for the kth gross moment
Mk0 = Integral(0,1) [dX f(a,b)*(X*delta+xmin)^k]
f(a,b) =X^(a-1)* (1-X)^(b-1)/B(a,b)
A piece of advice: Note the difference between X and x
