## Friday, 18 March 2011

### Logic problem solution

Last week I posed a classic problem in logic for which I now offer the solution:

There are four cards on a table. Each card has a letter on one side and a number on the other. The cards are laid out so that we can see two of the letters and two of the numbers:

A B 8 5
Someone makes this assertion: 'If a card has a vowel on one side then it has an even number on the other side.'
Which cards must you turn over to find out whether this assertion is true or not?

The solution is that you have to turn over the A and the 5.

Clearly, we must check that there is actually an even number on the back of the A ( a vowel). If not, the statement is shown to be false.

What is on the reverse of the B is irrelevant, since the assertion refers only to what we will find on the reverse of a vowel. It could be an even number or an odd number and not affect the truth of the assertion.

Similarly – and this is the tricky one – what is on the back of the 8 is irrelevant! If we find a vowel, then OK, the assertion is satisfied; if we find a consonant, then it does not have any bearing on the assertion, because that was only about what is on the reverse of a vowel!

But we must check the 5, because if this turns out to have a vowel on the reverse then the assertion is shown to fail.

The difficulty here for many students is grasping that the truth of a statement in the form 'if p then q' does not require 'if q then p' to be true as well. In this problem, the assertion is 'if vowel then even' not 'if even then vowel'.

For example, I may say (truthfully) 'If rain is forecast then I carry an umbrella'. This does not imply that 'If I carry an umbrella then rain is forecast'! If you see me with an umbrella then you can deduce nothing about the weather forecast: in my original statement I gave no information about what I would do if rain is not forecast.

It is really important in mathematics to get the direction of our 'if ... then ...' statements correct. For example, only one of these is true:
• If a is a factor of 6 then it is a factor of 24.
• If a is a factor of 24 then it is a factor of 6.
It's the first one that's true. The second one can be shown to be false by a counterexample. A counterexample is a case where the 'if' bit is true, but the 'then' bit is not. For example, choosing a to be 8: it is true that 8 is a factor of 24, but not true that 8 is a factor of 6.

Sometimes, both of the statements are true, in which case the 'if' bit and the 'then' bit are equivalent, and we can replace the two statements with one statement that uses 'if and only if'. For example:
• If a positive whole number n has an odd number of factors then it is a square number.
• If a positive whole number n is a square number then it has an odd number of factors.
Both these are true statements. So we can combine them as one statement:
• A positive whole number n has an odd number of factors if and only if it is a square number.
(Try some examples: 16 is a square number and it has 5 factors, 1, 2, 4, 8 and 16; 15 is not a square number and it has 4 factors, 1, 3, 5, 15.)