Assume that $X$ is $Exp(\lambda)$ distributed and $Y$ is $Exp(\mu)$, and they are independent. I want to know how I can calculate $P(X<Y)$. I don't understand why
$$ P(X < Y)=\int_{-\infty}^\infty P(X<Y|X=x)\cdot f_X(x)dx, $$
where $f_X$ is the density of $X$.
Assuming $X$ and $Y$ are independent with pdfs $f_X(x)$ and $f_Y(y)$ we have \begin{align} P\{X<Y\}&=\int_{y=-\infty}^{\infty}\left(\int_{x=-\infty}^{y}f_X(x)dx\right)f_Y(y)dy\\ &=\int_{y=-\infty}^{\infty}F_X(y)f_Y(y)dy \end{align} where $F_X(x)$ is the CDF of $X$.