Emzini weCodeUmhlahlandlelaMathematics 15.3 · Sets, Logic and Counting NoticesAll books

Chapter 15/15.3Foundationabout 6 min

Logic: and, or, not, if

Try this first

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?

Definition

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.
Definition

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.

Worked example 15.2
Decide whether each statement is true, giving a reason.
  1. (a)15 is odd and 15 is prime.
  2. (b)15 is odd or 15 is prime.
  3. (c)If n is a multiple of 6, then n is a multiple of 3.
  4. (d)The converse of (c).
(a)
False: 15 = 3 × 5 is not prime.
(b)
True: 15 is odd, and one true part is enough.
(c)
True:
6k = 3 × 2k
(d)
"If n is a multiple of 3, then n is a multiple of 6." False: 9 is a counterexample.

Now try one yourself

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.

Logic gates: logic built into a chipA signal of 1 means true and 0 means false. Each gate works out and, or or not.A CHIP ON A CIRCUIT BOARDinsidea chip holds many tiny circuits called logic gates1AND GATEPQP and QPQP and Q1111000100001 only when both inputs are 12OR GATEPQP or QPQP or Q1111010110001 when at least one input is 13NOT GATEPnot PPnot P1001turns 1 into 0 and 0 into 1
Figure 15.3 Each logic gate is a tiny circuit that carries out and, or or not on signals of 1 (true) and 0 (false).

Check your understanding 15.3

  1. 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.
  2. 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.
  3. 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.)