# Probability of a coin being two-headed given it lands on heads

There seems to be some disagreement on among answers on the internet for the question:

A bag contains 1 fair and 1 double-sided (heads) coin. We choose a coin at random and flip it once. What is the probability of the coin being the double-sided sided one, given the result is heads?

I decided to explore the problem using Python, and came up with the code below. Does the code correctly represent the situation, and is the experimental answer of "roughly two thirds" which it produces correct please?

import random

num_trials = 10000

results = {
}

for i in range(num_trials):
if this_coin == "fair":
else:


• What alternative might some have been imagining?
– Nat
Commented Mar 20, 2021 at 2:15
• Some say its 50/50. This doesn't seem entirely unreasonable. There are two coins - I've flipped one of them and it shows heads. So what? It's still one of two coins. I get that this is wrong, but the correct answer isn't obvious, IMO. I think the situation is somewhat analogous to the Monty Hall Problem, which many expert mathematicians were stubbornly wrong about. Commented Mar 20, 2021 at 7:41
• Why count to 4 and be sure you exhaust every possible case, when you can write a python script, loop 10000 times and hope you describe every outcome? :) Commented Mar 20, 2021 at 12:30
• There is a good reason for that - abstraction is often harder to understand than concrete examples, and intuition can be very wrong. Look at the history of the Monty Hall Problem for evidence of this. Commented Mar 20, 2021 at 13:25

The outcomes are:

1. Fair coin, $$H$$

2. Fair coin, $$T$$

3. Unfair coin, $$H$$

4. Unfair coin, $$H$$ (the other one)

Each of these is equally likely, so each has a probability of $$1/4$$, meaning that $$P(\text{H}) = \frac{3}{4}$$.

We want to know $$P(\text{Unfair} \vert H)$$. This is a job for Bayes' Theorem: $$P(B\vert A) = \dfrac{P(A\vert B)P(B)}{P(A)}$$.

Our $$B$$ is the unfair coin, and our $$A$$ is heads.

$$P(\text{Unfair} \vert H) = \dfrac{P(H\vert\text{Unfair})P(\text{Unfair})}{P(H)} = \dfrac{1\times \frac{1}{2}}{\frac{3}{4}} = \dfrac{2}{3}$$

$$\square$$

I would like to add to @Dave’s excellent answer by stating it in words, as some may find that easier to understand (but it’s no different).

You start with 2 coins, one is double heads, the other is normal. So that’s 4 sides, of which 3 are heads and 1 is tails. Therefore, before you have chosen a coin, your probability of getting a head is 3/4. And your probability of getting the unfair coin is 1/2.

After you have selected a coin and looked at one side to reveal a head, you have now reduced the “in play” possibilities to 3 sides: 2 heads and 1 tail.

Obviously, now the probability the other side is heads = the probability the coin is unfair. Given that, what’s the probability the other side is another head? Well, it must be 2/3.

There are lots of variations on this type of problem, often starting with 3 objects (doors/pancakes/cards) and it’s sometimes more instructive to think of those situations - indeed sometimes it helps to start with 99 unfair coins and 1 fair, and then consider the probabilities.

Richard McElreath has a nice video explaining this in the context of pancake flipping, which is a version of the Monty Hall Problem

• I'm having trouble following this. I've got two bits of paper, one with H on both sides, one with H on one side and T on the other. I've selected one piece, and it shows H. You wrote "After you have selected a coin and looked at one side to reveal a head, you have now reduced the “in play” possibilities to 3 sides: 2 heads and 1 tail.". What exactly are these possibilities of, and why are there 3 please? Commented Mar 19, 2021 at 14:59
• You started with 4 sides. You looked at one (H). Once you’ve looked at one side you have the information for that side, you’re certain what it is - there’s only 3 remaining sides with any uncertainty, so it’s only these 3 you need consider for forming any probabilities. These are 2 H and 1 T. So probability of H is 2/3. Commented Mar 19, 2021 at 15:04
• Some really smart people have been flummoxed by Bayes’ Rule! The key point is to think - what is my state of knowledge right now. What do I know, what do I not know (ie what do I have to assign a probability to)? And then when a new piece of information comes in, you update your state of knowledge in a rigorous way (by Bayes Rule). Think about after you’ve selected a coin and looked at one side, you’ve seen heads. The other side is still unknown so if it’s heads you’re 100 % sure the coin is unfair. If it’s not you’re 100 % sure it isn’t. So at that moment P(heads) = P(unfair). Commented Mar 19, 2021 at 15:31
• The way I see it, you've got a bag containing three heads and a tail. You reach in and pull out a head. What's the probability that it's attached to the unfair coin? Well, two out of the three are, so that's your probability: 2/3.
– Mark
Commented Mar 19, 2021 at 22:12
• +1 for the Monty Hall problem reference. Commented Mar 20, 2021 at 22:45

Something else I would add, which might help make the answer a bit clearer: if you pull out a coin and get a tails, you put it back in the bag and start again. This is why the probability is not 50:50, because when you say you've pulled out a heads, you have encountered one of a limited set of outcomes, compared to all of the possible outcomes.

If you pulled a coin out and it was heads or tails, the probability is clearly 50:50. But you know it was heads, so it is now intuitively more likely to have been the unfair coin that was both heads.

• I find this hard to reason about. "If you pulled a coin out and it was heads or tails" doesn't actually make sense to me - it's like Schrodinger's Cat at that stage... Commented Mar 20, 2021 at 13:27
• @RobinAndrews If you pulled out a coin and there's no restriction on what you see, that's just pulling out a coin. But given that you saw heads, if you want to model that in the real world, you can make not-heads “try again”, replacing it with a smaller copy of the probabilities of everything else, like a converging series. Commented Mar 20, 2021 at 23:07

This answer tries to bring together concepts from the other answers, but using clearer words.

When we “choose a coin at random and flip it once”, there are four equally likely outcomes:

1. Fair coin, tails