This is obviously a mathematical problem (at least once you've clarified the assumptions and the reasoning), but from my messing around, it seems notoriously difficult to formulate mathematically. One way is to use modal propositional logic.
Let B_1, B_2, ... be propositional variables with the interpretation that B_n means "islander number n has blue eyes". Let K_1, K_2, ... be modal operators with the interpretation that K_n P means "islander number n believes P".
Then we would need to axiomatize how these modal operators work. Something along the lines of:
For i \neq j,
B_i \leftrightarrow K_j B_i (Everybody knows whether or not everybody else has blue eyes)
And then there would be rules of inference of the form:
(K_n A) \wedge (K_n (A \rightarrow B)) \rightarrow K_n B
This seems enormously complicated. An alternative approach is to use graphs to represent possible worlds and their connections. Let a closed circle represent a possible world. Inside the circle, we list all the ID numbers of islanders with blue eyes. For each j, we draw an arrow from world W_1 to world W_2 if islander number j in world W_1 believes that he might be in world W_2.
For a simple example, imagine a world with two islanders. Here are shown 4 possible worlds: (W1) No blue-eyed people, (W2) Islander #1 has blue eyes, (W3) Islander #2 has blue eyes, and (W4) Both have blue eyes. In world W1, islander #2 believes that he might be in worlds W1 or W3, and islander #1 believes he might be in worlds W1 or W2.
Now, to simplify things, I'm going assume that:
- All blue-eyed islanders are indistinguishable. They believe the same things (or analogous things).
- All non-blue-eyed islanders are indistinguishable.
- The beliefs are completely determined by the objective facts (how many people with what colored eyes there are). So there can't be two worlds with the same number of blue-eyed and non-blue-eyed people, but differ in what people believe is possible.
- There are the same number of islanders in every possible world.
In light of these assumptions, we can characterize a world by the number of blue-eyed individuals in it. For definiteness, let's assume there are 3 islanders. Then we can characterize the situation by a sequence of graphs, one graph per day. On day -1, nobody knows anything except what they can see (and what they can deduce about what other people can see). On day 0, all the people in all possible worlds are told that there is at least one blue-eyed person. In any possible world, if a blue-eyed person can deduce that he is blue-eyed, then he kills himself. On day 1, in every possible world, if someone sees that a blue-eyed person is still alive, he deduces that that person did not deduce that he had blue eyes. Etc.
To say that someone deduces some fact means that that fact is true in every world that he considers possible.
Since all blue-eyed people believe the same thing, we will just use blue arrows to represent what blue-eyed people believe, and brown arrows to represent what non-blue-eyed people believe. So here is the sequence of situations (where a situation is an entire connected set of possible worlds corresponding to a day)
- On Day -1, blue-eyed people in any possible world believe that they are either in their actual world, or one with one fewer blue-eyed person (because they consider it possible that their own eyes are not blue). Non-blue-eyed people believe that they are either in their actual world, or one with one more blue-eyed person.
- On Day 0, it is announced (in every possible world) that there is at least one blue-eyed person. This eliminates the possible world with 0 blue-eyed people. So the graph of possible worlds is changed so that there is no blue arrow out of the world with 1 blue-eyed person. So the blue-eyed person in that world knows what world they are in, and so know that they have blue eyes, and so they commit suicide.
- On Day 1, in the possible world in which there are 2 blue-eyed people, they can see that nobody committed suicide. So that means that they do not live in the world with 1 blue-eyed person. So that arrow is eliminated, and they know exactly what world they are in--the one with 2 blue-eyed people. So they commit suicide.
- On Day 2, in the possible world in which there are 3 blue-eyed people, they can see that nobody committed suicide, so that means there are 3 blue-eyed people. So they commit suicide.