# How to find $\mathbb{E}(X\mid\mathbf{1}_{X<Y})$ where $X,Y$ are i.i.d exponential variables?

Given that $X,Y\stackrel{\text{i.i.d.}}{\sim}\text{Exp}$ with mean $\lambda(>0)$ and $Z=\mathbf{1}_{X<Y}$, what is $\mathbb{E}(X\mid Z=z)$ ?

We have $Z=1$ with probability $\Pr(X<Y)$ and $Z=0$ with probability $1-\Pr(X<Y)$.

But $\Pr(X<Y)=\frac{1}{2}$ as $X$ and $Y$ are i.i.d. random variables.

Does this mean I can simply say that $Z\sim\text{Ber}\left(\frac{1}{2}\right)$ ?

Then, $\mathbb{E}(X)=\mathbb{E}(X\mid Z=0)\times\frac{1}{2}+\mathbb{E}(X \mid Z = 1) \times \frac{1}{2}$

$\implies2\lambda=\mathbb{E}(X\mid Z=0)+\mathbb{E}(X\mid Z=1)$.

But I cannot conclude anything from here. I couldn't find the conditional distribution of $X\mid Z$ either. Maybe I have to condition on another variable $U$ so that $\mathbb{E}(X\mid Z)=\mathbb{E}\,[\mathbb{E}(X\mid Z,U)\mid Z]$.

$$\mathbb E[X\mid X<Y]=\frac{\mathbb E[X\mathbf 1_{X<Y}]}{\mathbb P(X<Y)}=2\mathbb E[X\mathbf 1_{X<Y}].$$ To find expectation of any measurable function $g(X,Y)$ of pair of independent r.v.'s $X$ and $Y$ with pdf's $f_X(x)$ and $f_Y(y)$, use Law of the unconscious statistician: $$\mathbb E[g(X,Y)] = \iint g(x,y)f_X(x)f_Y(y)\,dx\,dy.$$ So, $$\mathbb E[X\mathbf 1_{X<Y}] = \int\limits_0^\infty \int\limits_0^\infty x\mathbf 1_{x<y} f_X(x)f_Y(y)\,dx\,dy = \ldots = \frac{\lambda}{4}$$ So, $$\mathbb E[X\mid X<Y]= \frac{\lambda}{2}.$$ You can do the same for $\mathbb E[X\mid X>Y]$.

On the other side, you can notice that $$\mathbb E[X\mid X<Y]=\mathbb E[\min(X,Y)],$$ $$\mathbb E[X\mid X>Y]=\mathbb E[\max(X,Y)]$$ and find these expectations from distributions of $\min(X,Y)$ and $\max(X,Y)$.

• No. $\mathbb E[X|\mathbf 1_{X<Y}=1]=\mathbb E[X|X<Y]$.
– NCh
Mar 3, 2018 at 15:49
• @StubbornAtom No. $\mathbb E(X\mid\mathbf1_{X<Y})$ is a random variable, but $\mathbb E(X\mid X<Y)$ is only a real number. We do have $\mathbb E(X\mid\mathbf1_{X<Y}=1)=\mathbb E(X\mid X<Y)$ Mar 3, 2018 at 15:49
• Ah thanks. I was trying to compute the conditional expectation for any $Z=z$, which is not possible. One has to do it separately for $z=0$ and $z=1$. Mar 3, 2018 at 16:07
• Note this conspicuous typographical difference: $$2\mathbb E[X\mathbf 1_{X<Y}] \text{ versus } 2\operatorname{\mathbb E}[X\mathbf 1_{X<Y}]$$ The spacing to the left and right of things within \operatorname{} depends on the context. Mar 3, 2018 at 17:00
• @Did Thank you. I read not only the title and also the text of the question, which asks for calculation of $\operatorname{\mathbb E[X|Z=z]}$ (see yellow text). The above calculations are for $z=1$. If it is not quite clear, I am sorry.
– NCh
Mar 4, 2018 at 11:12

By definition, since $P(Z\in\{0,1\})=1$, $E(X\mid Z)$ is the random variable equal to $$E(X\mid Z)=E(X\mid Z=1)\mathbf 1_{Z=1}+E(X\mid Z=0)\mathbf 1_{Z=0}$$ and, for every $z$ in $\{0,1\}$, $E(X\mid Z=z)$ is the real number equal to $$E(X\mid Z=z)=\frac{E(X;Z=z)}{P(Z=z)}$$ In your case, $P(Z=1)=P(Z=0)=\frac12$ by symmetry.

To complete the formulas for $E(X\mid Z)$ and $E(X\mid Z=z)$, note that, by independence of $(X,Y)$, $$P(X<Y\mid X)=1-F_Y(X)=e^{-X/\lambda}$$ hence $$E(X;Z=1)=E(X;X<Y)=E(Xe^{-X/\lambda})=\int_0^\infty xe^{-x/\lambda}\,e^{-x/\lambda}\,dx/\lambda=\lambda/4$$ and $$E(X;Z=0)=E(X)-E(X;Z=1)=3\lambda/4$$

• Not that it helps solving the problem, but is the conclusion that $Z$ is Bernoulli correct? Mar 4, 2018 at 17:56
• Indeed $Z$ is Bernoulli, since $Z\in\{0,1\}$ almost surely. Every indicator random variable $\mathbf 1_A$ with $A$ measurable, is Bernoulli, and vice versa.
– Did
Mar 4, 2018 at 18:03

You're looking for both $\operatorname E(X\mid X<Y)$ and $\operatorname E(X\mid X>Y).$ Since the events $X<Y$ and $X>Y$ each have probability $1/2,$ the equally weighted average of these two conditional expected values must be $\lambda,$ so if you find one of them, you can quickly deduce the other.

\begin{align} \operatorname E(X\mid X<Y) & = \left. \iint\limits_{\{\, (x,y) \,:\, 0\,<\,x\,<\,y \,\}} x e^{-x/\lambda} e^{-y/\lambda}\, \frac{d(x,y)}{\lambda^2} \right/ \Pr(X<Y) \\[10pt] & = 2\int_0^\infty \left( \int_x^\infty xe^{-x/\lambda} e^{-y/\lambda} \, \frac{dy} \lambda \right) \, \frac{dx} \lambda \\[10pt] & = 2\int_0^\infty xe^{-x/\lambda} e^{-x/\lambda} \, \frac{dx} \lambda \\[10pt] & = 2\int_0^\infty x e^{-2x/\lambda} \, \frac{dx} \lambda \\[10pt] & = 2\int_0^\infty \left( \frac{2x} \lambda \right) e^{-2x/\lambda} \left( \frac{2\,dx} \lambda \right) \cdot\frac\lambda 4 \\[10pt] & = 2\int_0^\infty u e^{-u} \, du \cdot \frac \lambda 4 \\[10pt] & = \frac \lambda 2. \end{align}

• Interestingly, (correct) complete computations were posted one hour earlier on this page, and $E(X\mid X<Y)=\lambda/2$, not $\lambda/4$.
– Did
Mar 3, 2018 at 17:29
• @Did : I initially entirely forget to divide by $\Pr(X<Y),$ but now I have corrected that. Mar 3, 2018 at 17:51

For convenience let $\lambda=1$.

This can be repaired easily and our notations will be "cleaner".

$\mathsf P(\min(X,Y)>t)=\mathsf P(X>t)\mathsf P(Y>t)=e^{-2t}$ showing that $\min(X,Y)\sim\mathsf{Exp}(2)$.

$\mathsf E(X\mid Z=1)=\mathsf E(X\mid X<Y)=\mathsf E\min(X,Y)=0.5$.

$\mathsf E(X\mid Z=0)=\mathsf E(X\mid X>Y)=\mathsf E\max(X,Y)=\mathsf E[X+Y-\min(X,Y)]=1.5$.

So for $z\in\{0,1\}$ we found that:$$\mathsf E(X\mid Z=z)=1.5-z$$

Since $\mathsf P(Z\in\{0,1\})=1$ this justifies the conclusion that:$$\mathsf E(X\mid\mathbf1_{X<Y})=\mathsf E(X\mid Z)=1.5-Z$$

In the more general setting that will be:$$\mathsf E(X\mid\mathbf1_{X<Y})=\mathsf E(X\mid Z)=(1.5-Z)\lambda$$