# The Quarter Flip a quiz with coins

# Intro

I have found this brainteaser in Max Damas “Automated trading”, but without a solution. I think my solution should be correct.

## Problem

You have 5 quarters on the table in front of you. Four of them are
fair, i.e., one side is heads the other tails, and one coin has heads
on both sides.

You pick one at random and flip it five times. Each time you get
heads.
What is the probability, that you picked up the coin with two heads?

I suggest you try this for yourself before reading on.

## Solution

There is a thing called Bayes’ theorem, which makes this seemingly
difficult brainteaser a simple exercise, as we mathematicians like to
call it.

Bayes’ theorem is about relating conditional probabilities. Let
be the probability of the event and the
probability of the event given the event .

Then Bayes’ says that

So we just need to define the events accordingly, plug in the values and whoosh, we are finished. So, let be the event, that we picked the coin with two heads, the event, that we got five heads. The question is now, what is ?

According to Bayes:

Obviously , since we can only get heads from the coin with two heads. , since we have four fair coins and one head-head-coin.

So it remains to compute . This is for the fair coins and for the rigged coin. Summing up yields

All in all