Probability of Flipping Heads

How would you derive a confidence interval for the probability of flipping heads from a series of coin tosses?

This is the same question as problem #11 in the Statistics Chapter of Ace the Data Science Interview!

The confidence interval (CI) for a population proportion is an interval that includes a true population proportion with a certain degree of confidence $1-\alpha$.

For the case of flipping heads from a series of coin tosses, the proportion follows the binomial distribution. If the series size is large enough (each of the number of successes and the number of failures is at least 10), we can utilize the Central Limit Theorem and use the normal approximation for the binomial distribution as follows:

where $\hat{p}$ is the proportion of heads tossed in series, and $n$ is the series size. The CI is centered at the series proportion, and plus or minus a margin of error:

where $z_{\alpha/2}$ is the appropriate value from the standard normal distribution for the desired confidence level.

For example, for the most commonly used level of confidence 95%, $z_{\alpha/2}=1.96$.