Blue Eye Problem

There is an island where a wizard has captured 100 people, every morning he comes back to island and anyone who can tell colour of his own eyes, is set free. But if anyone who tell it wrong is immediately killed. Though there are some conditions.

  • Initially, they(trapped people) don’t know the colour of their own eyes.
  • They can’t communicate to each other.
  • They can see each other, so they know colour of others’ eyes.

On first day morning, the wizard made a statement : “Ahh…. at least someone has blue eyes”

Assuming all prisoners are intelligent. What is the maximum number of prisoners who can escape and in minimum how many days?

Solution: At first this problem seems to complex, But if we reduce this problem to basic cases, it has an obvious solution.

Case 1 : When there is only one prisoner.

He will immediately know that his eyes are blue, after wizard makes his statement. He can leave on day 1 itself.

Case 2 : When there are two prisoners.

Assume you are prisoner 1, You don't know colour of your eyes but you know prisoner 2 has blue eyes. 
* If you don't have blue eyes, prisoner 2 should know he has blue eyes (because according to wizard's statement, at least one has blue eyes) and he should leave on day 1. But if he doesn't that means he is in same condition as you (He is seeing your blue eyes). Next day both will know that you both have blue eyes and leave (on day 2).

Case 3. When there are 3 prisoners.

Assume you are prisoner 1, and there are only 2 cases for you. Either you have blue eyes or not.
Assume you don't have blue eyes, But rest 2 have (you can see). So they should leave on day 2 (how?? already discussed in case 2). But if they don't that implies you have blue eyes and each prisoner is in same condition as you. So, you all leave on day 3.

Here we see, if n-1 prisoners can be free in n-1 days, it will take 1 extra day for n prisoners. So, n prisoners can be free in n days (Can be proved, see case 3). But all of them will leave on nth day only. No one can leave before that. I hope solution is clear, for any clarification please comment.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade