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

• Your code suggests $X_i$ are exponentially distributed. This affects the answer Commented Jul 8, 2019 at 15:06
• I understand that the distribution is exponential. The law of larger numbers tells us that this sequence converges to $2/\lambda$ Commented Jul 8, 2019 at 15:07
• @Henry Yes, they are exponentially distributed. Commented Jul 8, 2019 at 15:09
• This works for an exponential distribution. It would not work for a distribution with zero mean, such as a standard normal distribution Commented Jul 8, 2019 at 15:30

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.

• This is really a fine answer from the scratch, I love it. Commented Jul 9, 2019 at 2:18

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

• Have you used $E(X_1/X_2) = E(X_1)/E(X_2)$? Commented Jul 8, 2019 at 15:19
• @喵喵是我的猫猫 - No. I have used $X_1 \to c$ and $X_2 \to d$ where $c$ and $d$ are non-zero constants to say $X_1/X_2 \to c/d$, i.e convergence to a constant. I have not looked at $E(X_1/X_2)$ Commented Jul 8, 2019 at 15:29

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.

• SLLN is not quite enough in general. You need something along the lines of uniform integrability to pass from pointwise convergence to convergence in mean. You have that here, but it is not guaranteed.
– Ian
Commented Jul 8, 2019 at 15:12
• Are you calculating the denominator and numerator separately? Commented Jul 8, 2019 at 15:15
• @喵喵是我的猫猫 Yes, which is OK for computing the a.s. limit because $f(x,y)=x/y$ is continuous away from $y=0$. But that doesn't get you the convergence in mean. Slutsky's theorem gets you convergence in distribution, which technically doesn't give you convergence in mean but it does get you convergence of the means, which is really all you want here.
– Ian
Commented Jul 8, 2019 at 17:13