# Probability of getting an even number of sixes in $n$ throws of a die

A fair die is thrown $$n$$ times. Show that the probability of getting an even number of sixes is $$\frac{1}{2}[ 1 + (\frac{2}{3})^{n}]$$, where $$0$$ is counted as even number.

My solution. I have probability of getting even number of sixes as:

$$\sum_{k=0}^{{\lfloor n/2\rfloor}} {n \choose 2k}(\frac{1}{6})^{2k}(\frac{5}{6})^{n-2k}$$

I also know that the probability of getting an even number of sixes plus an odd number of sixes is $$1$$, i.e.

$$\sum_{k=0}^{{\lfloor n/2 \rfloor}} {n \choose 2k}(\frac{1}{6})^{2k}(\frac{5}{6})^{n-2k}+ \sum_{k=0}^{{\lfloor n/2 \rfloor}+1} {n \choose 2k+1}(\frac{1}{6})^{2k+1}(\frac{5}{6})^{n-2k-1} = 1$$

However I am not sure how to extract the "even" part of the expression to obtain the answer required?

• What about the probability of an even number of sixes minus the probability of an odd number of sixes? – Lord Shark the Unknown Nov 23 '18 at 20:23
• Have you considered using induction? – James Nov 23 '18 at 20:27
• I don't see how that helps - @LordSharktheUnknown – Alex Nov 23 '18 at 20:32

$$\sum_{k=0}^{[n/2]}{n\choose 2k}(1/6)^{2k}(5/6)^{n-2k}+\sum_{k=0}^{[n/2]}{n\choose 2k+1}(1/6)^{2k+1}(5/6)^{n-2k-1}=1$$

and $$\sum_{k=0}^{[n/2]}{n\choose 2k}(1/6)^{2k}(5/6)^{n-2k}-\sum_{k=0}^{[n/2]}{n\choose 2k+1}(1/6)^{2k+1}(5/6)^{n-2k-1}=\sum_{k=0}^{n}{n\choose k}(-1/6)^{k}(5/6)^{n-k}=(2/3)^n$$

Hence $$\sum_{k=0}^{[n/2]}{n\choose 2k}(1/6)^{2k}(5/6)^{n-2k}=1/2(1+(2/3)^n).$$

Let's suppose you have a discrete random variable $$X$$ taking on non-negative integer values. Let $$p_n=P(X=n)$$. The generating function of $$X$$ is $$G(s)=E(s^X)=\sum_{n=0}^\infty p_ns^n.$$ Then $$G(1)=E(1^X)=\sum_{n=0}^\infty p_n=1$$ and $$G(-1)=\sum_{n=0}^\infty (-1)^np_n.$$ Adding these, $$1+G(-1)=2(p_0+p_2+\cdots)=2P(X\text{ is even}).$$

In your example, $$X$$ is the number of sixes in $$n$$ throws of a die. Then $$X$$ is a binomial random variable with parameters $$1/6$$ and $$n$$.

So (i) what is the generating function of a binomial random variable, and (ii) how do you apply that to the question at hand?

Let $$e(n)$$ be the probability of getting an even number of sixes in $$n$$ rolls.

It is easy to show directly that $$e(0)=1$$, so for $$n=0$$, $$e(n)=\frac{1}{2}[ 1 + (\frac{2}{3})^{n}]$$.

Let $$n$$ be a positive integer and assume that $$e(n-1)=\frac{1}{2}[ 1 + (\frac{2}{3})^{n-1}]$$. If this assumption implies that $$e(n)=\frac{1}{2}[ 1 + (\frac{2}{3})^{n}]$$, the desired result holds, thanks to the principle of mathematical induction.

After $$n-1$$ rolls of the die, the probability of an even number of sixes is $$e(n-1)$$ and the probability of an odd number of sixes is $$1-e(n-1)$$. After one more roll, the probability of an even number of sixes is $${5\over6}e(n-1)+{1\over6}(1-e(n-1))$$. (There are an even number of sixes after $$n$$ rolls only if there were an even number after $$n-1$$ rolls and the $$n$$-th roll was not a six, or if there were an odd number after $$n-1$$ rolls and the $$n$$-th roll was a six.)

Therefore $$e(n)={5\over6}e(n-1)+{1\over6}(1-e(n-1))={5\over6}\left(\frac{1}{2}[ 1 + (\frac{2}{3})^{n-1}]\right)+{1\over6}(1-\left(\frac{1}{2}[ 1 + (\frac{2}{3})^{n-1}]\right))$$, which (it can be seen with a bit of algebra) equals $$\frac{1}{2}[ 1 + (\frac{2}{3})^{n}]$$.