50 Challenging Problems in Probability [Part 18]: An Even Split at Coin Tossing

Shelvia
2 min readMar 11, 2024

--

Hi, I’ve recently developed an interest in problems related to probability. I came across this book “Fifty Challenging Problems in Probability with Solutions” by Frederick Mosteller. I thought it would be interesting to create a series discussing these captivating problems that might arise as interview questions. Each post will feature only 1 problem, making it a series with a total of 50 parts. Let’s dive in and activate our brain cells 🧠!

Problem:

When 100 coins are tossed, what is the probability that exactly 50 are heads?

Image by the author using DALL-E 3.

Solution:

The probability of any sequence of 100 tosses (could be any number of heads) is 1/2¹⁰⁰. There are 100C50 number of ways to get 50 heads from a total 100 tosses. To get the probability that exactly 50 of the tosses are head, we just need to multiply the two terms:

Therefore, the probability that exactly 50 coins (out of the 100 coins that are tossed) are heads is about 0.08.

Python code:

import numpy as np

n_simulations = 100000
count = 0

for _ in range(n_simulations):
heads = sum(np.random.choice(2,100))
if heads == 50:
count += 1

print(f"The prob. that exactly 50 out of the 100-coin tosses are heads is {count/n_simulations:.3f}.")

# Output:
# The prob. that exactly 50 out of the 100-coin tosses are heads is 0.080.

And that’s all for this coin tossing 🟡 problem. Any feedback or questions are welcome! The code is available on my Github. Check out the other problems in this series:

50 Challenging Problems in Probability

31 stories

Thank you for reading! :)

--

--

Shelvia

Researcher in Information Theory and Trustworthy AI. Addicted to puzzles and brain teasers. Interested in particle physics and neuroscience.