# Calculate conditional expectation of exponential variables

1. Sep 27, 2014

### obst12

1. The problem statement, all variables and given/known data
Let X and Y be independent exponential random variables with parameters a and b. Calculate E(X|X+Y).

2. Relevant equations

3. The attempt at a solution
I'm pretty sure I have it, just want to make sure.

Joint density for X and Y is abe^(-ax)e^(-by) for x,y>0. Let Z=X and W=X+Y so X=Z and Y=W-Z. The Jacobian is 1, so the joint density is

abe^(-az)e^(-bw+bz)=abe^(+bz-az) e^(-bw)

Marginal density for w is

\int_0^ w abe^(bz-az) e^(-bw) dz=ab(e^(bw-aw)-1) /(b-a)

So then conditional density is

(b-a)e^(bz-az) e^(-bw)/(e^(bw-aw)-1)

Then just integrate z from 0 to infinity to get
e^(-bw)/(1-e^(bw-aw))

Is this okay?

2. Sep 27, 2014

### Ray Vickson

No, it is not OK. Given $X+Y = w$, $X$ has range $[0,w]$; in your notation, $0 \leq (Z|W=w) \leq w$. Therefore, integrating out to $\infty$ is wrong. Also, your "conditional density" $f(z|w)$ for $(Z|W=w)$ looks incorrect a bit. Go back to square one and proceed very carefully. The correct final answer is more complicated than yours.

3. Sep 27, 2014

### obst12

Thanks. Let me try once more.

The joint density is
$abe^{-ax}e^{-by}$
Then making the substitution $X=Z$ and $Y=W-Z$.
$\rho_{Z.W}=abe^{-az}e^{-bw+bz}$
$\rho_{Z,W}=abe^{(b-a)z}e^{-bw}$

Thus the marginal density is
$\rho_W=\int_0^w abe^{(b-a)z}e^{-bw} dz$
$\rho_W=abe^{-bw} \int_0^w e^{(b-a)z} dz$
$rho_W=abe^{-bw} \frac{1}{b-a} (e^{(b-a)w}-1)$

And the conditional density is
$\rho_{Z|W}=abe^{(b-a)z}e^{-bw}\frac{1}{abe^{-bw} \frac{1}{b-a} (e^{(b-a)w}-1)}$
$\rho_{Z|W}=e^{(b-a)z}\frac{1}{\frac{1}{b-a} (e^{(b-a)w}-1)}$
$\rho_{Z|W}=e^{(b-a)z}\frac{b-a}{(e^{(b-a)w}-1)}$

Then integrate from $0$ to $w$

$\mathbb{E}(Z|W)=\int_0^w z e^{(b-a)z}\frac{b-a}{(e^{(b-a)w}-1)} dz$
$\mathbb{E}(Z|W)=\frac{b-a}{(e^{(b-a)w}-1)} \int_0^w z e^{(b-a)z} dz$
$\mathbb{E}(Z|W)=\frac{b-a}{(e^{(b-a)w}-1)} \frac{e^{(b-a)w}((b-a)w-1)+1}{(b-a)^2}$

Is this okay? Thanks for your help.

4. Sep 27, 2014

### Ray Vickson

Yes, it's OK, but it should be simplified a bit. You can make it look nicer by writing
$$E(X|X+Y=w) = \frac{e^{cw}(cw-1)+1}{c(e^{cw}-1)}, \: c = b-a$$

5. Sep 27, 2014

### obst12

Awesome, thanks for all your help!