Vous êtes sur la page 1sur 3

Guessing the Color of Your Hat

The problem at hand is based on the following two, then this player shall pass. Otherwise, this
very simple problem: player sees two hats of the same color and should
guess that his hat is the other color. A moment’s
Three people, upon entering a room, each have thought reveals that this strategy will result in
either a black or a white hat placed upon their a win for the team in all cases except when the
heads. The color choices are randomly and in- random hat distribution is all of the same color.
dependently determined. Each person is able to Since this will happen with probability 2/8=1/4,
see the colors of the other two peoples’ hats but then the probability of a win for the team comes
cannot see the color of his own hat. The prob- in at 75%.
lem is for the players to simultaneously guess
the color of his own hat (or to pass, not lodg- The above team challenge can be generalized
ing a guess). If at least one of the three people in an obvious way to include any number of play-
guesses the color correctly, and if no one guesses ers and any number of hat colors. If we stick to
incorrectly, then the team is said to have won. two colors and allow the number of players to
be of the form 2k − 1, where k ≥ 2, then we
As this endeavor is to be thought of as a “team can devise a strategy for winning that—perhaps
effort,” some time shall be allowed before enter- surprisingly—results in increasing probability of
ing the room for a discussion of strategy. Thus, a win as the parameter k get large. Even better,
as in Sara Robinson’s article, we may assume this probability of winning approaches unity as
that the team has the prospect of winning three k → ∞ ! In fact, we’ll show how to devise a
million dollars if they win and nothing other- strategy whose probability of a win is
wise. Obviously, we are not to allow any sig-
nalling among the players; they are to make k
22 −k−1
their guesses entirely on the basis of the hat col- Prob(win) = 1 − 2k −1 .
2
ors they observe. The problem, then, is to devise
a strategy to as to maximize the probability of Note that if k = 2 (three players), this sets the
winning. probability of winning at 1 − 28 = 34 .
A simple-minded strategy would be to decide The reason for this somewhat forced con-
that a given player shall randomly guess a color straint on the number of people is that it allows a
and that the other two players shall pass. This strategy based on the so-called Hamming codes,
will fix the probability of winning at an even which we now briefly describe. We let F be the
50%. Can the team do better? binary field, i.e., the field with two elements (0
and 1). All vector spaces shall be over the field
Yes. Suppose that the team adopts the follow- F. Let k be a fixed positive integer (≥ 2) and let
ing strategy. If any player sees both a white W be a fixed vector space of dimension k over
hat and a black hat on the heads of the other F. Therefore we see that W contains exactly
∗ Based on the New York Times article, Why Mathematicians
2k − 1 nonzero vectors; we label these vectors
Now Care About Their Hat Color, April 10, 2001, by Sara Robin-
son. I’ve made this article available via my web page; the link is
w1 , w2 , . . . , w2k −1 . Now set n = 2k − 1 and let
www.math.ksu.edu/ dbski/robinson.pdf V = Fn :

1
2

of F, respectively. Therefore, the random plac-


ing of hats on the team members’ heads is tan-
V = {(a1 , a2 , . . . , an ) | all ai ∈ F}. tamount to the specification of a random vec-
tor v = (a1 , a2 , . . . , an ) ∈ V where person i has
The tautological map is the surjective linear been given a hat with color a . Note that it may
i
transformation τ : V → W defined by or may not be the case that v ∈ H (in fact it
Xn usually won’t be—this is an easy calculation).
τ (a1 , a2 , . . . , an ) = ai wi ∈ W. Therefore, if the distribution vector describing
i=1 the placement of hats is given by the vector
Since this is surjective, the kernel H (null space) v = (a1 , a2 , . . . , an ) ∈ V,
has dimension
then person i can only infer that the distribution
dim H = dim V − dim W = n−k = 2k −1−k. vector is of the form

We call H the (2k − 1, 2k − k − 1)-Hamming v = (a1 , a2 , . . . , ai−1 , 0, ai+1 , . . . , an ) + bi ei


code; note that if k = 3, then H has dimension = vi + bi ei ,
4; when k = 4, then H has dimension 11.
for some bi ∈ F, and where the vector vi is de-
The only result that we need concerning the fined above by what person i sees. In terms of
Hamming codes is the following. We define the above notation, here’s the strategy:
the “unit vectors” e1 , e2 , . . . , en ∈ V by setting
(a) If vi + bi ei 6∈ H for either choice of bi ∈ F,
ei = (0, 0, . . . , 0, 1, 0, . . . , 0), where there is a “1”
then player i shall pass;
in the i-th position and 0s elsewhere. For con-
venience, set e0 = 0 ∈ V . (b) If vi + bi ei ∈ H, then player i shall guess
that his hat color is 1 + bi .
Lemma. Let H be the (2k − 1, 2k − k − 1)-
Hamming code. Then
We proceed to prove that the above is a well-
n
[ defined strategy and is, in fact, a winning strat-
V = (ei + H) (disjoint union), egy for all hat distributions v such that v 6∈ H.
i=0
First of all, the well-definedness issue stems from
where we set e0 = 0. (b), above; namely we must show that we can-
not have vi + bi ei ∈ H for both choices of bi ∈ F .
Proof. Note first that if i 6= j, 1 ≤ i, j ≤ n, Indeed, were this to happen then we would have
then (ei + H) ∩ (ej + H) = ∅. For otherwise, it ei = vi + vi + ei ∈ H.
would happen that ei +ej ∈ H; since τ (ei +ej ) =
wi + wj 6= 0 (set w0S= 0 ∈ W ), this assertion Since τ (ei ) = wi 6= 0 we have a contradiction.
follows. Therefore, (ei + H) has cardinality Therefore the strategy is well-defined.
k k
(n + 1) · |H| = 2k (22 −k−1 ) = 22 −1 = |V |, and Next we show that if v 6∈ H, then the above
the result follows. strategy result in a win, i.e., at least one person
will guess his hat color correctly and no one will
Now assume that k ≥ 2 is fixed and that we guess incorrectly. Thus, assuming that v 6∈ H,
have n = 2k − 1 members on the team. La- we have, by the above lemma that v +ej ∈ H for
bel these people 1, 2, . . . , n. In preparation for some unique index j, 1 ≤ j ≤ n. Therefore, we
the “hat trial,” we shall agree on the following see immediately that person j will necessarily
strategy. First of all, let us represent the colors correctly guess his hat color. We contend that
“black” and “white” by the elements 0 and 1 everyone else must pass. To see this, fix i 6= j
3

and write v = vi + ai ei . For person i to do any-


thing but pass, it must happen that vi +bi ei ∈ H
for some bi ∈ F. Were this the case, then since
v = vi +ai ei , and since vi +ai ei +ej = v+ej ∈ H,
we infer that
(ai + bi )ei + ej = (vi + bi ei ) + (vi + ai ei + ej ) ∈ H.
Since τ ((ai + bi )ei + ej ) = (ai + bi )wi + wj 6= 0
this contradiction proves the result.
We could be content to stop here as we’ve al-
ready shown that the above strategy results in a
win with probability at least 1 − |H| |V |
= 1 − 2−k .
However, this is the exact probability as it’s clear
that when v ∈ H, then everyone guesses wrong.

Vous aimerez peut-être aussi