Sei sulla pagina 1di 37

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 elds,
specically in computer science in areas such as digital logic circuit design, database theory
and articial 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 rst-order) logic. This builds on propositional logic
by using constants and variables, functions and predicates over objects, as well as
quantiers. First-order logic is sucient to express any mathematical statement.
The purpose of these notes is to give you an introductory background of the basic concepts
of classical logic, by introducing the formal languages of propositional and rst-order logic
and discussing the concepts of truth, validity and logical consequence.
1.1 Propositional Logic
1.1.1 Propositions
Denition: 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.
The following sentences are not propositions:
Are you tired? (Not a statement)
1
She is a college student. (We dont know who she is)
x is a rational number. (We dont know 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 makes 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 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, from the primitive propositions 2 is a prime number and The sun is hot
we can form more complex propositions such as
It is not the case that 2 is a prime number.
2 is a prime number and the sun is hot.
If the sun is hot, then 2 is a prime number.
The sun is hot if and only if 2 is a prime number.
For a more involved example, we can use the propositions;
John is healthy, John is wealthy and John is wise to compose the following compound
proposition:
2
John is not wealthy or if he is healthy then he 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 and q or not 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 is true if and only if the proposition p is false, i.e. it has the
opposite 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 if and only if 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
p q p q
T T T
T F F
F T F
F F F
3
The proposition p q (p or q) is true if and only if either of p or q (possibly both) is
true. It is false only 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 shall win or I shall
die, 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 if and only if 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
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 requires nothing
regarding the truth of q. One can think of an implication as a promise.
Consider the following example: Thabos father tells him: If you pass your Math exam,
then I will buy you a motorbike. Under what circumstances will Thabos father have
spoken falsely?
4
Answer: If Thabo passed his maths exam and his father does not buy him a motorbike.
After all, Thabos father promise only says he will buy the motorbike if he passes the exam,
it says nothing about what will happen if Thabo doesnt pass the exam. He can buy a
motorbike even if Thabo doesnt pass the exam. Hence the statement can be true even if
the antecedent is false.
The implication p q can be expressed in many dierent 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 if and only if p and q have the same
truth values.
The truth table for biconditional is
p q p q
T T T
T F F
F T F
F F T
Note:
It is common to abbreviate if and only if with i.
1.1.4 Computing truth values of propositions
The truth value of a compound proposition only depends on the truth values of the primitive
propositions. So to check the truth 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.
5
Example 1.1
Suppose we know that
Mary is clever is true,
Mary is lazy is false,
Mary likes mathematics is true.
Then we can determine the truth value of the compound proposition
Mary is not clever or if she likes mathematics, then she is clever and not lazy.
We rst have to analyze the structure of the proposition. Let us make use of parentheses
to rewrite the sentence.
(Mary 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.
Let A = Mary is clever,
B = Mary is lazy,
C = Mary likes mathematics.
Then it can be rewritten as
(A) (C (A B)).
Now replace A, B and C 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)
6
1.1.5 Truth tables
When constructing truth tables, we need to consider all the possible combinations for the
primitive propositions. If a compound proposition contains two primitive propositions, then
there are 2 2 = 4 possible combinations, since each proposition can take one of two truth
values, T or F. Similarly, if a compound proposition contains three primitives, there are
2 2 2 = 2
3
= 8 possible combinations of truth values. Hence, in general, if a compound
proposition contains n primitive propositions, then there are 2
n
possible combinations.
One can simplify truth tables by successively calculating the truth values of all the occur-
ring subformulae, 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 compound proposition (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.
7
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.
1.1.6 Tautologies and contradictions
Denition: A tautology is a propositional formula that obtains a truth value true for
any assignment of truth values to the variables, i.e. it is a compound proposition that is
always true.
Tautologies are also called logically valid formulae.
Example 1.4
Show that the compound propositions p p and (p (p q)) q are tautologies.
p p p p
T F T
F T T

All Ts
8
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

All Ts
The opposite concept of a tautology is a contradictory formula.
Denition: A contradiction is a propositional formula that obtains a truth value false
for any assignment of truth values, i.e. it is a compound proposition 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

All Fs
Hence p p is a contradiction.
1.1.7 Logical equivalence
Denition: Propositional formulae A and B are logically equivalent if for every assign-
ment of truth values to the variables in them they obtain identical truth values.
We will write A B to indicate that A and B are logically equivalent.
We can determine whether or not two propositions 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.
9
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
(p q) p q
and (p q) p q
are called De Morgans laws, after the British mathematician Augustus De Morgan, who
was the rst 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 which will be used further
1. Commutative laws: p q q p p q q p
2. Associative laws: (p q) r p (q r) (p q) r p (q r)
3. Distributive laws: p (q r) (p q) (p r) p (q r) (p q) (p r)
4. Identity laws: p t p p f p
5. Negation laws: p p t p p f
6. Double negative law: (p) p
7. Idempotent laws: p p p p p p
8. Universal bound laws: p t t p f f
9. De Morgans laws: (p q) p q (p q) p q
10. Absorption laws: p (p q) p p (p q) p
Note:
Propositional formulae p and q are logically equivalent if and only if the propositional for-
mula p q is a tautology.
We can use the following logical equivalence to rewrite a conditional proposition as an or
proposition:
p q p q
Therefore the negation of a conditional proposition is an and proposition, and not a con-
10
ditional proposition:
(p q) p q
Example 1.7
Use the logical equivalence above to rewrite the following statement in if-then form.
Either you get to work on time or you are red.
Let p = You get to work on time,
q = You are red.
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 red.
Example 1.8
Write the negation of the following statement.
If Jackie lives in George, then she lives in South Africa.
Since the negation of p q is p q, the negation of the above statement is
Jackie lives in George and she does not live in South Africa.
The negation of the biconditional is given by the following logical equivalence:
(p q) (p q) (q p)
1.1.8 Contrapositive, converse, inverse
A very important law of logic is the equivalence between a conditional proposition and its
contrapositive.
Denition: The contrapositive of the implication p q is q p.
Note that a conditional proposition is logically equivalent to its contrapositive. There are
two other variants of an implication that are not logically equivalent to the statement.
11
Denition: Suppose an implication p q is given
q p is the converse of p q
p q is the inverse of p q.
A conditional proposition and its converse are not logically equivalent.
A conditional proposition and its inverse are not logically equivalent.
The converse and inverse of a conditional proposition are logically equivalent to each
other.
Example 1.9
Write down the contrapositive, converse and inverse of the following proposition.
If Mogale can x his bike, then Mogale can win the race.
Contrapositive: If Mogale cannot win the race, then he cannot x his bike.
Converse: If Mogale can win the race then he can x his bike.
Inverse: If Mogale cannot x his bike, then he cannot win the race.
1.1.9 Necessary and sucient conditions
Denition: If p and q are propositions, then
p is a sucient condition for q means p q,
p is a necessary condition for q means q p, or, equivalently, p q.
Consequently, p is a necessary and sucient condition for q means p q.
Example 1.10
Rewrite the following statements in the if-then form.
a) Johns attaining age 18 is sucient for him being eligible to vote.
b) Being divisible by 3 is a necessary condition for a number to be divisible by 9.
12
a) If John 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.10 Logical validity
Logic is not so much concerned with what is true and what is false, but rather with the
correctness of reasoning. An argument is simply a sequence of propositional formulae. All
the propositional formulae, except for the nal one, are called premises. The nal proposi-
tional formula is called the conclusion.
The crucial fact about a valid argument is that the truth of its conclusion follows necessarily
from the truth of its premises. It is impossible to have a valid argument with true premises
and a false conclusion.
When an argument is valid and its premises are true, the truth of the conclusion is said to
be inferred, or deduced, from the truth of the premises.
Testing the validity of an argument:
1. Identify the premises and conclusion of the argument.
2. Construct a truth table.
3. If the truth table contains a row in which all the premises are true but the conclusion
is false, then the argument is invalid. If in every case where all the premises are true,
the conclusion is also true, then the argument is valid.
Example 1.11
Determine whether or not the following argument is valid.
p (q r)
r
p q
Truth table:
13
T T T T F T
T T F T T T
T FT T F T
T FF T T T
FT T T F T
FT F T T T
FFT T F F
FFF F T F
pqrp (q r)rp q v v v
Criticalrows
{
{
In all the critical rows, where all the premises are true, the conclusion is also true.
Argument is valid.
An inference rule is a form of argument that is valid. The most famous inference rule in
logic is modus ponens. It has the following form
A B
A
B
Here is an argument of this form:
If my glasses are not in the kitchen, then I left them in the bedroom.
My glasses are not in the kitchen.
I left them in the bedroom.
You can check the validity of this argument with a truth table.
Now consider another valid argument called modus tollens. It has the following form:
A B
B
A
Here is an example of modus tollens:
If Zeus is human, then Zeus is mortal.
14
Zeus is not mortal.
Zeus is not human.
The following are additional inference rules that are used often in logical reasoning.
Generalization: a) p b) q
p q p q
Specialization: a) p q b) p q
p q
Conjunction: p
q
p q
Elimination: a) p q b) p q
q p
p q
Transitivity: p q
q r
p r
Example 1.12
You are about to leave for school and discover that you dont have your glasses. You know
the following statements are true:
a) If my glasses are on the kitchen table, then I saw them at breakfast.
b) I was reading the newspaper in the living room or in the kitchen.
c) If I was reading the newspaper in the living room, then my glasses are on the coee
table.
d) I did not see my glasses at breakfast.
e) If I was reading the newspaper in the kitchen then my glasses are on the kitchen table.
Where are the glasses?
We use some of the inference rules given above to draw the conclusion:
1. The glasses are not on the kitchen table. (by a), d) and modus tollens).
2. I did not read the newspaper in the kitchen (by e), 1) and modus tollens).
15
3. I read the newspaper in the living room. (by b), 2) and elimination).
4. My glasses are on the coee table. (by c), 3) and modus ponens).
1.1 Exercises
1) Determine whether the following sentences are propositions or not.
a) 2
4
+ 3
2
= 24.
b) 2
4
+ 3
2
= x.
c) n is an even number.
d) Do you love me?
e) Raj got married on January 15
th
, 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.
16
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 a
2
> 0 or a is not a real number.
b) x is a real number and x
2
+ 1 = 0.
c) If Paul 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 Christopher doesnt play tennis, he plays cricket but not soccer.
f) Julia likes gymnastics, or if she enjoys ballet then she doesnt like gymnastics and
likes yoga.
5) Determine the antecedent and the consequent in each of the following implications:
a) If Chris talks, everyone else listens.
b) Chris 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 dierent divisors.
e) My keys are not in the safe only if I can drive my car.
6) Construct truth tables for the following propositional formulae 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:
17
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)
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) The Orlando Pirates will win the championship only if they win tomorrows game.
b) Sam will be allowed on Peters 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) If
a
b
and
b
c
are integers, then
a
c
is an integer.
b) If ABC is a right triangle, then a
2
+b
2
= c
2
.
c) If a = 0, then a = 0 or b = 0.
d) If x
2
= 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 sucient 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 sucient condition for a triangle to be a right triangle.


18
12) Determine whether or not the following arguments are valid:
a) p
p q
q r
r
b) p r
p q
q p
r
c) p r
q r
p q r
d) p q r
q r
p r
e) Catherine is a math major or Catherine is an economics major.
If Catherine is a math major, then she is required to take MAT1A01.
Catherine is an economics major or Catherine is not required to take MAT1A01.
13) Some of the arguments given below are valid, whereas other exhibit the converse
error or inverse error. If the argument is valid, identify the rule of inference applied,
otherwise state whether the converse or inverse error is made.
_
_
Converse error: p q Inverse error: p q
q p
p q
_
_
a) This real number is rational or it is irrational.
This real number is not rational.
This real number is irrational.
19
b) If x > 2, then x
2
> 4.
x 2.
x
2
4.
c) If I go to the movies, I wont nish my homework.
If I dont nish my homework, I wont pass the test tomorrow.
If I go to the movies, I wont pass the test tomorrow.
d) If Julius solved this problem correctly, the he obtained the answer 2.
Julius obtained the answer 2.
Julius solved the problem correctly.
14) Zandile went shopping on Saturday and when she got home she realised she forgot
her purse somewhere. She remember the following facts about her shopping trip. Use
these facts to gure out where Zandile left her purse.
a) If she left her purse in the coee shop, then she didnt pay for the movie.
b) If she went to the bookstore, she left her purse in the bathroom.
c) She left her purse in the coee shop or she went to the bookstore.
d) She paid for the movie.
15) You discover a note describing the whereabouts of a hidden treasure. Use the clues
given to determine where the treasure is.
a) If the house is next to a lake, then the treasure is not in the kitchen.
b) If the tree in the front yard is an oak, then the treasure is in the kitchen.
c) The house is next to a lake.
d) The tree in the front yard is an oak or the treasure is buried under the agpole.
e) If the tree in the front yard is an elm, then the treasure is in the garage.
20
1.2 Basic Concepts of Predicate Logic
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 specied, 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 specied.
We also have to consider the role played by words that denote quantities such as all or
some. The study of quantied statements such as the ones above is called predicate logic,
or rst-order logic.
1.2.1 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.
Denition: A predicate is a sentence that contains a nite number of variables and
becomes a proposition when the variables are replaced by specic values. The domain of
a predicate variable is the set of values that may be substituted in place of the variable.
For example, in the sentence above, let P stand for is a student at UJ. P is called a
predicate symbol. Then the sentence x is a student at UJ can be symbolized as the pred-
icate 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 stands for is
a student at. Then the sentence x is a student at y can be represented by the predicate
Q(x, y).
Example 1.13
Let P(x) be the predicate x
2
> x with domain the set R of all real numbers. Write
P(2), P
_
1
3
_
and P
_

1
3
_
and indicate whether each statement is true of false.
21
P(2) : 2
2
> 2, or 4 > 2. True
P
_
1
3
_
:
_
1
3
_
2
>
1
3
, or
1
9
>
1
3
False
P
_

1
3
_
:
_

1
3
_
2
>
1
3
, or
1
9
>
1
3
True
1.2.2 Quantiers
One way to change predicates into propositions is to assign specic values to all the vari-
ables. Another way to obtain propositions from predicates is to add quantiers. Quantiers
are words that refer to quantities such as some or all, they tell us for how many elements
a given predicate is true.
The symbol denotes for all or for every and is called the universal quantier. 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 proposition 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.
Example 1.14
Determine the truth value of the following universally quantied statements:
a) x R(x
2
= 1)
b) x D(x
2
x), where D = {1, 2, 3, 4, 5}
a) x R(x
2
= 1)
This statement says that the square of every number is 1. To show that it is false, we
22
have to nd at least one real number whose square is not 1. Counterexample: take
x = 2, then x
2
= 2
2
= 4, which is not equal to 1.
Hence the statement is false.
b) x D(x
2
x), if 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 x
2
x is true for every x in D.
1
2
1 - True
2
2
2 - True
3
2
3 - True
4
2
4 - True
5
2
5 - True.
Hence the statement is true.
The other quantier is called the existential quantier, denoted by the symbol , which
denotes there exists of for some. For example, we can rewrite the sentence
There is a student who takes MAT1A01
in formal language as
x S(M(x))
where S is the set of all students, and M(x) is the predicate x takes MAT1A01.
The proposition 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.
1.2.3 Using rst-order (predicate) languages
It is important to be able to translate a statement from rst-order language to natural lan-
guage (English, etc.) when trying to understand new mathematical concepts. It is just as
important to be able to rewrite predicates given in natural language to rst order language.
23
Example 1.15
Rewrite the following formulae in natural language:
a) x R(x = x
3
)
There is a real number which equals its cube. (True, take x = 0).
b) x R(x
2
= 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 number is
0)
c) x R(x < 0 x
3
< 0)
All real numbers that are negative, have negative cubes.
Every negative number has a negative cube. (True)
Example 1.16
Translate the following statements from English into rst-order language:
a) There is an integer greater than 2 and less than 3
x Z(x > 2 x < 3) (False)
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.
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 means All integers are
rational.
24
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.17
a) Translate the following conditional statement into rst-order language and rewrite it
into two ways.
All squares are rectangles.
x(S(x) R(x))
where S(x) = x is a square
and R(x) = x is a rectangle
x S, R(x)
where S denotes the set of all squares.
b) Translate the following existential statement into rst-order language by writing it
into two ways.
There is an integer which is both prime and even.
x Z(P(x) E(x))
where P(x) = x is prime
and E(x) = x is even
x P(E(x)), where P is the set of primes
OR x E(P(x)), where E is the set of even numbers.
25
1.2.4 Negations of quantied 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 Some mathe-
maticians do not wear glasses, since if there is even one mathematician who does not wear
glasses, it proves that the statement that all mathematicians wear glasses is false.
Denition: The negation of a universally quantied statement
x D, Q(x)
is logically equivalent to a statement of the form
x D(Q(x)).
The negation of an existentially quantied statement
x D(Q(x))
is logically equivalent to a statement of the form
x D(Q(x))
Example 1.18
Rewrite the following sentence in rst-order language. Then write negations in rst-order
language and in natural language.
No politicians are honest.
First-order language: x P(H(x))
First-order negation: x P(H(x))
Natural negation: Some politicians are honest.
Recall that in propositional logic, the negation of an implication is a conjunction:
(p q) p q.
The same rule applies when negating a quantied conditional statement. Hence
(x(P(x) Q(x)) x(P(x) Q(x))
26
and (x(P(x) Q(x))) x(P(x) Q(x))
Example 1.19
Write down the negation of the following universally quantied conditional statement:
x R(x
2
> 1 x > 0)
(x R(x
2
> 1 x > 0))
x R((x
2
> 1 x > 0))
x R(x
2
> 1 (x > 0))
x R(x
2
> 1 x 0)
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.
2) Let Q(n) be the predicate n
2
30. Write Q(2), Q(2), Q(7) and Q(
1
2
) and
determine which of these statements are false and which are true.
3) Find counterexamples to show that the following propositions are false:
a) x R
_
x >
1
x
_
b) a Z
_
a 1
a
is not an integer
_
c) m Z
+
n Z
+
(mn m+n)
d) x Ry R
_

x +y =

x +

y
_
4) Translate the following rst-order fomulae into English and determine which of them
represent true propositions if the domain is the set of real numbers, R.
27
a) x(x
3
x)
b) x(x
2
= 2)
c) x(x Q) (Q denotes the set of rational numbers)
d) x(x > 0 x
2
> x)
e) x(x = x
2
x < 0)
f) x(x = 0)
g) x(x + 2 = x)
5) Use the predicate I(x) for x is an integer and formalize the following sentences in
rst-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 rst-order language where
the domain is R. Simplify.
a) x(2
x
> 0)
b) x(x < 0 x = x
2
)
c) x(x = x
2
x > 0)
d) x(x = 0 x
2
> 0)
e) x(x
2
+x > 0 x > 0 x < 1)
28
2. METHODS OF PROOF, INDUCTION
2.1 Methods of proof
In a mathematical eld 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,
. .
hypothesis
then xy is positive
. .
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 A
1
A
2
. . . B.
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.
Many of the proofs we will encounter are direct proofs.
29
2.1.2 Proof by cases
Sometimes a direct argument is simplied by dividing it into a number of cases. Each of
these cases must then lead to the wanted conclusion.
Example 2.2
Let n be an integer. Prove that 9n
2
+ 3n 2 is even.
Proof
9n
2
+ 3n 2 = (3n + 2)(3n 1), 3n + 2 and 3n 1 are two integers.
Case 1: (3n + 2) is even.
If 3n +2 is even, then 9n
2
+3n 2 is even. (It is the product of two integers, where one of
them, 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.
9n
2
+3n2 is even. (It is the product of two integers where one of them, 3n1, is even.)
2.1.3 Proof by contradiction
In some cases a direct proof of a statement A is very dicult - 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.3
Prove that for all real numbers x, x
2
4x + 17 = 0.
Proof
We have to prove A: For all real x, x
2
4x + 17 = 0.
Suppose A is false.
x
2
4x + 17 = 0 for some real number x.
Let x
2
4x = 17 and complete the square:
30
x
2
4x + (2)
2
= 17 + (2)
2
x
2
4x + 4 = 17 + 4
(x 2)
2
= 13
But this is a contradiction, since the square of this real number, x2, 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 x
2
4x + 17 = 0
Example 2.4
Suppose that x is a nonzero rational number and y is an irrational number. Prove that xy
is irrational.
Proof:
We need to prove that implication A B where
A : x is nonzero 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 rational, y is irrational and xy is rational.
x =
k

for integers k and , = 0. (x is rational.)


xy =
m
n
where n = 0. (We assume xy is rational.)
y =
m
n
x
y =
m
n

k

y =
m
n


k
y =
m
nk
, and n = 0, k = 0.
y is a rational number. (It can be written as a fraction.)
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.
31
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.5
Let x be an integer and prove that if x
2
is even, then x is even.
Proof
In order to prove the implication x
2
even x even, we are going to prove the contrapos-
itive, (x even) (x
2
even), which is x odd x
2
odd.
Let x be odd. If x is odd, it can be written as x = 2m+1, where m is some integer. Hence
x
2
= (2m+ 1)
2
= 4m
2
+ 4m+ 1
Since 4m
2
and 4m is even, their sum 4m
2
+ 4m will also be even.
This means that 4m
2
+ 4m+ 1 is odd, which proves that x
2
is odd.
Since we have shown that x odd x
2
odd, it holds that x
2
even x even.
2.1.5 Disproof by counterexample
One is often asked whether a given statement is true or false, or to prove or disprove a
statement. A foolproof way to prove that something is false is to provide a specic example
which shows that it cannot be true. Such an example used to disprove a statement is a
counterexample.
The assertion All trigonometric functions are continuous is false, since, for example, the
tangent function is a trigonometric function which is not continuous. Thus tan is a coun-
terexample to the assertion.
Consider the proposition For every nonzero integer c, there exist nonzero integers a and b
such that a
2
+b
2
= c
2
. This is false, since it is not true for c = 2: There are no integers a
and b such that a
2
+b
2
= 4. Thus c = 2 is a counterexample.
Note:
32
One can eectively disprove a 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 the trig function sin is continuous, does not prove
the assertion All trigonometric functions are continuous.
2.1 Exercises
1) Provide a direct proof that n
2
n + 5 is odd, for all integers n.
2) Find a proof or give a counterexample to each of the following statements.
a) If a is an even integer, then
1
2
a is an even integer.
b) For all real numbers x, there exists a real number y such that xy = 1.
c) 2x
2
+ 2y
2
> 0 for all real numbers x and y.
3) Use proof by contradiction to show that if a is a rational number and b is an irrational
number, then a +b is irrational.
4) Prove that 2x
2
4x + 3 > 0 for any real number x.
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 a domino theory. If the rst
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.
33
Example 2.6
Use mathematical induction to prove that
1 + 2 + 3 +. . . +n =
n(n + 1)
2
for all integers n 1.
Proof:
Let S be the set of positive integers n for which
1 + 2 + 3 +. . . +n =
n(n + 1)
2
.
1) Show that 1 S:
LHS = 1 RHS =
1(1 + 1)
2
= 1
LHS = RHS
1 S.
2) Assume that k S:
1 + 2 + 3 +. . . +k =
k(k + 1)
2
Now we verify that the equation holds for the case where n = k +1, that is, we show
that:
1 + 2 + 3 +. . . +k + (k + 1) =
(k + 1)(k + 1 + +1)
2
Consider the left-hand side of the above equation:
LHS = 1 + 2 + 3 +. . . + k
. .
+(k + 1)
=
k(k + 1)
2
+ (k + 1) by the inductive hypothesis
34
=
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)
2
= RHS
k + 1 S
It holds for all positive integers n.
Example 2.7
Use mathematical induction to establish the truth of the following statement for n 0:
n

i=0
2
i
= 2
n+1
1
OR 1 + 2 + 2
2
+ 2
3
+. . . + 2
n
= 2
n+1
1.
Proof:
Let S be the set of integers n 0 for which
n

i=0
2
i
= 2
n+1
1
1) Show that 0 S:
LHS = 2
0
RHS = 2
0+1
1
= 1 = 2 1
= 1
35
0 S
2) Assume that k S. So we are assuming that:
k

i=0
2
i
= 2
k+1
1
OR 1 + 2 + 2
2
+ 2
3
+. . . + 2
k
= 2
k+1
1
Show that k + 1 S :
k+1

i=0
2
i
= 2
k+1+1
1
LHS =
k+1

i=0
2
i
= 1 + 2 + 2
2
+. . . + 2
k
. .
+2
k+1
= 2
k+1
1 + 2
k+1
= 2.2
k+1
1
= 2
k+1+1
1
= 2
k+2
1
= RHS
k + 1 S
It holds for all n 0.
2.2 Exercises
Use mathematical induction to prove the following.
1) 2 + 4 + 6 +. . . + 2n = n
2
+n, for n 1.
2) 1 + 3 + 5 +. . . + (2n 1) = n
2
, for n 1.
36
3)
1
1.2
+
1
2.3
+
1
3.4
+. . . +
1
n(n + 1)
=
n
n + 1
, for n 1.
4) 4
3
+ 4
4
+ 4
5
+. . . + 4
n
=
4(4
n
16)
3
, for n 3.
5)
n

i=1
i
3
=
n
2
(n + 1)
2
4
, for n 1.
6)
n1

i=1
i(i + 1) =
n(n 1)(n + 1)
3
, for n 2.
7)
n+1

i=1
i.2
i
= n.2
n+2
+ 2, for n 0.
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.
37

Potrebbero piacerti anche