# Covariance of $X^2$ and $X^3$ when $X$ is exponentially distributed

Here is my work....

\begin{align*} Cov(Y,Z) &= E(YZ) - E(Y)E(Z)\\ &= E(X^2\cdot X^3) - E(X^2)E(X^3)\\ &= E(X^5) - E(X^2)E(X^3) \end{align*}

And we know $E(X^n) = \frac{n!}{\lambda^n}$ so,

\begin{align*} Cov(Y,Z) &= \frac{5!}{\lambda^5} - \frac{2!}{\lambda^2}\cdot \frac{3!}{\lambda^3}\\ &= \frac{120}{\lambda^5} - \frac{12}{\lambda^5}\\ &= \frac{108}{\lambda^5} \end{align*}

Does this seem like it is correct? Thanks!

• It looks fine. Perhaps you are expected to do the integrations explicitly, or use the mgf. – André Nicolas Jul 28 '14 at 21:18
• $2!\cdot 3!$ is $12$ – Narut Sereewattanawoot Jul 28 '14 at 21:18
• @NarutSereewattanawoot whoops thanks! – user161154 Jul 28 '14 at 21:19
• Yes, but the final result is OK, so it's a typo. – André Nicolas Jul 28 '14 at 21:19
• If you prove the equation $${\rm E}[X^n] = n!/\lambda^n,$$ then your solution should be completely satisfactory as stated. You could do it with an MGF but it is just as valid to do the integration directly and appeal to the gamma function or gamma distribution. – heropup Jul 28 '14 at 21:22

Your answer looks right, though maybe you want to prove the identity $E(x^n) = {n! \over \lambda^n}$. If you want a funky proof (assuming x ~ $\lambda e^{-\lambda x}$):

$$E(x^n) = \lambda \int^\infty_0 x^n e^{- \lambda x} dx \\ = \lambda \int^\infty_0 \left((-1)^n {d^n \over d \lambda^n} e^{-\lambda x} \right) dx\\ = (-1)^n \lambda {d^n \over d \lambda^n} \int^\infty_0 e^{-\lambda x} dx \\ = (-1)^n \lambda {d^n \over d \lambda^n} {1 \over \lambda} \\ = {n! \over \lambda^n}$$

The third line follows from the second because integration over x and differentiation WRT $\lambda$ is commutative.

• 1. What does $\frac{d^n}{d\lambda ^n}e^{- \lambda x}$ mean ? It is the nth differentiation of $e^{- \lambda x}$ w.r.t $\lambda ? \ \ \ \ \ \ \ \ \ \ \$ 2. And what is the relation between first line and the second line ? Thanks in advance. – callculus Jul 29 '14 at 2:26
• Yes, it means the nth derivative WRT $\lambda$. The second line follows from the first line simply by $\frac{d^n}{d \lambda^n} e^{-\lambda x} = (-1)^n x^n e^{-\lambda x}$. – Bridgeburners Jul 29 '14 at 13:46
• Now I've got it. Thanks. – callculus Jul 29 '14 at 14:01

It is correct.

If you try the R code

set.seed(2014)
cases  <- 1000000
lambda <- 10
X      <- rexp(cases, lambda)
cov(X^2, X^3)


you get $0.001079931$ which is closer to $\dfrac{108}{10^5}$ than you have any reasonable right to expect