A simple question of probability

Pages: 12
I want to say this now before someone asks the question and sparks a firestorm of misunderstood maths. It might never happen, but if it does, the fires tend to rage out of control for weeks. This is a metaphorical firebreak!

I toss two fair coins. I look at them and then I tell you truthfully that the coins are definitely NOT both heads, or NOT both tails, depending on what I saw.

So, given this, what is the probability that they are both the same?

Before I looked, there were four equally likely options that you helpfully wrote down:

HH
HT
TH
TT

After I look, one of these has been removed (either HH or TT). Leaving three equally valid options, only one of which is both the same, so the probability of both the same is one-in-three, or 1/3, depending on how you like to say it.

Does anyone disagree with this in a rational, coherent way that involves a direct application of Bayes theorem or a tree diagram? This is a very slight change from the original wording to emphasise that I have full knowledge of the state of both coins and all the information I give you is to eliminate either the HH or TT option, but I am manifestly aware that it's easy to screw things up in probability when you change the input information.


Google the "Monty Hall Problem". You can't up and change probabilities in the middle of a problem.
You can't up and change probabilities in the middle of a problem.


Are you saying that because the probability of HH is 1/4 before I look at the coins, if I then look at the coins and truthfully tell you that it isn't TT, and it isn't HT, and it isn't TH, the probability of it being HH is STILL 1/4?

Obviously you are not saying this, because that's insane. So what are you saying? I am very familiar with Monty Hall and the associated variations etc, and Bayes theorem.

The question above is an attempt to make the following question more intuitive: "I've got two children and I promise you they're not both girls; what are the chances that they're both boys?" The answer is 1/3, but people seem to either insist on 1/2, or insist on altering the question until the answer is 1/2.
Last edited on
How is what you say chosen if the coins are different? Do you say that they are not the same, or you choose one of the two statements at random?
How is what you say chosen if the coins are different?
I'll look at one of them at random and tell you the coins are definitely not both <other side of the coin I looked at> (because that way, I also do not have any information that you don't - I don't know what they are any more than you do).

Do you say that they are not the same?
No. You get from me ONLY that the outcome was not HH, or not TT, and that's all that I know as well (this deviates a bit from the original question involving children, because I would already have full information about the children, but hopefully this deviation makes the question clearer).

I'll stress now that the answer is 1/3. The only problem is in managing to make the wording utterly unambiguous.
Last edited on
How's this?

Let HH, TH, HT, and TT be the coin configurations, and TT' be you saying "it's not double tails".

P(HH | TT') = P(TT' | HH)P(HH)/(P(TT' | HH)P(HH) + P(TT' | TT)P(TT) + P(TT' | TH)P(TH) + P(TT' | HT)P(HT)) =
= P(TT' | HH)/(P(TT' | HH) + P(TT' | TT) + P(TT' | TH) + P(TT' | HT)) =
= 1/(1 + 0 + 1/2 + 1/2) =
= 1/2
+1 @ helios. It's 50% chance.

You flip one of the coins. No matter what the result of the first flip is, the 2nd coin has a 50% chance of matching it.

Looking at one of the coins but not the other cannot possibly change the probabilities.

To rephrase this in your own terms:

Say you have two coins: a dime and a nickle. Do the flip thing. Leaves you with 4 possibilities:

HH
HT
TH
TT

(note: for purposes of this example, the dime result is listed first).

Then you decide to look at the dime. It turns out to be tails. This means you've ruled out HH and HT. Leaving TH and TT as possible outcomes ( 50% chance that they're the same).


Your problem is the same. Only the dime is just another nickle.


If it helps... rephrase your original problem to say "look at coin 1" instead of "look at one of the coins". The result of coin 1 will rule out two possibilities, not just one.
Last edited on
I disagree. And this, in fact, is exactly what happens with this question. I quote myself above:
people seem to either insist on 1/2, or insist on altering the question until the answer is 1/2.



Okay, I have picked a number from 0 to 3, with an equal chance of each.

Now, I'm telling you it isn't 3.

What is the chance that it's zero? I say that the chance it is zero is 1 in 3.

I am now going to write the numbers out in binary.

00
01
10
11

It isn't 3 (i.e. it isn't 11). What is that chance that it's zero (00)?

If it helps... rephrase your original problem to say "look at coin 1" instead of "look at one of the coins". The result of coin 1 will rule out two possibilities, not just one.
That doesn't help. That's the exact opposite of what I want. The answer is 1 in 3. I want the version where you do NOT know which coin I looked at, because that is a different question.

How's this?

Let HH, TH, HT, and TT be the coin configurations, and TT' be you saying "it's not double tails".

P(HH | TT') = P(TT' | HH)P(HH)/(P(TT' | HH)P(HH) + P(TT' | TT)P(TT) + P(TT' | TH)P(TH) + P(TT' | HT)P(HT)) =
= P(TT' | HH)/(P(TT' | HH) + P(TT' | TT) + P(TT' | TH) + P(TT' | HT)) =
= 1/(1 + 0 + 1/2 + 1/2) =
= 1/2
I believe it's incorrect the answer to a different question. Here's my version, starting with the simple statement of Bayes theorem:

P(A|B) = P(B|A) P(A) / P(B)

Let's say A is HH (both heads), and B is TT' (not tails-tails) i.e.

P(HH|TT') = P(TT' | HH) P(HH) / P(TT')

P(TT' | HH) is the probability of not tail-tail, given that it's head-heads. Well, that's one. If it IS heads-heads, it's definitely NOT tails-tails, so this is a certainty. P(TT' | HH) = 1

P(HH) = 1/4 (this is just the simple probability of heads-heads)
P(TT') = 3/4 (this is just the simple probability of anything other than tails-tails)

So, P(HH|TT') = P(TT' | HH) P(HH) / P(TT')
= 1 x (1/4) / (3/4)
= 1/3
Last edited on
Now, I'm telling you it isn't 3.

What is the chance that it's 0? I say that the chance it is one is 1 in 3.
The error in your reasoning is assuming that the distribution of the remaining three possibilities is uniform. As my calculation above shows, given that X≠3, P(X=0) = P(X=1) + P(X=2).

Some empirical evidence:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import random

def main():
	random.seed()
	times_not_zero_stated=0
	times_not_zero_stated_and_three=0
	for i in range(0,100000):
		i=random.randint(0,3)
		if i%2!=0:
			times_not_zero_stated+=1
			if i==3:
				times_not_zero_stated_and_three+=1
	print(times_not_zero_stated_and_three/times_not_zero_stated)

main()
Output: 0.49918666532784417
Last edited on
people seem to either insist on 1/2, or insist on altering the question until the answer is 1/2.


I wasn't altering the problem, I was trying to show it in a different light.

Allow me to try again, this time changing neither of the coins.

Let's say there are 2 perfectly identical quarters. Let's call them A and B.

We agree that there are 4 possible outcomes for the coin flips:
1) A=H, B=H
2) A=H, B=T
3) A=T, B=H
4) A=T, B=T

We also agree that each of those outcomes have an equal probability of happening (25%).

So after both coins are flipped and one of them is revealed to us as Tails. We are able to rule out possibility 1 above. But that's not the end of the story.

If the coin we are looking at is coin A... we can rule out 1 & 2 (result: 50% chance of TT)

If the coin we are looking at is coin B... we can rule out 1 & 3 (result: 50% chance of TT)


We don't know whether the coin is A or B... but that doesn't matter because the result is the same (50%) regardless of which coin we're looking at.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
  srand ( time(NULL) );

  int zeroes = 0;
  int ones = 0;
  int twos = 0;
  int threes = 0;

  for (int i = 0; i<1000000; i++)
    {
       int randomNumber = rand() % 3;
       switch (randomNumber)
	 {
          case 0: zeroes++; break;
          case 1: ones++; break;
          case 2: twos++; break;
           case 3:  break;
	 }
    }

  cout << "Zeroes: " << zeroes << endl
           << "Ones: " << ones << endl
            << "Twos: " << twos << endl;

}


Results:
Zeroes: 332785
Ones: 334018
Twos: 333197


Looks pretty uniform distribution to me. I'm not quite sure what you're calculating, but I expect it's the answer to a different question.
Last edited on
Now who's altering the question....
Now who's altering the question....


I'm illustrating my question. I pick a number from zero to three. It's not three. What are the odds it's zero?

What's the problem with my Bayesian maths above? This thing:
P(A|B) = P(B|A) P(A) / P(B)

Let's say A is HH (both heads), and B is TT' (not tails-tails) i.e.

P(HH|TT') = P(TT' | HH) P(HH) / P(TT')

P(TT' | HH) is the probability of not tail-tail, given that it's head-heads. Well, that's one. If it IS heads-heads, it's definitely NOT tails-tails, so this is a certainty. P(TT' | HH) = 1

P(HH) = 1/4 (this is just the simple probability of heads-heads)
P(TT') = 3/4 (this is just the simple probability of anything other than tails-tails)

So, P(HH|TT') = P(TT' | HH) P(HH) / P(TT')
= 1 x (1/4) / (3/4)
= 1/3
What's the error in this?
Last edited on
P(TT') = 3/4
This is incorrect. I asked you and you told me that if the coins turn up different, there's a random chance of either TT' or HH'. If P(TT') = 3/4 then that means that P(TT' | HT) = P(TT' | TH) = 1. At the same time, P(HH' | HT) = P(HH' | TH) = 0.

Results:
Zeroes: 332785
Ones: 334018
Twos: 333197


Looks pretty uniform distribution to me. I'm not quite sure what you're calculating, but I expect it's the answer to a different question.
*Sigh*
You're calculating something entirely different from what your problem states.
Your original question was about coin flips. Not about picking a number between 0 and 3. They are two completely unrelated problems. helios and I were both talking about the coin flip problem.
Let's say I flip a coin twice. Let's say there is a zero on one side and a one on the other.

I could get:

00
01
10
11

I have in effect picked a random number from zero to three.

Let's cross out the zero on the coin, and write in a H. Let's cross out the one, and write a T. Now I get:

HH
HT
TH
TT

I have still in effect picked a random number from zero to three. Now I tell you it's not three (not TT). What are the odds it's zero (HH)?


P(HH' | HT) = P(HH' | TH) = 0.

I disagree. P(HH' | HT) is "what's the probability of NOT heads-heads, given that it actually is heads-tails". Well, that's one. It's a certainty. If it's heads-tails, it is definitely not heads-heads.
P(HH' | TH) likewise. If it's tails-heads, it is definitely not heads-heads, so that's also one.

As an aside, please do not *sigh*. It comes across as extraordinarily patronising.
Last edited on
I disagree. P(HH' | HT) is "what's the probability of NOT heads-heads, given that it actually is heads-tails". Well, that's one. It's a certainty. If it's heads-tails, it is definitely not heads-heads.
Wrong. That was the first thing I defined. HH' is you stating "it's not double heads". HH' ≠ ¬HH.
You can't state two things at the same time. I asked this, too.
You get from me ONLY that the outcome was not HH, or not TT
P(HH') = 1 - P(TT').
Last edited on
Here's another example program. One that does not deviate AT ALL from the original coin flip problem:

EDIT: actually it does deviate because I was misunderstanding the problem.
EDIT again: actually it doesn't deviate based on what Moschops said about how the HH/TT option is removed in his 2nd post.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;

int main()
{
    srand((unsigned)time(0));
    int hh = 0; // number of times HH occurred with 'Heads' revealed to the player.
    int tt = 0; // number of times TT occurred with 'Tails' revealed to the player.

    int hrevealed = 0; // number of times H revealed
    int trevealed = 0; // number of times T revealed

    int coins[2];  // the coins.

    int iterations = 100000;

    for(int i = 0; i < iterations; ++i)
    {
        // flip the coins:
        coins[0] = rand() % 2;
        coins[1] = rand() % 2;

        // reveal a random coin:
        int c = coins[ rand() % 2 ];

        // is this coin heads?
        if(c == 0)
        {
            ++hrevealed;
            // is it heads/heads?
            if(coins[0] == 0 && coins[1] == 0)
                ++hh;
        }
        // otherwise it's tails
        else
        {
            ++trevealed;
            // is it tails/tails?
            if(coins[0] == 1 && coins[1] == 1)
                ++tt;
        }
    }

    // calculate percentages:
    cout << "Heads revealed " << hrevealed
         << " times, HH " << hh
         << " times.  Probability: " << ((double)hh / hrevealed) << endl;

    cout << "Tails revealed " << trevealed
         << " times, TT " << tt
         << " times.  Probability: " << ((double)tt / trevealed) << endl;
    
    cout << "Total probability " << ((double)(tt+hh) / iterations) << endl;

    cin.get();
}
Heads revealed 50132 times, HH 25061 times.  Probability: 0.4999
Tails revealed 49868 times, TT 24980 times.  Probability: 0.500922
Total probability 0.50041
Last edited on
I don't understand what you're saying. I must be completely misunderstanding. Is THIS true?
P(HH' | HT) is "what's the probability of NOT heads-heads, given that it actually is heads-tails".



P(HH') = 1 - P(TT').
Again I disagree. I think P(HH') is 3/4. I think P(TT') is 3/4.
Last edited on
The statement "it is not TT" gives you more information than just that. It also implies that it can't be HT or TH, depending on which coin was looked at.
Pages: 12