# If $X$ is a continuous random variable and $Y$ is a discrete random variable, is $P(X=Y) = 0$?

I have a general question. Lets say I have $2$ random variables

$X$ - Continuous Random Variable

$Y$ - Discrete Random Variable

For all $X$,$Y$ is $P(X=Y) = 0$ ?

• What if the law of X has atoms? – Michele Triestino Mar 4 '15 at 11:29
• @MicheleTriestino If $X$ is continuos then it does not have atoms. – Ant Mar 4 '15 at 11:31
• @Ant: I had doubts on the definition of continuous rv, so I prefered to leave a comment that could either lead to a counterexample or provide the key step of the proof ;) – Michele Triestino Mar 4 '15 at 11:35

Let $n$ be all the values taken upon by $Y$, that is $P(Y=n) \neq 0$. Note that there can be at most a countable number of such $n$, so that we can use below the probability axioms.(On the third equality)

$$P(X = Y) = P(\{\omega: X(\omega) = Y(\omega)\}) = P\left(\bigcup_n \{\omega: X(\omega) = n, Y(\omega) = n\}\right) =$$$$=\sum_n P(\{\omega: X(\omega) = n, Y(\omega) = n\})$$

But $$\{\omega: X(\omega) = n, Y(\omega) = n\} \subset \{\omega: X(\omega) = n\} \implies$$$$P(\{\omega: X(\omega) = n, Y(\omega) = n\})\le P(\{\omega: X(\omega) = n\}) = 0$$

Hence $$P(X = Y) = \sum_n P(\{\omega: X(\omega) = n, Y(\omega) = n\}) = 0$$

• Thanks, it is also true about 2 Continuous Random Variables right? – Lee Mar 4 '15 at 11:39
• @Lee No in that case it's not true. (Take X = Y continuos. $P(X=Y) = 1$) The problem is that we cannot write the set $X=Y$ as countable union of sets, so it all fall apart at the very beginning :) – Ant Mar 4 '15 at 11:41
• Yeah if they are equal its not true, but if for example $X$~ $Y$ ~ $U(0,1)$? – Lee Mar 4 '15 at 11:45
• @Lee You need some form of independence. Without independence, you cannot say much. It could be that they are not equal but still have a nonzero probability to be equal. – Yoni Rozenshein Mar 4 '15 at 11:50
• @Lee If they are independent then it is true, as their joint distribution is the product of their distribution, this means that every set of Lebesgue measure $=0$ on the plane will have probability $0$. And of course the line $X=Y$ has $0$ measure. On the other hand without independence I don't think one can arrive at meaningful results :) – Ant Mar 4 '15 at 11:52

Let me give a proof without involving explicit computations, when the two rv are independent. Let us define the new random variable Z=X-Y: we will prove that the law of Z has no atoms (and actually absolutely continuous). Indeed, the law of Z correponds to the convolution of the law of X with the law of -Y. Now, when you consider a convolution of two functions, one of which is absolutely continuous, then this convolution is absolutely continuous. QED

• But it is still true if they are not independent right? – Lee Mar 4 '15 at 12:03
• No, it is not always true (well, if you suppose Y discrete yes, it is). – Michele Triestino Mar 4 '15 at 14:59