Let's Play A Game

I pick a subset S S of {Sue, Arron, Pete, Dan, Calvin}.

You make a guess of any subset T T , and I will then tell you how many elements there are in T S T \cap S .

You continue making different choices of T T until you are able to exactly determine S S . What is the minimum number of guesses that are necessary?

Note: You do not need to pick S S as one of your choices.

Image credit: Cece Yu
3 4 5 2

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Here is an algorithm which can guess any subset in 4 guesses.

  • A = #({Sue, Arron, Pete} \cap S)
  • B = #({Pete, Dan, Calvin} \cap S)
  • C = #({Sue, Pete} \cap S)
  • D = #({Pete, Calvin} \cap S)

You should be able to reason out the chosen subset.

Now here is a list of the answers you can get for every possible subset.

( ( A , B , C , D ) S ( 0 , 0 , 0 , 0 ) { } ( 1 , 0 , 1 , 0 ) { Sue } ( 1 , 0 , 0 , 0 ) { Arron } ( 1 , 1 , 1 , 1 ) { Pete } ( 0 , 1 , 0 , 1 ) { Dan } ( 0 , 1 , 0 , 0 ) { Calvin } ( 2 , 0 , 1 , 0 ) { Sue , Arron } ( 2 , 1 , 2 , 1 ) { Sue , Pete } ( 1 , 1 , 1 , 1 ) { Sue , Dan } ( 1 , 1 , 1 , 0 ) { Sue , Calvin } ( 2 , 1 , 1 , 1 ) { Arron , Pete } ( 1 , 1 , 0 , 1 ) { Arron , Dan } ( 1 , 1 , 0 , 0 ) { Arron , Calvin } ( 1 , 2 , 1 , 2 ) { Pete , Dan } ( 1 , 2 , 1 , 1 ) { Pete , Calvin } ( 0 , 2 , 0 , 1 ) { Dan , Calvin } ( 3 , 1 , 2 , 1 ) { Sue , Arron , Pete } ( 2 , 1 , 1 , 1 ) { Sue , Arron , Dan } ( 2 , 1 , 1 , 0 ) { Sue , Arron , Calvin } ( 2 , 2 , 2 , 2 ) { Sue , Pete , Dan } ( 2 , 2 , 2 , 1 ) { Sue , Pete , Calvin } ( 1 , 2 , 1 , 1 ) { Sue , Dan , Calvin } ( 2 , 2 , 1 , 2 ) { Arron , Pete , Dan } ( 2 , 2 , 1 , 1 ) { Arron , Pete , Calvin } ( 1 , 2 , 0 , 1 ) { Arron , Dan , Calvin } ( 1 , 3 , 1 , 2 ) { Pete , Dan , Calvin } ( 3 , 2 , 2 , 2 ) { Sue , Arron , Pete , Dan } ( 3 , 2 , 2 , 1 ) { Sue , Arron , Pete , Calvin } ( 2 , 2 , 1 , 1 ) { Sue , Arron , Dan , Calvin } ( 2 , 3 , 2 , 2 ) { Sue , Pete , Dan , Calvin } ( 2 , 3 , 1 , 2 ) { Arron , Pete , Dan , Calvin } ( 3 , 3 , 2 , 2 ) { Sue , Arron , Pete , Dan , Calvin } ) \left( \begin{array}{cc} \left (A,B,C,D\right) & S \\ \left (0,0,0,0\right ) & \{\} \\ \left (1,0,1,0\right ) & \{\text{Sue}\} \\ \left (1,0,0,0\right ) & \{\text{Arron}\} \\ \left (1,1,1,1\right ) & \{\text{Pete}\} \\ \left (0,1,0,1\right ) & \{\text{Dan}\} \\ \left (0,1,0,0\right ) & \{\text{Calvin}\} \\ \left (2,0,1,0\right ) & \{\text{Sue},\text{Arron}\} \\ \left (2,1,2,1\right ) & \{\text{Sue},\text{Pete}\} \\ \left (1,1,1,1\right ) & \{\text{Sue},\text{Dan}\} \\ \left (1,1,1,0\right ) & \{\text{Sue},\text{Calvin}\} \\ \left (2,1,1,1\right ) & \{\text{Arron},\text{Pete}\} \\ \left (1,1,0,1\right ) & \{\text{Arron},\text{Dan}\} \\ \left (1,1,0,0\right ) & \{\text{Arron},\text{Calvin}\} \\ \left (1,2,1,2\right ) & \{\text{Pete},\text{Dan}\} \\ \left (1,2,1,1\right ) & \{\text{Pete},\text{Calvin}\} \\ \left (0,2,0,1\right ) & \{\text{Dan},\text{Calvin}\} \\ \left (3,1,2,1\right ) & \{\text{Sue},\text{Arron},\text{Pete}\} \\ \left (2,1,1,1\right ) & \{\text{Sue},\text{Arron},\text{Dan}\} \\ \left (2,1,1,0\right ) & \{\text{Sue},\text{Arron},\text{Calvin}\} \\ \left (2,2,2,2\right ) & \{\text{Sue},\text{Pete},\text{Dan}\} \\ \left (2,2,2,1\right ) & \{\text{Sue},\text{Pete},\text{Calvin}\} \\ \left (1,2,1,1\right ) & \{\text{Sue},\text{Dan},\text{Calvin}\} \\ \left (2,2,1,2\right ) & \{\text{Arron},\text{Pete},\text{Dan}\} \\ \left (2,2,1,1\right ) & \{\text{Arron},\text{Pete},\text{Calvin}\} \\ \left (1,2,0,1\right ) & \{\text{Arron},\text{Dan},\text{Calvin}\} \\ \left (1,3,1,2\right ) & \{\text{Pete},\text{Dan},\text{Calvin}\} \\ \left (3,2,2,2\right ) & \{\text{Sue},\text{Arron},\text{Pete},\text{Dan}\} \\ \left (3,2,2,1\right ) & \{\text{Sue},\text{Arron},\text{Pete},\text{Calvin}\} \\ \left (2,2,1,1\right ) & \{\text{Sue},\text{Arron},\text{Dan},\text{Calvin}\} \\ \left (2,3,2,2\right ) & \{\text{Sue},\text{Pete},\text{Dan},\text{Calvin}\} \\ \left (2,3,1,2\right ) & \{\text{Arron},\text{Pete},\text{Dan},\text{Calvin}\} \\ \left (3,3,2,2\right ) & \{\text{Sue},\text{Arron},\text{Pete},\text{Dan},\text{Calvin}\} \\ \end{array} \right)

Since, for every possible subset, (A,B,C,D) is unique as in the list, the algorithm works

Oh wow! I wasn't expecting a fixed list of guesses to work. My approach was conditional on the results to the answers, hence the way the question was written up.

The entries for {Sue, Calvin} and {Sue, Dan} should be interchanged.

Calvin Lin Staff - 6 years, 12 months ago

Log in to reply

Thanks for pointing out the error.

(I still do not know what was the bug in my code)

How do I prove that it cannot be done in less than 4 guesses?

Agnishom Chattopadhyay - 6 years, 12 months ago

Log in to reply

I don't have a proper proof that it cannot be done in less than 4 guesses. Ultimately, such a proof would likely be exhaustive case checking.

This question actually arose from complexity analysis in computing. It is interesting to study what the big O bound is for subsets of [ n ] [n] elements.

Calvin Lin Staff - 6 years, 12 months ago

Log in to reply

@Calvin Lin What is the G that you are reffering to in the Note included in the question?

Agnishom Chattopadhyay - 6 years, 12 months ago

Log in to reply

@Agnishom Chattopadhyay Thanks, edited that to S.

Calvin Lin Staff - 6 years, 12 months ago

Hello can you pls insert \\ between your latex for new line, I am unable to read on mobile i will have to read on computer

Megh Parikh - 6 years, 12 months ago

Log in to reply

Fixed my latex. You should see a table now

Agnishom Chattopadhyay - 6 years, 12 months ago

Could you please explain the though process behind choosing the subsets this way?

Aditya Sivakumar - 6 years, 7 months ago

According to the table, if the response to the query is (1,1,1,1), S will not be unique. So, even with this procedure, don't you need more than 4 guesses ?

Harish Sasikumar - 5 years, 8 months ago

Log in to reply

I think the table is slightly off

Agnishom Chattopadhyay - 5 years, 8 months ago

I agree. But Robert's choice will work imo: "Let S, A, P, D, and C represent Sue, Arron, Pete, Dan, and Calvin. We can get enough information to know who all is in the subset by guessing (S,A,P,D,C), (P,D), (A,D), (S,D), which is four guesses."

Dávid Sebők - 5 years, 8 months ago

Let S, A, P, D, and C represent Sue, Arron, Pete, Dan, and Calvin. We can get enough information to know who all is in the subset by guessing (S,A,P,D,C), (P,D), (A,D), (S,D), which is four guesses.

To prove that this works, consider 3 cases: if there are 5 people in the subset, if there are 4 people in the subset, and if there are 3 people in the subset. The 0, 1 and 2 people in the subset will all be inverses of the 5, 4, or 3 cases, so we can ignore those without loss of generality.

If there are 5 people in the subset, your first guess will tell you such, and you will know the exact subset.

If there are 4 people in the subset, of the (P,D), (A,D) and (S,D) guesses, we will have one of the following responses (not necessarily in order of guesses):

-All 3 guesses coming up 1 person, in which case we know that everyone but Dan is in the subset.

-2 guesses coming up with 2 people, the 3rd coming up with 1 person, in which case we know that the person in the guess that only had 1 person in the subset who isn't Dan is the only one not in the subset.

-All 3 guesses coming up as 2 people, in which case we know that Calvin is the only person not in the subset.

If there are 3 people in the subset, we have 2 cases, either:

  1. The last 3 guesses all come up with 1 person, in which case we know that Dan and Calvin are the only ones not in the subset.

  2. At least one of the 3 guesses comes up either 2 people or 0 people, in which case we can derive the status of Dan, and thus derive the status of Sue, Arron, and Pete, and Calvin would be whatever is left over.

Proving that we cannot do it in 3 guesses is a bit trickier, but here is how (i think, if i haven't made any mistakes, which i very well might have): firstly, look at people as if they are divided into groups with known total (a group being defined as a set of people who we know how many of them are in the initial subset). We want to get all of these groups into groups of size 1. Note that this does not imply that you need 5 guesses: by guessing (S,A,P) followed by (P,D,C) we have divided the people into 3 groups since we know what the group consisting of P's total is.

Firstly, we start by knowing that we need to guess everyone at least once to put everyone in a group. This leads to two cases: you guess everyone as your first guess, or it takes two guesses to put everyone into a group.

In the first case, we have everyone in one group to start with. We need to divide these people into groups of size 1. However, this is impossible in two guesses, as everyone will be divided into one of these groups: -in both the second and third guess -in the second, but not third guess -in the third, but not second guess -in neither the second or third guess Leaving aside the issue that the last group isn't necessarily guaranteed to have a known total, this is still only 4 groups, and we need 5, so guessing all 5 people at the start will not let know for sure who is in the subset.

If we use two guesses to group everyone, we are left with the possibilities of 3 groups of size 1,2,2 or 3 groups of size 1,1,3. We could divide the people into 2 groups, but having one person of intersection between your first two guesses is always better because you can then know wether or not that person is in the initial subset. For example, a guess of (S,A) followed by (A,P,D,C) is always better than (S) followed by (A,P,D,C) since they both provide the same information, except that the first one tells you wether or not Arron is in the initial subset.

Now, if the groups are 1,1,3, there is no way to divide the group of 3 into 3 groups of 1. If the groups are of sizes 1,2,2, then you would need to divide both groups of 2 into two groups of 1. The only way to possibly do this would be to guess one person from each group of 2. However, this does not tell you the answer in the case that both groups have 1 person in the initial subset and the third guess tells you that one of the people you guessed was in the initial subset.

Nicola Mignoni
Mar 29, 2018

Let be A = { a 1 , a 2 , a 3 , a 4 , a 5 } A=\{a_1, a_2, a_3, a_4, a_5\} . Let be T T the 'set of decision' such that T = { T 1 , T 2 , T 3 , T 4 } T=\{T_1, T_2, T_3, T_4\} I choose at first T 1 = { a 1 , a 2 } T_1=\{a_1,a_2\} . Than

1 a . T 1 S = 0 a 1 S A N D a 2 S 1a. \hspace{5pt} \displaystyle |T_1 \cap S|=0 \hspace{5pt} \Longrightarrow \hspace{5pt} a_1 \notin S \hspace{3pt} AND \hspace{3pt} a_2 \notin S

2 a . T 1 S = 1 a 1 S X O R a 2 S 2a. \hspace{5pt}\displaystyle |T_1 \cap S|=1 \hspace{5pt} \Longrightarrow \hspace{5pt} a_1 \in S \hspace{3pt} XOR \hspace{3pt} a_2 \in S \hspace{3pt}

3 a . T 1 S = 2 a 1 S A N D a 2 S 3a. \hspace{5pt}\displaystyle |T_1 \cap S|=2 \hspace{5pt} \Longrightarrow \hspace{5pt} a_1 \in S \hspace{3pt} AND \hspace{3pt} a_2 \in S

1 a . 1a. and 2 a . 2a. tell us whether { a 1 , a 2 } S \{a_1, a_2\}\in S or not. Regarding 2 a . 2a. we don't know which one between a 1 a_1 and a 2 a_2 is in S S , so we choose T 2 = { a 2 , a 3 } T_2=\{a_2,a_3\} :

1 b . T 2 S = 1 a 1 S X O R a 2 S X O R a 3 S 1b. \hspace{5pt} \displaystyle |T_2 \cap S|=1 \hspace{5pt} \Longrightarrow \hspace{5pt} a_1 \in S \hspace{3pt} XOR \hspace{3pt} a_2 \in S \hspace{3pt} XOR \hspace{3pt} a_3 \in S

2 b . T 2 S = 2 a 2 S X O R a 3 S 2b. \hspace{5pt} \displaystyle |T_2 \cap S|=2 \hspace{5pt} \Longrightarrow \hspace{5pt} a_2 \in S \hspace{3pt} XOR \hspace{3pt} a_3 \in S

2 b . 2b. tells us that { a 2 , a 3 } S \{a_2, a_3\}\in S and a 1 S a_1 \notin S . Regarding 1 b . 1b. we don't know which one among a 1 a_1 , a 2 a_2 , a 3 a_3 is in S S , so we choose T 3 = { a 3 , a 4 } T_3=\{a_3,a_4\} :

1 c . T 3 S = 1 a 1 S X O R a 2 S X O R a 3 S X O R a 4 S 1c. \hspace{5pt} \displaystyle |T_3 \cap S|=1 \hspace{5pt} \Longrightarrow \hspace{5pt} a_1 \in S \hspace{3pt} XOR \hspace{3pt} a_2 \in S \hspace{3pt} XOR \hspace{3pt} a_3 \in S \hspace{3pt} XOR \hspace{3pt} a_4 \in S

2 c . T 3 S = 2 a 3 S X O R a 4 S 2c. \hspace{5pt} \displaystyle |T_3 \cap S|=2 \hspace{5pt} \Longrightarrow \hspace{5pt} a_3 \in S \hspace{3pt} XOR \hspace{3pt} a_4 \in S

3 c . T 3 S = 0 a 3 S A N D a 4 S 3c. \hspace{5pt} \displaystyle |T_3 \cap S|=0 \hspace{5pt} \Longrightarrow \hspace{5pt} a_3 \notin S \hspace{3pt} AND \hspace{3pt} a_4 \notin S

2 c . 2c. tells us that { a 1 , a 3 , a 4 } S \{a_1,a_3,a_4\} \in S , and a 2 S a_2 \notin S . 3 c . 3c. tells us that a 2 S a_2 \in S . Regarding 1 c . 1c. we don't know which one among a 1 a_1 , a 2 a_2 , a 3 a_3 , a 4 a_4 is in S S , so we choose T 4 = { a 4 , a 5 } T_4=\{a_4,a_5\} :

1 d . T 4 S = 1 a 1 S X O R a 2 S X O R a 3 S X O R a 4 S a 5 S 1d. \hspace{5pt} \displaystyle |T_4 \cap S|=1 \hspace{5pt} \Longrightarrow \hspace{5pt} a_1 \in S \hspace{3pt} XOR \hspace{3pt} a_2 \in S \hspace{3pt} XOR \hspace{3pt} a_3 \in S \hspace{3pt} XOR \hspace{3pt} a_4 \in S \hspace{3pt} a_5 \in S

2 d . T 4 S = 2 a 4 S A N D a 5 S 2d. \hspace{5pt} \displaystyle |T_4 \cap S|=2 \hspace{5pt} \Longrightarrow \hspace{5pt} a_4 \in S \hspace{3pt} AND \hspace{3pt} a_5 \in S

3 d . T 4 S = 0 a 4 S A N D a 5 S 3d. \hspace{5pt} \displaystyle |T_4 \cap S|=0 \hspace{5pt} \Longrightarrow \hspace{5pt} a_4 \notin S \hspace{3pt} AND \hspace{3pt} a_5 \notin S

1 d . 1d. tells us that S = { a 1 , a 3 , a 5 } S=\{a_1, a_3, a_5\} . 2 d . 2d. tells us that { a 2 , a 4 , a 5 } S \{a_2, a_4, a_5\} \in S and { a 1 , a 2 } S \{a_1, a_2\} \notin S . 3 d . 3d. tells us that { a 3 , a 1 } S \{a_3, a_1\}\in S and { a 2 , a 4 , a 5 } S \{a_2, a_4, a_5\} \notin S . I didn't list all possible 2 5 2^5 sets S S , but just the { 1 , 1 , 1 , 1 , } \{1,1,1,1,\} situation that leads to S = { a 1 , a 3 , a 5 } S=\{a_1, a_3, a_5\} . Each S S , infact, could be see as a sequence of { d 1 , d 2 , d 3 , d 4 } \{d_1,d_2,d_3,d_4\} where d i = d i m ( T i S ) d_i=dim(T_i \cap S) , i = 1 , . . . , 4 i=1,...,4 .

Note: Instead of "dim" which refers to the dimension (of a vector space), you actually want | \cdot | , which counts the number of elements in the set.

Nice algorithmic setup, but it would be easier to read if you broke down the cases into explicit steps. Currently, it is hard to visually trace through what you are doing, e.g. the "Regarding 1" could refer to several 1's>

Calvin Lin Staff - 3 years, 2 months ago

Log in to reply

I just fixed both the 'dim' problem and the cases notation, hope it'll be a bit clearer now. Thank you for your reporting!

Nicola Mignoni - 3 years, 2 months ago
Rafael Tages Melo
Jun 15, 2014

There are 5 elements in the set. Any time you guess, he´ll tell you if you are right or wrong. As there are 5 elements, if you guess 4 times, you already know how many elements are in T. That´s the minimum, anymore than that and you are already guessing all the elements, and there´s no game. Less than that, and you could still leave any other combination.

Example please?

Agnishom Chattopadhyay - 6 years, 12 months ago

Log in to reply

You already solved the question, why do you want an example?

Rafael Tages Melo - 6 years, 12 months ago

Log in to reply

If you have three elements on a set S, and you´re gonna make a subset T of them - I would only have to guess twice to know all the elements of subset T. Number of elements of the set - 1.

Rafael Tages Melo - 6 years, 12 months ago

Because i do not understand it

Agnishom Chattopadhyay - 6 years, 11 months ago

I'm afraid I do not understand your solution.

Can you explain what your subsets T T are? Note that all you know is the number of elements in the intersection, as opposed to knowing exactly who is in the intersection.

Calvin Lin Staff - 6 years, 12 months ago

Log in to reply

Calvin, why do I have to explain it to you? You are the creator of the question. It is already solved, and lots of people provided explanation. I´m just appending a footnote here. If you don´t like the solution, perhaps it is useful for someone else.

Rafael Tages Melo - 6 years, 12 months ago

"Any time you guess, he will tell you if you are right or wrong"

Not true. I only know about those specific people which i guessed.

"As there are 5 elements, if you guess 4 times, you already know how many elements are in T."

No, not all four guesses tell you how many elements are in T. I could guess as my first 4 guesses Sue, then Arron, then Pete, then Dan, and i wouldn't know about calvin.

"That's the minimum,"

This is unsubstantiated. You haven't proven this.

"less than that, and you could still leave any other combination."

Again, this is an unproven assertion.

Anonymous Anonymous - 6 years, 12 months ago
Calvin Lin Staff
Jun 14, 2014

[This is not a solution.]

Clearly, at most 5 guesses are needed, where you make the guesses of {Sue}, {Arron}, {Pete}, {Dan}, {Calvin}. This would tell you which people are in S S , and who are not in S S , thereby determining S S .

However, we can actually do slightly better, and need at most 4 guesses. (See Agnishom's solution)

I'm not sure why 3 guesses is insufficient, and that has yet to be demonstrated.

I am unsure how to prove, but i took all five elements as my first guess, then i would thus get an analysis of number of people in subset then, i manually checked cases if you relied 4 or 3 or 2 or 1 i would have to take subset of 3 people to get minimum of 3 extra guesses.

Megh Parikh - 6 years, 12 months ago

Log in to reply

My approach was similar to yours. I like @Agnishom Chattopadhyay 's solution better :)

Calvin Lin Staff - 6 years, 12 months ago

I've found an exhaustive proof, I will post it

Agnishom Chattopadhyay - 6 years, 12 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...