Posts Tagged ‘logic puzzles’

Slow And Steady Wins The Race

Saturday, September 19th, 2009

After reading When Logic And Intuition Fail, someone asked me about a related paradox you may have heard about.

Let’s say you drive to work at 40 mph, and come back at 60 mph. What was your average speed?

It’s natural to think your average speed was 50 mph, but it was actually 48 mph. It would be 50 mph if you spent the same amount of time at both speeds. But since you’re spending more time at 40 mph than you are at 60 mph, your average speed has to be less than 50 mph.

If you’re driving to the beach, you might try to hold steady at 60 mph. But you won’t be able to stay exactly at that speed. You’ll sometimes be going a little faster, and sometimes be going a little slower. Even if the fast periods perfectly cancel out the slow periods, your average speed will still be less than 60 mph.

If you use cruise control, you not only save effort and gas, you also save time. That’s what slow and steady (emphasis on the steady) does for you.

And it’s one reason why you’re more productive when you do things at a steady pace, instead of slacking off and trying to make up for it later. It’s better to put your efforts on cruise control.

When Logic And Intuition Fail

Tuesday, September 15th, 2009

Seth Godin recently posted a wonderful brainteaser in Not so good at math:

Let’s say your goal is to reduce gasoline consumption.

And let’s say there are only two kinds of cars in the world. Half of them are Suburbans that get 10 miles to the gallon and half are Priuses that get 50.

If we assume that all the cars drive the same number of miles, which would be a better investment:

  • Get new tires for all the Suburbans and increase their mileage a bit to 13 miles per gallon.
  • Replace all the Priuses and rewire them to get 100 miles per gallon (doubling their average!)

Would you believe that you save more gas by putting new tires on the Suburbans? Because that’s the right answer.

What’s great about this problem is that it seems so simple, but the result is so astonishing. Even after you know the answer, it’s still hard to get your head around it.

Seth’s point was that we’re not wired for arithmetic. True, but I think what this problem really shows is that we’re wired for making faulty assumptions about numbers. It’s not our arithmetic that fails us in this case. It’s our logic and intuition that do.

How to solve it logically

In 6 Ways To Improve Your Telecommunication, Zack Grossbart shows a simple way to solve the problem by using pictures and plugging in real numbers. He crunches the numbers for one Suburban, one Prius, and a specific number of miles for the commute.

That’s one way I might have done it. Another way I might have done it is by flipping the miles per gallon (1/mpg) to get gallons per mile. When you want to see how much gas you’re burning, the relevant metric is gallons.

Suburban Prius
Before upgrade 0.100 gpm 0.020 gpm
After upgrade 0.077 gpm 0.010 gpm
Gas saved 0.023 gpm 0.010 gpm

As you can see, upgrading a Suburban saves 2.3 times as much gas.

How to solve it intuitively

OK, we know how to arrive at the answer. But how can we resolve the paradox? How can getting 30% more mpg possibly be better than getting 100% more mpg? Here are two ways to understand it intuitively.

1. Consider a more extreme version of the problem.

You own a Hummer that gets 5 miles per gallon. You also own a futuristic supercar that can drive across the country on a single drop of gas. Would you rather get 1% better mileage on your Hummer, or 1,000,000% better mileage on your futuristic supercar?

Don’t turn this into a problem of comparing one percentage against another. There’s no point in upgrading the supercar. The percentage you improve it by is irrelevant, because nanodrops of gas don’t matter. But any improvement on the Hummer is huge because it burns a lot of gas.

2. Consider a reworded version of the problem.

All the Suburbans in the world burn 83% of the gas. All the Priuses in the world burn 17% of the gas. Which model should you upgrade?

When it’s phrased this way, the answer is obvious. The wording of the original problem distracted you from what was really important. Of course, problems aren’t always nice enough to phrase themselves in the way that is most convenient for you.

Why doesn’t common sense work?

There are several reasons why it’s so easy to be led astray.

1. We fail to spell out our objective. The wording is critically important, because it’s easy to solve the wrong problem.

Are we trying to maximize the mpg of the average car? No. (If we were, we should upgrade the Prius.) Our goal is to minimize the total amount of gas burned by all cars. So focus on that.

2. It might seem strange that we’re not trying to maximize the average miles per gallon. Isn’t that the same as reducing the total amount of gas burned? Well, it would be, if there was only one car. But averages can be tricky.

If we upgrade the Suburbans, the average car would get (13 + 50) / 2 = 31.5 miles per gallon.

If we upgrade the Priuses, the average car would get (10 + 100) / 2 = 55 miles per gallon.

55 is more than 31.5, so upgrading the Prius means burning less gas, right? It might seem like it should work that way, but there is no mathematical law that says so.

Looking at the average isn’t enough – you need to look at the distribution. Here are three pairs of cars, each pair averaging 10 mpg. The greater the variance within each pair, the more gas is needed to drive a fixed distance.

Mileage Gas needed to drive 100 miles
Car 1a 10 mpg 10 gallons
Car 1b 10 mpg 10 gallons
Total gas 20 gallons
Car 2a 5 mpg 20 gallons
Car 2b 15 mpg 6.67 gallons
Total gas 26.67 gallons
Car 3a 0 mpg infinity gallons
Car 3b 20 mpg 5 gallons
Total gas infinity gallons

That’s what we get when we keep the distance fixed and look at how much gas we need, which is what we have to do for this problem. But just for fun, let’s keep the amount of gas fixed and look at how far we can drive with the same cars.

Mileage Distance driven on a 10 gallon tank
Car 1a 10 mpg 100 miles
Car 1b 10 mpg 100 miles
Total distance 200 miles
Car 2a 5 mpg 50 miles
Car 2b 15 mpg 150 miles
Total distance 200 miles
Car 3a 0 mpg 0 miles
Car 3b 20 mpg 200 miles
Total distance 200 miles

Is that surprising?

3. Reciprocals (mpg vs. gpm) are confusing. We’re trained to think in terms of miles per gallon. But gallons per mile is actually a much more natural unit to work with when you’re looking at how much gas you’re burning.

The Suburban gets 10 mpg, and the Prius gets 50 mpg. The Prius gets 400% better mileage (mpg), but it burns 80% less gas (gpm), so you have to be really clear on what you’re talking about.

The differences between reciprocals get more pronounced when you approach a singularity. 0/1 is very different from 1/0, which is what caused the difference in the previous two charts.

4. We’re told that there are equal numbers of Suburbans and Priuses, and we subconsciously think they should therefore be treated equally. But we need to discriminate. The Suburbans are burning 83% of the gas in the world, so they need to be given more weight. It doesn’t matter how many there are, only how much gas they’re all burning.

Of course, what people should really be doing is trading in their Suburbans for Priuses.

Logic Test From My Interview

Thursday, February 12th, 2009

I had a job interview today, where they gave me a logic test. I didn’t get to keep it, but I remembered most of the questions. Have fun!

1. Split 110 into two parts, so that one part is 150% of the other. What are the two numbers?

2. There are 100 people, and everyone is either a football player or a basketball player. There is at least one football player. For any two people, at least one of them is a basketball player. How many football players are there?

3. The number 8,549,176,320 is the only one of its kind. Can you figure out what’s so special about it?

4. There are 20 questions on a test. You gain 10 points for each correct answer, and lose 5 points for each incorrect answer. Someone answers all the questions and gets 125 points. How many questions did they get wrong?

5. Two coins add up to $0.55, and one of them is not a nickel. What are the two coins?

6. What is the biggest number you can make using two numbers? Just two numbers, no other mathematical symbols.
[When they say "just two numbers," I took that to mean two digits.]

7. The number of lilly pads in a pond doubles every day. Starting with just one lilly pad on the first day, the pond is completely covered with lilly pads after 60 days. How long did it take for the pond to be half covered?

8. An adult and two children need to cross a river. They have a boat that either child is able to handle by themselves. The boat can carry either the adult or both children, but not the adult and a child at the same time. How can they cross the river?

9. Someone introduces you to your mother’s only sister’s husband’s sister in law. He has no brothers. How do you address this person?
[This isn't stated too well, but I assume "he" refers to your mother's sister's husband.]

10. There are two different colors of socks in a drawer. Without looking at them, how many do you need to take out to ensure you have a matching pair?

11. According to someone’s will, $666,666 is to be divided between 2 fathers and 2 sons. They discuss it, and each person gets $222,222. Explain.

Einstein’s Riddle (The Zebra Puzzle)

Sunday, January 11th, 2009


Photo by http2007

This is my 200th post. Thus, I can now say I’ve written hundreds of posts, instead of dozens. It will take 1,800 more posts before I can say I’ve written thousands, so this is a nice milestone!

I heard about this puzzle from @marelisa on Twitter, and I found a related but harder version on Wikipedia. It’s known as either Einstein’s Riddle, or The Zebra Puzzle. Albert Einstein allegedly created it as a boy, and he said that only 2% of the world’s population could solve it.

While it’s not clear whether it was actually created by Einstein, the 2% figure seems about right, especially because most people haven’t tried a puzzle like this before. But if you’re feeling up to it, I’ll give both versions of the puzzle, followed by some tips on how to do it.


Here’s the version of Einstein’s Riddle that Marelisa found. (Note there’s no zebra in this one.)

- In a street there are five houses, painted five different colors.

- In each house lives a person of different nationality.

- These five homeowners each drink a different kind of beverage, smoke a different brand of cigar, and keep a different pet.

Einstein’s riddle is: Who owns the fish?

Necessary clues:

1. The British man lives in a red house.
2. The Swedish man keeps dogs as pets.
3. The Danish man drinks tea.
4. The Green house is next to, and on the left of the White house.
5. The owner of the Green house drinks coffee.
6. The person who smokes Pall Mall rears birds.
7. The owner of the Yellow house smokes Dunhill.
8. The man living in the center house drinks milk.
9. The Norwegian lives in the first house.
10. The man who smokes Blends lives next to the one who keeps cats.
11. The man who keeps horses lives next to the man who smokes Dunhill.
12. The man who smokes Blue Master drinks beer.
13. The German smokes Prince.
14. The Norwegian lives next to the blue house.
15. The Blends smoker lives next to the one who drinks water.


Here’s the version of The Zebra Puzzle in Wikipedia. This is the first known publication of the puzzle, from 1962. While similar to the version above, it’s significantly harder. As far as I can tell, it requires making a guess from multiple possibilities, then looking ahead to see how it pans out, and backtracking if it doesn’t work.

1. There are five houses.
2. The Englishman lives in the red house.
3. The Spaniard owns the dog.
4. Coffee is drunk in the green house.
5. The Ukrainian drinks tea.
6. The green house is immediately to the right of the ivory house.
7. The Old Gold smoker owns snails.
8. Kools are smoked in the yellow house.
9. Milk is drunk in the middle house.
10. The Norwegian lives in the first house.
11. The man who smokes Chesterfields lives in a house next to the man with the fox.
12. Kools are smoked in a house next to the house where the horse is kept.
13. The Lucky Strike smoker drinks orange juice.
14. The Japanese smokes Parliaments.
15. The Norwegian lives next to the blue house.

Now, who drinks water? Who owns the zebra?

(In the interest of clarity, it must be added that the five houses are in a row, each is painted a different color, and their inhabitants are of different nationalities, own different pets, drink different beverages, and smoke different brands of cigarettes.)


Here are some tips.

I can’t imagine solving these puzzles without using a chart to keep track of what you know. Most people would use a chart like the following, where it starts off blank and you fill in the words as you learn what’s in each house.

This is how the chart would look near the very beginning, after applying the clue that milk is drunk in the middle house.

House 1st 2nd 3rd 4th 5th
Nationality
Color
Drink Milk
Cigar
Pet

But this is what I did. I started with a chart listing all the possibilities. For example, each of the drink cells started off with “Water Tea Orange Milk Coffee,” which I abbreviated here as “WTOMC” so it fits. Then I began deleting options that were impossible.

Below you can see how it looks after learning that milk is drunk in the middle house.

House 1st 2nd 3rd 4th 5th
Nationality NUESJ NUESJ NUESJ NUESJ NUESJ
Color YBRIG YBRIG YBRIG YBRIG YBRIG
Drink WTOC WTOC M WTOC WTOC
Cigar KCLPO KCLPO KCLPO KCLPO KCLPO
Pet FZHDS FZHDS FZHDS FZHDS FZHDS

This way is more cumbersome, and I would only do it on a computer, not on paper. But I think it makes it easier to keep track of what you know, and therefore easier to solve the puzzle. That’s because you can track every possibility you rule out, instead of only writing something down after you’ve ruled out all other possibilities.

One more tip: cross out clues after you no longer need them. As the list of clues shrinks, you fill in the details, and eventually find out who owns the fish or the zebra.

The Case Of The Stolen Diamond

Saturday, January 3rd, 2009


Photo by stephend9

In the comments on The Birthday That Never Arrives, some people requested another lateral thinking puzzle. Here you go!

This one comes from Encyclopedia Brown, a series of children’s mystery books published from 1963 to as recently as 2007. These books star Leroy “Encyclopedia” Brown, the 10-year-old know-it-all supersleuth son of the chief of police. (For the members of generation Y, an encyclopedia was something like Wikipedia, but in books!)

This story has been reconstructed from what I remember.

Mr. Diamondthief is invited to a party at a friend’s house. Because the house contains things that people would like to steal, all arriving guests are frisked to make sure they aren’t carrying any weapons and such. Mr. Diamondthief is clean, so they let him in.

But Mr. Diamondthief has sinister motives. He’s really there to steal a diamond. And he’s been in this house before, so he knows exactly where it is. Upon entering the foyer, he goes up a narrow staircase, down a long hallway, into the fourth room on the left, where the diamond is. He takes the diamond.

Because he knows he’ll be frisked on the way out, he can’t just take the diamond out with him. So he looks around, trying to find some way to get the diamond out of the house. He comes across a bow and a quiver full of arrows. Perfect! He ties the diamond to an arrow, opens the window, and shoots the arrow into a tree down the street. He closes the window, puts the bow back where he found it, and wipes off his fingerprints.

He then walks out the front door. They frisk him, and he’s clean. The arrow with the diamond is stuck in a tree down the street, but he decides it’s too risky to get it now. Another party guest might see him walking down the street instead of getting into his car, or the cops might search the homes of all the party guests. He decides to come back for the diamond another time.

The next day, the owners of the house notice the missing diamond, and call the police. Police chief Brown calls all the party guests back to the house for questioning, and to search for the diamond. The assumption is that the diamond is probably still in the house, since all guests were frisked on the way out. Of course, Chief Brown takes his son Encyclopedia with him, since he’s the one with the best detective mind.

Encyclopedia thinks Mr. Diamondthief looks suspicious, but there’s no evidence against him. Encyclopedia starts exploring on his own, and finds the bow and quiver of arrows, noting that one arrow is missing. He sees the window, and realizes how the diamond was stolen.

As Encyclopedia comes down the stairs, he hears Mr. Diamondthief saying “Chief, this search is pointless. Even if the diamond is still here, this house is huge. We’ll never find it!”

Encyclopedia says, “Don’t worry, Mr. Diamondthief. The diamond is just an arrow flight away.”

Mr. Diamondthief says, “Well then, go outside and look for it.”

Encyclopedia says, “Dad, arrest him!”

How did he know Mr. Diamondthief was guilty?

As a kid, I thought the answer was a little cheesy. I actually like it much better now, though my preferred answer is slightly different from the official answer.

If you’ve heard it before, don’t blurt out the answer – let’s give a chance for other people to guess.

The Birthday That Never Arrives

Tuesday, December 30th, 2008


Salvador DalĂ­’s The Persistence of Memory

Marelisa Fabrega wrote about lateral thinking and gave us some interesting logic puzzles to play with. In the spirit of promoting lateral thinking, I’ve come up with a puzzle of my own. Be the first to solve it, and win a prize.

A guy wakes up early in the morning, happy because it’s his birthday. Because he’s very precise about time, he wants to jump up and shout “Woo hoo!” at the exact time of his birth.

He looks at the clock and sees that it’s not time yet, so he waits and twiddles his thumbs. But after a while, he suddenly realizes that it will never be the right time. Why?

If you think you know the answer, leave a comment and tell us. If you’re the first one to get it, I’ll leave a comment on your blog and give you a stumble. Hey, I didn’t say it was a big prize!