Exponentially distributed random variables Given two exponentially distributed random variables $ X_1 $ and $X_2$ (assuming rates $\lambda_1$ and $\lambda_2$ respectively), determine the probability that one is smaller than the other.
So basically, I need to find $P(X_1<X_2)$ which is equivalent to $P(X_2 = x)$ AND $P(X_1 < X_2)$ which can be written as $P(X_1 < X_2 | X_2 = x)\times P(X_2 = x)$.
In reality $P(X_1 < X_2 | X_2 = x) = 1 - e^{-\lambda_1x} $ while $P(X_2 = x) = \lambda_2e^{-\lambda_2x}$.
My professor went a step further and said that:
$P(X_1 < X_2) = \int_0^{\infty}P(X_1 < X_2 | X_2 = x)P(X_2 = x)dx = \int_0^{\infty}(1 - e^{-\lambda_1x})\lambda_2e^{-\lambda_2x}dx $ 
Questions:


*

*Is writing $P(X_1 < X_2 | X_2 = x)P(X_2 = x)$  instead of $P(X_1 < X_2)P(X_2 = x)$ really necessary when we're assuming that the random variables are independent?

*More importantly, why do we have to integrate the product at all? and why from 0 to $\infty$?


Thanks for your help!
 A: Since your question (1) does not rely on any particular distribution, to make the notation valid, let's assume both $X_1, X_2$ are discrete. Now, both need to be tied to the same $x$ somehow, so you can write
$$
\mathbb{P}[X_1<x] \cdot \mathbb{P}[X_2=x]
$$
instead and it will work ok. Although the original form clearly shows where you are coming from, whereas in this second one, that requires one skipped step...
For the second one, he really should integrate over all possible values of $x$, but since $X_2$ is exponential, $\mathbb{P}[X_2 < 0] = 0$ so you are safe restricting to the non-negatives.
EDIT To address the question in the comments, why is the integral needed. Basically, if the variables are discrete, $\mathbb{P}[X_1 < X_2]$ when $X_2 = x$ and $X_1 < x$ for any value of $x$, so you want to sum all of them. In other words,
$$
\mathbb{P}[X_1 < X_2]
 = \sum_{x = -\infty}^\infty \mathbb{P}[X_1 < x] \mathbb{P}[X_2 = x]
 = \sum_{x = -\infty}^\infty F_1(x) f_2(x),
$$
which for continuous random variables becomes
$$
\int_{x = -\infty}^\infty F_1(x) f_2(x) dx
$$
