# What is the joint probability mass function of $X$ and $Y$?

You repeatedly toss two fair coins together until both coins show heads. Let $$X$$ and $$Y$$ denote the number of heads resulting from the tosses of the first and second coin, respectively. What is the joint probability mass function of $$X$$ and $$Y$$? What are the marginal distributions of $$X$$ and $$Y$$? What is $$P(X=Y)$$?

suppose have to throw $$n$$ times in order to get $$(H,H)$$. X=x is the number of heads in the first coin and so $$Y=n-x$$. Therefore,

$$P(X=x,Y=y) = P(X=x, Y=n-x)$$

In other words, this is geometric with p=1/4 and $$x+y-1$$ trials before we observe $$HH$$. Thus,

$$P(X=x, Y=y) = (3/4)^{x+y-1} 1/4$$

Now,

$$P(X=x) = \sum_{y=1}^{n-x} (3/4)^{x+y-1} 1/4$$

and

$$P(Y=y) = \sum_{x=1}^{n-y} (3/4)^{x+y-1} 1/4$$

now, I get stuck in $$P(X=Y)$$. Do we need to sum over the diagonal?

I don't think we have $$X+Y=n$$.

We repeated throw two coins together until both show heads simultaneously, we don't stop tossing one of them at any point of time.

In each toss, we can get $$(H,H), (H,T), (T,H), (T,T)$$.

If $$X=x$$ and $$Y=y$$, it means we have $$x-1$$ times of $$(H,T)$$ and $$y-1$$ times of $$(T,H)$$, exactly one $$(H,H)$$ and it is possible to have as many $$(T,T)$$.

\begin{align} Pr(X=x, Y=y) &=(0.25)^{x-1}(0.25)^{y-1}(0.25) \sum_{i=0}^\infty(0.25)^i \\ &=(0.25)^{x+y-1}\cdot \frac{1}{1-0.25} \end{align}

From there, we can compute the marginal distributions of $$X$$ and $$Y$$ as well.

\begin{align} Pr(X=Y) &= \frac{1}{1-0.25}\sum_{x=1}^\infty (0.25)^{2x-1} \end{align}