# Is it reasonable to calculate $P(X_1 = X_2)$ given that $X_1$ and $X_2$ are continuous random variables?

To be specific, suppose $X_1$ and $X_2$ are independent exponential random variables with parameters $\lambda_1$ and $\lambda_2$; what is $P(X_1 = X_2)$?

According to section 5.2.3 of the book "Introduction to Probability Models" by Sheldon M.Ross (the 10th edition), $P(X_1 < X_2) = \frac{\lambda_1}{\lambda_1 + \lambda_2}$. Symmetrically, $P(X_1 > X_2) = \frac{\lambda_2}{\lambda_1 + \lambda_2}$.

$$P(X_1 < X_2) = \int_{0}^{\infty} P(X_1 < X_2 \mid X_1 = x) \lambda_1 e^{-\lambda_1 x}dx \\ = \int_{0}^{\infty} P(x < X_2) \lambda_1 e^{-\lambda_1 x}dx \\ = \int_{0}^{\infty} e^{-\lambda_2 x} \lambda_1 e^{-\lambda_1 x}dx \\ = \int_{0}^{\infty} \lambda_1 e^{-(\lambda_1 + \lambda_2) x}dx = \frac{\lambda_1}{\lambda_1 + \lambda_2}.$$

My Problems:

1. Can I now conclude that $P(X_1 = X_2) = 1 - P(X_1 < X_2) - P(X_1 > X_2) = 0$?
2. I am confused about the argument because of the fact that the probability that a continuous random variable will take on any particular value is zero. Is it reasonable to calculate the probability that the two variables simultaneously take on the same particular value?
3. If so, how to calculate $P(X_1 = X_2)$ directly, in the same way used in the calculation of $P(X_1 < X_2)$? Furthermore, can this calculation be applied to all continuous random variables?
• Your confusion is more basic: given any continous random variable (say, $X$ exponential) is $P(X=x)=0$? – leonbloy May 19 '14 at 13:48
• @leonbloy Isn't it? As I understand it, the claim that the probability that a continuous random variable will take on any particular value is zero is exactly about this. Do I miss or misunderstand something? – hengxin May 19 '14 at 13:56

## 2 Answers

It can be confusing to think of an event such as $\{X_1=X_2\}$, since both sides are random; perhaps it will be easier to think about it a little differently.

Instead of considering the event that $X_1=X_2$, let's consider the (clearly equivalent) event that $X_1-X_2=0$. Note that $X_1-X_2$ is just another random variable -- and, in particular, since $X_1$ and $X_2$ both have densities, and are independent, it is not hard to show that $X_1-X_2$ also has a density.

We can compute that density, $f_{X_1-X_2}$, explicitly by considering cases:

If $x\geq0$, then $$f_{X_1-X_2}(x)=\int_x^{\infty}f_{X_1}(t)\cdot f_{X_2}(t-x)\,dt=\frac{\lambda_1\lambda_2e^{-\lambda_1x}}{\lambda_1+\lambda_2},$$ while for $x<0$ we have $$f_{X_1-X_2}(x)=\int_{-\infty}^{x}f_{X_1}(x-t)\cdot f_{X_2}(-t)\,dt=\frac{\lambda_1\lambda_2e^{\lambda_2x}}{\lambda_1+\lambda_2}.$$

where $f_{X_1}$ and $f_{X_2}$ are the densities for $X_1$ and $X_2$, respectively.

But, since $X_1-X_2$ has a density, it is a continuous random variable -- and so the probability that it takes any particular value is $0$.

• I notice that before computing the density $f_{X_1 - X_2}$, you first claim that it exists. Could you please give some explanations? As a non-mathematical student, I often tend to forget and misunderstand such rigorous things. – hengxin May 19 '14 at 14:44
• If you want to do that, it can be done by considering CDF's; you can show that if $A$ and $B$ are independent random variables (think $X_1$ and $-X_2$) then $C=A+B$ has CDF $F_C(z)=\mathbb{E}[F_A(z-B)]$. (The thought process is that $A+B\leq z$ if and only if $A\leq z-B$.) You could compute this, then show that it is nicely differentiable... and voila. – Nick Peterson May 19 '14 at 14:50
1. Yes.
2. Yes.
3. Your confusion appears to be the following. If $X_1,X_2$ are continuously distributed random variables then $X_1-X_2$ may or may not be continuously distributed. If $X_1-X_2$ is continuously distributed then $\Pr(X_1=X_2)=0$. If it is not continuously distributed then it can be anything. For instance, suppose that $X_1$ has a $N(0,1)$ distribution, $Z$ has a Bernoulli (0/1) distribution with $p=0.5$ and $X_2=X_1+Z$. Then $X_1,X_2$ have continuous distributions but $\Pr(X_1=X_2)=0.5$.
• Interesting points and nice example! Never thought that the difference of two continuous random variables could be discrete; it is quite clear after your explanation. If I want to calculate $P(X_1 = X_2)$ directly, how should I go further with $P(X_1 = X_2) = \int_{0}^{\infty} P(X_1 = X_2 \mid X_1 = x) \lambda_1 e^{-\lambda_1 x}dx = \int_{0}^{\infty} P(X_2 = x) \lambda_1 e^{-\lambda_1 x}dx$? Could I substitute in $P(X_2 = x) = 0$ directly? Is this mathematically rigorous? – hengxin May 19 '14 at 14:16
• The natural thing to do would be to derive the distribution function of $Z=X_1-X_2$, i.e. $$\Pr(Z\leq z)=\int_0^z \Pr(X_1\leq z-x) f_{X_2}(x) dx$$ and then check if there is a jump at $z=0$. In your case there isn't. – JPi May 19 '14 at 14:53
• What would a jump at $z = 0$ imply? – hengxin May 19 '14 at 15:02
• That there is a mass point at zero. The jump is $\Pr(Z=0)$. – JPi May 19 '14 at 15:03