<s>[INST] A die is thrown $n$ times. What is the probability that $6$ appears even number of times? A die is thrown $n$ times. What is the probability that $6$ appears even number of times (for the purpose of task $0$ is even number)?
The solution from my textbook is:
We have two hypotheses $H_1$ that the array starts with 6 and $H_2$ array does not start with 6; $p_n$ is the probability. $p_n=P(H_1)(1-p_{n-1})+P(H_2)p_{n-1}=\frac{1}{6}+\frac{2}{3}p_{n-1}$. $p_1=\frac{5}{6}$
After solving this recursive relation we get $p_n=\frac{1}{2}(1+(\frac{2}{3})^n)$.
I know how to solve recursion I just don't understand how they got it (I know probabilities of hypothesis). Also, is there any other way to approach this task?
 [/INST] Hint: Make use of Binomial Expansion.
Assuming n to be even
$(a + b)^n = {n \choose 0}a^n + {n \choose 1}a^{n-1}b + {n \choose 2}a^{n-2}b^{2} + {n \choose 3}a^{n-3}b^{3} ... + {n \choose n}b^{n}$
and,
$(a - b)^n = {n \choose 0}a^n - {n \choose 1}a^{n-1}b + {n \choose 2}a^{n-2}b^{2} - {n \choose 3}a^{n-3}b^{3} ... + {n \choose n}b^{n}$
Adding these two, we get:
$(a + b)^n + (a - b)^n = 2({n \choose 0}a^n + {n \choose 2}a^{n-2}b^{2}...)$,
thus the quantity on the right of the above equation represents the probability of getting an even number of events $a$. Bring the $2$ from RHS to LHS,
$\frac{1}{2}((a + b)^n + (a - b)^n) = ({n \choose 0}a^n + {n \choose 2}a^{n-2}b^{2}...)$
We know from a fair, unbiased die, we have P(Die Value = 6) = 1/6 and P(Die Value != 6) = 5/6. Then, substitute $a$ for 1/6 and $b$ for 5/6 and solve.
</s>