Click here to Skip to main content
15,885,925 members
Articles / Programming Languages / C++
Article

A non-computational solution to Einstein's Riddle

Rate me:
Please Sign up or sign in to vote.
4.41/5 (18 votes)
20 Dec 2003CPOL6 min read 165.7K   277   18   30
This is a fun article on how to solve Einstein's riddle without the help of a computer.

Introduction

Einstein's Riddle

There are 5 houses of 5 different colors. In each house lives a person of a different nationality. Each of the 5 residents drinks a certain type of beverage, smokes a certain brand of cigar, and keeps a certain pet. None of them have the same pet, smoke the same brand of cigar or drink the same beverage.

The question is: Who owns the fish?

Hints

  1. The Brit lives in the red house.
  2. The Swede keeps dogs as pets.
  3. The Dane drinks tea.
  4. The green house is on the left of the white house.
  5. The resident of the green house drinks coffee.
  6. The person who smokes Pall Mall rears birds.
  7. The resident of the yellow house smokes Dunhill.
  8. The resident of the center house drinks milk.
  9. The Norwegian lives in the first house.
  10. The person who smokes Blends lives next to the one who keeps cats.
  11. The person who keeps the horse lives next to the one who smokes Dunhill.
  12. The person who smokes Bluemasters drinks beer.
  13. The German smokes Prince.
  14. The Norwegian lives next to the blue house.
  15. The person who smokes Blends has a neighbor who drinks water.

Well, where do I start? First to avoid any charge of plagiarism, the source code pointer above, isn't mine. It belongs to this article. As you can see, the article pointed to above, refers to a computational solution to the problem. Here I present a reasoning approach that uses no combinatorial methods. It is said that Einstein thought that 98% of the world's people couldn't solve this riddle, which might have been an accurate prediction for the relatively ancient time Einstein was living in. That might not be true today, but I personally don't think the percentage of people who can't solve it have gone down much. Maybe 80% would be a better estimate for today. Chances are if you're reading this article, you probably can solve it. It isn't a difficult riddle if you have some experience with reasoning beyond what evolution endowed all of us with. Anyways, before I derail into a politically motivated ranting, will get going...

My Method of solving such a problem.

Notice I stated, "my method", because other people would likely approach it differently. First we start with establishing certain assumptions. In this case, the base assumption I tried to establish was the orientation of the houses. From the hints, it is clear that many conclusions can be met by knowing how the houses are positioned relative to one another. While one can argue as to what the hints tell us about the orientation of the houses, my understanding lead me to the following conclusions:

step1

step2

Why did I end up with these two orientations? Well, they seem to be the only ones that made sense, given the use of phrases such as ["Center": hint#8], ["on the Left": hint#4]. I chose the second orientation because of simplicity, and am not even sure the first orientation would work, I didn't try it. Now let's get to answering some questions in the riddle.

  1. Finding The Color of the Houses

    House #5 can't be green because, it isn't to the left of any house (see hint #4). House #2 is blue because it is the only house next to the Norwegian (see hint#14), and from hint #9, we know that the Norwegian lives in house #1. House #3 drinks milk (see hint#8), but we know the resident of the green house drinks coffee (see hint#5), so house #3 can't be green. We are now left to choose between house #1 and house #4, but we know house #1 is to the left of the blue house (see second sentence of this section), and from hint #4, the green house is to the left of a white house not a blue one. So which house is green? common! :).

    Since we now know house #4 is green, we can infer by way of hint #4 that house #5 is white, because it is to whose left, green is located.

    Since there are 2 uncolored houses left (House #1, House #3), we start with House #1. Well that's simple, the Norwegian lives there and from hint#1, the Brit lives in the red house. We conclude house #3 is Red.

    You're not really expecting me to tell you which house is yellow, are you????!!!

    step3

    Now we can move on to the other aspects of the puzzle, good news is we don't have to do too much work to solve the whole puzzle. Some of the clues can be filled in by merely looking at the hints and filling in the gaps. Surprisingly, one can't get prematurely to the solution. In other words, you have to solve the whole riddle before you could answer the question. I might be wrong, maybe it is just a coincidence on my part. If however it isn't, then it might be that the puzzle was an adaptation of some already formulated combinatorial technique. Einstein must have come up with this while trying to pose another experimental challenge to his quantum theory nemesis. :) Anyways, lets get going....

    First, I have color coded the clues. Purple for the clues that can be filled in directly from the hints. Black for the ones we have to figure out. Here are the ones we can already fill:

    puzzle4

  2. Who keeps the horse?

    Well that's simple, from hint #11, the only house next to the Dunhill smoker is the blue house.

    Answer: House2

    puzzle5

    At this point, we're stock!!!. Now we need to use some rather fuzzy logic. Below is a list of puzzle characters lined-up against the houses they could possibly occupy.

    puzzle6

    As you can see, there is somewhat of a red light blinking on the relation between the Dane and the BlueMasters smoker. One thing we do know is that they are not the same person. Meaning the Dane isn't the BlueMasters smoker, because the Dane drinks tea (see hint #3) while the BlueMasters smoker drinks beer (see hint #12). What all of this means is that either the Dane lives in house #5 and the BlueMasters smoker lives in house #2 or vice verse. Let's try the first scenario:

    Scenario a

    puzzle7

    With the above scenario ,the German and the Swede are left to both battle for house #4, which shouldn't be. So scenario a doesn't work. So...well if I have to say it, we will try scenario b:

    Scenario b

    puzzle8

    Note that scenario b has already been proven to be correct by showing that scenario a is incorrect. Next we look at the German and the Swede. Between the two of them, they now have house #4 and house #5 to choose from (House #2 is out of question for the German, the Dane is already there.). The German smokes Prince (see hint #13), so he couldn't be living in house #5....well you get the idea.

    puzzle9

  3. Who Smokes the Blend brand of cigarette?

    Per hint #15, the only place the Blend smoker could live is house #2. It is also clear who drinks water.

    puzzle10

  4. Filling in the rest:

    We know what all houses smoke but the Brit, so the Brit is left to smoke Pall Mall. The only person who lives next to the Blend smoker, who hasn't been assigned a pet is the Norwegian (see hint #10), so the Norwegian keeps cats.

    puzzle11

Our Solution??...Please!!

History

Last update: Correction of step 2.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
biography? I am not that old yet.

Comments and Discussions

 
QuestionInteresting Pin
Member 1078506629-Apr-14 21:43
Member 1078506629-Apr-14 21:43 
AnswerEinstein's Riddle iphone app Pin
Anatol1y16-Apr-12 1:32
Anatol1y16-Apr-12 1:32 
GeneralHint 15 and the riddle description Pin
Dezhi Zhao24-Dec-03 5:01
Dezhi Zhao24-Dec-03 5:01 
GeneralRe: Hint 15 and the riddle description Pin
mystro_AKA_kokie24-Dec-03 5:59
mystro_AKA_kokie24-Dec-03 5:59 
GeneralLet's solve it without using Hint 15 Pin
Dezhi Zhao24-Dec-03 10:33
Dezhi Zhao24-Dec-03 10:33 
Step 1
First use Hint 8 & 9. Then apply Hint 14:
House            1            2          3            4            5
Color                         Blue			
Nationality      Norwegian				
Baverage                                 Milk		
Cigar					
Pet

Step 2
From Hint 4, we know either house 3 & 4 or house 4 & 5 are green and white respectively. House 3 can be excluded as Green because its owner drinks Milk instead of Coffee as Hint 5 requires.
Therefore:
House            1            2            3           4            5
Color                         Blue                     Green        White
Nationality      Norwegian				
Baverage                                   Milk        Coffee
Cigar					
Pet					


Step 3-1
As 3 colors have been used and Hint 1 says Brit's house is red, this leaves yellow to Norweigian who lives in House 1. And Brit is left to House 3.
House            1           2           3            4            5
Color            Yellow      Blue        Red          Green        White
Nationality      Norwegian               Brit		
Baverage                                 Milk         Coffee	
Cigar            Dunhill				
Pet					

Step 3-2
We can easily apply Hint 7. Then apply Hint 11. We have:
House            1           2           3            4            5
Color            Yellow      Blue        Red          Green	   White
Nationality      Norwegian               Brit		
Baverage                                 Milk         Coffee	
Cigar            Dunhill				
Pet                          Horses			

Step 4
Let's examine what Norwegian drinks. He cannot drink tea (Hint 3) and beer (Hint 12). And milk and coffee are others' baverage. Therefore Norwegian is left to drink water:
House            1            2            3            4            5
Color            Yellow       Blue         Red          Green        White
Nationality      Norwegian                 Brit		
Baverage         Water                     Milk         Coffee	
Cigar            Dunhill				
Pet                           Horses			

Step 5
Now consider the rest of the baverage, beer and tea.
There are only 2 possiblities:

Branch A: House 2 has beer and House 5 has tea.
Branch B: House 2 has tea and House 5 has beer.

Step 5A1
Let's go with Branch A first and apply Hint 3 and Hint 12:
House           1           2           3           4           5
Color           Yellow      Blue        Red         Green       White
Nationality     Norwegian               Brit                    Dane
Baverage        Water       Beer        Milk        Coffee      Tea
Cigar           Dunhill     BlueMaster			
Pet                         Horses			

Step 5A2
Swede now can only lives in House 2 or House 4. As he keeps dogs instead of Horses (Hint 2), he can only live in House 4:
House           1           2           3           4           5
Color           Yellow      Blue        Red         Green       White
Nationality     Norwegian               Brit        Swede       Dane
Baverage        Water       Beer        Milk        Coffee      Tea
Cigar           Dunhill     BlueMaster			
Pet                         Horses                  Dogs

You see now German is left to House 2 and smokes BlueMaster, which conflicts with Hint 13. Therefore we do not have any solution with Branch A.

Step 5B1
Now let's go with Branch B and apply Hint 3 and Hint 12:
House            1            2            3            4            5
Color            Yellow       Blue         Red          Green        White
Nationality      Norwegian    Dane         Brit		
Baverage         Water        Tea          Milk         Coffee       Beer
Cigar            Dunhill                                             BlueMaster
Pet                           Horses			

Step 5B2
You see now German can only live in House 4 or 5. Because he does not smoke BlueMaster (Hint 13), he must be in House 4. And Swede is left to House 5 with dogs (Hint 2):
House            1            2            3            4            5
Color            Yellow       Blue         Red          Green        White
Nationality      Norwegian    Dane         Brit         German       Swede
Baverage         Water        Tea          Milk         Coffee       Beer
Cigar            Dunhill                                Prince       BlueMaster
Pet                           Horses                                 Dogs

Step 5B3
Now consider Hint 6. It is obvious from the above diagram that only house without cigar and pet is House 3
House            1            2            3            4            5
Color            Yellow       Blue         Red          Green        White
Nationality      Norwegian    Dane         Brit         German       Swede
Baverage         Water        Tea          Milk         Coffee       Beer
Cigar            Dunhill                   Pall Mall    Prince       BlueMaster
Pet                           Horses       Birds                     Dogs

Step 5B4
From above diagram we know Dane in House 2 must smoke blends. Hint 10 says he also has a neighbor who keep Cats. The neighbor must be House 1 because House 3 already has Birds.
House            1            2            3            4            5
Color            Yellow       Blue         Red          Green        White
Nationality      Norwegian    Dane         Brit         German       Swede
Baverage         Water        Tea          Milk         Coffee       Beer
Cigar            Dunhill      Blends       Pall Mall    Prince       BlueMaster
Pet              Cats         Horses       Birds                     Dogs

Step 5B5

Now we all know what is the only thing left in the above diagram.



Merry Xmas
GeneralRe: Let's solve it without using Hint 15 Pin
mystro_AKA_kokie24-Dec-03 13:18
mystro_AKA_kokie24-Dec-03 13:18 
GeneralMore puzzles Pin
Blair Bonnett22-Dec-03 22:18
Blair Bonnett22-Dec-03 22:18 
QuestionHouse #4 missing a pet??? Pin
leppie22-Dec-03 6:52
leppie22-Dec-03 6:52 
AnswerRe: House #4 missing a pet??? Pin
mystro_AKA_kokie22-Dec-03 7:30
mystro_AKA_kokie22-Dec-03 7:30 
GeneralAlternative solution methods Pin
mogwai21-Dec-03 21:50
mogwai21-Dec-03 21:50 
GeneralRe: Alternative solution methods Pin
mystro_AKA_kokie22-Dec-03 1:58
mystro_AKA_kokie22-Dec-03 1:58 
GeneralRe: Alternative solution methods Pin
mogwai22-Dec-03 3:08
mogwai22-Dec-03 3:08 
GeneralRe: Alternative solution methods Pin
David Crow22-Dec-03 4:53
David Crow22-Dec-03 4:53 
GeneralQuestion about step 2 Pin
John M. Drescher21-Dec-03 19:53
John M. Drescher21-Dec-03 19:53 
GeneralRe: Question about step 2 Pin
unitrunker21-Dec-03 21:04
unitrunker21-Dec-03 21:04 
GeneralRe: Question about step 2 Pin
mystro_AKA_kokie22-Dec-03 2:05
mystro_AKA_kokie22-Dec-03 2:05 
GeneralRe: Question about step 2 Pin
John M. Drescher22-Dec-03 6:16
John M. Drescher22-Dec-03 6:16 
GeneralRe: Question about step 2 Pin
John M. Drescher22-Dec-03 6:24
John M. Drescher22-Dec-03 6:24 
GeneralRe: Question about step 2 Pin
mystro_AKA_kokie22-Dec-03 7:05
mystro_AKA_kokie22-Dec-03 7:05 
GeneralRe: Question about step 2 Pin
John M. Drescher22-Dec-03 8:56
John M. Drescher22-Dec-03 8:56 
GeneralRe: Question about step 2 Pin
mystro_AKA_kokie22-Dec-03 9:11
mystro_AKA_kokie22-Dec-03 9:11 
GeneralRe: Question about step 2 Pin
John M. Drescher22-Dec-03 14:45
John M. Drescher22-Dec-03 14:45 
GeneralRe: Question about step 2 Pin
mystro_AKA_kokie22-Dec-03 17:56
mystro_AKA_kokie22-Dec-03 17:56 
GeneralRe: Question about step 2 Pin
John M. Drescher23-Dec-03 7:33
John M. Drescher23-Dec-03 7:33 
GeneralRe: Question about step 2 Pin
mystro_AKA_kokie23-Dec-03 19:43
mystro_AKA_kokie23-Dec-03 19:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.