# Expected Value of Gamma Distribution

If $$X \sim \text{Gamma}(\alpha,\beta)$$, how would I go about finding $$E\left(\frac 1{X^2}\right)$$?

• Please add the [self-study] tag & read its wiki. Then tell us what you understand thus far, what you've tried & where you're stuck. We'll provide hints to help you get unstuck. – gung - Reinstate Monica Feb 25 '16 at 21:37
• I tried simplifying the integral, but I can't seem to find anyway to simplify it. – TJ Phu Feb 25 '16 at 21:50
• Could you give us some more details about what you attempted? You may find it useful to know you can write maths using Latex by enclosing it in $...$ - see our editing help – Silverfish Feb 25 '16 at 22:02
• Maybe you guys hurried up to pur this question on hold as off-topic. I have a hunch that he only tried integration by party and by substitution without using any intrinsic property of gamma function. Of course that is my own humble opinions and I don't want to act as TJ Phu advocate. – Adam Przedniczek Feb 26 '16 at 11:40
• Related question about finding $E[X^{-1}]$. – Dilip Sarwate Feb 26 '16 at 14:22

I would go about it the lazy way: by starting with a definition and looking hard at what ensues, in order to see whether somebody has already shown me the answer. In what follows no calculations are needed at all, and only the very simplest rules (of exponents and integrals) are required to follow the algebra.

Let's begin with the Gamma distribution. Choose a unit of measurement of $X$ in which $\beta = 1$, so that we may fairly say $X$ has a $\Gamma(\alpha)$ distribution. This means the density is positive only for positive values, where the probability density element is given by

$$f_\alpha(x)dx = \frac{1}{\Gamma(\alpha)} x^{\alpha} e^{-x} \frac{dx}{x}.$$

(If you're curious, the expression $dx/x$ is explained at https://stats.stackexchange.com/a/185709. If you don't like it, replace $x^\alpha dx/x$ by $x^{\alpha-1} dx$.)

Recall that the normalizing constant is there to make the integral of $f_\alpha(x) dx$ unity, whence we can deduce that

$$\Gamma(\alpha) = \Gamma(\alpha)(1) = \Gamma(\alpha)\int_0^\infty f_\alpha(x) dx = \frac{\Gamma(\alpha)}{\Gamma(\alpha)}\int_0^\infty x^{\alpha} e^{-x} \frac{dx}{x} = \int_0^\infty x^{\alpha} e^{-x} \frac{dx}{x}.\tag{1}$$

It doesn't matter what number $\Gamma(\alpha)$ actually is. It suffices to see that it is well-defined and finite provided $\alpha\gt 0$ and otherwise diverges.

Now let's turn to the rules for expectation. The "law of the unconscious statistician" says the expectation of any function of $X$, such as $X^p$ for some power $p$, is obtained by integrating that function of $x$ against the density:

$$E[X^p] = \int_0^\infty x^p \frac{1}{\Gamma(\alpha)} x^{\alpha} e^{-x} \frac{dx}{x}.$$

It's time to stare. Ignoring the integral, the integrand is a simple enough expression. Let's simplify it using the rules of algebra and, in the process, move that constant value of $1/\Gamma(\alpha)$ out of the integral:

$$E[X^p] = \frac{1}{\Gamma(\alpha)} \int_0^\infty x^{p+\alpha} e^{-x} \frac{dx}{x}.\tag{2}$$

That should look awfully familiar: it's just like another Gamma distribution density function, but with the power $p+\alpha$ instead of $\alpha$. Equation $(1)$ tells us immediately, with no further thinking or calculation, that

$$\int_0^\infty x^{p+\alpha} e^{-x} \frac{dx}{x} = \Gamma(p+\alpha).$$

Plugging this into the right hand side of $(2)$ yields

$$E[X^p] = \frac{\Gamma(p+\alpha)}{\Gamma(\alpha)}.$$

It looks like we had better have $p+\alpha \gt 0$ in order for this to converge, as noted previously.

As a double-check, we may use our formula to compute the first few moments and compare them to, say, what Wikipedia says. For the mean we obtain

$$E(X^1) = \frac{\Gamma(1+\alpha)}{\Gamma(\alpha)} = \alpha$$

and for the second (raw) moment,

$$E(X^2) = \frac{\Gamma(2+\alpha)}{\Gamma(\alpha)} = \alpha(\alpha+1).$$

Consequently the variance is $$E(X^2) - E(X)^2 = \alpha(\alpha+1) - \alpha^2 = \alpha.$$

These results agree perfectly with the authority. There are no convergence problems because since $\alpha\gt 0$, both $\alpha+1 \gt 0$ and $\alpha+2 \gt 0$.

You may now safely plug in $p=-2$ and draw your conclusions about the original question. Remember to check the conditions under which the answer exists. And don't forget to change the units of $X$ back to the original ones: that will multiply your answer by $\beta^p$ (or $\beta^{-p}$, depending on what whether you think $\beta$ is a scale or a rate).

Assuming you're concerning random variable of Gamma distribution with shape $\alpha > 0$ and rate $\beta > 0$ parameters, that is $X \sim Gamma(\alpha,\beta)$, you can find $\mathbb{E}[\frac{1}{X^2}]$ in the following manner:

For any random variable X of continuous distribution (like Gamma) for which $f$ denotes its probability density function (in your example $f(x) = \frac{\beta^{\alpha}}{\Gamma(\alpha)} x^{\alpha - 1}e^{- \beta x}$) and for any function $g$ of this variable (in your case $g(x) = \frac{1}{x^2} = x^{-2}$), it holds: $$\mathbb{E}[g(x)] = \int\limits_{-\infty}^{+ \infty}g(x)f(x)dx$$

In your example, it simplifies very much (pay attention on $-3$): $$g(x)f(x) = \frac{\beta^{\alpha}}{\Gamma(\alpha)} x^{\alpha - 3}e^{- \beta x}$$ The fraction doesn't depend on $x$, so it can be put outside an integral.

By the way, for discrete distribution it's very similar: $$\mathbb{E}[g(x)] = \sum\limits_{x \in \mathcal{X}} g(x)f(x), ~~\text{where}~\mathcal{X}~\text{denotes support for X (set of values it can take)}$$

I won't keep you in suspense any longer. First of all, recall that $\Gamma(\alpha+1) = \alpha \cdot \Gamma(\alpha)$.

Let $f_{\alpha}(x) = \frac{\beta^{\alpha}}{\Gamma(\alpha)} x^{\alpha - 1}e^{- \beta x}$. Combining these two results in a straightforward observation: $$x \cdot f_{\alpha}(x) = \frac{\alpha}{\beta} \cdot f_{\alpha+1}(x)$$ Consecutively: $$\frac{f_{\alpha+1}(x)}{x} = \frac{\beta}{\alpha} \cdot f_{\alpha}(x)$$ Using this twice, you will get the result:

$$\frac{f_{\alpha}(x)}{x^2} = \frac{\beta}{\alpha-1} \cdot \frac{f_{\alpha-1}(x)}{x} = \frac{\beta}{\alpha-1} \cdot \frac{\beta}{\alpha-2} \cdot f_{\alpha-2}(x)$$ Ultimately (as $f_{\alpha-2}(x)$ is also PDF which integral equals $1$): $$\mathbb{E}(\frac{1}{X^2}) = \int\limits_{-\infty}^{+\infty} \frac{f_{\alpha}(x)}{x^2} dx = \frac{\beta}{\alpha-1} \cdot \frac{\beta}{\alpha-2} \cdot \int\limits_{-\infty}^{+\infty} f_{\alpha-2}(x) dx = \frac{\beta}{\alpha-1} \cdot \frac{\beta}{\alpha-2}$$ This solution above is for this particular case, but as whuber pointed out, the more general case for any real and positive $p \in \mathbb{R},~p >0$ it holds: $$\mathbb{E}(X^p) = \beta^p \cdot \frac{\Gamma(\alpha + p)}{\Gamma(\alpha)}$$

• @TJ Phu Let us know with what you reallly have problem, maybe with computing this integral? Anyway, let us know. However, try to follow gung and Silverfish comments and improve the overall layout of the question. – Adam Przedniczek Feb 25 '16 at 22:49
• @TJ Phu Maybe my very first remark about doing raw integration was a bit misleading. Let me know whether you completly understand my solution (simply by accepting /ticking my or whuber answer). – Adam Przedniczek Feb 26 '16 at 8:57