# Best strategy to get all heads/tails from three coins

Your friend has 3 fair coins: a dime, a nickel, and a quarter. She places them on a table behind you. She can arrange then in any pattern of heads and tails as long as they are not all the same.

You then tell your friend to flip the coins any way you like (ex: flip the dime, flip all 3 coins, flip dime and quarter, etc.)

The goal is to get all three coins to be all heads or tails.

What is the best strategy to win the game in the fewest number of steps possible?

Obviously 2 of the coins will either be heads or tails. So that is important to take into account. However, I don't know which ones are heads/tails. I keep turning this into a probability problem but don't seem to be getting anywhere.

Any help?

• When you say "flip", do you mean "flip randomly" or "turn over"?
– Deusovi
Sep 14 '16 at 2:41
• (Also, welcome to Puzzling! c: )
– Deusovi
Sep 14 '16 at 2:41
• I mean flip randomly @deusovi
– Ern
Sep 14 '16 at 2:48
• Do you know which coin was showing head and which was showing tail initially??
– Sid
Sep 14 '16 at 6:40

From comments it seems that the question is:

• There are three coins, named "Nickel", "Dime", and "Quarter".
• You know that exactly one of the three, but not which, is in a different state to the others, either:
1. one is showing heads and the other two tails; or
2. one is showing tails and the other two heads
• You can choose to toss (randomise) the state of any combination of the coins by name
• After this single randomisation of state you win if all three coins are in the same state, either:
2. all tails

Given that we do not know if your friend has any bias we should treat her as a random process, with an equal chance of choosing any one of the coins to be in the different state.

This puzzle has a somewhat counter-intuitive solution:

choosing either all three, or any two are equally likely to win

Why?

There are eight combinations from which we could choose, but only four (seemingly) effectively different choices with our assumption of no bias:

1. No coins - this has a probability of $1$ for losing and $0$ for winning.

2. All coins - this has a probability of $\frac34$ for losing and $\frac 14$ for winning
(the first toss can be either, then the next will match that $\frac12$ the time and the third will match $\frac12$ of that time for a total of $\frac12 \times \frac12 = \frac14$)

3. One coin - $\frac13$ of the time it is the coin our friend chose to be different and we have a probability of $\frac12$ for losing and $\frac12$ for winning; the other $\frac23$ of the time it was not the coin our friend chose to be different and we have a probability of $1$ for losing and $0$ for wining. Thus in expectation we have a probability of $\frac13 \times \frac12 + \frac23 \times 1 = \frac56$ of losing and $\frac13 \times \frac 12 + \frac23 \times 0 = \frac16$ of winning.

4. Two coins - the coin on the table has a state which both tosses need to match (just like the coin on the table has just been tossed) and hence is equivalent to (2) for a probability of $\frac34$ for losing and $\frac 14$ for winning.

• Not sure if "flip" means randomize in this case (toss), or if it means "turn" (change state from H to T or the other way around). I tend to believe it means "turn" because otherwise it is not very important if they are all int the same state at the beginning or not, since you will be randomizing it anyway. Sep 14 '16 at 7:47
• @Marius see the comments on the question. Sep 14 '16 at 7:48
• Hmmm, You are right. I missed that. This does not make much sense to me. Sep 14 '16 at 7:50
• It is not surprising that 2 and 3 give the same answer. Think of flipping 3 sequentially. After the first one falls, you don't care which way, the other 2 have to match. Sep 14 '16 at 15:06
• @RossMillikan that is the exact explanation I gave; it will surprise some people. Sep 14 '16 at 15:22

In:

3

Logic:

Let's say you start with HHT. You choose to flip any 2, but obviously you are unlucky, so now you have (after picking 2 and 3 say): HTH. Choose another 2, and include 1. Again obviously unlucky, you pick 1,2, so you have THH. However you now know 2 and 3 are the same (you have flipped 2 twice and 3 once and they were different to begin with), so flipping 1 gives you a result.

However, if you meant 'to flip randomly':

Choose any 2 and flip until they both come down the same as the third. (1 in 4)

• I don't think i get to see what the coins are after flipping them.. Which is what made me struggle so much with this problem
– Ern
Sep 14 '16 at 2:47
• @JonMarkPerry I think you've overcomplicated it (for the non-random case). Instead of flipping 2 each time, just flip 1 (e.g. the one you didn't flip each turn in your example). You'll get the same result (but the opposite 'face'). Sep 14 '16 at 3:04
• But now I see the 'flip randomly' comment of OP, so I guess this is moot... Sep 14 '16 at 3:06
• Or flip all 3 and you still have a 1/4 chance. Sep 14 '16 at 3:55

If you dont know the coins before and dont know what they are after flipping (as stated in the question and comment on the other answer) I would say your best chance is to flip all 3 each time until you get 3 heads (1/8 chance) assuming your friend tells you when you win.

If she doesnt tell you then you have no way of knowing when you will win.

Realized it could be heads or tails so it is actually 1/4

If We do not know which coin is a dime, a nickel or a quarter.

We can do permutation algorithm to reveal all possibilities
By flipping 1 coin each time
So there are at most 4 flips

Worst Case example :

H H T
H T T
H T H
T T H
T T T

But If the question is to make all heads,

there are at most 7 flips
H H T
H T T
H T H
T T H
T T T
T H T
T H H
H H H

My guess is

3 (Worst Case)

Logic

Let's number the coins 1,2,3 since I'm not familiar with the obvious nomenclature. Then Here are the steps

1. You ask your friend to flip coins 1 and 2. If they are same, the game is over since third one is obviously different initially and after flipping, all of them are same. And if the game is not over, then certainly they are different. In that case,

2. You ask your friend to flip coin 1. If it is the odd coin, then the game will finish then only since now all of them will be same. But if not, at least you now know that 1 and 2 are same since they were found different in step 1. Now,

3. You ask him to flip 3. Now for sure, you know that all of them are same.

Initially, they are not all heads or tails. Thus, there are at least one heads and one tails, and the third coin is unknown. WLOG, we will assume the third coin is a heads. Thus, there are two heads and 1 tails.

Lets say we get them to flip

a single coin (say the nickel), hoping that this is the one coin different from the others. We are right 33% of the time and end the game with 3 heads. The rest of the time, we flip one of the heads, so we end up with two tails (one of which is the nickel) and one heads.

If we didn't end the game (66% of the time), then we can get them to flip

one of the remaining two coins (say the dime) hoping it is heads. If we are right (50% of the time) we have ended the game. Otherwise, the dime was tails and we now have two heads (dime and quarter) and one tails (nickel).

The last move is to

flip the nickel again.

So, the simplified strategy is simply

1. Flip nickel
2. Flip dime
3. Flip nickel

What ever starting configuration, this will guarantee to get you all three the same at some point.

Here is a quick demonstration of all possibilities. Say that the nickel is value "X" where X can be heads or tails. The following are the possible configurations for Nickel, Dime, Quarter:

• XYY
• XXY
• XYX

Note that "XXX" is not a valid configuration since we would already be done. Also, note that since we have abstracted out "heads" and "tails", we don't need to consider "YXX" since that is symmetrical to "XYY".

Here is what happens when we apply the above strategy to these configurations:

* XYY -> YYY
* XXY -> YXY -> YYY
* XYX -> YYX -> YXX -> XXX

You can see that the first finished in one move, the second in two, and the third in three.