# Finding $P(X = Y)$

I have the following problem:

Let $$X$$ and $$Y$$ be independent random variables taking values in the positive integers and having the same mass function $$P(X = k) = P(Y = k) = 2^{−k}$$ for $$k = 1, 2, \dots$$

Find $$P (X = Y)$$.

My solution is as follows:

\begin{align} P(X = Y) &= P(X = x, Y = y) \\ &= P(X = x) P(Y = y) \ \ \text{(Since X and Y are independent.)} \\ &= \sum_{k = 1}^\infty 2^{-2k} \\ &= 2^{-2} \sum_{k = 1}^\infty 2^{-2(k - 1)} \\ &= \left( 2 \sum_{k = 1}^\infty 2^{k - 1} \right)^{-2} \end{align}

Then I used the formula for an infinite geometric series $$\sum_{n = 1}^\infty ar^{n - 1} = \dfrac{a}{1 - r}$$, where $$a = 1$$ and $$r = 2$$, to get $$\left( 2 \dfrac{1}{1 - 2} \right)^{-2} = (-2)^{-2} = \dfrac{1}{4}$$. However, according to the solution, this is incorrect, and the correct solution is

\begin{align} P(X = Y) &= P(X = x, Y = y) \\ &= P(X = x) P(Y = y) \ \ \text{(Since X and Y are independent.)} \\ &= \sum_{k = 1}^\infty 2^{-2k} \\ &= 2^{-2} \sum_{k = 1}^\infty 2^{-2(k - 1)} \\ &= 2^{-2} \dfrac{1}{1 - 2^{-2}} \\ &= \dfrac{1}{4} \dfrac{4}{3} \\ &= \dfrac{1}{3} \end{align}

It seems that I made an error in going from $$2^{-2} \sum_{k = 1}^\infty 2^{-2(k - 1)}$$ to $$\left( 2 \sum_{k = 1}^\infty 2^{k - 1} \right)^{-2}$$? Did I make an algebraic error by factoring out the $$-2$$ to the exponent?

But I'm also confused about how the author used to formula for geometric series in their solution.

I would greatly appreciate it if people could please take the time to clarify this.

• Yes that's the error. Exponents don't distribute over sums so you can't take the $-2$ from the summation out. Think about $2^{-2} (3^{-2} + 5^{-2})\neq (2(3+5))^{-2}$ – Osama Ghani Oct 30 '19 at 14:24
• You can apply the formula for infinite geometric series directly. This for $a=\frac14=r$. – drhab Oct 30 '19 at 14:27
• @OsamaGhani But see this problem: math.stackexchange.com/questions/3414830/… \begin{align} P( \min\{X, Y\} < x ) &= 1 - P( \min\{X, Y\} > x ) \\ &= 1 - P(X > x, Y > y) \ \ \text{(Joint PMF.)} \\ &= 1 - P(X > x) P(Y > y) \ \ \text{(Since X and Y are independent.)} \\ &= 1 - \sum_{k > x} 2^{-k} \sum_{k > y} 2^{-k} \ \ \text{(By the definition of PMF for X and Y.)} \\ &= 1 - \left( \sum_{k > x} 2^{-k} \right)^2 \ \ \text{(Since X and Y have the same PMF.)} \end{align} Wasn't the same thing done here with $2$? – The Pointer Oct 30 '19 at 14:27
• @ThePointer No. $\{\min(X,Y)>0\}$ and $\{X=Y\}$ are distinct events. – drhab Oct 30 '19 at 14:29
• The statement $P(X=Y)=P(X=x,Y=y)$ is not correct. You should rather write \begin{align} P(X=Y)&=P\left[\bigcup\limits_{k=1}^\infty\{X=k,Y=k\}\right] \\&=\sum_{k=1}^\infty P(X=k,Y=k) \\&=\sum_{k=1}^\infty P(X=k)P(Y=k)=\sum_{k=1}^\infty(P(X=k))^2 \end{align} – StubbornAtom Oct 30 '19 at 14:53

The very first equality is wrong $$P(X=Y)\neq P(X=x,Y=y)$$. You are calculating the probability, that $$(X,Y)$$ is in the set $$\{(x,y)\in \mathbb{R}^2 \: | \: x=y\}$$. This probability can be calculated using the law of total probability:
\begin{align*} P(X=Y) &= \sum_{k=1}^\infty P(X=Y \: | \: Y=k)P(Y=k) \\ &= \sum_{k=1}^\infty P(X=k \: | \: Y=k)P(Y=k) \\ &= \sum_{k=1}^\infty P(X=k)P(Y=k) \quad \text{by independence } \\ &= \sum_{k=1}^\infty 2^{-2k} \end{align*} From here we apply the geometric series formula and obtain the result.
For the question about factoring recall that $$\sum a_k^{-2}=\frac{1}{a_1^2}+\frac{1}{a_2^2} + ...$$, which is very different from $$(\sum a_k)^{-2}= \frac{1}{(a_1+a_2+a_3...)^2}.$$