Chapter 15/15.3Foundationabout 6 min
Logic: and, or, not, if
A teacher says: "If you finish your homework, you may play football." Thandi did not finish her homework, but she played football. Did the teacher's statement turn out false? What would make it false?
statement A statement is a sentence that is either true or false, but not both. "7 is prime" is a true statement; "7 is even" is a false one; "Is 7 prime?" is not a statement.
Statements can be joined. Let P and Q be statements.
- P and Q is true only when both are true.
- P or Q is true when at least one is true. In mathematics "or" includes both, just as A ∪ B includes the overlap.
- not P is true exactly when P is false.
- if P then Q is false only when P is true and Q is false. It is a promise about what happens when P is true, and it is not broken when P is false. So the teacher's promise was not broken by Thandi.
truth table A truth table lists every possible combination of true (T) and false (F) for some statements, and the truth of a combined statement in each case.
| P | Q | P and Q | P or Q | if P then Q |
|---|---|---|---|---|
| T | T | T | T | T |
| T | F | F | T | F |
| F | T | F | T | T |
| F | F | F | F | T |
Converse and contrapositive. Recall from Chapter 13 that the converse of "if P then Q" is "if Q then P", and that it may be false. The contrapositive, "if not Q then not P", is always true when the original is. "If a number is a multiple of 4, it is even" has the contrapositive "if a number is not even, it is not a multiple of 4": the same fact seen from the other side. Recall also from Chapter 1 that a statement about every number is destroyed by one counterexample: it is an "if then" that fails in one case.
- (a)15 is odd and 15 is prime.
- (b)15 is odd or 15 is prime.
- (c)If n is a multiple of 6, then n is a multiple of 3.
- (d)The converse of (c).
Logic in machines. In 1854 the English mathematician George Boole, who had taught himself mathematics and became a professor at Queen's College, Cork, in Ireland, published The Laws of Thought. He wrote logic as algebra, with 1 for true and 0 for false. In 1937 the American engineer Claude Shannon showed that electrical switches obey Boole's algebra. Today every chip is built from tiny circuits called logic gates, each working out "and", "or" or "not" on signals of 1 and 0. Long before such machines existed, Ada Lovelace wrote in 1843 a method for the Analytical Engine, a calculating machine designed by Charles Babbage, to compute a sequence of numbers. It is often called the first published computer program. In 1936 Alan Turing described a simple imaginary machine that can carry out any calculation that can be written as a list of steps, the idea behind every computer.
Check your understanding 15.3
- Make a truth table for "P and not Q".
Show answerHide answer
Rows (P, Q, result): TT F; TF T; FT F; FF F. It is true only when P is true and Q is false. - Write the converse and the contrapositive of "if a triangle is equilateral, it is isosceles". Which are true?
Show answerHide answer
Converse: "if a triangle is isosceles, it is equilateral", false (sides 5, 5, 3). Contrapositive: "if a triangle is not isosceles, it is not equilateral", true. - Find a counterexample: "if n is odd, then n2 + 2 is prime".
Show answerHide answer
n = 5: 27 = 3 × 9 is not prime. (n = 1 and n = 3 give 3 and 11, both prime.)
