Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose $X_1$ and $X_2$ are iid random variables. I want to determine $P(X_1=X_2)$.

If they are integer-valued random variables, then $$P(X_1=X_2) = \sum_{i \in \mathbb{Z}} P_{X_1,X_2}(i,i) = \sum_{i \in \mathbb{Z}} P_{X_1}(i)^2. $$

If they are continuous random variables, then $$P(X_1=X_2) = \int_{x \in \mathbb{R}} f_{X_1,X_2}(x,x) dx = \int_{x \in \mathbb{R}} f_{X_1}(x)^2 dx. $$ But when $X_1$ and $X_2$ are uniformly distributed over $[0,1)$, $$P(X_1=X_2) = \int_{x \in \mathbb{R}} f_{X_1}(x)^2 dx = \int_{x \in [0,1)} 1 dx = 1. $$ Intuitively it is not possible, since $P(X_1\neq X_2) > 0$. So is there some mistake I have made? Thanks!

share|cite|improve this question
i know a fair share of probability,but just seem to forget .. wats iid variables? – Bhargav Sep 12 '11 at 2:49
Hint: $\mathbb P(X_1 = X_2) = \mathbb E 1_{(X_1 = X_2)}$. Now, apply this (carefully) to your example... – cardinal Sep 12 '11 at 2:51
I think the expression $$\int_{\mathbb R} f_{X_1, X_2}(x,x) dx $$ is the density of the distribution of the RV $X_1 - X_2$ at $0$. It is not the probability that $X_1 - X_2 = 0$. (Actually, if these distributions are nice and continuous, then we will expect this "collision" probability to be $0$.) – Srivatsan Sep 12 '11 at 2:51
@Srivatsan: I'd write that as an answer more or less. – anon Sep 12 '11 at 2:55
@Srivatsan: Thanks! For some integral of a density function of a random vector, how can one tell if the integral is the density of some r.v. at some value, or the probability of some other r.v. at some value? Is it told from whether the dimension of the integral is strictly less than the dimension of the original random vector? – Tim Sep 12 '11 at 3:54
up vote 7 down vote accepted

No, your calculation for the continuous case is wrong. It should be $ P(X_1 = X_2) = \displaystyle\iint_D f_{X_1}(x) f_{X_2}(y)\ dx \ dy$, where $D = \{(x,y) \in {\mathbb R}^2: x = y\}$. But $D$ has two-dimensional measure (i.e. area) $0$, so the answer is $0$.

share|cite|improve this answer
Thanks! But it is not intuitively easy to understand why the probability for discrete case may not be zero, while it is zero for continuous case? – Tim Sep 12 '11 at 3:07
Well, @Tim, the same reason why a random chosen number from the interval $[0,1]$ has a zero probability of being exactly $0$. – Srivatsan Sep 12 '11 at 3:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.