Where does binomial formula for the probability that, in $n$ coin flips, the number of heads is divisble by 3 come from?

42 Views Asked by At

While looking for some interesting probability problems, I stumbled across Q1 from the 2013 MIT Primes Entrance Exam which asks "[in $n$ coin tosses], what is the probability that the number of heads you’ll get is divisible by 3"? Their official solution (link, pg. 2) claims that the probability $p$ is given by $$ p = 2^{-n} \left(1 + \binom{n}{3} + \binom{n}{6} + \cdots\right) $$.

Where does this formula come from? How might one approach coming up with a formula like this?