Monday, June 22, 2009

Wanna feel smart?

Few things give me the boost of solving a difficult puzzle. Whether I've rooted out a logical flaw in one of my scripts or finally grasped an unintuitive programming concept, I always feel best when I've conquered a challenging problem. From now on, anytime I figure out satisfying puzzle, I'll pass it along to you along with my rationale for solving it. If you have a better way, feel free to tell me.

Today, I found a real stumper on my favorite blog, Coding Horror. Jeff Atwood examined a probability conundrum related to the game show "Let's Make a Deal". Here's the setup, according to Jeff's post:

Suppose the contestants on a game show are given the choice of three doors: behind one door is a car; behind the others, goats. After a contestant picks a door, the host, who knows what's behind all the doors, opens one of the unchosen doors, which reveals a goat. He then asks the contestant, "Do you want to switch doors?"

Should the contestant switch doors?

Even though you know that the answer can't be the obvious "It doesn't matter", you probably can't think of any reason that it's not. One of Jeff's links supplied this totally unsatisfying explanation:

When you first selected a door, you had a 1/3 chance of being correct. You knew the host was going to open some other door which did not contain the car, so that doesn't change this probability. Hence, when all is said and done, there is a 1/3 chance that your original selection was correct, and hence a 1/3 chance that you will win by sticking. The remaining probability, 2/3, is the chance you will win by switching.

That explanation didn't assuage my doubts, so I started thinking of the problem in different terms. I finally convinced myself that 2/3 was the right answer by breaking the problem into cases.

In the first case, the car is behind door number one and you decided not to switch. If you chose door number one, you would win, but if you chose door number two or three, you would walk away with a goat.

In the second case, the car is still behind door number one, but you decided to switch no matter what. If you pick door number one and switch, you lose the game. However, if you pick door number two or door number three, you get to drive off in a brand new car.

I don't have the expertise or patience to posit why people tend to make the wrong decision, but I'm satisfied to have figured it out for myself. If I find any more head-scratching logic puzzles, I'll make sure to pass them on. I want you to feel smart, too!