Monday 25 August 2014

Dangerous caterpillars solution

Figure 1. The usual suspects.
Last time I asked if we could work out which caterpillars from Figure 1 are safe based on the following rules:
  1. If a caterpillar has blue eyes or spots it is dangerous. If a caterpillar has both, we can't tell if it is dangerous.
  2. All safe caterpillars have more than one of the following features: teeth, blue eyes, spots, or spikes.
  3. Caterpillars with both teeth and spots are dangerous.
As I suggested Venn diagrams are expertly suited to this kind of puzzle. 

To solve the puzzle using Venn diagrams we, first, decide what our sets are going to be. In the clues there are 4 features that are discussed: teeth, blue eyes, spots and spikes. Thus, we construct a Venn diagram of these four qualities and insert the caterpillars to their appropriate spaces. This can be seen in Figure 2. Note that in this specific problem we have to use the full Venn diagram form of the four sets, rather than the Euler diagram that we discussed, previously.
Figure 2. Separating the caterpillars into types.
Now that we have our diagram we use the clues to remove sections and restrict the safe caterpillar possibilities.

The simplified Venn diagrams corresponding to each of the clues can be seen in Figure 3. For example, the first clue states that animals with blue eyes and spots (but, perhaps, not both) are dangerous. Thus, we remove the sections corresponding to the blue eyed caterpillars and the spots. However, the region over which they intersect is left, because we can't be sure if those caterpillars are dangerous or not.
Figure 3. Removing sections of the Venn diagram based on the clues. Left: the blanked out section corresponds to either having blue eyes or spots, but not both. Center: removing the sections with only one feature. Right: removing the section with teeth and spots.
This process is carried out for all three clues. Finally, we put together only the sections that remain in all three diagrams in Figure 3 to get Figure 4.
Figure 4. Only one caterpillar left.
As you see will from Figure 4 there are only 3 sections of the Venn diagram left. These include two sections in the blue eyes and spots region. Because of rule 1, we cannot tell if those sections are safe, or not. Luckily, there are no caterpillars in these regions, so no risks need be taken. The only caterpillar left has both spikes and teeth... would you trust this guy?

Monday 11 August 2014

More Venn diagrams with a logic puzzle

A long time ago I posted about Venn and Euler diagrams and I have been meaning to get back to this subject. Coincidentally, it was John Venn's 180th birthday on the 4th of August, celebrated by Google, so I cannot think of a better time to revive the subject.

Firstly, we recall the all important definition: a Venn diagram contains every single possible intersection between all combinations of the sets. This can be compared with an Euler diagram, which only shows the intersections in which you are interested. An illustration of this can be found in Figure 1.
Figure 1. Using four shapes a basic Euler diagram is not the same as a Venn diagram. The right shows an Euler diagram whereas the left is a Venn diagram, as it contains all possible combinations of the four groups.
As I mentioned, these are great ways of seeing logical information quickly and clearly. To show how useful they are let us consider the following puzzle.
________________________________________________________________
________________________________________
I have a collection of 8 caterpillars that have a range of different features. They can all be seen in Figure 2, below.
Unfortunately, some of them are dangerous to touch. Equally troubling is that I do not know which the dangerous ones are! All I know is that the following three statements are true:
  1. If a caterpillar has blue eyes or spots it is dangerous. If a caterpillar has both, we can't tell if it is dangerous.
  2. All safe caterpillars have more than one of the following features: teeth, blue eyes, spots, or spikes.
  3. Caterpillars with both teeth and spots are dangerous.
Using just these facts, which caterpillars are safe to touch?

Now of course there are many ways to solve this little puzzle, but Venn diagrams offer a really nifty way of seeing the solution simply and completely. Have a go at solving it and I'll post the solution next time.