# Conditional mean and variance with negative random variable

We have the following random variables

$X\sim ber(\frac{1}{3})$

$Y \sim exp(3) \ \text{given} \ \{X=0\}$

$-Y \sim exp(5) \ \text{given} \ \{X=1\}$

Now I have to determine the mean and variance of $Y$

This is my approach, first of all calculate mean and variance of $X$ which is Bernoulli distributed.

$$\mathbb{E}[X]=\frac{1}{3}$$ $$Var(X)=\frac{1}{3}\cdot\frac{2}{3}=\frac{2}{9}$$

Now we move on to the conditional mean and variance

$$Y \sim exp(3) \ \text{given} \ \{X=0\}$$

$$\mathbb{E}[Y|X]=\frac{1}{\lambda}=\frac{1}{3}\cdot X$$

$$\mathbb{E}[Y]=\mathbb{E}[\mathbb{E}[Y|X]]$$ $$\mathbb{E}\left[\frac{1}{3}\cdot X\right]$$ $$\frac{1}{3}\mathbb{E}[X]=\frac{1}{3}\cdot\frac{1}{3}=\frac{1}{9}$$

$$Var(Y)=\mathbb{E}[Var(Y|X)]+Var(\mathbb{E}[Y|X])$$ $$\mathbb{E}\left[\frac{1}{3}\cdot \frac{2}{3}\cdot X\right]+Var\left(\frac{1}{3}X\right)$$ $$\frac{2}{9}\cdot\mathbb{E}[X]+\frac{1}{9}Var(X)=\frac{2}{9}\cdot \frac{1}{3}+\frac{1}{9}\cdot \frac{2}{9}=\frac{8}{81}$$

But what do I have to do with $-Y$ I don't know how to integrate this random variable into my calculation.

The task is to get $\mathbb{E}[Y]$ and $Var(Y)$

• From $-Y|X=1\sim\text{Exp}(5)$, you should be able to find the distribution of $Y|X=1$. Jan 11, 2018 at 14:01

Hint: The density of $Y$ given $X=1$ is given by $$P(Y=y|X=1) \begin{cases} 0&y>0\\ \lambda e^{\lambda y}&y\leq0 \end{cases}$$ with $\lambda=5$.

$$E[Y]=\sum_xE[Y|X=x]P(X=x) = \frac13 E[Y|X=1]+\frac23E[Y|X=0]\\= \frac13\times(-\frac15)+\frac23\times \frac13$$

Assuming the density of $-Y|X=1$ is of the form $h(t)=5e^{-5t}\mathbf 1_{\{t\ge0\}}$,

you should be able to show that the density of $Y|X=1$ is given by $g(z)=5e^{5z}\mathbf 1_{\{z\le0\}}$.

If you are having trouble finding the mean and variance from the law of total expectation/variance, you can find the distribution of $Y$ directly.

By the total probability theorem, the density of $Y$ is given by

$$f_Y(y)=f_{Y|X=0}(y)\mathrm{Pr}(X=0)+f_{Y|X=1}(y)\mathrm{Pr}(X=1)$$

$$=\frac{5}{3}e^{5y}\mathbf 1_{\{y\le0\}}+2e^{-3y}\mathbf 1_{\{y>0\}}$$

You can find the mean and variance from this density.