What is the mean value of $(X_1^2+X_2^2+\cdots X_N^2)/(X_1+X_2 + \cdots +X_N)$ Consider $N$ independent exponential distributed random variables $X_1, X_2, \cdots X_N$ with same parameter $\lambda$. What is the expected value of random variable, suppose N is very large:
$$
 X=\frac{X_1^2+X_2^2+\cdots X_N^2}{X_1+X_2 + \cdots +X_N}
$$
By computer simulation, I found the answer is $2/\lambda$. The code is simple enough, however, due to so many random variables, I don't know how this problem can be formulated in simple analytical means. Here is the code:
In [1]: import numpy as np

In [3]: ar = np.random.exponential(size=10000)

In [4]: ar.mean()
Out[4]: 0.9996274823304305

In [5]: ar.dot(ar)/ar.sum()
Out[5]: 1.970052388599698

 A: Here is an exact derivation for finite $n$. We first use the integral identity
$$z^{-1} = \int_0^{\infty} e^{-zs} ds $$ 
which is valid for $z > 0$. Furthermore, it follows that 
$$\mathbb{E}\left[ \frac{X_1^2}{X_1 + \cdots + X_N} \right] = \mathbb{E}\left[ \frac{X_2^2}{X_1 + \cdots + X_N} \right] = \cdots = \mathbb{E}\left[ \frac{X_N^2}{X_1 + \cdots + X_N} \right] $$
by symmetry so it suffices to find only one of the above expected values and multiply by $N$ at the end.
Now,
$$ \mathbb{E}\left[ \frac{X_1^2}{X_1 + \cdots + X_N}  \right] = \int_0^{\infty} \mathbb{E}[X_1^2e^{-(X_1 + \cdots + X_N)s}] \ ds = \int_0^{\infty} \mathbb{E}[X_1^2e^{-sX_1}] \mathbb{E}[e^{-sX_2}] \cdots \mathbb{E}[e^{-sX_N}] \ ds.$$
Note that moving the expected value inside the integral is justified since everything is non-negative. Now using the pdf of the exponential distribution, we can compute the following two quantities easily:
$$ \mathbb{E}[e^{-sX_i}] = \frac{\lambda}{\lambda + s} $$
and 
$$ \mathbb{E}[X_1^2e^{-sX_1}] = \frac{2\lambda}{(\lambda + s)^3}.$$
So altogether, we have
$$\mathbb{E}\left[ \frac{X_1^2}{X_1 + \cdots + X_N} \right] = 2\lambda^n \int_0^{\infty} \frac{1}{(s+\lambda)^{n+2}} \ ds =  \frac{2}{\lambda (n+1)}.$$
Therefore, our desired value is $\frac{2n}{\lambda(n+1)}.$ Non asymptotic results are much nicer :P.
A: Supposing that $X_i \sim expo.(\lambda)$, you can use the strong law of large numbers. So $\sum_{i=0}^NX_i^2 \to_{a.s} E[X^2] = \frac{2}{\lambda^2}$ and $\sum_{i=0}^NX_i \to_{a.s} E[X] = \frac{1}{\lambda}$. By taking the ratio, you will find your answer.
This can be seen as an application of the Slutsky's theorem. 
A: Assuming the $X_i$s have non-zero expectation $\mu$ and variance $\sigma^2$, both finite, then by the law of large numbers 


*

*$\frac1N (X_1^2+\cdots X_N^2) \to \sigma^2 +\mu^2$

*$\frac1N (X_1+\cdots X_N) \to \mu$ which is then non-zero


so $\frac{X_1^2+X_2^2+\cdots X_N^2}{X_1+X_2 + \cdots +X_N} \to \frac{\sigma^2}{\mu}+\mu$
For an exponential random variable with rate $\lambda$, 
you have $\mu=\frac{1}{\lambda}$ and  $\sigma^2=\frac{1}{\lambda^2}$, 
so  $\frac{\sigma^2}{\mu}+\mu = \frac{2}{\lambda}$ as you found empirically
