TITLE: Finding $E\left[\frac{\sum_{i=1}^n X_i^2}{(\sum_{i=1}^n X_i)^2}\right]$ of a sample of gamma random variables
QUESTION [8 upvotes]: Suppose $X_1,\ldots,X_n$ is a random sample from the $\Gamma(k,\lambda)$ distribution where $\lambda$
is unknown and $k$ is a positive integer and known. How can I find $$E\left[\frac{\sum_{i=1}^n X_i^2}{(\sum_{i=1}^n X_i)^2}\right] \>?$$

REPLY [15 votes]: Sasha gives a very nice answer. Here is an alternative using standard relationships between distributions. I, too, will assume that the $X_i$ are independent.
Write $\newcommand{\Beta}{\mathrm{B}}Y_i = \frac{X_i}{X_i + \sum_{i\neq j} X_j}$. 
Then, $Y_i \sim \mathrm{Beta}(k,(n-1)k)$ since $X_i \sim \Gamma(k,\lambda)$ and $\sum_{i \neq j} X_j \sim \Gamma((n-1)k,\lambda)$ and the latter two are independent.
By linearity of expectation and the fact that each $Y_i$ has a common distribution, we have
$$
\mathbb E\left(\frac{\sum_{i=1}^n X_i^2}{(\sum_{i=1}^n X_i)^2}\right) = n \mathbb E Y_1^2 \>.
$$
But,
$$
\mathbb E Y_1^2 = \frac{1}{\Beta(k,(n-1)k)} \int_0^1 y^2 y^{k-1} (1-y)^{nk-k-1} \,\mathrm dy = \frac{\Beta(k+2,(n-1)k)}{\Beta(k,(n-1)k)} = \frac{k+1}{n(nk + 1)} \>.
$$
So,
$$
\mathbb E\left(\frac{\sum_{i=1}^n X_i^2}{(\sum_{i=1}^n X_i)^2}\right) = \frac{k+1}{nk + 1} \>.
$$