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

. In the public school I taught at, there were still parents who thought AP courses should be provided for their child, regardless of past performances.

That’s one reason I sent my kids to private school.

They had three levels (standard, Honors, and AP). The public schools had the same.

But the standard level in my kids school was equivalent to the public schools Honors or in some cases AP. My daughter took AP Calc, Physics and Chemistry. And at my daughters high-school you had to be ACCEPTED into the AP class. The average in her class on the AP exam was 3.5. The HIGHEST on the AP exam at the public high-school was 3.0. My daughter got 5.0 on all three AP exams. And MIT gave her college credit for her AP classes. Many schools will only give credit for 4 or higher.

@dogasa…One of the main problems in the public high-school near us is the quality of the Math teachers. Of all the math teachers they have at the school…only 2 actually have degrees in Math or Science. One use to teach in the middle school where my sons and daughter went. He had a degree in History…but because he had is “Teachers certificate” he was considered qualified to teach ANY subject. He barely understood the 7th grade math he was teaching. At least the private schools my kids attended (and still attending) the teachers are far more qualified to teach Match and Science. One of the teachers has a PHD in Physics from RPI. GREAT teacher…Retired from GE when GE moved their Jet engine plant out of Lynn MA.

“In less then a year dear, you’ll be on your own without mommy or daddy to hold your hand. Start preparing”.
dagosa–I agree with you 100%. Unfortunately, in too many classes today (and this includes college courses), there is too much memorization required with little application. I have had students ask “What should we memorize for the test?” My answer to this: “You will see problems on the test that you didn’t see in class. If you have kept up with the outside work, you should be able to do these problems”. What I found disturbing, particularly in my last ten years of teaching, is that I had younger colleagues who never picked up assignments. One colleague complained to me that his linear algebra students, when asked if any had questions over the assigned work, none had a question. Yet, when it came to a test, these students did poorly. I asked him if he picked up the assignments and the answer was NO. He didn’t think that one should have to pick up and grade assignments.
In my last years of teaching, our classrooms were equipped with digital camera devices. We could place an object under the camera and it would be projected on a screen. One of the funny, but sad experiences I had was just before class started, a group of students were snickering and one told me that I wasn’t teaching the way I should. I asked how I was supposed to teach. The student responded, “You are supposed to project the textbook onto the screen and read it to us. That is what our other professors do”. I responded, “I’m not your other professors. I think you are all able to read for yourselves”. During a free period, I walked down the hall and I had colleagues that were teaching just the way the students described. My students weren’t really critical of me–they knew what a couple of other faculty were doing was a joke.
There is a book that came out a year ago titled “Academically Adrift–Limited Learning on College Campuses”. Roughly 4000 students were tested in critical thinking, problem solving and writing skills on 20 different college campuses. The conclusion was that students were making little or no gains in their first two years of college. As a nation, we are going through the mortgage crisis. I am afraid that the next big hit will be public higher education. With college loan debt exceeding credit card debt and many college graduates not employable, there is a big problem on the horizon.

Another quick way to see the solution: no matter which color turns up, the con man will bet you that the unseen side of the card is the same color. The only way you would win is if you had picked the red/green card, and you have only a 1 in 3 chance of having done that. So his odds are twice as good as yours.

Trie…“there is a big problem on the horizon”. Being the wide eye, flower child of the 60s, I feel we tackle education ( as well as healthcare) head on. Everyone gets it free from cradle to grave. I don’t think many will believe me if I said it’s the cheapest way to go. Bottom line, a single payer in both determines the cost and quality of the product. My logic is different then others. But then, I would like to see single payer Vette ownership too.

@Dsorgnzd:
Here is a similar problem: The cowboy turns his back and the gambler lays out the three cards on a table. He peaks under each card and knows the colors that are face down. The cowboy turns around and is asked to select the card with the opposite color on the reverse. The cowboy points at the card he guesses is oppositely colored, say #1. His odds in winning are 1 in 3. The gambler picks another card, say #3, and flips it over, showing that it has the same color on both sides. The gambler now gives the cowboy the option of switching his selection to card #2, or staying pat with his original selection of card #1.

The question: What now are the cowboys odds of winning if he stays with his original selection of card #1? What are the cowboys odds of winning if he switches to card #2? Explain your reasoning.

Bayesian statistics are a large component of financial analysis algorithms. Those who are knowledgeable in Bayesian statistics and graduate from a prestigious GSB school can almost write their six-figure ticket to a firm on Wall Street.

Jon Corzine graduated in my class in 1975. He was a whiz in Bayesian statistics. Too much of a whiz in other things as it worked out.

That’s the Monte Hall problem and it’s been done to death.

“Time is based on the rotation speed of the earth with 24 hours equal to one trip around the earth at the equator.”

I’m an old geizzer. I can’t possibly remember my probability classes and definitely not Bayes Theorem. I just listed out all the possible combinations for the three cards. Then it was easy to see a certain number of the combinations had a red card showing. And a certain subset of those had what the questions asked, and the other ones didn’t. It’s just a questions of whether the set of red card ups that had what the question asked, was that greater than the set of red card ups that didn’t? Does that sound correct?

Sounds good to me. That’s how probability starts out, making a list of all possible combinations.

GeorgeSanJose"I can't possibly remember my probability classes and definitely not Bayes Theorem. I just listed out all the possible combinations for the three cards. ... Does that sound correct?"
I don't know ... you lost me somewhere in the middle of your post.

The cowboy has two strategies: When asked to make a choice after the gambler flips a red/red or a green/green card, he can either stand pat with his first decision, or switch and point to another card.

If he stands pat, his odds of winning are 1/3, the same as it was before the gambler flipped the card.

If he always switches his selection, his odds of initially picking a red/red or a green/green card on the first selection are 2/3. But now he wins because the gambler must flip the remaining red/red or green/green card and the cowboy wins after switching has selection to the remaining card, which must be the card with differing face colors.

So the cowboys strategies and odds of winning are —

  • Stand pat and win one out of three; or
  • Always switch picks and win two out of three.

This could be solved by a modification of Bayes’ theorem using three variables, but I don’t think it’s worth the effort.

OMG.
yes! take the bet.

To Click and Clack:

I disagree with your published answer
> TOM: So you’re saying the chances of winning are two to one in favor of
> red?

about dependent probabilities:
Multiplication Rule 2:
When two events, A and B, are dependent, the probability of both
occurring is:
P(A and B) = P(A) * P(B | A)

A = picking a card with red on either side
B = probability of a card with red on one side is also red on the other
P(A) = 2/3
P(B) = 1/2
P(A and B) = 2/3 * 1/2 = 1/3

(at the bottom I’ll directly respond to Mechaniker’s reponse).

I imagine you’ll get a lot of other people also writing to
tell you.
The odds are that the con man is wrong. it’s only 1/3 likely that
the other side of the card is red.
run a simulation. you’ll see.

RAY: Believe it or not. You can believe it because what
you’re dealing with is not cards–
you’re dealing with the sides. When you see the red side
up,
you could be seeing one or the other face of the red card.
That’s what most people don’t grasp

It’s true that you don’t know if a card showing red has red on the other side.
That’s the point of the question.
Your conclusion is wrong.
You seem to conclude that because there are more red sides, it’s more likely
to see red on the other side.

To help you visualize, consider a situation with 1000 cards.
Let’s say 500 are green on both sides; 499 have both red and green;
and 1 has red on both sides.

As in your puzzler, there are more red sides than green sides.
given that it’s not a green/green card
green sides = 499
red sides = 499 + 2

Here, P(A) = 1/2
P(B) = 1/500
P(A and B) = 1/2 * 1/500 = 1/1000

Alternatively, consider only 1 card out of 1000 that have red on both sides
What do you think your chances are of picking that card?
Doesn’t it seem to you that it would be unlikely. say 1/1000.
Given that it’s not a green/green card, there are more red sides possible,
but do you really think you’d have been more likely to pick that 1 card in 1000
instead of one of those cards with red and green ?

This is similar to the “Monty Hall” situation. shown 3 doors, all closed.
the contestant picks one.
Monty opens a door, showing a booby prize, and asks if you should switch.
The answer is yes. Your chances are 2/3 that the door you didn’t pick is the
winner.

To visualize, again consider 1000 doors.
only one good door.
you pick a door.
Monty opens 998 doors with bad prizes.
Should you switch ?
yes.
The chances are 1/1000 that you picked the good door.
The chances of the other door you didn’t pick is 999/1000 of having
the good prize behind it.

The fact that doors were opened doesn’t increase your original odds.
But, you now have more information, and you know that 998 doors were wrong.
Chances were 999/1000 that you didn’t pick the right door, and now that
you know 998 of the other doors were wrong, the one remaining door is
likely to hide the good prize with a probability of 999/1000
Switch your choice.

For the puzzler, take the bet.
You’ll be right 2/3 of the time.


Mechaniker says:

use Bayes’ theorem: P(A|B) = P(B|A) * P(A) / P(B)
Let A be the event: red on both sides before seeing face; P(A) = 1/3
Let B be the event: a red face shows up; P(B) = 1/2
Let B|A be the event:
red face shows up given that red is on both sides; P(B|A) = 1

Then A|B is the event: red on both sides given that red face up;
P(A|B) = 1*(1/3)/(1/2) = 2/3

With all due respect, I think this is a mis-application of Bayes’ theorem.

You don’t get to pick the side.
You pick a card.
you say P(B|A) = 1
but that assumes you’ve picked the red/red card.
You define A to be the event of picking the red/red card.
Of course, if you pick the card with red/red, the probability of the other
side being red is 1.
But you don’t know that A has occurred.
All you know is that red is visible.

It should be:
The initial event, A, is picking a card. some have red, some don’t.
It should be that:
A = picking a card with red on some side.
P(A) = 2/3

now that you’ve picked a card with red showing, what’s the probability that
the other side is red? there are two possibilities, 1/2 are red.
B = probability that other side is red
P(B) = 1/2

using Multiplication Rule 2:
When two events, A and B, are dependent, the probability of both
occurring is:
P(A and B) = P(A) * P(B | A)

The application of Bayes’ theorem should be:
P(B | A) = 1/2
P(A) = 1/3
P(B) = 1/2

P(A|B) = 1/2 * (1/3) / (1/2) = 1/3

so the chances of having picked the red/red card are 1/3
you’d be right 2/3 of the times to take the bet with the con man.


This also is an answer to Mechaniker February 22

The question: What now are the cowboys odds of winning if he stays with his
original selection of card #1? What are the cowboys odds of winning if he
switches to card #2? Explain your reasoning.

the cowboy should switch his choice.
just like the Monty Hall situation.

I agree with your post on Mechaniker February 23

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.