DEV Community

santisbon
santisbon

Posted on

The Sleeping Beauty Problem

Sleeping Beauty agrees to be the subject of an experiment and is informed of the procedure:

  • On Sunday night, she will be put to sleep.
  • Then, a fair coin will be flipped.
  • If it comes up Heads, she will be awakened on Monday and put back to sleep.
  • If it comes up Tails, she will also be awakened on Monday and put back to sleep, but then she'll be awakened on Tuesday as well and put back to sleep.
  • Each time that she is put back to sleep she will forget that she was ever awakened.
  • Any time she's awake, she will be told no information but she'll be asked one question: What do you believe is the probability that the coin came up heads?

Experiment

Image credit: Veritasium

How should she answer?

You might be tempted to say 50%50\% because that's the probability of a fair coin coming up Heads, but you would be mistaken. The correct answer is 1/31/3 . To understand why, we need to realize that the question that is really being asked is this: What is the probability that the coin came up Heads given that you've been awakened?

This is a case where we need to incorporate observed data into our prior odds to come up with new odds that account for the new data. To do that, we need to calculate the probability of an event happening given that another event has already happened. We can use Bayes' Theorem for this.

ℹ️ Bayes' Theorem

P(AB)=P(BA)P(A)P(B)P(A|B)={P(B|A)P(A) \over P(B)}

But wait, where did that come from?

💡 It can be derived from the conditional probability that tells us in how many cases do both events AA and BB happen out of the cases where BB happens:

P(AB)=P(AB)P(B)P(A|B)={P(A \cap B) \over P(B)}

Similarly, P(BA)=P(AB)P(A)P(B|A)={P(A \cap B) \over P(A)}

which means

P(AB)=P(BA)P(A)P(A \cap B)=P(B|A)P(A)

and substituting in the expression for conditional probability yields Bayes' Theorem:

P(AB)=P(BA)P(A)P(B)P(A|B)={P(B|A)P(A) \over P(B)}

Now that we understand where Bayes' Theorem comes from, there's another way to look at it: As a way to understand two competing hypotheses H1H_1 and H2H_2 . We start by having some prior belief about the odds of those two. After observing some data, what are the new odds of the two hypotheses given the new data? In other words, how do we update our belief based on new evidence?

ℹ️
Let's start by specifying what we mean by odds. We mean how large is one probability relative to the other. Let's put it as a ratio. For example, if prior to seeing any data one hypothesis has 3/43/4 probability of being true and the other has 1/41/4 :

P(H1)P(H2)=3/41/4=31\frac {P(H_1)} {P(H_2)}=\frac {3/4} {1/4}=\frac 3 1

Meaning the odds of H1H_1 to H2H_2 are 33 to 11 .

So how do we incorporate the new data DD into our belief?

💡 By calculating the new probability of each hypothesis given the new data.

P(H1D)P(H2D)=P(H1D)P(D)P(H2D)P(D)=P(H1D)P(H2D)\frac {P(H_1|D)} {P(H_2|D)}=\frac {\frac {P(H_1 \cap D)} {P(D)}} {\frac {P(H_2 \cap D)} {P(D)}}=\frac {P(H_1 \cap D)} {P(H_2 \cap D)}

Now we'll use a mathematical trick of multiplying and dividing by the same number to get the same value but expressed in terms of the probability of seeing the observed data given each hypothesis.

=P(H1D)P(H2D)P(H2)P(H1)P(H1)P(H2)=\frac {P(H_1 \cap D)} {P(H_2 \cap D)} \cdot \frac {P(H_2)} {P(H_1)} \cdot \frac {P(H_1)} {P(H_2)}
=P(H1D)P(H1)P(H2D)P(H2)P(H1)P(H2)=\frac {\frac {P(H_1 \cap D)} {P(H_1)}} {\frac {P(H_2 \cap D)} {P(H_2)}} \cdot \frac {P(H_1)} {P(H_2)}

So,

P(H1D)P(H2D)=P(DH1)P(DH2)P(H1)P(H2)\frac {P(H_1|D)} {P(H_2|D)}=\frac {P(D|H_1)} {P(D|H_2)} \cdot \frac {P(H_1)} {P(H_2)}

And so we have that as a ratio, the posterior odds equal the prior odds times the probabilities of generating the new data.

Now let's apply this to our Sleeping Beauty problem. Let
H1=H_1= The coin came up Heads
H2=H_2= The coin came up Tails
D=D= You've been woken up

P(H1D)P(H2D)=1/32/31/21/2=3/6=1/2\frac {P(H_1|D)} {P(H_2|D)}=\frac {1/3} {2/3} \cdot \frac {1/2} {1/2}=3/6=1/2

Meaning H2H_2 is twice as likely as H1H_1 given the new data. If you want to convert that to probabilities:

P(H1)=11+2=1/3P(H_1)=\frac 1 {1+2}=1/3
P(H2)=21+2=2/3P(H_2)=\frac 2 {1+2}=2/3

Therefore Sleeping Beauty should answer that the coin came up Tails as the probabilities are 1/31/3 for Heads and 2/32/3 for Tails.


We can give another explanation that is more informal but more intuitive. Imagine she's still woken up once if it's Heads, but on 100100 consecutive days if it's Tails. She's awake. She has no idea which of those 101101 scenarios she's in, but effectively she's being asked if she thinks she's in the 11 scenario where it was Heads or in one of the 100100 scenarios where it was Tails. The answer should be clear.

Top comments (0)