# expectation of $\left(\sum_{i=1}^n {x_i} \right)^2$

If $x_i$ is exponentially distributed $(i=1,...,n)$ with parameter $\lambda$ and $x_i$'s are mutually independent, what is the expectation of

$\left(\sum_{i=1}^n {x_i} \right)^2$

in terms of $n$ and $\lambda$ and possibly other constants?

Note: This question has gotten a statistical answer on http://stats.stackexchange.com/q/4959/2148. The readers would take a look at it too.

-
Let $Z = \sum_{i=1}^{n} x_i$. Then it seems that you are asking for $E(Z^2)$. I think $Z$ has a hypo-exponential distribution. Here: en.wikipedia.org/wiki/Hypoexponential_distribution – PEV Nov 27 '10 at 15:03
@PEV $Z$ has a Gamma distribution as noted in the answer on stats.SE. – Dilip Sarwate Jul 2 '12 at 15:59

In what follows, $x_j$ are assumed to be independent.

$$E[x_0^2] = \int_0^{\infty} \lambda t^2 e^{-\lambda t} dt = \frac{2}{\lambda^2}$$

$$E[x_0 x_1] = \int_0^{\infty} \int_0^{\infty} \lambda^2 t_0 t_1 e^{-\lambda t_0} e^{-\lambda t_1 } dt_0 dt_1 = \frac{1}{\lambda^2}$$

$$E[ (\sum_{j=0}^{n-1} x_j)^2 ] = n E[ x_0^2] + n(n-1) E[x_0 x_1] = \frac{ n^2 + n }{ \lambda^2 }$$

-
The same question i've post on stats.stackexchange.com/q/4959/2148 got a simpler answer. I decided to delete this question, but is this answer wrong? what is the difference between them? – Isaac Nov 27 '10 at 17:19
There is no difference. Both get the exact same answer. – user4143 Nov 27 '10 at 17:46
@user4143: I like your neat answer which doesn't need much statistical background. Would you mind to resubmit this answer at this question stats.stackexchange.com/q/4959/2148 ? And as suggestion, please register to math.stackexchanges! we need you! ;) – Isaac Nov 27 '10 at 22:31

This problem is just a special case of the much more general problem of 'moments of moments' which are usually defined in terms of power sum notation. In particular, in power sum notation:

$$s_1 = \sum_{i=1}^{n} X_i$$

Then, irrespective of the distribution, the original poster seeks $E[s_1^2]$ (provided the moments exist). Since the expectations operator is just the 1st Raw Moment, the solution is given in the mathStatica software by:

[ The '___ToRaw' means that we want the solution presented in terms of raw moments of the population (rather than say central moments or cumulants). ]

Finally, if $X$ ~ Exponential($\lambda$) with pdf $f(x)$:

f = Exp[-x/λ]/λ;      domain[f] = {x, 0, ∞} && {λ > 0};


then we can replace the moments $\mu_i$ in the general solution sol with the actual values for an Exponential random variable, like so:

All done.

P.S. The reason the other solution posted here yields an answer with $\lambda^2$ in the denominator rather than the numerator is, of course, because it is using a different parameterisation of the Exponential distribution. Since the OP didn't state which version he was using, I decided to use the standard distribution theory textbook definition Johnson Kotz et al … just to balance things out :)

-