I have the following random variables
$X = $ number of trials needed to obtain the first head
$Y = $ number of trials needed to get two heads
in repeated tosses of a fair coin. How I cand find the joint distribution of $X,Y$? I think that $X$ is a geometric, and $Y$ a negative binomial, because do we want the second success in a certain number of trials, although this would also be a possible geometric? I had thought that the joint is $$ p_{X,Y}(x,y) = \frac{1}{2^x} \binom{y-1}{2-1} \frac{1}{2^{2}} \frac{1}{2^{y-2}}, \quad x = 1,2,...; y = x+1,x+2,... $$ but $\displaystyle \sum_{x =1} \sum_{ y = x+1} p_{X,Y}(x,y) \neq 1$. Somebody could help me? greetings.
Yes. Those are the marginal distributions for these random variables. $${p_{\small X}(x)=2^{-x}\mathbf 1_{x\in[[1..\infty)]}\\[2ex]p_{\small Y}(y)=\binom{y-1}{1}2^{-y}\mathbf 1_{y\in[[2..\infty)]}}$$
However, the joint pmf is not simply the product of these marginals, as the random variables are not independent (the first head thrown must be less than the second head, which is a dependency.)
However, notice that if the first head occurs after $X$ trials then the second head will occur after $Y-X$ subsequent trials. So the conditional distribution of $Y-X$ for a given $X$ is geometric. Leading to:
$$p_{\small Y\mid X}(y\mid x) = 2^{-(y-x)}\,\mathbf 1_{(x,y)\in\Bbb Z^2:1\leq x\lt y}$$
And so...