We will show that if we toss a fair coinnnntimes (withn≥2n\ge2n≥2) and define
and set
then the probabilitypnp_npnthatYnY_nYnis odd is given by
Below is one way to arrive at this answer.
A. Reformulating the Problem
Notice thatXk−1Xk=1X_{k-1}X_k=1Xk−1Xk=1exactly when both tossk−1k-1k−1and tosskkkare heads. In other words,YnY_nYncounts the number ofconsecutive pairs of headsin thennntosses.A key observation is that if you break up the toss sequence intomaximal blocksof consecutive heads, then a block of lengthmmmproducesm−1m-1m−1pairs. In particular, the parity (odd or even) ofm−1m-1m−1is:
Even ifmmmis odd,
Odd ifmmmis even.
Even ifmmmis odd,
Odd ifmmmis even.
Thus, the parity ofYnY_nYnis the same as the parity of the number of head‐blocks that have even length.
B. A Recursive (State) Approach
An alternative way to see the answer is to analyze the sequence toss by toss. Define the following states for a sequence of tosses ending at timennn:
(T,0)(T,0)(T,0): Last toss is a tail, and the current number of head‐pairs is even.
(H,0)(H,0)(H,0): Last toss is a head, and the current number of head‐pairs is even.
(): Last toss is a tail, and the number is odd.
(H,1)(H,1)(H,1): Last toss is a head, and the number is odd.
(T,0)(T,0)(T,0): Last toss is a tail, and the current number of head‐pairs is even.
(H,0)(H,0)(H,0): Last toss is a head, and the current number of head‐pairs is even.
(): Last toss is a tail, and the number is odd.
(H,1)(H,1)(H,1): Last toss is a head, and the number is odd.
A new toss affects the parity only when the previous toss was a head and the new toss is also a head (since then a new pair is formed, toggling the parity). By carefully writing the transition relations and starting with the initial conditions (after the first toss, only states(T,0)(T,0)(T,0)and(H,0)(H,0)(H,0)are possible), one may show by induction that:
Ifnnnis even (say,n=2mn=2mn=2m) then the number of sequences with an odd number of pairs is2n⋅2m−12m+1\displaystyle 2^{n}\cdot\frac{2^m-1}{2^{m+1}}2n⋅2m+12m−1.
Ifnnnis odd (say,n=2m+1n=2m+1n=2m+1) the same ratio holds.
Ifnnnis even (say,n=2mn=2mn=2m) then the number of sequences with an odd number of pairs is2n⋅2m−12m+1\displaystyle 2^{n}\cdot\frac{2^m-1}{2^{m+1}}2n⋅2m+12m−1.
Ifnnnis odd (say,n=2m+1n=2m+1n=2m+1) the same ratio holds.
Thus, the probability thatYnY_nYnis odd is
For example, whenn=4n=4n=4we have⌊4/2⌋=2\lfloor4/2\rfloor=2⌊4/2⌋=2so
and whenn=3n=3n=3we have⌊3/2⌋=1\lfloor3/2\rfloor=1⌊3/2⌋=1so
C. Final Answer
Thus, the probability thatYnY_nYnis odd is
Any answer equivalent to the expression above is correct.