I was asking my friends a riddle about identifying hats. Each person has to correctly identify the colour of their own hat that was put on their head randomlly. There is no defined number of either colour. So they could be all white or all black or any combination in between.
They gave an answer that gets 50% right but I fired back that getting 50% right is what you would expect, on average, for straight guesses. They claimed that that would depend on the colours of the hats that are on the people's heads. In other words, if everyone was wearing black then the 50% rule not apply. This just doesn't "feel" right to me.
Who is correct?
Edit:
This is the puzzle I asked. You have 100 people standing one behind the other such that the last person can see all the people in front of him/her and so on. So the last one see 99 and the next sees 98 etc. They each have a hat put on their head which is black or white. They have no idea how many of each exist.
Assuming they plan on a strategy in advance, how many can get their hat right. They said that the best way is for the back person to say the colour of the hat on person 99. Person 99 can say his colour. Then 98 will say the colour of the one in front etc. This was I am guaranteed at least 50 right and maybe more if two consecutive people have the same colour. My claim was that 50% guaranteed is the same as random (ignoring the extra lucky one if there are consecutive hats). Their counter-claim was that the 50% random guess would only be right if their were exactly 50 of each colour.
If I understand the riddle correctly, for a set of N people, there is an algorithm by which all but one person are guaranteed to get the correct answer, assuming all the players are perfect mathematicians and can arrange a strategy before being assigned hats.
The person in back counts the number of black hats that he can see. If he sees an odd number, he says white and otherwise says black. He has no information whatsoever about his own hat, and has a 50-50 chance of what he said being the correct color hat for himself.
The other N-1 players have a similar game, except that they know whether the total number of the N-1 players with black hats is even or odd. As such, by counting the number of black hats that the others of the N-1 players have (whether by seeing the hats of the people in front of them or from the answers of the people behind them) and determining it as either even or odd, they can deduce whether they themselves have black or white hats.
Similarly, if there there M colors $(C_0,C_1,C_2,C_3,...,C_{m-1})$, they total the value of the hats of players in front of them by adding 0 for $C_0$, 1 for $C_1$, etc, and taking the remainder after dividing the total by M. As such, in a group of N players with M hat colors, the minimum number of players to answer correctly will be N-1, the maximum will be N, and the mathematical expectation of the number of correct answers is $N-1+\frac{1}{M}$