Question

Calculate the mean and variance of a Gamma random variable with parameters `alpha` and `lambda`.

Answer

PDF of Gamma distribution with parameters `alpha` and `lambda` is `g(x,alpha,lambda)={(1/(lambda^(alpha) Gamma(alpha)) x^(alpha-1)e^(-x/(lambda)) if x>0 quad alpha>0 quad lambda>0),(0 quad otherwise):}`,

where `Gamma(alpha)=int_0^(oo) x^(alpha-1)e^(-x)dx` which has following property: `Gamma(alpha+1)=alpha Gamma(alpha)`.

So, `mu=E(X)=int_0^(oo) x*1/(lambda^(alpha) Gamma(alpha)) x^(alpha-1)e^(-x/(lambda))=1/(lambda^(alpha) Gamma(alpha)) int_0^(oo)x^(alpha)e^(-x/lambda)dx`.

Let `y=x/lambda` then `dy=1/lambda dx` or `dx=lambda dy`. Since `x` is changing from 0 to `oo` then `y` is changing also from 0 to `oo`.

Thus, integral can be rewritten as `1/(lambda^alpha Gamma(alpha))int_0^(oo) (y lambda)^(alpha) e^(-y) lambda dy=lambda/(Gamma(alpha))int_0^(oo) y^(alpha)e^(-y)dy=(lambda)/(Gamma(alpha)) Gamma(alpha+1)=lambda/(Gamma (alpha))alpha Gamma(alpha)=alpha lambda`.

Now, `E(X^2)=int_0^(oo) x^2*1/(lambda^(alpha) Gamma(alpha)) x^(alpha-1)e^(-x/(lambda))=1/(lambda^(alpha) Gamma(alpha)) int_0^(oo)x^(alpha+1)e^(-x/lambda)dx`.

Let `y=x/lambda` then `dy=1/lambda dx` or `dx=lambda dy`. Since `x` is changing from 0 to `oo` then `y` is changing also from 0 to `oo`.

Thus, integral can be rewritten as `1/(lambda^alpha Gamma(alpha))int_0^(oo) (y lambda)^(alpha+1) e^(-y) lambda dy=(lambda^2)/(Gamma(alpha))int_0^(oo) y^(alpha+1)e^(-y)dy=`

`=(lambda^2)/(Gamma(alpha)) Gamma(alpha+2)=(lambda^2)/(Gamma (alpha))(alpha+1) Gamma(alpha+1)=(lambda^2)/(Gamma(alpha))(alpha+1) alpha Gamma(alpha)=alpha(alpha+1) lambda^2`.

Finally, `Var(X)=E(X^2)-(E(X))^2=alpha(alpha+1)lambda^2-(alpha lambda)^2=alpha lambda^2`.

Answer: `E(X)=alpha lambda` and `Var(X)=alpha lambda^2`.