# Expectation and covariance of a gamma distribution.

Assume that the conditional distribution of $U$, given $L$ is uniform over the interval $[0,L]$ and $L$ itself has the gamma-distribution with the density described below.

\begin{equation} \text{Density} = \begin{cases} f(y) = y e^{–y} & \text{for }y > 0 \\ f(y) = 0 & \text{elsewhere} \end{cases} \end{equation}

A. What is the expectation of $U$?

B. What is the covariance between $U$ and $Y = L – U$?

I really need help understanding where to start with this problem. How does conditional distribution affect my answer? I don't understand the whole "given $L$ is uniform over the interval..." part. Any help is greatly appreciated.

• Given $L$ means that, once you have knowledge of $L$ (let us say $L=5$) then $U$ "suddenly" becomes a uniform distribution $U\sim Uniform [0,5]$. Hint: Use the "tower property" of the conditional expectation, i.e. $E[U] = E[E[U|L]]$ – Martingalo Feb 12 '14 at 21:07
• Ok that makes sense. So whatever L is, U is a uniform distribution from 0 to L. Now what do I do with the density? Do I take the integral of f(y) from 0 to L? – YoungGrasshopper Feb 12 '14 at 21:18

## 1 Answer

$U$ given $L$ means $U|L$, that is $U$ conditioned we know the value of $L$. For instance, we let $L$ be realized, and obtain $L=2$, then $U\sim Uniform [0,2]$.

We do not knot how $U$ is distributed without any previous knowledge on $L$. Therefore, it is convenient to condition on $L$ to compute $E[U]$ and use the "Tower" property" of the conditional expectation. So

\begin{align*} E[U] &= E[E[U|L]] = E[E[Unif(0,L)]] = E[\frac{L}{2}] = \frac{1}{2} E[L] = \frac{1}{2}2 =1 \end{align*} where I used that $$E[L] = \int_0^\infty y^2 e^{-y}dy = 2.$$ (see also mean of a gamma distribution)

Finally, to compute the covariance you can use the formula: $$Cov(U,L-U) = E[(U-E[U])(L-U - E[L-U])]$$ and you will just need $E[U]$, $E[L]$ which we have computed and $E[LU]$ and $E[U^2]$ which you can compute by conditioning on $L$ as we just did.

• I almost understand what your saying. I am just getting confused going from E[E[Unif(0,L)]] to E[L/2]. Also When your giving E[L] = inf is that y^2 a typo? where did the y^2 come from? – YoungGrasshopper Feb 12 '14 at 21:22
• Yes, because the mean of a uniform distribution is the middle point, so $E[U|L] = E[Uniform(0,L)]=\mbox{middle point of (0,L)} = L/2$. Then finally take the outer expectation to obtain $E[U] = E[E[U|L]]= E[L/2] = 2/2 =1$. The expectation is defined as "integral of "y" times density function" So $y*(ye^{-y}) = y^2 e^{-y}$ and then integrate over the domain of $y$ which is $y>0$ or also $(0,\infty)$. – Martingalo Feb 12 '14 at 21:24