find probability of two coins tossed Throw coins until the head comes out twice.  It is assumed that the probability that head comes
 out is p and the probability that the tail comes out $q = 1-p$.
the random variables X and Y denote, respectively the number of trial required until the first and second heads are observed. 
 . At this time, the simultaneous probability distribution of $(X,Y)$ is 
given as follows. 
$P(X=m,Y=n) = p^2q^{n-2},    m =1,2,3,....n-1 , n=2,3....$
$0\text{ otherwise}$


*

*Find the probability distribution
of $X$ and the probability distribution of $Y$.


$P(x=m,y=n)=(1-p)^{m-1}p(1-p)^{n-m-1}p$
$P(Y=n)=\sum_{m=1}^{n-1}P(x=m,y=n)=(n-1)p^2(1-p)^{n-2}$ because m is max at n-1


*Find $P (X = m | Y = n)= P (X = m,Y = n) / P (Y = n)$ and show that it is not related to $m$. 


$P(x=m|y=n)=\frac{(1-p)^{m-1}p(1-p){n-m-1}}{P(Y=n)}$
$P(Y=n)=\sum_{m=1}^{n-1}P(x=m,y=n)=(n-1)p^2(1-p)^{n-2}$ because m is max at n-1
$P(x=m|y=n)=\frac{(1-p)^{m-1}p(1-p){n-m-1}}{(n-1)p^2(1-p)^{n-2}}=(n-1)^{-1}$
since its geometric distribution, its memoryless, so its not related to $m$(?)


*If $Z = Y-X$, find the probability
distribution of $Z$ and show that $X$ and $Z$ are independent. 


im not sure how can i find this pmf z in discrete joint distributions?
should i make table?
 A: The probability distribution of $X$ is the geometric one that counts the number of trials needed to arrive at a success. This equipped with parameter $p$:$$P(X=m)=q^{m-1}p$$ where $m\in\{1,2,\dots\}$. I cannot find this in your attempt.
The probability distribution of $Y$ can be recognized as a sort of negative binomial distribution also counting the number of trials. This time the number of trials needed for reaching $2$ successes, and with:$$P(Y=n)=\sum_{m=1}^{n-1}P(X=m,Y=n)=(n-1)p^2q^{n-2}$$
for $n\in\{2,3,4,\dots\}$. This part you did okay.
Also you stated correctly that $P(X=m\mid Y=n)=\frac1{n-1}$ for every integer $n\geq2$ and every $m\in\{1,\dots,n-1\}$.
For finding the probability of $Z=Y-X$ be aware of the fact that $Z$ is the number of trials needed to arrive at the second succcess if we start our counting exactly after arriving at the first success. First we count until the first success is reached ($X$ trials needed). Then after this we start counting again (and anew) until the second success arrives ($Z$ trials needed for that). Evidently $X$ and $Z$ have the same probability distribution and also the new counting is not bothered or influenced by the result of the first. This means: $X$ and $Z$ are independent.
