Puzzler of 02/18/2012: use Bayes' theorem: P(A|B) = P(B|A) * P(A) / P(B)

littlemouse. I suggest you run a simulation and see for yourself.
we can argue for many days about the theory, but perhaps a little empirical evidence will help you.
Here. I’ll make it easy. Here’s a C program to guide you.
card 0 = green/green
card 1 = red/green
card 2 = red/red

#include “stdio.h”
#include “stdlib.h”

#define VM_RANDOM_INT(a,b)
((int)((a)+((b)-(a)+1)*((double)rand()/((double)RAND_MAX+1))))

int
main(int argc, char **argv)
{
int ii, nLoop = atoi(argv[1]);
int nRed = 0, nRedRed = 0;
// nRed means there is red on at least one side of the card

for (ii = 0; ii < nLoop; ii++) {
    int card = VM_RANDOM_INT(0, 2);
    int side = VM_RANDOM_INT(0, 1);
    if (card) {
        nRed++;
        if (side) {
            nRedRed++;
        }
    }
}

printf("%d = nRed = %g %%

“, nRed, (double)nRed / nLoop);
printf(”%d = nRedRed = %g %%
", nRedRed, (double)nRedRed / nLoop);
}

fredfhome–Great simulation program. If I were still teaching, I would ask your permission to use this program. When I taught a networking class, we had a laboratory where we networked the computers. We wrote a simulation program for the Monte Hall gameshow. When the student called up the program on his local computer, the program would ask whether he wanted to use the strategy of switching curtains after Monte Hall opened the curtain that did not contain the prize or to not switch and stay with his original choice. Each time, the program played the game 30 times using the one strategy chosen by the student. The student was able to view the results on his local computer and a file was updated on my computer which gave the student’s name, the strategy the student chose, and the number of times the student won the prize. Although the purpose of the program was to illustrate updating a remote file using the network, the students had so much fun running the program that we wrote a program that would access the master file, and calculate the number of wins under each strategy. The results almost perfectly match the results obtained theoretically.

Thanks for sharing the program. If I hadn’t retired, I would use your idea. Simulating a problem on the computer often helps in understanding the theoretical problem.

Hi Triedaq,
thanks for the words of support, and the story of your Monte Hall simulator.
I imagine that generated a lot of interesting discussion before and after the results were shown.

I have thought of one “gotcha” interpretation of the puzzler.
What would the con man say if the initial card side was green?

I’m assuming that if it turned up green, he’d want to bet even money that the other side is green.

Otherwise, it’s a goofy question.

If the con man didn’t want to bet when a green card showed, and would only bet when a red card showed;
offering an even bet only when he saw a red card; then the odds are 50/50.

If you’re only doing it once, then that doesn’t matter much…
I’d take the bet.

fredfhome"With all due respect, I think this is a mis-application of Bayes' theorem."
It was taken from a textbook on Bayesian statistics.
fredfhome"If you're only doing it once, then that doesn't matter much... I'd take the bet."
And your odds of winning would still be 1 out of 3. "Doing it once" does not turn a bad bet into a good bet.

It was taken from a textbook on Bayesian statistics.

The formula is correct.
What I question is the designation of event A vs B.

are you saying that the textbook had this same puzzle?
Assigning A and B as you indicated?

And your odds of winning would still be 1 out of 3. “Doing it once” does not turn a bad bet into a good bet.

I agree about “doing it once”.
I think it’s 2/3.
I’m just saying that over the long run, betting many times, the problem changes if the con man does not
take any bets when a green card shows up.

Who uses C anymore??? Just kidding…

At least with little modification the code will compile in C++, Java, J++ or C#.

“fredfhome 12:19PM Report
littlemouse. I suggest you run a simulation and see for yourself.”

That’s a terrible suggestion. Why would I do that? I know what the right answer is and why. This is pre-computer stuff. Butterfly in the sky. I can go twice as high. Take a look. It’s in a book. A Reading Rainbow. I’m not going to spell out again why you’re wrong, because that might encourage you to start another thread about why you think you’re right.

Mike

Who uses C anymore??? Just kidding…

OK. it was C++. I admit it.

I’ve edited the original to use (double) in VM_RANDOM_INT() which works better on some computers.
Same answer.
Here nRed means there is red on at least one side of the card

I’ve updated the program to take into account all card combinations.

If someone can point out what’s wrong with these simulation programs,
then I would be on my way to re-examine my reasoning above.
However, so far, the simulation matches my thinking above.

The chances you initially see a red side is 1/2.
that’s from 1/3 + (1/3)/2 + 0
Similarly for green.

Simulation for 1000 runs produces:
320 = nGrnGrn = 0.32 %
492 = nGrn = 0.492 %
508 = nRed = 0.508 %
338 = nRedRed = 0.338 %

Here, nRed and nGrn means you initially see that color
(different definition than first program).

So the chances you picked a grn/grn card is 1/3
The chances you picked a red/red card is 1/3

Here’s the program.
Unfortunately, this site doesn’t keep the indentation…

#include “stdio.h”
#include “stdlib.h”

#define VM_RANDOM_INT(a,b)
((int)((a)+((b)-(a)+1)*((double)rand()/((double)RAND_MAX+1))))

// card 0 - grn/grn
// card 1 - red/grn
// card 2 - red/red
// side = 1 / 0

int
main(int argc, char **argv)
{
int ii, card, side, nLoop = atoi(argv[1]);
int nGrn = 0, nGrnGrn = 0;
int nRed = 0, nRedRed = 0;
// nRed means the initial side shown is red
// nGrn means the initial side shown is grn
printf("%d = x%X = RAND_MAX
", RAND_MAX, RAND_MAX);
sranddev();

for (ii = 0; ii < nLoop; ii++) {
    card = VM_RANDOM_INT(0, 2);
    side = VM_RANDOM_INT(0, 1);
    switch (card) {
        case 0:
            nGrn++;
            nGrnGrn++; // side doesn't matter
            break;
        case 1:
            if (side) {
                nRed++;
            } else {
                nGrn++;
            }
            break;
        case 2:
            nRed++;
            nRedRed++; // side doesn't matter
            break;
    }
    printf("%d %d %d) %d %d %d %d

", ii, card, side,
nGrnGrn, nGrn, nRed, nRedRed);
}

printf("%d trials

“, nLoop);
printf(”%d = nGrnGrn = %g %%
“, nGrnGrn, (double)nGrnGrn / nLoop);
printf(”%d = nGrn = %g %%
“, nGrn, (double)nGrn / nLoop);
printf(”%d = nRed = %g %%
“, nRed, (double)nRed / nLoop);
printf(”%d = nRedRed = %g %%
", nRedRed, (double)nRedRed / nLoop);
}

As replied to the same question previously. You are not reading the puzzler, you are imputing conditions that do not exist. Use the constraints as defined. The puzzler only says. "I’ll bet you even money that the other side of the card is also red."
What part of it can only be the red green card, or red red card am I missing? Thus 1/2, 50/50 even money!

Barkydog wrote:

As replied to the same question previously.

well, I don’t see a previous post by Barkydog on my page (maybe a under a different user).

In any case, I agree that the puzzler says:

“I’ll bet you even money that the other side of the card is also red.”

I think the confusion all around is that people are enumerating all the sides,
as if all the other sides are independent combinations.

However, you are picking a card, and there are constraints involved that are ignored
if you simply enumerate all the other sides.

Maybe this will simplify.

If you pick a card, without looking at it, what is the chance you picked one of the cards with red?
2/3
There are 3 cards total, 2 cards with red.

Now you look at one side
(analogous to opening a door in the Monte Hall puzzle).
Now you have more information.

of all the cards which can show red, what is the chance of the other side being red?
1 is red, 1 is green. 50/50

You must multiply the two probabilities together: 2/3 * 1/2 = 1/3

So, I have my reasoning, and when I run a simulation I get the same result.

I don’t see what I’m missing.
I’d like to play this game with someone who believes the odds are 2/3 for red/red.

It does not matter which card you pick, of the three cards it can only be one of two options red or green. If red it is either red red card or red green card. If green red green or green green. You are not reading the puzzler, you are imputing conditions that do not exist. Use the constraints as defined. The puzzler only says. "I’ll bet you even money that the other side of the card is also red."
What part of it can only be the red green card, or red red card am I missing? Thus 1/2, 50/50 even money!

The one statement in the puzzle reads something like this: “Without looking, you will draw a card from the bag and place it face down on the table without revealing the side of the card that is down”. Neither the gambler nor the mysterious gentleman knows what the color is of the face that is down. However, both know the color of the side of the card facing up. There are two sides to each card and three cards, so there are six possibilities for the side of the card that faces up. Since the side of the card facing up is red, you can eliminate the card with two green faces. There are two ways that the card with two red faces could have been laid on the table, had this card been selected. However, there is only one way that the card with one face red and one face green been laid on the table had this card been laid on the table with the red face up. This is why it is twice as likely for the face of the card on the table to be red.

While the guest is focused on the red/green possibility (50/50), the host knows there is a 33% chance the mixed color card was pulled from the bag. With green or red the offer is the same.

Tom and Ray’s explanation was wrong and confusing.

Nevada_545 says:

With green or red the offer is the same.

sure.
that’s what the con man will do and win over the long run.
I agree.
If the host sees red, he bets the other side is red.
If the host sees green, he bets the other side is green.

However the puzzler didn’t say anything about doing this multiple times.
The puzzler asked about this one trial.
Doing it multiple times would change the probabilities in the hosts favor.

In one trial, the chances of picking the red/red card are 1/3.
Similar to the Monte Hall problem, although not exactly, it’s safer to bet
on the outcome that has 2/3 chance.
The chance of picking the winning Monte Hall door is 1/3.

the host knows there is a 33% chance the mixed color card was pulled from the
bag.

true.
that’s why the con man will take the bet many times and win over the long run.

However, the puzzler asked about would you take the first trial bet?
I say your chances are better than even the first time.

After the first time, the odds turn in the con man’s favor,
because the host will keep switching the bet.
Sometimes red, sometimes green, according to the face shown.
With more than 1 trial the enumerated possibilities favor the host.

BTW: It doesn’t help you to bet only when you see a particular color.

Tom and Ray’s explanation was wrong and confusing.

I agree to that.

Fred;

After the first time, the odds turn in the con man’s favor

What would the gamblers odds be on the second or third bet?
Sould I be the first in line?
I need to polish my gambling skills, I’m taking my pay check to the Silver Slipper Casino on friday.

"However the puzzler didn’t say anything about doing this multiple times.
The puzzler asked about this one trial.
Doing it multiple times would change the probabilities in the hosts favor.

In one trial, the chances of picking the red/red card are 1/3.
Similar to the Monte Hall problem, although not exactly, it’s safer to bet
on the outcome that has 2/3 chance.
The chance of picking the winning Monte Hall door is 1/3.

the host knows there is a 33% chance the mixed color card was pulled from the
bag.

true.
that’s why the con man will take the bet many times and win over the long run.

However, the puzzler asked about would you take the first trial bet?
I say your chances are better than even the first time."

I am the originator of this thread on the red/green card puzzler. It was an ideal problem to introduce Bayesian statistics, and so that is how I formulated the solution. The problem can be solved by enumerating all possible outcomes, but that can be tricky (see below). Bayesian statistics nails it. There is only one correct answer. Case closed.

Baysien statistics is the course de rigueur for MBA aspirants majoring in finance. My earliest experience in statistics was maximum-likelihood statistics, which worked fine for the natural sciences. I like to refer to that
(i.e., maximum likelihood estimators, distribution of estimators (“students-t” chi-squared, etc.)) as “classical” statistics. In comparison, Bayesian statistics is “quantum” statistics.

To see how enumeration of outcomes can lead one astray, google Bertrand’s paradox. To quote from Wikipedia -

<font face="times""The Bertrand paradox goes as follows:

Consider an equilateral triangle inscribed in a circle. Suppose a chord of the circle is chosen at random. What is the probability that the chord is longer than a side of the triangle?

Bertrand gave three arguments, all apparently valid, yet yielding different results.

The contradictions are resolved using Baysian statistics.

And that is my final word on this topic.

“And that is my final word on this topic.”

So when should we expect your next post on this topic?

This isn’t statistics, it’s probability.

As posted on the other active discussion,

You fail to read the puzzler question as posted, yes if you were drawing cards the odds are different, but I must remind you to only answer the question at hand AS POSTED IN THE PUZZLER.

"“I’LL BET YOU EVEN MONEY THAT THE OTHER SIDE OF THE CARD IS ALSO RED.”

No drawing cards from a bag, no nothing else, only 2 cards can satisfy the option of showing a red side! 50/50 chance.

A for persistence, F for being right.