[Math] N tosses of a coin ,what is the probability that number of heads are even

probability

We have a coin with probability of head is p and probability for tail is (1-p).
We toss the coin N times, what is the probability that the number of tosses that show head is even?

What I've tried is to sum over all even k's (k= 0,2,4,…) and to sum up the probability that the number of heads is k. Is there a way to elinimate the sum and to give a closed formula?

Best Answer

Let $a_N$ be the probability that $N$ Bernoulli trials result in an even number of successes. This occurs if an initial failure is followed by an even number of successes, or an initial success is followed by an odd number of successes. Therefore $a_0=1$ and for $N\geq 1$ $$a_N=q a_{N-1}+p(1-a_{N-1}).$$ Multiplying by $s^N$ and adding over $N$ we see that the generating function satisfies $$H(s)=1+qsH(s)+ps(1-s)^{-1}-psH(s)$$ or $$2H(s)=[1-s]^{-1}+[1-(q-p)s]^{-1}.$$ Expanding the right hand side using geometric series we find that the coefficients satisfy $$a_N={1\over 2}+{(q-p)^N\over 2}.$$

Reference: Chapter XI of An Introduction to Probability Theory and Its Applications (Volume 1) (3rd edition) by William Feller.