Logic Puzzles: Five Jars, Five Teams

We have received a number of questions about various kinds of logic puzzles. This week I want to collect several for which we gave hints or partial solutions that demonstrate in detail how to think, without taking away all the fun. These all involve a set of people or objects that have a set of attributes, which we have to match up based on a  list of facts.

Five jars: location, candy, color, count

We’ll start with this question from 1997:

How Many Pieces of Candy in Each Jar?

My Mom and I tried this logic question for about three hours and we still don't have the right answer.

Here's the question:

At the annual Cumberland County fair, one of the more popular booths is the Candy Contest. Five jars, each of which contains a different type of candy (one is bonbons) and has a different-colored lid, are lined up on a shelf, and contestants guess how many pieces of candy are in each jar. From the information provided, can you determine the color of the lid (one is pink) on each jar A, B, C, D, or E), the type of candy in the jar, and the number of pieces in it (125, 150, 175, 200, or 225)?
     
1. Gumdrops are in the jar to the immediate
   right of the one with the blue lid and to
   the left of the one containing 175 candies. 

2. The white-lidded jar is on one end of the
   shelf and the jar containing 150 pieces of
   candy is on the other end. 

3. There are 225 jellybeans in the jar to the
   immediate right of the licorice sticks and
   to the left of at least one other jar. 

4. The butterscotch candies are in the jar
   with the yellow lid.

5. The jar with the green lid, which is not
   next to the jar with the white lid, is to
   the immediate left of the jar containing 
   200 candies. 

6. The jar with the white lid does not
   contain 125 pieces of candy. 

The jars are:  A   B   C   D    E

The best we could do was this:

   green    yellow   blue    pink    white
   150      200      225     125     175
   bonbons  L.S.     jelly   gum     butterscotch
                     beans   drops

   A        B        C       D       E

The butterscotch is supposed to be yellow and there never seems to be a place for it. Can you help?

Doctor Rob answered, stepping us through the initial steps of analyzing the problem. First, we have to think about what is implied by each clue, which may be more than you think:

Ahhh! Another logic puzzle. These are usually fairly straightforward.

The clues give us various useful facts, and some less useful but important relations between the locations, numbers, colors, and candy types.  I will deal with the clues in turn.

Clue
  1 ==> F1:   Gumdrops are not in the jar with the blue lid.
  1 ==> F2:   Gumdrops are not in the jar with 175 candies.
  1 ==> F3:   The jar with the blue lid doesn't have 175 candies.
  1 ==> F4:   Gumdrops are not at A.
  1 ==> F5:   Gumdrops are not at E.
  1 ==> F6:   175 candies are not at A.
  1 ==> F7:   175 candies are not at B.
  1 ==> F8:   The blue lid is not at D.
  1 ==> F9:   The blue lid is not at E.
(There is more location information, too.)

  2 ==> F10:  The white lid is not at B.
  2 ==> F11:  The white lid is not at C.
  2 ==> F12:  The white lid is not at D.
  2 ==> F13:  150 candies are not at B.
  2 ==> F14:  150 candies are not at C.
  2 ==> F15:  150 candies are not at D.
  2 ==> F16:  The jar with the white lid doesn't have 150 candies.

  3 ==> F17:  There are 225 jellybeans.
  3 ==> F18:  There are not 225 bonbons.
  3 ==> F19:  There are not 225 licorice sticks.
  3 ==> F20:  There are not 225 gumdrops.
  3 ==> F21:  There are not 225 butterscotches.
  3 ==> F22:  There are not 125 jellybeans.
  3 ==> F23:  There are not 150 jellybeans.
  3 ==> F24:  There are not 175 jellybeans.
  3 ==> F25:  There are not 200 jellybeans.
  3 ==> F26:  The jellybeans are not at A.
  3 ==> F27:  The 225 candies are not at A.
  3 ==> F28:  The jellybeans are not at E.
  3 ==> F29:  The 225 candies are not at E.
  3 ==> F30:  The licorice sticks are not at E.
  3 ==> F31:  The licorice sticks are not at D.
(There is more location information, too).

  4 ==> F32:  The butterscotches are under the yellow lid.
  4 ==> F33:  The bonbons are not under the yellow lid.
  4 ==> F34:  The licorice sticks are not under the yellow lid.
  4 ==> F35:  The jellybeans are not under the yellow lid.
  4 ==> F36:  The gumdrops are not under the yellow lid.
  4 ==> F37:  The butterscotches are not under the green lid.
  4 ==> F38:  The butterscotches are not under the blue lid.
  4 ==> F39:  The butterscotches are not under the pink lid.
  4 ==> F40:  The butterscotches are not under the white lid.

  5 ==> F41:  The green lid is not at E.
  5 ==> F42:  The 200 candies is not at A.
  5 ==> F43:  The 200 candies are not under the green lid.
(There is more location information, too).

  6 ==> F44:  The 125 candies are not under the white lid.

In the answer to the next question, Doctor Rob will tell us about a visual way to organize such information.

Next, we find a fact that is almost known (with only a couple possibilities), and assume one possibility for the sake of argument; we’ll go back and change that if it leads to a contradiction.

Now we derive a fact from others:

F21 & F32 ==> F45:  The 225 candies are not under the yellow lid.

Since there are just two places for the white lid, let's assume one of them.  Assume:

 A1: The jar with the white lid is at A.

Derive the following consequences:

 A1 & F44 ==> C1:  125 candies are not at A.
 A1 & F16 ==> C2:  150 candies are not at A.

C1, C2, F6, F42 & F27 together are a contradiction.  The conclusion is that the assumption A1 is wrong.  Thus we have the following:

 F46:  The white lid is not at A.

 F46, F10, F11 & F12 ==> F47:  The white lid is at E.
 F47 ==> F48:  The yellow lid is not at E.
 F47 ==> F49:  The pink lid is not at E.
 F47 & F29 ==> F50:  The 225 candies are not under the white lid.
 F47 & F30 ==> F51:  The licorice sticks are not under the white lid.
 F47 & F28 ==> F52:  The jellybeans are not under the white lid.
 F47 & F5 ==> F53:  The gumdrops are not under the white lid.
 F40, F51, F52 & F53 ==> F54:  The bonbons are under the white lid.
 F54 ==> F55:  The bonbons are not under the green lid.
 F54 ==> F56:  The bonbons are not under the blue lid.
 F54 ==> F57:  The bonbons are not under the pink lid.
 F54 & F47 ==> F58:  The bonbons are at E.
 F58 ==> F59:  The bonbons are not at A.
 F58 ==> F60:  The bonbons are not at B.
 F58 ==> F61:  The bonbons are not at C.
 F58 ==> F62:  The bonbons are not at D.
 F58 ==> F63:  The butterscotches are not at E.
  5 & F47 ==> F64:  The green lid is not at D.

Again, we make an assumption, which will be found to be false:

Now assume the blue lid is at A. By clue no. 1, the gumdrops would be at B. Since by clue no. 3 the licorice sticks and the jellybeans are adjacent, they must fit into C and D, so the licorice sticks would be at C, and the 225 jellybeans at D.  That leaves the butterscotches at A, which means the yellow lid has to be at A, which contradicts the assumption.  Thus:

 F65: The blue lid is not at A.

Keep in mind that assumptions are not things we consider actually true, only temporarily so. If it didn’t lead to a contradiction, we’d still want to come back and try the alternative, in order to be sure that our answer is not just one of several possibilities.

Now assume the blue lid is at C. By clue no. 1, the gumdrops would be at D, and the 175 candies at E. Since the yellow lid covers the butterscotches, it must be at A or B, but if at B, no. 3 would be contradicted. Thus the yellow lid and the butterscotches would have to be at A, the licorice sticks at B, and the 225 jellybeans at C.  Now the green lid cannot be at A (the yellow lid is) or at B (since the 200 candies would have to be at C, but the 225 are), or at C (the blue lid is) or at D (it is next to the white lid), or at E (the white lid is). Thus we have a contradiction, and so:

 F66: The blue lid is not at C.
 F8, F9, F65 & F66 ==> F67:  The blue lid is at B.

Now use the location information from clues numbers 1, 3, and 5 above to reason as in the above two paragraphs and finish figuring out what is where. I note that the solution is unique.

Like Doctor Rob, I’ll  leave the rest to you. But knowing that there is a (unique) solution provides hope that your work will not be wasted. That’s part of the fun of puzzles; in real life, we can’t always be sure of that.

Five teams: stadium, sport, name

The following problem is also from 1997:

The Sportsville Teams

Our teacher gives us these kinds of logic problems each  week. They have to do with combining the clues, and I think they are really hard. Sometimes I solve some of a problem, but I am seldom able to finish all of it. Are there straightforward methods for solving logic problems like this one?   

Sportsville teams. 

There are four stadiums in Sportsville: Memorial, the Coliseum, Central, and All Saints. These are the homegrounds for football, soccer, baseball, tennis, and basketball teams. Two teams share the same stadium. The five teams are the Blazers, the Fireballs, the Streaks, the Flames, and the Demons. 

From the clues given, try to determine the NICKNAME of each sports team and the STADIUMS at which they play: 

1) Neither the Demons nor the team that plays
   at Central must share its stadium but the
   Flames must.
 
2) The football team doesn`t play at Central
   stadium and it shares its stadium with the
   Streaks. 

3) The basketball team, the baseball team, and
   the Fireballs do not share their stadiums. 

4) The soccer team is not called the Fireballs
   and doesn`t play at All Saints. 

5) The tennis team plays at Memorial stadium
   but the baseball team does not play at All
   Saints.

The stadium-sharing makes this a little different!

Doctor Rob answered again, starting with a way to organize his thinking, by making a table for each pair of attributes. (Next time, we’ll see an example of tables like these in use.)

To do problems like these, I make a diagram to help me keep track of what is known.  

In this case there are four attributes: stadium, sport, nickname, and sharing. This means that my diagram will have 1 + 2 + 3 = 4*(4-1)/2 = 6 parts.  Each part will be a rectangular array.

The first part will be stadium versus sport, so it will have four rows and five columns. Each row will be labeled with the name of a stadium, and each column with the name of a sport. In any cell in the array, I put a 1 if that sport is played in that stadium, and a 0 otherwise.

The second part will be stadium versus nickname, so it will also have four rows and five columns. Each row will be labeled with the name of the stadium, and each column with the nickname of a team. In any cell in the array, I put a 1 if that team plays in that stadium, and a 0 otherwise.

The third part will be stadium versus sharing, so it will be 4-by-1.

The fourth part will be sport versus nickname, so it will be 5-by-5.

The fifth part will be sport versus sharing, so it will be 5-by-1.

The sixth part will be nickname versus sharing, so it will be 5-by-1.

In each row or column of each array there will be either a single 1 and the rest 0s, because each sport is played in only one stadium, and so on; or else there will be exactly two 1s and the rest 0s, because one stadium hosts two teams, and so on. There should be exactly five 1s in the 4-by-5 and 5-by-5 arrays, two 1s in the 5-by-1 arrays, and one 1 in the 4-by-1 array.

Thinking through all of this from the start helps in carrying out the work; we’re setting the rules for our game, and planning how to recognize a valid solution.

Next, he copies the clues and breaks  them apart, identifying facts as he did last time, which can be put into the tables, each Fact represented by a 1 or 0. Fill out your tables step by step to follow the reasoning:

Now we carefully analyze the clues for facts that they imply. I use the symbol "=>" to mean "implies". Each fact will allow us to put a 0 or a 1 in one of the six arrays.

1) Neither the Demons nor the team that plays
   at Central must share its stadium but the
   Flames must.
2) The football team doesn`t play at Central
   stadium and it shares its stadium with the
   Streaks. 
3) The basketball team, the baseball team, and
   the Fireballs do not share their stadiums. 
4) The soccer team is not called the Fireballs
   and doesn`t play at All Saints. 
5) The tennis team plays at Memorial stadium
   but the baseball team does not play at All
   Saints.

5) =>
F1: The tennis team plays at Memorial stadium.
F2: The tennis team does not play at the Coliseum.
F3: The tennis team does not play at Central.
F4: The tennis team does not play at All Saints.
F5: The baseball team does not play at All Saints.

4) =>
F6: The soccer team is not the Fireballs.
F7: The soccer team does not play at All Saints.

1) =>
F8: The Demons do not share their stadium.
F9: Central is not the shared stadium.
F10: The Flames share their stadium.

2) =>
F11: The football team doesn't play at Central.
F12: The football team is not the Streaks.
F13: The football team shares its stadium.
F14: The Streaks share their stadium.
F9 above.

3) =>
F15: The basketball team does not share its stadium.
F16: The baseball team does not share its stadium.
F17: The Fireballs do not share their stadium.
F18: F10 & F14 => The Streaks and Flames share their stadium.
F19: F10 & F14 => The Blazers do not share their stadium.
F20: F13 & F12 & F18 => The football team is the Flames.
F21: F20 => The football team is not the Blazers.
F22: F20 => The football team is not the Fireballs.
F23: F20 => The football team is not the Demons.
F24: F20 => The soccer team is not the Flames.
F25: F20 => The baseball team is not the Flames.
F26: F20 => The tennis team is not the Flames.
F27: F20 => The basketball team is not the Flames.
F28: F18 & F16 => The baseball team is not the Streaks.
F29: F18 & F15 => The basketball team is not the Streaks.

Now if the Streaks played at All Saints, by F4, F5, and F7, they could not be the tennis, baseball, or soccer teams, and by F29 and F12, they are not the basketball or football teams.  This is a contradiction, so

F30: The Streaks do not play at All Saints.
F31: F30 & F18 => All Saints is not the shared stadium.
F32: F31 & F18 => The Flames do not play at All Saints.
F33: F18 & F9 => The Flames do not play at Central.
F33: F18 & F9 => The Streaks do not play at Central.
F34: F32 & F20 => The football team does not play at All Saints.
F35: F34 & F4 & F5 & F7 => The basketball team plays at 
All Saints.
F36: F35 => The basketball team does not play at Central.
F37: F35 => The basketball team does not play at the Coliseum.
F38: F35 => The basketball team does not play at Memorial.

Sometimes English grammar is ambiguous, or the logic of a clue may not be identical to formal logic. The first clue, “Neither the Demons nor the team that plays at Central …”,  doesn’t imply, to a mathematician, that the two teams mentioned are necessarily distinct; but in everyday language it does. Similarly, the third clue, “The basketball team, the baseball team, and the Fireballs …”, doesn’t logically demand that these are three different teams, but it would be unnatural to say that it if they weren’t. It’s always a good idea to note any questionable interpretations, rather than to just barge through your work without identifying places where you might be wrong (and might have to come back and change your opinion). So he points these things out:

Questions:
Does 1) => The Demons do not play at Central?
Does 3) => The Fireballs do not play basketball or baseball?

These are questions of semantics, not of mathematics or logic, I think. They need to be clarified with your teacher. In this case, the answer is not unique unless this is what is meant, so I suppose we can go ahead and assume that that is what is meant.

1) =>
F39: The Demons do not play at Central.
3) =>
F40: The Fireballs do not play basketball.
F41: The Fireballs do not play baseball.

These last three facts imply many further facts, starting with the Fireballs playing tennis (F6, F22, F40, F41).

The rest is up to you, after a brief explanation of the use of assumptions we saw in the first problem:

At some point we may have to make an assumption.  Assume one of a small set of possibilities, and try to see what it implies. Call the assumption A1, and the consequences it implies C1, C2, ...  If the assumption implies a contradiction, it must be false, and the set of possibilities is reduced in size. Then discard A1 and its consequences, and continue.  This is what we did after F29 above.

This is the way that these logic puzzles are worked out. Usually theyare constructed so that there is only one solution, and you are more or less forced to discover it by this method.

With this start, you should be able to finish the problem.

Isak replied,

Thank you so much for the help with the logic problem!  I was able to sort it out by keeping track of the information the way you taught me. I am sharing this help with some friends.

Just what we like to see!

Next time, I’ll have two more puzzles of this type, again with partial solutions.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.