= Solution
After $n+1$ independent tosses, an even count arises in exactly two disjoint ways: an even count after $n$ tosses followed by a tail, or an odd count followed by a head. <Independence> of the last toss from the preceding ones therefore gives
$$
\pi_{n+1}=(1-p)\pi_n+p(1-\pi_n)=p+(1-2p)\pi_n.
$$
Subtracting the <fixed point> $1/2$ turns this into the <linear recurrence>
$$
\pi_{n+1}-\tfrac12=(1-2p)(\pi_n-\tfrac12).
$$
As zero is even, $\pi_0=1$, so \b[the probability is]
$$
\boxed{\pi_n=\frac{1+(1-2p)^n}{2}.}
$$
For $p=1/2$ this is $1/2$ for every $n\ge1$; for $p=0$ it is always one; for $p=1$ it alternates between one and zero according to the parity of $n$.
Back to article page