0% found this document useful (0 votes)
83 views

Logic Notes - MAT2EB1

The document provides an introduction to propositional and predicate logic by: 1) Distinguishing between propositional and predicate (first-order) logic, with propositional logic using propositions and predicate logic adding variables, functions, and quantifiers. 2) Defining propositions, logical connectives like negation and conjunction, and truth tables for determining the truth value of compound propositions from primitive propositions. 3) Explaining how to use truth tables and logical connectives to compute the truth value of complex logical statements.

Uploaded by

Kgopotso Maponya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Logic Notes - MAT2EB1

The document provides an introduction to propositional and predicate logic by: 1) Distinguishing between propositional and predicate (first-order) logic, with propositional logic using propositions and predicate logic adding variables, functions, and quantifiers. 2) Defining propositions, logical connectives like negation and conjunction, and truth tables for determining the truth value of compound propositions from primitive propositions. 3) Explaining how to use truth tables and logical connectives to compute the truth value of complex logical statements.

Uploaded by

Kgopotso Maponya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

1 LOGIC

Logic is a classical branch of mathematics which studies the foundations, laws and struc-
ture of mathematical reasoning. Contemporary logic has applications in a number of fields,
specifically in computer science in areas such as digital logic circuit design, database theory
and artificial intelligence.

We distinguish two levels of logical expressions and reasoning:

• The lower level is propositional logic. Propositions are sentences which are built from
primitive statements with only a truth value (true or false), using logical connectives.

• The higher level is predicate (or first-order) logic. This builds on propositional logic
by using constants and variables, functions and predicates over objects, as well as
quantifiers. First-order logic provides us with a method to express any mathematical
statement.

The purpose of these notes is to give an introduction to the basic concepts of classical logic,
by introducing the formal languages of propositional and first-order logic and discussing the
concepts of truth, validity and logical equivalence.

1.1 Propositional Logic

1.1.1 Propositions

Definition: A proposition is a sentence that is true or false but not both.

Some examples:

• UJ is situated in Johannesburg.

• Durban is the capital of South Africa.

• 3 plus 3 equals 6.

• 3 plus 3 equals 5.

1
The following sentences are not propositions:

• Are you tired? (Not a statement.)

• She is a university student. (Whether this is true or false depends on who ‘she’ is.)

• x is a rational number. (Whether this is true or false depends on what x is.)

• This statement is false. (If it is true, then it contradicts the fact that the statement
is false. And it cannot be false, since the statement says it is false, which would then
make it true.)

1.1.2 Logical connectives

Propositions which cannot be broken up into smaller parts, are called primitive, or atomic,
propositions. We can form compound propositions from primitive ones using logical connec-
tives. We use the lower case letters p, q and r as propositional variables to denote primitive
propositions.

The most commonly used connectives are:

• not, called negation, denoted by ¬

• and, called conjunction, denoted by ∧

• or, called disjunction, denoted by ∨

• if then . . ., called implication, or conditional, denoted by →

• . . .if and only if. . ., called biconditional, denoted by ↔.

For example, suppose we have the primitive propositions p = “2 is a prime number” and
q = “The sun is hot”. (Recall that a prime number is a natural number greater than 1
that has no positive divisors other than 1 and itself, see Section 1.2.1) We can then form
compound propositions from these primitive ones such as

• ¬p = “It is not the case that 2 is a prime number.” or “2 is not a prime number.”

• p ∧ q = “2 is a prime number and the sun is hot.”

2
• q → p = “If the sun is hot, then 2 is a prime number.”

• q ↔ p = “The sun is hot if and only if 2 is a prime number.”

For a more involved example, we can use the propositions p = “Sihle is healthy”, q = “Sihle
is wealthy” and r = “Sihle is wise” to compose the following compound proposition:
¬q ∨ (p → (q ∧ ¬r)) = “Sihle is not wealthy or, if she is healthy then she is wealthy and not
wise.”

1.1.3 Truth values for logical connectives

In order to determine the truth value of a compound proposition, we need to know the
truth value of the primitive components. In the same way as we can calculate the value of
the algebraic expression a × (b − c) + b/a as soon as we know the values of a, b and c, we
can determine the truth value of a compound proposition such as “(p ∧ q) ∨ ¬r” if we know
the truth values of p, q and r.

We also need to know how our logical connectives behave with respect to truth values, so
we use the following rules of ‘propositional arithmetic’:

• The proposition ¬p (not p) is true precisely when the proposition p is false, i.e. it has
the opposite truth value from p.
We use T to denote the value ‘true’ and we use F to denote the value ‘false’. Then
the truth values for negation can be summarized in a truth table.

p ¬p

T F

F T

• The proposition p ∧ q (p and q) is true precisely when both p and q are true.
The truth values for conjunction can also be summarized in a truth table. The table
is obtained by considering the four possible combinations of truth values for p and q.
Each combination is displayed in one row of the table and the corresponding truth
value for the whole statement is placed in the right-most column of that row.
The truth table for conjunction is:

3
p q p∧q

T T T

T F F

F T F

F F F

• The proposition p ∨ q (p or q) is true precisely when at least one of p or q (possibly


both) is true. It is false precisely when both p and q are false.
The truth table for disjunction is:

p q p∨q

T T T

T F T

F T T

F F F

Note:
In ordinary language ‘or’ is often used in an exclusive sense, e.g. in ‘I will win or I will lose’,
while in formal logic ‘or’ is used in an inclusive sense, thus ‘It will rain or it will be cold’
will be true if it is both rainy and cold.

• The proposition p → q (if p, then q) is true precisely when p is false or q is true, i.e. it
is false only when p is true and q is false, otherwise it is true. We call p the antecedent
(or hypothesis) and q the consequent (or conclusion). The truth table for implication
is:

4
p q p→q

T T T

T F F

F T T

F F T

Note:
It is important to note that if p is not true, then the truth of p → q is independent of the
truth of q. One can think of an implication as a promise.
Consider the following example: Thabo’s father tells him: “If you pass your Maths exam,
then I will buy you a motorbike.” Under what circumstances will Thabo’s father have
spoken falsely?
Answer: If Thabo passed his maths exam and his father does not buy him a motorbike.
After all, Thabo’s father’s promise only says he will buy the motorbike if he passes the
exam, it says nothing about what will happen if Thabo doesn’t pass the exam. He can buy
a motorbike even if Thabo doesn’t pass the exam. Hence the statement can be true even if
the antecedent is false.
The implication p → q can be expressed in many different ways, which you should be able
to recognize:
(1) p implies q.
(2) If p, then q.
(3) p only if q.
(4) q if p.
(5) q whenever p.

• The proposition p ↔ q (p if and only if q) is true precisely when p and q have the
same truth values. (It is common to abbreviate ‘if and only if’ with ‘iff’.)
The truth table for biconditional is:

5
p q p↔q

T T T

T F F

F T F

F F T

Note that the proposition p ↔ q is equivalent to propositions p → q and q → p being true


at the same time. In symbols:

p ↔ q ≡ (p → q) ∧ (q → p)

1.1.4 Computing truth values of propositions

The truth value of a compound proposition only depends on the truth values of the prim-
itive propositions. So to check the truth value of a compound proposition we replace all
component propositions by their respective truth values and then ‘calculate’ the truth of
the whole proposition using truth tables.

Example 1.1
Suppose we know that
“Dineo is clever” is true,
“Dineo is lazy” is false,
“Dineo likes mathematics” is true.
Then we can determine the truth value of the compound proposition
“Dineo is not clever or, if she likes mathematics, then she is clever and not lazy.”

We first have to analyze the structure of the proposition. Let us make use of parentheses
to rewrite the sentence.
“(Dineo is not clever) or, (if (she likes mathematics) then ((she is clever) and (not lazy))).”
We can go one step further by using letters to denote the primitive propositions.

6
Let p = “Dineo is clever”,
q = “Dineo is lazy”,
r = “Dineo likes mathematics”.

Then it can be rewritten as


(¬p) ∨ (r → (p ∧ ¬q))

Now replace p, q and r by their truth values:

(¬T ) ∨ (T → (T ∧ ¬F ))

= F ∨ (T → (T ∧ T ))

= F ∨ (T → T )

= F ∨T
= T

To avoid ambiguity, we will, as in arithmetic, impose a priority order amongst the logical
connectives:
(1) ¬
(2) ∧ and ∨
(3) →
(4) ↔

1.1.5 Truth tables

If we only consider specific propositions, our study of logic would be limited and not very
useful. Instead, we want to look at schemes of propositions and their properties, just like
we study algebraic formulas and equations in general.
We will make use of propositional variables p, q, r, . . . to denote unknown propositions, in the
same way we use algebraic variables to denote unknown numbers. We then use these propo-
sitional variables and the logical connectives defined in Section 1.1.2 to form propositional
formulas, similar to the way we form algebraic expressions from variables and arithmetic
operations. Note that it is common practice to denote propositional variables with the
letters p, q, r, etc. and propositional formulas with capital letters A, B, C, etc.
When constructing truth tables, we need to consider all the possible combinations for the
truth values of the relevant propositional variables. If a propositional formula contains two
propositional variables, then there are 2 × 2 = 4 possible combinations, since each variable

7
can take one of two truth values, T or F . Similarly, if a formula contains three variables,
there are 2 × 2 × 2 = 23 = 8 possible combinations of truth values. Hence, in general, if a
formula contains n variables, then there are 2n possible combinations.

One can simplify truth tables by successively calculating the truth values of all the occur-
ring subformulas, as we did in the example above. It is important to remember the order
of logical connectives when parentheses are not present.

Example 1.2
Construct a truth table for the propositional formula (p ∨ q) ∧ ¬(p ∧ q).

p q p ∨ q p ∧ q ¬(p ∧ q) (p ∨ q) ∧ ¬(p ∧ q)

T T T T F F

T F T F T T

F T T F T T

F F F F T F

Example 1.3
Construct a truth table for ((p ∧ ¬q) ∨ r) → ¬r.

p q r ¬q p ∧ ¬q (p ∧ ¬q) ∨ r ¬r ((p ∧ ¬q) ∨ r) → ¬r

T T T F F T F F

T T F F F F T T

T F T T T T F F

T F F T T T T T

F T T F F T F F

F T F F F F T T

F F T

F F F

The last two rows are left to the reader as an exercise.

8
1.1.6 Tautologies and contradictions

Definition: A tautology is a formula that obtains a truth value true for any assignment
of truth values to the variables, i.e. it is a formula that is always true. Tautologies are
also called logically valid formulas.

Example 1.4
Show that the propositional formulas p ∨ ¬p and (p ∧ (p → q)) → q are tautologies.

p ¬p p ∨ ¬p

T F T

F T T

p q p→q p ∧ (p → q) (p ∧ (p → q)) → q

T T T T T

T F F F T

F T T F T

F F T F T

The opposite concept of a tautology is a contradictory formula.

Definition: A contradiction is a formula that obtains a truth value false for any assign-
ment of truth values, i.e. it is a formula that is always false.

Example 1.5
Is p ∧ ¬p a contradiction, a tautology or neither?

p ¬p p ∧ ¬p

T F F

F T F

Hence p ∧ ¬p is a contradiction.

9
1.1.7 Logical equivalence

Definition: Propositional formulas A and B are logically equivalent if for every assign-
ment of truth values to the variables in them they obtain identical truth values, i.e., they
have ‘the same truth table’.

We will write A ≡ B to indicate that A and B are logically equivalent.

We can determine whether or not two formulas are logically equivalent by constructing the
truth table and checking whether the columns for A and B are the same or not.

Example 1.6
Show that ¬(p ∨ q) ≡ ¬p ∧ ¬q.

p q p∨q ¬(p ∨ q) ¬p ¬q ¬p ∧ ¬q

T T T F F F F

T F T F F T F

F T T F T F F

F F F T T T T
↑ ↑
same truth values
There are a few logical equivalences which are used often, such as the one in Example 1.6
above. The two logical equivalences

¬(A ∧ B) ≡ ¬A ∨ ¬B
and ¬(A ∨ B) ≡ ¬A ∧ ¬B

are called De Morgan’s laws, after the British mathematician Augustus De Morgan, who
was the first to note these logical equivalences.

Note that we use the letter t to denote a tautology, and f to denote a contradiction.
Here are some more logical equivalences:

10
1. Commutative laws: A∧B ≡ B∧A A∨B ≡ B∨A
2. Associative laws: (A ∧ B) ∧ C ≡ A ∧ (B ∧ C) (A ∨ B) ∨ C ≡ A ∨ (B ∨ C)
3. Distributive laws: A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C) A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C)
4. Identity laws: A∧t ≡ A A∨f ≡ A
5. Negation laws: A ∨ ¬A ≡ t A ∧ ¬A ≡ f
6. Double negative law: ¬(¬A) ≡ A
7. Idempotent laws: A∧A ≡ A A∨A ≡ A
8. Universal bound laws: A∨t ≡ t A∧f ≡ f
9. De Morgan’s laws: ¬(A ∧ B) ≡ ¬A ∨ ¬B ¬(A ∨ B) ≡ ¬A ∧ ¬B
Note:
Propositional formulas A and B are logically equivalent if and only if the propositional
formula A ↔ B is a tautology.

We can use the following logical equivalence to rewrite a conditional proposition as an ‘or’
proposition:

A → B ≡ ¬A ∨ B

Note that the negation of a conditional proposition is an ‘and’ proposition, and not a
conditional proposition:

¬(A → B) ≡ A ∧ ¬B

Example 1.7
Use the logical equivalence above to rewrite the following statement in if-then form.
“You get to work on time or you are fired”.

Let ¬p = You get to work on time,


q = You are fired.

The given statement is in the form ¬p ∨ q.


Hence p = You do not get to work on time.
So the equivalent if-then statement, p → q, is
“If you do not get to work on time, then you are fired.”

Example 1.8
Write the negation of the following statement.
“If Nandi lives in Soweto, then she lives in South Africa.”

Since the negation of p → q is p ∧ ¬q, the negation of the above statement is


“Nandi lives in Soweto and she does not live in South Africa.”

11
Recall that
A ↔ B ≡ (A → B) ∧ (B → A)

The negation of the biconditional is given by the following logical equivalence:

¬(A ↔ B) ≡ (A ∧ ¬B) ∨ (B ∧ ¬A)

1.1.8 Contrapositive, converse, inverse

A very important law of logic is the equivalence between a conditional formula and its con-
trapositive.

Definition: The contrapositive of the implication A → B is ¬B → ¬A.

Note that a conditional formula is logically equivalent to its contrapositive. There are two
other variants of an implication, but neither of these variants are logically equivalent to the
original implication.

Definition: Suppose an implication A → B is given

• B → A is the converse of A → B

• ¬A → ¬B is the inverse of A → B.

• A conditional formula and its converse are not logically equivalent.

• A conditional formula and its inverse are not logically equivalent.

• The converse and inverse of a conditional formula are logically equivalent to each
other.

The following truth table verifies these logical equivalences:

p q ¬p ¬q p→q ¬q → ¬p q→p ¬p → ¬q

T T F F T T T T

T F F T F F T T

F T T F T T F F

F F T T T T T T

12
Example 1.9
Write down the contrapositive, converse and inverse of the following proposition: “If Rover
is a dog, then Rover is an animal.”

Contrapositive: “If Rover is an not animal, then Rover is a not dog.”


Converse: “If Rover is an animal then Rover is a dog.”
Inverse: “If Rover is a not dog, then Rover is not an animal.”

1.1.9 Necessary and sufficient conditions

Definition: If A and B are propositional formulas, then

• “A is a sufficient condition for B” means A → B,

• “A is a necessary condition for B” means B → A, or, equivalently, ¬A → ¬B.

Consequently, “A is a necessary and sufficient condition for B” means A ↔ B.

Example 1.10
Rewrite the following statements in the if-then form.

a) Being age 18 is sufficient for Mandla being eligible to vote.

b) Being divisible by 3 is a necessary condition for a number to be divisible by 9.

a) If Mandla attains age 18, then he is eligible to vote.

b) If a number is divisible by 9, then it is divisible by 3.

OR If a number is not divisible by 3, then it is not divisible by 9.

1.1 Exercises

1) Determine whether or not the following sentences are propositions.

a) 24 + 32 = 24.

b) 24 + 32 = x.

13
c) n is an even number.

d) Do you love me?

e) Raj got married on January 15th , 2001.

f) She is in love with William.

2) Let A and B be true propositions and let C and D be false propositions. Determine
the truth value of each of the following compound propositions:

a) ¬(B ∧ ¬D) ∨ A

b) (C → A) → D

c) (B ↔ C) ∧ ¬C

d) (C ↔ ¬A) ∨ (B → ¬B)

e) ¬(A → D) ∨ (D → C)

f) ¬(¬(¬D ∧ (A → ¬B))).

3) Determine the truth value of the proposition A in each of the following cases:

a) B and B → A are true.

b) A → B is true and B is false.

c) B is false and ¬A ∧ ¬B is true.

d) B → ¬A is true, ¬B → ¬C is true, C is true.

4) Write down the negation of each of the following statements in clear and concise
English. Do not use the expression “It is not the case that” in your answers.

a) Either a2 > 0 or a is not a real number.

b) x is a real number and x2 + 1 = 0.

c) If Sizwe cannot catch a ball, then he cannot play rugby.

d) Miriam can complete the Comrades if and only if she runs 60 km per week.

e) If Bongani doesn’t play tennis, he plays cricket but not soccer.

f) Naledi likes gymnastics, or if she enjoys ballet then she doesn’t like gymnastics and
likes yoga.

14
5) Determine the antecedent and the consequent in each of the following implications:

a) If Lerato talks, everyone else listens.

b) Lerato talks only if everyone else listens.

c) An integer is positive if its cube is positive.

d) n is composite whenever n has three or more different divisors.

e) My keys are not in the safe only if I can drive my car.

6) Construct truth tables for the following propositional formulas and determine which
of them are tautologies and which are contradictions:

a) ¬(p ∧ q) ∨ (p ∨ q)

b) (p ∧ ¬p) → q

c) ¬p ∧ ¬(p → q)

d) ¬p ∨ (q → r)

e) (p → r) ↔ (q → r)

f) (p → q) ∧ (q → r) ∧ ¬(¬p ∨ r)

g) ¬(¬p ↔ q) ∧ (r ∨ ¬q)

7) Use truth tables to determine whether or not the following sets of propositions are
logically equivalent:

a) p → q ∨ r and p ∧ ¬q → r

b) p ∧ (q ∨ r) and (p ∧ q) ∨ (p ∧ r)

c) ((¬p ∨ q) ∧ (p ∨ ¬r)) ∧ (¬p ∨ ¬q) and ¬(p ∨ r)

d) p → (q → r) and (p → q) → r

8) Use known logical equivalences to rewrite each of the following propositions using only
∧, ∨ and ¬:

a) p ∧ ¬q → r

b) p ∨ ¬q → r ∨ q

c) ¬p ∧ ¬(p → q)

15
d) (p → r) ↔ (q → r)

e) ((p → q) → p) → p

9) Use the contrapositive to rewrite the following statements in if-then form in two ways.

a) Orlando Pirates will win the championship only if they win tomorrow’s game.

b) Sizwe will be allowed on Bongani’s boat only if he is an expert sailor.

c) John will marry Angela if she loves him.

10) Write down the converse and inverse of the following propositions:

a b a
a) If and are integers, then is an integer.
b c c

b) If 4ABC is a right triangle, then a2 + b2 = c2 .

c) If ab = 0, then a = 0 or b = 0.

d) If x2 = 1, then x = ±1.

11) Rewrite the following statements in if-then form:

a) Doing homework regularly is a necessary condition for Jim to pass this course.

b) Catching the 6:50 bus is sufficient for my being on time for class.

c) Being divisible by 3 is necessary for a number to be divisible by 9.

d) Having two 45◦ angles is a sufficient condition for a triangle to be a right triangle.

16
1.2 Basic Concepts of Predicate Logic

Before we proceed to Predicate Logic, we remind ourselves of a few important concepts and
definitions from the number systems.

1.2.1 Basic Number Theory

Number Theory is the branch of Mathematics that is devoted primarily to the study of
properties of the integers. We need some basic properties of integers for the examples and
exercises to come. Recall that the set of integers is denoted by Z. That is,

Z = {. . . , −3, −2, −1, 0, 1, 2, 3, . . .}

We will sometimes be interested only in the positive or negative integers. These are denoted
by Z+ and Z− respectively. That is,

Z+ = {1, 2, 3, . . .} and Z− = {. . . , −3, −2, −1}

/ Z+ ∪ Z− as 0 is neither positive nor negative.


Note that 0 ∈

The integers are used to construct the rational numbers. We denote the set of rational
numbers by Q. Formally,

a
q ∈ Q if and only if q = where a, b ∈ Z and b 6= 0
b

The number system that we are most familiar with is the real numbers, R. Note that
√ √
numbers like 2, π, e, 2 2 are elements of R but are not elements of Q.
Let m and n be integers. We say m divides n or m is a divisor of n and write m|n if there
exists an integer k such that n = m · k.
For example 2|6 and 5|15. Notice the following:

1. 1|n for every integer n, i.e. 1 is a divisor of n for every integer n, and

2. n|n for every integer n, i.e. every integer divides itself.

The above two properties mean that every integer n (other than 1) has at least two divisors.
Let p > 1 be an integer. If the only positive divisors of p are 1 and p, then we call p a prime
number.

17
Examples

• an integer n is divisible by 3 if and only if n = 3k for some integer k

• an integer m is even if and only if m = 2k for some k ∈ Z

• an integer z is odd if and only if z = 2k + 1 for some k ∈ Z

• the first eight prime numbers are 2, 3, 5, 7, 11, 13, 17, 19. More than 2000 years ago, the
Greek mathematician Euclid proved that there are infinitely many prime numbers.

The propositional logic in Section 1.1 can formalize some of our reasoning, but it is incapable
of describing most of the statements in mathematics. Consider for example the statement
“x + 3 is greater than 5”.

This statement is not a proposition, since it can be true or false depending on the value of
x. It will only be a proposition once the domain from which x comes is specified, as well as
the value of x. Similarly, the sentence “There exists a number y such that y 2 = 2” is not a
proposition until the domain (or domain of discourse) is specified.

We also have to consider the role played by words that denote quantities such as ‘all’ or
‘some’. The study of quantified statements such as the ones above is called predicate logic,
or first-order logic.

1.2.2 Predicates

In grammar the word predicate refers to the part of a sentence that gives information about
the subject. In the sentence “Laika is a student at UJ”, the word Laika is the subject and
the phrase “is a student at UJ” is the predicate. A similar approach is used in logic.

Definition: Given a domain, a predicate is a property that objects from the domain can
have, or a relationship between objects from the domain.

For example, in the sentence above, let P stand for “is a student at UJ”. P is called a pred-
icate symbol. Then the sentence ‘x is a student at UJ’ can be symbolized as the predicate
P (x). Since there is only one variable, this is a unary predicate, but we also make use of
binary predicate when two variables are involved. For instance, let Q stand for “is a student
at”. Then the sentence “x is a student at y” can be represented by the predicate Q(x, y).

18
Example 1.11
Let P (x) be the predicate “x is a prime number” with domain Z+ , the set of all positive
integers. Write P (1), P (9) and P (13) and indicate whether each statement is true or false.

P (1): 1 is a prime number → False, since 1 is not greater than 1

P (9): 9 is a prime number → False, since 9 has divisors 1,3 and 9

P (13): 13 is a prime number → True, since 13 has only 1 and 13 as divisors

Example 1.12
Let P (x, y) be the predicate “x < y” with domain R, the set of all real numbers. Write
√ 
 
5 6
P (−9, −10), P π, 17 and P , and indicate whether each statement is true or false.
8 10

P (−9, −10): −9 < −10 → False, since −9 is greater than −10


√  √ √
P π, 17 : π< 17 → True, since π ≈ 3.14 and 17 ≈ 4.12
 
5 6 5 6 5 25 6 24
P , : < → False, since = and =
8 10 8 10 8 40 10 40

1.2.3 Quantifiers

Quantifiers are words that refer to quantities such as ‘some’ or ‘all’. The symbol ∀ denotes
‘for all’ or ‘for every’ and is called the universal quantifier. For example, we can express
the statement
“All integers are real numbers”

in predicate logic as
(∀x ∈ Z)(x ∈ R)

where Z denotes the set of integers and R denotes the set of real numbers.

Let Q(x) be a predicate and let D be the domain of x. The expression “(∀x ∈ D)( Q(x))”
is true if Q(x) is true for every choice of x from D. It is false if at least one x ∈ D can
be found such that Q(x) is false. The value for which Q(x) is false is called a counterexample.

19
Example 1.13
Determine the truth value of the following universally quantified statements:
a) (∀x ∈ R)(x2 = 1)
b) (∀x ∈ D)(x2 > x), where D = {1, 2, 3, 4, 5}

a) (∀x ∈ R)(x2 = 1)
This statement says that the square of every real number is 1. To show that it is false,
we have to find at least one real number whose square is not 1. Counterexample: if
we take x = 2, then x2 = 4, which is not equal to 1.
Hence the statement is false.

b) (∀x ∈ D)(x2 > x), where D = {1, 2, 3, 4, 5}.


This statement says that the square of every number in the set D is greater than or
equal to itself.
We show that “x2 > x” is true for every x in D.

12 > 1 - True

22 > 2 - True

32 > 3 - True

42 > 4 - True

52 > 5 - True.
Hence the statement is true.

The other quantifier is called the existential quantifier, denoted by the symbol ∃, which
denotes ‘there exists at least one’ or ‘for some’. For example, we can rewrite the sentence

“There is a student who takes MAT01A1”

in formal language as
(∃x ∈ S)(M (x))

where S is the set of all students, and M (x) is the predicate “x takes MAT01A1”.

The expression (∃x ∈ D)(Q(x)) is true if at least one x ∈ D can be found such that Q(x) is
true for the particular x. It is therefore false if Q(x) is false for every x in D.

20
1.2.4 Using first-order (predicate) languages

It is important to be able to translate a statement from first-order language into natural


language (English, etc.) when trying to understand new mathematical concepts. It is just
as important to be able to rewrite predicates given in natural language in first-order lan-
guage.

Example 1.14
Rewrite the following formulas in natural language:

a) (∃x ∈ R)(x = x3 )
“There is a real number which equals its cube.” (True, take x = 0, x = 1.)

b) (∀x ∈ R)(x2 6= −1)


“All real numbers have squares not equal to −1.”
OR “No real numbers have squares equal to −1.” (True, the square of any real num-
ber is greater than or equal to 0.)

c) (∀x ∈ R)(x < 0 → x3 < 0)


“All real numbers that are negative, have negative cubes.”
“Every negative number has a negative cube.” (True. Why?)

Example 1.15
Translate the following statements from English into first-order language:

a) “There is an integer greater than 2 and less than 3.”


(∃x ∈ Z)(x > 2 ∧ x < 3)

b) “No dogs have wings.”


(∀x ∈ D)(¬W (x)) where D denotes the set of all dogs and W (x) is the predicate “x
has wings”.

c) “Every computer science student is an engineering student.”


(∀x ∈ S)(C(x) → E(x)) where S denotes the set of all students, C(x) is “x is a
computer student” and E(x) is “x is an engineering student”.

21
Note:
Observe that two statements “(∀x ∈ R)(x ∈ Z → x ∈ Q)” and “(∀x ∈ Z)(x ∈ Q)” have
the same meaning. When translated into natural language, both mean “All integers are
rational”.

In fact, a statement of the form

(∀x ∈ U)(P (x) → Q(x))

can always be rewritten in the form

(∀x ∈ D)(Q(x))

by narrowing the universal domain U to the domain D consisting of all values of x that
make P (x) true.

Example 1.16
Consider Example 1.1.15(c): “Every computer science student is an engineering student.”

This expression can be written in first-order language in two ways:


(∀x ∈ S)(C(x) → E(x)) where S denotes the set of all students, C(x) is “x is a computer
student” and E(x) is “x is an engineering student”.
OR (∀x ∈ C)(E(x)) where C denotes the set of all computer science students and E(x) is
“x is an engineering student”.

1.2.5 Negations of quantified statements

Consider the sentence “All mathematicians wear glasses”. One might think that the nega-
tion of this statement is “No mathematicians wear glasses”. But in fact, it is “There is at
least one mathematician who does not wear glasses”, since if there is even one mathemati-
cian who does not wear glasses, it proves that the statement is false.

Definition:
¬(∀x ∈ D)(Q(x)) ≡ (∃x ∈ D)(¬Q(x))

¬(∃x ∈ D)(Q(x)) ≡ (∀x ∈ D)(¬Q(x))

22
Example 1.17
Rewrite the following sentence in first-order language. Then write the negation in first-order
language and in natural language.

“No plants are heavy”.

First-order language: (∀x ∈ P)(¬H(x)),


where P is the set of all plants, and H(x) is the predicate “x is heavy”.
First-order negation: (∃x ∈ P)(¬¬H(x)) ≡ (∃x ∈ P)(H(x))
Natural negation: “At least one plant is heavy”.
OR “Some plants are heavy.”

Recall that in propositional logic, the negation of an implication is a conjunction:

¬(p → q) ≡ p ∧ ¬q.

The same rule applies when negating a quantified conditional statement. Hence

¬(∀x ∈ D)(P (x) → Q(x)) ≡ (∃x ∈ D)(P (x) ∧ ¬Q(x))

and ¬(∃x ∈ D)(P (x) → Q(x)) ≡ (∀x ∈ D)(P (x) ∧ ¬Q(x)).

Example 1.18
Write down the negation of the following universally quantified conditional statement:

(∀x ∈ R)(x2 > 1 → x > 0)

∴ ¬(∀x ∈ R)(x2 > 1 → x > 0)

≡ (∃x ∈ R)(¬(x2 > 1 → x > 0))

≡ (∃x ∈ R)(x2 > 1 ∧ ¬(x > 0))

≡ (∃x ∈ R)(x2 > 1 ∧ x 6 0).

23
1.2 Exercises
1. Determine whether the following statements are true or false. Justify your answer.

a) Every integer is a real number.

b) 0 is a positive real number.

c) For every real number r, −r is a negative real number.

d) Every real number is an integer.

1
2. Let Q(n) be the predicate “n2 6 30”. Write Q(2), Q(−2), Q(7) and Q( ) and
2
determine which of these statements are false and which are true.

3. Find counterexamples to show that the following propositions are false:


 
1
a) (∀x ∈ R) x >
x
 
a−1
b) (∀a ∈ Z) is not an integer
a

c) (∀m ∈ Z+ )(∀n ∈ Z+ )(mn > m + n)


√ √ √ 
d) (∀x ∈ R)(∀y ∈ R) x+y = x+ y

e) (∀x ∈ R)(∃a ∈ R)(ax = 1)

4. Translate the following first-order formulae into English and determine which of them
represent true propositions.

a) (∀x ∈ R)(x3 > x)

b) (∃x ∈ R)(x2 = 2)

c) (∃x ∈ R)(x ∈ Q) (Q denotes the set of rational numbers)

d) (∀x ∈ R)(x > 0 → x2 > x)

e) (∃x ∈ R)(x = x2 ∧ x < 0)

f) ¬(∀x ∈ R)(x 6= 0)

g) (∃x ∈ R)(x + 2 = x)

h) (∃a ∈ R)(∀x ∈ R)(ax = x)

24
5. Formalize the following sentences in first-order language.

a) Every square of an integer is greater than 0.

b) There is at least one real number whose cube is 6.

c) Some real numbers are not integers.

d) The cube of any real number is greater than or equal to its square.

6. Negate the following statements and give your answer in natural language:

a) All dogs are loyal.

b) Some mathematics students are athletic.

c) Every integer is divisible by a prime number.

d) There exists an integer whose cube equals itself.

7. Write down the negation of the following propositions in first-order language. Simplify.

a) (∀x ∈ R)(2x > 0)

b) (∃x ∈ R)(x < 0 ∧ x = x2 )

c) (∀x ∈ R)(x = x2 → x > 0)

d) (∃x ∈ R)(x 6= 0 → x2 > 0)

e) (∀x ∈ R)(x2 + x > 0 → x > 0 ∨ x < −1)

25
2 METHODS OF PROOF AND INDUCTION
2.1 Methods of proof

In a mathematical field such as Calculus we encounter numerous theorems, statements which


have been proven to be true. Once proven, we take these theorems to be universally true
and we apply them to solve problems and calculate results.

There are a number of ways to prove these theorems and in this section we consider a few
of these methods.

2.1.1 Direct proof

Most mathematical theorems are stated as implications: “A → B”; a hypothesis (A) is


given which implies the conclusion (B).

For example

“If x and y are positive numbers, then the product xy is positive ”


| {z } | {z }
hypothesis conclusion

Sometimes it is possible to prove such a statement directly, i.e. by assuming that the
hypothesis A is true and showing that the conclusion B is true by means of establishing the
truth of a sequence of implications

A → A1 → A2 → . . . → B.

Many of the proofs we will encounter are direct proofs.

Example 2.1
Suppose that x and y are real numbers such that 2x + y = 1 and x − y = −4. Prove that
x = −1 and y = 3.

Proof
y =x+4 (Make y the subject of the equation x − y = −4.)
∴ 2x + (x + 4) = 1. (Substitute y = x + 4 into 2x + y = 1.)
∴ x = −1. (Solve for x.)
∴ y = 3. (Substitute x = −1 into x − y = −4.)
∴ x = −1, y = 3. 

26
Example 2.2
Prove that the sum of two even integers is even.

Proof
Let x be an even number, ∴ x = 2a where a is an integer.
Let y be an even number, ∴ y = 2b where b is an integer.
Then
x + y = 2a + 2b
= 2(a + b) where a + b is an integer
∴ x + y is even. 

2.1.2 Proof by cases

Sometimes a direct argument is simplified by dividing it into a number of cases. Each of


these cases must then lead to the desired conclusion.

Example 2.3
Use proof by cases to prove that for any integer n, n2 + n is even.

Proof
Every integer is either even or odd.
Consider two cases.

Case 1: Let n be even.


∴ n = 2a, where a is an integer.
Then
n2 + n = (2a)2 + 2a
= 4a2 + 2a
= 2(2a2 + a) where 2a2 + a is an integer

∴ n2 + n is even.

Case 2: Let n be odd.


∴ n = 2a + 1, where a is an integer.
Then
n2 + n = (2a + 1)2 + (2a + 1)
= 4a2 + 4a + 1 + 2a + 1
= 4a2 + 6a + 2
= 2(2a2 + 3a + 1) where 2a2 + 3a + 1 is an integer

∴ n2 + n is even. 

27
Example 2.4
Let n be an integer. Prove that 9n2 + 3n − 2 is even.

Proof
We have 9n2 + 3n − 2 = (3n + 2)(3n − 1), where 3n + 2 and 3n − 1 are two integers.
Case 1: (3n + 2) is even.
If 3n + 2 is even, there exists p ∈ Z such that 3n + 2 = 2p.
Hence 9n2 + 3n − 2 = 2p(3n − 1) = 2(3np − p).
Since 3np − p ∈ Z we have that 9n2 + 3n − 2 is even.

Case 2: (3n + 2) is odd.


Consider the consecutive integers 3n − 1, 3n, 3n + 1, 3n + 2.
If 3n + 2 is odd, then its predecessor, 3n + 1, is even.
If 3n + 1 is even, then its predecessor, 3n, is odd.
If 3n is odd, then the one before that, 3n − 1, is even, i.e. 3n − 1 = 2q where q ∈ Z.
∴ 9n2 + 3n − 2 = (3n + 2)2q = 2(3nq + 2q) so it is even. 

2.1.3 Proof by contradiction

In some cases a direct proof of a statement A is very difficult—we do not know how to
begin. In such a case, one approach is to assume that the conclusion is false, i.e. ¬A is
true. If this assumption leads to a statement which is clearly not true, or to a statement
which contradicts known truths, then we will have shown that ¬A is false. Hence, by the
principle of double negation, A must be true.

Example 2.5
Prove that for all real numbers x, x2 − 4x + 17 6= 0.

Proof
We have to prove A: For all real x, x2 − 4x + 17 6= 0.
Suppose A is false.
∴ x2 − 4x + 17 = 0 for some real number x.
Let x2 − 4x = −17 and complete the square:
∴ x2 − 4x + (−2)2 = −17 + (−2)2

28
∴ x2 − 4x + 4 = −17 + 4

∴ (x − 2)2 = −13
But this is a contradiction, since the square of this real number, x − 2, is now negative, and
we know that the square of any real number is greater than or equal to 0.
Hence our assumption that A is false is wrong.
Hence A is true.
Hence x2 − 4x + 17 6= 0. 

Example 2.6
Suppose that x is a non-zero rational number and y is an irrational number. Prove that xy
is irrational.

Proof:
We need to prove the implication A → B where
A : “x is non-zero rational, y is irrational”.
B : “xy is irrational”.

Suppose this implication is false. (Recall that A → B is false only when A is true and B is
false.)
∴ There are numbers x and y such that x is non-zero rational, y is irrational and xy is
rational.
k
∴ x = ` for integers k and `, ` 6= 0 (because x is rational). Note that k 6= 0 since x is
non-zero.
m
We are assuming xy is rational so therefore xy = n where n 6= 0.
m
∴y= n ÷x
m k
∴y= n ÷ `
m `
∴y= n × k
m`
∴y= nk , and n 6= 0, k 6= 0.
From this we can conclude that y is a rational number. (It can be written as a quotient of
integers with the denominator non-zero.) But this contradicts the fact that y is given as
irrational.
Hence our assumption that A → B is false, is wrong.
Therefore A → B is true and xy is irrational. 

29
2.1.4 Proof by contraposition

Recall from propositional logic that an implication A → B is logically equivalent to its


contrapositive ¬B → ¬A. This means that we can prove a theorem by proving that its
contrapositive is true.

Example 2.7
Let x be an integer and prove that if x2 is even, then x is even.

Proof
In order to prove the implication “x2 even → x even”, we are going to prove the contrapos-
itive, “¬(x even) → ¬(x2 even)”, which is “x odd → x2 odd”.

Let x be odd. If x is odd, it can be written as x = 2m + 1, where m is some integer. Hence

x2 = (2m + 1)2

= 4m2 + 4m + 1

= 2(2m2 + 2m) + 1.

Since m ∈ Z we have that 2m2 + 2m ∈ Z. Hence x2 is of the form 2p + 1 with p ∈ Z so x2


is odd.
Since we have shown that “x odd → x2 odd”, it holds that “x2 even → x even”. 

Example 2.8
Prove the statement by proving that its contrapositive is true: “If m2 + n2 6= 0, then m 6= 0
or n 6= 0.”

Proof
Write down the contrapositive:
“If m = 0 and n = 0, then m2 + n2 = 0.”

Let m = 0 and n = 0.
Then
m2 + n2 = 0 + 0
= 0

Hence the contrapositive is true.


Therefore the original statement is also true. 

30
2.1.5 Disproof by counterexample

Consider the statement “All 2020 first-year UJ students were born before 1 January 2003”.
This statement is either true or false. To prove that it is true we would need to check
the date of birth of every first-year student. However, to show that it is false, we would
just need to find one 2020 first-year student born in 2003 or later. If we could find such a
student, they would be a counterexample that would disprove the statement above.

Finding a counterexample is a common technique in mathematics to disprove a universally


quantified statement. For a mathematical example, consider the statement “Every integer
is greater than or equal to −100”. We can show that this statement is false (i.e. we can
disprove the statement) by using −101 as a counterexample. In this case there are many
other counterexamples that we could have used (−102, −103 etc.) but we need just one to
show that the statement is not true for all integers.

Consider the proposition “For every non-zero integer c, there exist non-zero integers a and
b such that a2 + b2 = c2 ”. This is false, since it is not true for c = 2: There are no integers
a and b such that a2 + b2 = 4. Thus c = 2 is a counterexample.

Note:
One can effectively disprove a universally quantified statement with a counterexample, but
one cannot prove a theorem with an example. The fact that it holds for one example does
not mean it holds universally. For example, the fact that 32 + 42 = 25 = 52 does not prove
the proposition above.

Example 2.9
Disprove the following statement by providing a counterexample which makes it false: “For
every integer n > 1, if n is odd, then n2 + 4 is a prime number.”

Proof
Counterexample: Take n = 9. Then n2 + 4 = (9)2 + 4 = 85.

But 85 is not a prime number as it has divisors 1, 5, 17, 85.


Hence n = 9 is a counterexample which shows that the statement is false. 

31
2.1 Exercises
Use the method of direct proof unless a different method is suggested:

1. Prove that for all integers x, if x is even, then x2 is even.

2. Prove that the sum of two odd integers is always even.

3. Find a proof or give a counterexample to each of the following statements.

1
a) If a is an even integer, then a is an even integer.
2
b) For all real numbers x, there exists a real number y such that xy = 1.

c) 2x2 + 2y 2 > 0 for all real numbers x and y.

4. Use proof by contradiction to show that if a is a rational number and b is an irrational


number, then a + b is irrational.

5. Prove that 2x2 − 4x + 3 > 0 for any real number x.

6. Prove that n2 − n + 5 is odd, for all integers n.

7. Provide a counterexample for the statement: “For each integer n > 1, if n is odd,
then 4n − 1 is a prime number”.

8. Prove that every odd perfect square can be written in the form 4k + 1, where k ∈ Z.

9. Prove that the product of an odd integer and an even integer is always even.

10. Use proof by cases to prove that every perfect square is either a multiple of 4 or is of
the form 4q + 1 for some integer q.

11. Prove that if m and n are both divisible by 3, then m × n is divisible by 9.

12. Use the contrapositive to prove: “If 3n is odd, then n is odd”.

13. Prove that for any rational number r, the number r + 1 is also rational.

14. Provide a counterexample for the statement: “For each n > 1 and m > 1, if m is odd
and n is even, then m + n is divisible by 3”.

15. Prove that for all integers n > 4, if n is a perfect square, then n − 1 is not prime.

16. Use proof by contradiction to show that for all x ∈ [0, π/2] we have sin x + cos x > 1.

32
2.2 Mathematical Induction
Mathematical induction is a method of proof which can be used to show that certain propo-
sitions are true for all positive integers n. The method is based on the following principle.

Principle of Induction: Let S be a set of positive integers. If

1) a ∈ S

2) k ∈ S → k + 1 ∈ S,

then S contains every integer greater than or equal to a.

We can think of the principle of induction as a kind of “domino theory”. If the first domino
falls, and if each domino that falls causes the next one to fall, then according to the principle
of induction, every domino will fall (see this video of dominoes).

Example 2.10
Use mathematical induction to prove that

n(n + 1)
1 + 2 + 3 + ... + n =
2

for all integers n > 1.

Proof:
n(n + 1)
Let S be the set of positive integers n for which 1 + 2 + 3 + ... + n = .
2

1) Show that 1 ∈ S:

1(1 + 1)
LHS = 1 RHS = =1
2

∴ LHS = RHS
∴ 1 ∈ S.

k(k + 1)
2) Assume that k ∈ S. That is, 1 + 2 + 3 + . . . + k = .
2
Now we verify that the equation holds for the case where n = k + 1, that is, we will
show that:
(k + 1)(k + 1 + 1)
1 + 2 + 3 + . . . + k + (k + 1) =
2

33
Consider the left-hand side of the above equation:

+ . . . + k} +(k + 1)
LHS = 1| + 2 + 3{z

k(k + 1)
= + (k + 1) by the inductive hypothesis
2

k(k + 1) + 2(k + 1)
=
2

k 2 + k + 2k + 2
=
2

k 2 + 3k + 2
=
2

(k + 1)(k + 2)
=
2

(k + 1)((k + 1) + 1)
= = RHS
2

∴ k+1∈S

∴ It holds for all positive integers n. 

Example 2.11
Use mathematical induction to establish the truth of the following statement for n > 0:

n
X
2i = 2n+1 − 1
i=0

OR 1 + 2 + 22 + 23 + . . . + 2n = 2n+1 − 1.

Proof:
n
X
Let S be the set of integers n > 0 for which 2i = 2n+1 − 1.
i=0

1) Show that 0 ∈ S:

34
LHS = 20 = 1 RHS = 20+1 − 1 = 2 − 1 = 1

∴0∈S

k
X
2) Assume that k ∈ S. So we are assuming that 2i = 2k+1 − 1,
i=0

OR 1 + 2 + 22 + 23 + . . . + 2k = 2k+1 − 1.
k+1
X
Show that k + 1 ∈ S : 2i = 2k+1+1 − 1
i=0

k+1
X
LHS = 2i
i=0

= 1| + 2 + 22{z+ . . . + 2k} +2k+1

= 2k+1 − 1 + 2k+1

= 2.2k+1 − 1

= 2k+1+1 − 1
= RHS

∴ k+1∈S
∴ It holds for all n > 0. 

Example 2.12
Use mathematical induction to show that 4n − 1 is divisible by 3 for all n > 0 (n ∈ Z).

Proof: Let S be the set of positive integers n for which 4n − 1 is divisible by 3.

1) Show that 0 ∈ S. If n = 0 then 40 − 1 = 1 − 1 = 0. Now 0|3 since 0 = 3(0). So 0 ∈ S.

2) Assume that k ∈ S. Now consider 4k+1 − 1 = 4(4k ) − 1. Since k ∈ S, we know


that 4k − 1 is divisible by 3. That is, there exists m ∈ Z such that 4k − 1 = 3m, so
4k = 3m + 1. Therefore

4k+1 − 1 = 4(4k ) − 1 = 4(3m + 1) − 1 = 12m + 4 − 1 = 12m + 3 = 3(4m + 1).

Since m ∈ Z, we have 4m + 1 ∈ Z and so 3|(4k+1 − 1). Hence k + 1 ∈ S and so the


statement holds for all integers n > 1.

35
2.2 Exercises
Use mathematical induction to prove the following.

(1.) 2 + 4 + 6 + . . . + 2n = n2 + n, for n > 1.

(2.) 1 + 3 + 5 + . . . + (2n − 1) = n2 , for n > 1.

1 1 1 1 n
(3.) + + + ... + = , for n > 1.
1.2 2.3 3.4 n(n + 1) n+1

4(4n − 16)
(4.) 43 + 44 + 45 + . . . + 4n = , for n > 3.
3
n
X n2 (n + 1)2
(5.) i3 = , for n > 1.
4
i=1

n−1
X n(n − 1)(n + 1)
(6.) i(i + 1) = , for n > 2.
3
i=1

n+1
X
(7.) i.2i = n.2n+2 + 2, for n > 0.
i=1

(8.) n5 − n is divisible by 5 for n > 1.

(9.) n3 − n is divisible by 6 for all n ∈ Z+ . (Hint: you will need to use Example 2.3 at some
point in your proof.)

References
[1] D.R. Behrendt, E. Raubenheimer, Introductory Discrete Mathematics - Study notes,
2005.

[2] W.E. Conradie, V.F. Goranko, WIS3A20 Discrete Mathematics Lecture Notes: Logic,
Combinatorics and Graph Theory, 2010.

[3] S.S. Epp, Discrete Mathematics with Applications, Third Edition, Thomson
Brooks/Cole, 2004.

[4] E.G. Goodaire and M.M. Parmenter, Discrete Mathematics with Graph Theory, Pren-
tice Hall, 1998.

36

You might also like