Coin Puzzle: Predict the Other's Coin
pratikpoddarcse.blogspot.in
pratikpoddarcse.blogspot.in
Possible tosses:
TT win
HT lose
TH lose
HH win
Counter-intuitive though isn't it.
Why does using your own result improve the odds of winning the game!?
What is the probability that two coins come up with the same face value? 0.5
If we use the guessing scheme where each player guesses his own guess as the result of the other player's coin, then players A and B win if their coins are the same. Their coins are the same with probability 0.5.
Thus, Expectation[game] = Expectation[Game|A & B Win] * P(A & B win) + Expectation[Game|A & B Lose] * P(A & B Lose) = 1 * .5 + -2 * .5 = -1, so C should not play.
If the players guessed randomly then the expectation of the game would be as you say it is.
Point out the hole directly.
I find the result very confusing as well. I suspect the source of this counterintuitiveness is that I over simplified the puzzle when I first read it.
I simplified the puzzle to "A attempts to guess B's coin, and B attempts to guess A's coin", whereas in fact the true puzzle is "A and B together try to guess the total set of results".
When A and B guess randomly, they attempt to guess the total set without using the information they have available to them. When A and B both guess the results of their own coin, they use the information they have regarding the set of results (i.e. the results of their own coin) to reduce the problem space and increase their chances of success. Clearly, if you have heads, you know the chances of the set of results being heads-heads are much higher than choosing a random set of results.
In other words, the proposition for A is not "What are the odds of B having heads given that you have heads?" but rather "What are the odds of the set of results being heads-heads given that you have heads?"
I believe the core mechanism at play here is that coordination eliminates the possibility of one player being right and the other being wrong, because one can partition the coin outcomes into "We have the same result" and "We have different results"; by agreeing in advance to only guess "we have the same result" every time you eliminate the "I'm right, you're wrong" and "You're right I'm wrong" failure modes (50% of the probability space under random guessing).
One could accomplish the same by always guessing the opposite of what you obtain (i.e. always bet on "we got different results" which again has a 50% probability).
This is related to the "guess your own hat's color" riddle:
"You and a friend are on a game show. The host sets you facing each other at a table, blindfolded. A hat, known to be either white or black, is placed on each of your heads. The host removes the blindfolds, and asks each of you to write down the color of your own hat without communicating with each other. If either of you guesses correctly, you both win a prize. How do you guarantee success by pre-communicating a strategy?"
The answer here uses the same partitioning into "either we're the same, or we're different". One friend agrees to always guess his own hat to be the same as the friend's, while the other always guesses that his hat is different.
- A always uses A's result as a guess for B's result.
- B always uses opposite to B's result as a guess for A's result.
They would always lose then.
- Assuming everybody is honest
The chance of A getting the guess right is 0.5, same for B, so the joint probability should be 0.25 (or 1/4)
You're out of 2 dollars (3 - the 1 you get) for something with a chance of 1/4 (in the other 3/4 you're being payed $1) SO
Looks like it's worth playing.
Expected losses: 2 * 1/4 < Expected wins: 1 * 3/4
Edit: see comment below
Edit 2, see the other comment below where the probability of prediction can be of 1/2, in this case: Expected losses: 2* 1/2, wins: 1/2 so you should not play
You're out $2 (since you get the $1 from the other players at the beginning, no matter what)
100 prisoners are given either a blue or a red hat, at random. Each prisoner is told colors of every hat except their own, and has to make a guess about his hat with absolutely no communication. They win only if they all guess correctly. They can agree on a strategy beforehand. What is the optimal probability of success?
For this to work, however, you'd have to know the exact expected probability of each hat (and if it was even or odd), which is improbable.
If everyone guesses randomly they stand a (1/2)^100 chance.
If they all guess the majority, with, say, blue as the tie-breaker just to have a deterministic algorithm, then they win twice as often because they capture the all-blues and all-reds cases, each with probability (1/2)^100.
I don't know if that's optimal but I always find these "improve random outcomes even with really stupid coordination mechanisms" situations amusing. If there's something better to be done I'd be curious to know :)
[Edit: raldi's clever answer that partitions by parity eliminates all but the we're-all-right and we're-all-wrong outcomes, and is clearly superior :)]
Same thing if they both agree to guess the inverse of step 2.
-------------------------- The fact that there is no communication ensures that whether A is right and whether B is right are completely indpendent. Conceptually, predicting a coin flip is like making a statement "1" or "0" which will then be XOR'd with a 1 or 0 from a securely, randomly, uniformly generated OTP of which no copies exist. In other words, the plaintext is immediately lost forever and you just have the ciphertext.
As a result of this, we must truly consider that A being right is a 50/50 proposition. It is also indpendent of B being right.
Thus we have the following four cases:
A right, B right - Result value * Percent chance = EV
0, 0 = +1 * 0.25 = +0.25
0, 1 = +1 * 0.25 = +0.25
1, 0 = +1 * 0.25 = +0.25
1, 1 = -2 * 0.25 = -0.5
------------------------------- sum of above: +0.25. Therefore, as long as each team member is independently predicting their own coin (which means that their prediciton will be xor'd by a random bit) C should play this game long-term.
(The values of +1 is because each round starts with the team giving C +1. If at the end of the roudn C must return 3 then this is +1 -3 = -2 for the round.)
Now here is another interesting question. What if under the same conditions A and B both try to predict C's coin toss, of which there is only one? Should C now play? Here is the answer is: "No", because A can predict heads, B can predict heads, and then it looks like this: A right, B right - Result value * Percent chance = EV
0, 0 = +1 * 50% = 0.5
0, 1 = +1 * 0% = 0 } not possible
1, 0 = +1 * 0% = 0 }
1, 1 = -2 * 50% = -1
-------------------
-0.5
In this case, C should not play. This is because in this case the events are not truly independent, there is a way to break the 25% 25% 25% 25% into 50% and 50% - namely by picking the same prediction together.
--------------------------
The first is described by: 'If I get heads, I will guess you got heads, otherwise I will guess you got tails' The second: 'If I get heads, I will guess you got tails, otherwise I will guess you got heads'
These are functionally identical, in that in half of the cases they get the same result (first strategy wins these) and in the other half they get opposite results (second strategy wins these) - they get 2$ for winning and give 1$ when they lose, since they win half the time under either strategy C should not play this game.
import random
# Modify strategy here
def turn():
toss = random.randint(0, 1)
guess = random.randint(0, 1)
# Uncomment to make A/B win
# guess = toss
return toss, guess
random.seed()
score_ab, score_c = 0, 0
for i in range(1, 1001):
score_ab -= 1
score_c += 1
toss_a, guess_a = turn()
toss_b, guess_b = turn()
if toss_a == guess_b and toss_b == guess_a:
score_ab += 3
score_c -= 3
print i, 'ab:', score_ab, 'c:', score_c
if score_ab > score_c:
print "Players A, B win"
else:
print "Player C wins"Isn't that step 1 where they can agree on a strategy (of which randomly, independently guessing is just one possible strategy)?
Are you the author of the original problem? Perhaps the English prose could be tighter to be more correct with the solution you have in mind.
By using the algorithm that hmexx says (use the result of your own coin flip to make the guess of the other's coin flip) what this is really doing is reducing the problem to "What is the probability that two coin flips are the same?"
The probability that two coin flips are the same is 50% (HH or TT vs HT or TH). The algorithm could also be "Use your own coin flip and then guess the opposite of your own result" and the probabilities would be the same, ie. 50%.
Give the fact that you have a 50% chance of losing $2 and a 50% chance of winning $1, this is not a game that C should play, since the expected value is -$0.50.
A, B, GuessA, GuessB, Winner, AmountC, Chance, EV
H, H, H, H, AB, -3, 0.25, -0.75
H, T, H, T, C, +1, 0.25, +0.25
T, H, T, H, C , +1, 0.25, +0.25
T, T, T, T, AB, -3, 0.25, -0.75
Sum(EV)=-1 per round
So C should not playSo no, C should not play this game.
Instead of HH and TT being winners with this approach, HT and TH become winners with this approach. Any combination of opposite or agreement will result in the same net odds.
The way for C to win is for A or B to treat it randomly.
A very interesting experiment would be to test how long it would take a random human subject A with no contact with a consistent B (but a memory for past results) to figure out how to win (in cases where they were told winning was possible, impossible, or neither).
It's not like C would ever everrrr....Lie....
And when G(overnment) comes around to fix this evil fraud, they fine for 10% of the profits. Everybody but A and B make out like a bandit. Sound like '09, doesn't it?
(tongue in cheek, only because there were multiple vald analysees of this question elsewhere in the comments.)