# The Second Hardest Logic Puzzle in the World

This puzzle is an original creation of mine (as far as I know), although other people have solved it before me.

You meet five people: Alice, Bob, Carol, Daniel and Evie. Your aim is to ask yes/no questions to identify them.

One of these five people always lies, one always tells the truth, one flips a coin in their head (if it lands heads they say yes and if it lands tails they say no), one always says yes and one always says no. Everyone knows who the rest are (although they might not say it).

You have to ask three yes/no questions to see who is who. But each question can be targetted to multiple people. So, for instance, the first question can be targetted to all 5, the second question can be targetted to A, B and C and the third question can be targetted to A and D. In this case, you will get a total of 10 responses.

The main difference between this puzzle and the "Hardest Logic Puzzle in the World", which it is based on, is that you also know the words used for yes and no.

No head-exploders or questions which hinge on the coin-flipper's behavior.

As always, spoiler your solves and have fun doing them. First to submit a method to tell the characters apart in 3 questions wins.

• I have clarified my metric for a single question. One question = one single question that you make, even if multiple guards are intended to answer it. If it still looks intractable, what's the deadline by which I have to post a solution? And do I edit it into the question or post it as an answer? Commented Jun 27, 2021 at 15:41
• I can find 4. I guess others would have figured it out as well. Its just that there is possibility that our flip guy flips for 3 questions and gets same outcome(say HEADS). Then there is no difference between the "flip" guy and the "yes" guy Commented Jun 27, 2021 at 17:20
• I think the puzzle statement should say whether each person knows which ones the others are. Commented Jun 27, 2021 at 19:08
• What happens if you ask a question that could go either way (e.g. you ask the truthteller "What would the coin-flipper say if I asked him whether 2+2=4?")?
– Deusovi
Commented Jun 28, 2021 at 0:49
• The other main difference between this and the Hardest Puzzle is that you can here ask one question to multiple people. This makes it a LOT easier. Commented Jun 28, 2021 at 13:59

This solution works no matter what happens in the case of paradoxes or questions with ambiguous answers.

"Is it true that 2+2=4?"
And then ask: "Is it true that 2+2=5?"

With this,

the truthteller, liar, yes-sayer, and no-sayer will all give different pairs of answers. So, the coin-flipper will match with one of them, and you definitively know the identity of the other three.

Now you can easily finish: point to one of the two ambiguous people, and ask the truthteller "is this person the coin-flipper?". If the truthteller is ambiguous, ask the liar instead. Either way, you can distinguish between the last two people.

A note: this problem is actually easier than it seems, because

you can set up arbitrarily complicated questions if you're allowed to have multiple targets for a single question. For instance, you can hand everyone a card with a statement on it, and ask them "is your card's statement true?". This lets you ask three questions to each person, which is more than enough to distinguish them.

If you don't have cards to write on, you can simply set up a hypothetical description of what that looks like. Your question can take the form:
"If I assigned person 1 the statement [...], and person 2 the statement [...], and person 3 the statement [...], and person 4 the statement [...], and person 5 the statement [...], would your statement be true?"
This question is convoluted, but perfectly acceptable -- and there's not really a nice boundary you can draw here that allows the questions in my simple solution above, but rules out this one.

• What happens if (as unlikely as it may be) somebody doesn't actually know the answer to 2+2? Are they still able to tell the truth even if they don't know what the truth is? Commented Jun 28, 2021 at 11:27
• @musefan Hold up two fingers and ask "Am I holding up two/three fingers?" I guess that would account for people who are really bad at arithmetic, though not for people who can't even count to two (or are blind or something). I guess you just have to assume a certain level of basic common knowledge for any of this type of question... Commented Jun 28, 2021 at 13:41
• "Are you a guard?" "Are you a non-guard?" Commented Jun 28, 2021 at 15:07
• @DarrelHoffman: Indeed. I certainly wasn't trying to discredit this answer. As you have rightly said, where does one draw the line. Just more a case of prompting an interesting thought... Commented Jun 28, 2021 at 16:31
• You don't have to assume common knowledge if you rely instead on what the question tells you that they do know.
– ROX
Commented Jun 30, 2021 at 17:23

The existing answer from Deusovi is good, but it can also be solved in a way that will, one third of the time, only need 2 questions, and the rest of the time still be solved with a third question. I'm not saying that's better, but it might be interesting anyway...

Hint

Try to find the coin-flipper earlier

1st Question:

Ask a question to which the true answer is yes. To ensure this is something we know that they all know we can use what we've been told in the statement of the problem - that the 5 of them know how the others answer and we can ask "Does one of you always lie?"

I've assumed that we can vary the follow up questions based on the answer before.

2nd Question:

The first question will have been answered yes by truth-teller and always-says-yes and answered no by liar and always-says-no, so if the coin-flipper says yes there will be 3 people saying yes, and if they say no there will be 3 saying no. Randomly select one of the 3 that gave the same answer ask everyone "Is this the coin-flipper?" (i.e. if 3 said yes select someone who said yes, if 3 said no select someone who said no)

Part 3

If the coin-flipper is the one selected then the truthful answer to question 2 is again yes, so in that case all 4 of the non-coin-flippers answers will all stay the same as question 1

If the selected person is not the coin-flipper then the truth-teller and the liar (and maybe the coin-flipper) will change their answers. So if 2 or more change their answers, the coin-flipper is the selected person, otherwise they are not.

If the coin-flipper was the selected one then this requires a 3rd question to identify the other 4 people, anything for which the true answer is no will do, for example "Do all of you always tell the truth?" The liar will now have answered no,no,yes; the truth-teller yes,yes,no and the always-no and always-yes will be obvious.

The remaining cases are where we know the selected person is not the coin-flipper. If 3 people said yes to the first question: Answers of No,Yes implies liar; No,No -> always-no; Yes,No -> truth-teller or coin-flipper; Yes,Yes Always-Yes or coin-flipper. The coin-flippers answers will match another persons, but if they match the selected person's then, because we know the selected person is not the coin-flipper we can identify everyone without asking a 3rd question. If they do not match the selected person, then a third question is required to distinguish between the coin-flipper and the other (non-selected) person with the same answers. Pick either of these 2, ask "is this the coin-flipper?", since the liar has been identified we can use their incorrect answer to identify the last 2.

The logic is similar, with some inversions for the case where 3 people said no to the first question and the selected person is not the coin-fipper: Answers of Yes,Yes -> Always-says-yes; Yes,No -> Truth-teller; No,No -> Always-says-no or coin-flipper; No,Yes -> Liar or coin-flipper. Again if the coin-flippers answer matches the selected person then no further question is required, otherwise ask the same question noting that in this case the truth-teller has already been identified.

Why this needs 2 questions one third of the time:

The cases that only needed 2 questions require that the person selected to ask about in question 2 is not the coin-flipper, There is a 2/3 chance of that. It also requires that the coin-flippers random answer to that question matches the answer given by the selected person 1/2 chance of that. 2/3 * 1/2 = 1/3 chance of only needing 2 questions.

• Although you are ineligible to win (it's too long to change the winning criterion) I still like this answer because of the chance to only need 2 questions. Now, I wonder if you can do better than 11 responses for the worst case... Commented Jun 30, 2021 at 17:31
• @Andrew sorry I don't understand what you mean about the 6 responses in the worst case. The worst case here needs only 3 questions, but if you mean you'd only need to consider 6 of the responses to those questions then I haven't spotted that myself.
– ROX
Commented Jun 30, 2021 at 17:41
• I was referring to an alternate metric (and it wasn't 6 responses, it was 11). In the solution that has the green checkmark, although you only ask 3 questions you get 11 responses from every participant: 5 for the first question (one to which the answer is yes), 5 for the second and 1 for the third. I was asking if you could do better. Commented Jun 30, 2021 at 17:43
• @Andrew OK understood now, Do I have to declare before asking who I will want answers from, or can I decide not to get an answer from a certain person once I've got answers from some of the others?
– ROX
Commented Jun 30, 2021 at 17:53
• @ROX I have rechecked your argument and yup, you are right. Commented Nov 8, 2022 at 8:54