The Magic Hat

Jul 11, 2005

RAY: Imagine there is a hat sitting on the table. And there are two contestants. You, Tommy, will be one of the contestants, and we'll call the other one Vinnie.

You reach into the hat, Tommy, and pull out a number. Then, Vinnie does the same. Now, the reason this hat is magical is that, no matter what number you pull out, Vinnie will always pull out a number that is either one above or one below your number. For example, if you pull out a two, Tommy, you know Vinnie has pulled out either a one or a three.

TOM: I'm with you man! Keep going. I like it.

RAY: To make it simple, we'll limit the numbers to between one... and infinity.

So, each of you pulls out a number. Let's say you pick three and Vinnie picks two. I'm the moderator, and I ask Tommy, "Do you know what number Vinnie has?" Tommy looks at his number, which is 3, and says, "No, I don't."

I then ask Vinnie, "Do you know what number Tommy has?" He looks at his number two and says, "Yes." He knows Tommy has to have a 3.

TOM: Really?

RAY: Now, here's the tricky part:

Regardless of the numbers that are picked, and assuming that both contestants answer truthfully, if I keep asking the question of both of them, eventually one contestant will know what number the other contestant has.

In other words, if I ask Tommy, then ask Vinnie, then Tommy again... then Vinnie again... eventually one of them will know the other's number.
RAY: Here's what I want you to do: Take a pencil and paper and draw five boxes, starting at the top. In the first box, in the upper left corner, put the number one.

In the upper right of the first box, put the number two. Then, right below that, in the lower left and right corners, reverse the digits, so they're labeled two and one.

The second box, below the first, is going to have the numbers two and three in the upper right and upper left corners. Then in the lower left corner three, and two in the lower right.

RAY: The next box is three and four, left to right.

TOM: And then four, three.

RAY: Then four, five, five, four. You see the trend.

Now, let's say you have the number three. In other words, you're on the left. Vinnie, meanwhile, has four.

TOM: I have three and Vinnie has four. So I'm in the third box.

RAY: Correct, Tommy. I ask you, "Do you know what number Vinnie has?"

TOM: No.

RAY: Right--because Vinnie could have either a two or a four.

Now I ask Vinnie, "Do you know what number Tommy has?" He also answers, "No." Then I come back to you. I ask you again, "Do you know what number Vinnie has?"

And you answer, "Yes." How do you know? Well, let's go to the previous example, which is just above.

You have three and Vinnie has two. I ask you, "Do you know what number Vinnie has? As in the previous example that I gave, you have to say, "No."

TOM: Right, because Vinnie could have a two or a four since I have a three.

RAY: That's right. But when I ask Vinnie if he knows your number, he answers, "Yes." Because if he has two, you must have either one or three. And if you had one, you'd have known right off what number he had.

TOM: Right. He'd have had a two.

RAY: Because you didn't answer, "Yes," he answers, "Yes."

Okay. Now, let's go back to the first example, where you have 3 and Vinnie has 4.

When you answered, "No," the first time, and Vinnie answered, "No," you knew he couldn't have a two--because if he had a two he would have said, "Yes."

Because Vinnie didn't answer, "Yes," he must have four. So, when I ask you the second time, "Do you know what number Vinnie has?" you answer, "Yes."

Now go to the next example, where you have four and Vinnie has five. Believe it or not, the sequence of answers is, "No," "No," "No," and "No," and it comes back to you...

TOM: And I, Tommy, answer, "Yes."

RAY: Tommy, you got it man! Congratulations.

Get the Car Talk Newsletter