# Probability of two random variables being equal

The question is as follows:

Let $X_1$ ~ Binomial(3,1/3) and $X_2$ ~ Binomial(4,1/2) be independent random variables. Compute P($X_1$ = $X_2$)

I'm not sure what it means to compute the probability of two random variables being equal.

• Would it help if the question said: "Let $Y=X_1-X_2$. Compute $P(Y=0)$"? Nov 20 '15 at 8:25
• How would this work with a continuous uniform distribution? Aug 17 '20 at 17:58

The probability that $X_1=X_2$ is the probability that both are zero, plus the probability that both are one, plus the probability that both are two, and so on.

• $\sum_x P(X_1 = x) P(X_2 = x)$
– ACE
Nov 20 '15 at 4:39

Let $Z=X_1-X_2$

$P(Z=z)=\sum_{x_1=z+x_2}^\infty P(X_1=x,X_2=x-z)$ (since $X_1$ and $X_2$ are independent)

$P(Z=z)=\sum_{x_1=z+x_2}^\infty P(X_1=x)P(X_2=x-z)\\=\sum_{x_1=z+x_2}^\infty \binom{3}{x}(\frac{1}{3})^x(\frac{2}{3})^{3-x}\binom{4}{4-x+z}(\frac{1}{2})^{x-z}(\frac{1}{2})^{4-x+z}$

When $X_1=X_2\Rightarrow z=0$

Therefore

$P(Z=0)=\sum_{x_1=x_2}^\infty \binom{3}{x}(\frac{1}{3})^x(\frac{2}{3})^{3-x}\binom{4}{4-x+0}(\frac{1}{2})^{x-0}(\frac{1}{2})^{4-x+0}\\=\binom{3}{0}(\frac{1}{3})^0(\frac{2}{3})^{3-0}\binom{4}{4-0+0}(\frac{1}{2})^{0-0}(\frac{1}{2})^{4-0+0} \quad (x_1=x_2=0)\\+\binom{3}{1}(\frac{1}{3})^1(\frac{2}{3})^{3-1}\binom{4}{4-1+0}(\frac{1}{2})^{1-0}(\frac{1}{2})^{4-1+0}\quad(x_1=x_2=1)\\+\binom{3}{2}(\frac{1}{3})^2(\frac{2}{3})^{3-2}\binom{4}{4-2+0}(\frac{1}{2})^{2-0}(\frac{1}{2})^{4-2+0}\quad(x_1=x_2=2)\\+\binom{3}{3}(\frac{1}{3})^3(\frac{2}{3})^{3-3}\binom{4}{4-3+0}(\frac{1}{2})^{3-0}(\frac{1}{2})^{4-3+0}\quad(x_1=x_2=3)$

Ok, you can add up them to get the probability.

And remember for binomial distribution the random variable is total number of success. In your case $X_1$ and $X_2$ can be both 0, 1,2,3 for the total number of success of the two distribution.This answer in fact the same as the answer by Daniel and comment by ACE.