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.
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}.$