# $X_i \sim e(\lambda_i), i = 1,2$ be independent. Show $P(X_1 > X_2) = \frac {\lambda_2}{\lambda_1 + \lambda_2}$ using the Law of Total Probability.

Let $X_1,X_2$ be independent, $X_i \sim e(\lambda_i)$ for $i=1,2$.

Find $G(x_2) = P(X_1 > x_2): \int^{\infty}_{x_2} \lambda_1 e^{-\lambda_1 x_1} \ d_{x_1} = e^{-\lambda_1 x_2}$

Now show $P(X_1 > X_2) = \frac {\lambda_2}{\lambda_1 + \lambda_2}$ using the Law of Total Probability: $P((X,Y) \in A) = E[G(Y)]$ where $\ G(y) = P((X,y) \in A \mid Y = y)$.

I have $P((X_1,X_2) \in (X_1 > X_2)) = E[G(X_2)]$ and $G(x_2) = P((X_1,x_2) \in (X_1 > x_2) \mid X_2 = x_2) = P(X_1 > x_2 \mid X_2 = x_2) = P(X_1 > x_2) = e^{-\lambda_1 x_2}$

So $E[G(X_2)] = \int^{\infty}_0 e^{-\lambda_1x_2} e^{-\lambda_2 x_2} \ dx_2 = \frac {e^{-x^2(\lambda_1 + \lambda_2)}} {-(\lambda_1 + \lambda_2)} ]^{\infty}_0 = \frac 1 {\lambda_1 + \lambda_2}$ but this is not the desired value.

$${\rm E}[G(X_2)]=\int_{\mathbb{R}} g(x_2)f_{X_2}(x_2)\,\mathrm dx_2=\int_0^\infty g(x_2)\color{red}{\lambda_2}\mathrm{e}^{-\lambda_2x_2}\,\mathrm dx_2$$
• Owww, I cannot believe are didn't see that. Also could you tell if these equalities are true: $P((X_1,x_2) \in (X_1 > x_2) \mid X_2 = x_2) = P(X_1 > x_2 \mid X_2 = x_2) = P(X_1 > x_2) = e^{-\lambda_1 x_2}$ ? I'm a bit insecure on them, especially because the area $A$ is determined by $X_1,X_2$ so it is not a fixed area ?? – user141901 Apr 10 '14 at 11:53
• Exactly, you want $A$ to be a "fixed" area. Let $A=\{(x,y)\in\mathbb{R}^2\mid x>y\}$ and write $P((X_1,x_2)\in A\mid X_2=x_2)=\cdots$ instead. The rest of your reasoning is fine (note that you're using the independence here). – Stefan Hansen Apr 10 '14 at 11:58
• Ahh thanks a lot. So I get $$P((X_1,x_2) \in A \mid X_2 = x_2) = P(X_1 > x_2 \mid X_2 = x_2) = P(X_1 > x_2)$$ where the last inequality follows by independence. – user141901 Apr 10 '14 at 12:08
You can do the following \begin{align*}P(X_1>X_2)&=\int_{X_2}P(X_1>X_2|X_2=x_2)f_{X_2}(x_2)~dx_2=\int_{X_2}P(X_1>x_2)f_{X_2}(x_2)~dx_2=\\\\&=\int_{0}^{+\infty}(1-F_{X_1}(x_2))f_{X_2}(x_2)~dx=\int_{0}^{+\infty}e^{-λ_1x_2}λ_2e^{-λ_2x_2}~dx_2=\\\\&=λ_2\int_{0}^{+\infty}e^{-(λ_1+λ_2)x_2}~dx_2=λ_2\cdot \frac{1}{λ_1+λ_2}=\\\\&=\frac{λ_2}{λ_1+λ_2}\end{align*} Actually the first equation is the law of total probability in the continuous case.