Zebra Puzzle


The zebra puzzle is a well-known logic puzzle. Many versions of the puzzle exist, including a version published in Life International magazine on December 17, 1962. The March 25, 1963, issue of Life contained the solution and the names of several hundred successful solvers from around the world.
The puzzle is often called Einstein's Puzzle or Einstein's Riddle because it is said to have been invented by Albert Einstein as a boy; it is also sometimes attributed to Lewis Carroll. However, there is no known evidence for Einstein's or Carroll's authorship and the Life International version of the puzzle mentions brands of cigarette, such as Kools, that did not exist during Carroll's lifetime or Einstein's boyhood.
The Zebra puzzle has been used as a benchmark in the evaluation of computer algorithms for solving constraint satisfaction problems.

Description

The following version of the puzzle appeared in Life International in 1962:

Solution

Assuming that one person drinks water and one owns a zebra, then it is possible not only to deduce the answers to the two questions, but to figure out a complete solution of who lives where, in what color house, keeping what pet, drinking what drink, and smoking what brand of cigarettes. By considering the clues a few at a time, it is possible to slowly build inferences that incrementally complete the puzzle's unique correct solution. For example, by clue 10, the Norwegian lives in house #1, and by clue 15, house #2 must be blue. The Norwegian's house therefore cannot be blue, nor can it be red, where the Englishman lives, or green or ivory, which are next to each other. It must therefore be yellow, which means the Norwegian also smokes Kools.
The March 25, 1963 issue of Life International contained the following solution, and the names of several hundred solvers from around the world.
House12345
ColorYellowBlueRedIvoryGreen
NationalityNorwegianUkrainianEnglishmanSpaniardJapanese
DrinkWaterTeaMilkOrange juiceCoffee
SmokeKoolsChesterfieldOld GoldLucky StrikeParliament
PetFoxHorseSnailsDogZebra

Alternate solution

Clue 10 mentions the "first" house, without specifying whether it is the house on the extreme left or extreme right if standing in front of them. However, selecting either side as the first house does not change the outcome as to who drinks the water and who has the zebra.
House54321
ColorIvoryGreenRedBlueYellow
NationalitySpaniardJapaneseEnglishmanUkrainianNorwegian
DrinkOrange juiceCoffeeMilkTeaWater
SmokeLucky StrikeParliamentOld GoldChesterfieldKools
PetDogZebraSnailsHorseFox

Other versions

Other versions of the puzzle have various differences from the Life International puzzle, in which various colors, nationalities, cigarette brands, drinks, and pets are substituted, or the clues are given in a different order. These do not change the logic of the puzzle.
Some versions of the puzzle indicate that the green house is on the left of the ivory house, instead of on the right of it. This results in swapping the two corresponding houses with all their properties, and makes the puzzle easier to solve.