Probability of first and second run of coin tosses A coin when flipped shows heads with probability $p$ and tails with probability $q = 1 − p$. It is flipped repeatedly. Assume that the outcome of different
flips is independent. Let $X$ be the length of the initial run and $Y$ the length of the second run.
Evaluate $P(X=2)$ and $P(Y=3)$ and $P(X=2\:$ and $\:Y=3)$
Since for the first run of length 2 is either $HHT$ or $TTH$, I have $P(X=2)=p^2q+q^2p\:$, but I'm not sure how to evaluate the second and third part of the question. I'm thinking that the second run is either $...THHHT$ or $...HTTTH$ so $P(Y=3)=q^2p^3+p^2q^3$. 
But the notes my lecturer asked us to refer to show that $P(Y=3)=q^2p^{3-1}+p^2q^{3-1}=q^2p^2+p^2q^2$, which I dont understand. The notes also show the probability is derived from an infinite sum, which we are specified NOT to do, but to do it by conditioning on the first toss instead.
 A: Think about the question itself as a coin flip with two trials.
What is the probability my coin is heads once AND heads another time. It will be $$(1/2)^{2} = 0.25. $$
So when the question asks what is the probability X = 2 and Y = 3, the and can be thought of as multiplicative just like the heads a coin toss.

What is the probability that our initial run is exactly of length 2 AND the second run is of length 3? 
$$((p^{2}*q) + (q^{2}*p))  * ((p^{3}*q) + (q^{3}*p)).$$
In general, it is useful to think of AND as multiplication and OR as addition. 
A: let the probability of tossing a tail be $q=1-p$
$P(X=2)$ is the probability of tossing $HHT$ or $TTH$, $$\therefore P(X=2)=p^2q+q^2p$$
$P(Y=3)$ is the probability of tossing $H...HTTTH$ or $T...THHHT$. Thus we need to account for all possible values of the first run
$$
\begin{equation} 
\begin{split} 
\therefore P(Y=3)&=(p+p^2+p^3+...)(q^3p)+(q+q^2+q^3+...)(p^3q) \\ 
&=p(\sum_{n=0}^{+\infty} p^n)q^3p+q(\sum_{n=0}^{+\infty} q^n)p^3q \\
&=p^2q^3\frac{1}{1-p}+q^2p^3\frac{1}{1-q}\\
&=p^2q^2+p^2q^2 \\
&=2p^2q^2
\end{split} 
\end{equation}
$$
$P(X=2\; \text{and} \; Y=3)$is the probability of tossing $HHTTTH$ or $TTHHHT$, 
$$
\begin{equation} 
\begin{split}
\therefore P(X=2\; \text{and} \; Y=3)&=p^2q^3p+q^2p^3q \\
&=2p^3q^3
\end{split} 
\end{equation}
$$
