Intro to Logic and Proofs - UHnleger/3325_lecture_notes_blank.pdf · Intro to Logic and Proofs...
Transcript of Intro to Logic and Proofs - UHnleger/3325_lecture_notes_blank.pdf · Intro to Logic and Proofs...
Intro to Logic and Proofs
Propositions
A proposition is a declarative sentence (that
is, a sentence that declares a fact) that is
either true or false, but not both.
Examples:
• It is raining today.
• Washington D.C. is the capital of the
United States
• Houston is the capital of Texas.
• 1 + 1 = 2.
1
Some sentences are not propositions (that
is, no truth value can be assigned).
Examples:
• What time is it?
• Read this carefully.
• x + 1 = 2.
• x + y = z.
2
Truth Values and Propositional Vari-
ables
To each proposition a truth value is as-
signed: T for true and F for false.
We will often use propositional variables
(most commonly: p, q, r, s, . . .) to repre-
sent a proposition, especially when forming
compound propositions.
3
Compound Propositions
Examples:
• It is not raining today. (¬p)
• Today’s temperature is 72 degrees, and
the humidity is 50%. (p ∧ q)
• Washington D.C. is the capital of the
United States, or Houston is the capital
of Texas. (p ∨ q)
• If it is raining today, then it is cloudy
today. (p→ q)
• It is raining today if and only if it is
cloudy. (p↔ q)
4
Logical Connectives
1. negation (¬)
2. conjunction (∧)
3. disjunction (∨)
4. conditional (→)
5. biconditional (↔)
5
1. Negation (¬p)
The negation of a proposition p, denoted
by ¬p, and read “not p”, is the statement
¬p : “It is not the case that” p
The truth value of the negation of p is the
opposite of the truth value of p.
6
2. Conjunction (p ∧ q)
The conjunction of two propositions p and
q, denoted by p ∧ q, is the statement
p ∧ q : p “and” q
The conjunction p ∧ q is true when both p
and q are true, and is false otherwise.
7
3. Disjunction (p ∨ q)
The disjunction of two propositions p and
q, denoted by p ∨ q, is the statement
p ∨ q : p “or” q
The disjunction p ∨ q is false when both p
and q are false, and is true otherwise.
8
3. Disjunction (p ∨ q)
The logical connective ∨ is called inclusive
or. This means if p and q are both true,
then p ∨ q is true.
Note that the word “or” sometimes means
exclusive or, denoted ⊕.
Example: “Soup or salad comes with an
entree.”
9
4. Conditional Statement (p→ q)
The conditional statement p → q, is the
proposition
p→ q : “If” p, “then” q
The conditional statement p → q is false
when p is true and q is false, and true oth-
erwise.
p is called the hypothesis (or antecedent or
premise) and q is called the conclusion (or
consequence).
10
4. Conditional Statement (p→ q)
Note: There are many ways to express the
conditional statement p→ q. Here are sev-
eral common forms:
“if p, then q”
“if p, q”
“p is sufficient for q”
“a sufficient condition for q is p”
“q is necessary for p”
“a necessary condition for p is q”
“p implies q”
“p only if q”
“q if p”
“q when p”
“q whenever p”
“q follows from p”
11
5. Biconditional Statement (↔)
The biconditional statement p↔ q, is the
proposition
p↔ q : p “if and only if” q
The conditional statement p ↔ q is true
when p and q have the same truth values,
and is false otherwise.
12
5. Biconditional Statement (↔)
Common ways to express p↔ q in English:
“p if and only if q”
“p iff q”
“p is necessary and sufficient for q”
“p implies q, and conversely”
13
5. Biconditional Statement (↔)
Note: In informal language, a biconditional
is sometimes expressed in the form of a
conditional, where the converse is implied,
but not stated. For example:
“If you finish your meal, then you can have
dessert.”
14
Truth tables (¬, ∧, ∨)
p ¬p
T
F
p q p ∧ q
T T
T F
F T
F F
p q p ∧ q
T T
T F
F T
F F
15
Truth table (p→ q)
p q p→ q
T T
T F
F T
F F
Example: If you score 100% on the final, then you
get an A in the class.
p : You score 100% on the final.
q : You get an A in the class.
16
Truth table (p↔ q)
p q p↔ q
T T
T F
F T
F F
Example: You get an A in the class if and only if
your course average is 90% or above.
p : You get an A in the class.
q : Your course average is 90% or above.
17
Converse, Inverse, and Contrapositive
Given the conditional statement
p→ q
we sometimes refer to three related condi-
tional statements
• converse (q → p)
• inverse (¬p→ ¬q)
• contrapositive (¬q → ¬p)
18
Example
p: It is raining today.
q: It is cloudy today.
• original (p→ q):
If it’s raining, then it’s cloudy.
• converse (q → p):
If it’s cloudy, then it’s raining.
• inverse (¬p→ ¬q):
If it’s not raining, then it’s not cloudy.
• contrapositive (¬q → ¬p):
If it’s not cloudy, then it’s not raining.
19
Truth table (¬q → ¬p)
p q ¬q ¬p ¬q → ¬p
T T
T F
F T
F F
p q p→ q
T T
T F
F T
F F
Important Fact:
The contrapositive (¬q → ¬p) always has
the same truth-value as the original condi-
tional (p→ q).
20
Translating English Sentences
Let p, q, r be the propositions
p: You get an A on the final exam.
q: You do every exercise in the book.
r: You get an A in this class.
Translate:
(a) You get an A in this class, but you do
not do every exercise in this book.
21
Translating English Sentences
Let p, q, r be the propositions
p: You get an A on the final exam.
q: You do every exercise in the book.
r: You get an A in this class.
Translate:
(b) To get an A in this class, it is necessary
for you to get an A on the final.
22
Translating English Sentences
Let p, q, r be the propositions
p: You get an A on the final exam.
q: You do every exercise in the book.
r: You get an A in this class.
Translate:
(c) Getting an A on the final and doing
every exercise in this book is sufficient for
getting an A in this class.
23
Logical Equivalence
Compound propositions that have the same
truth values in all possible cases are called
logically equivalent.
The notation p ≡ q means that propositions
p and q are logically equivalent.
24
Equivalence of p→ q and ¬p ∨ q
p q p→ q
T T
T F
F T
F F
p q ¬p ¬p ∨ q
T T
T F
F T
F F
25
Basic Equivalence Laws
De Morgan’s Laws
¬(p ∨ q) ≡ ¬p ∧ ¬q
¬(p ∧ q) ≡ ¬p ∨ ¬q
Distributive Laws
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
26
Basic Equivalence Laws
Example: Use De Morgan’s Law to ex-
press the negation of the given statement.
p : Jim has an iPhone and he has an iPad.
¬p:
27
Basic Equivalence Laws
Example: Use the distributive law to ex-
press the given statement in an equivalent
form.
p : Jim will have cookies, and he will have
coffee or tea.
Logically equivalent statement:
28
Equivalence of ¬(p ∨ q) and ¬p ∧ ¬q
p q p ∨ q ¬(p ∨ q)
T T
T F
F T
F F
p q ¬p ¬q ¬p ∧ ¬q
T T
T F
F T
F F
29
Equivalence of ¬(p ∧ q) and ¬p ∨ ¬q
p q p ∧ q ¬(p ∧ q)
T T
T F
F T
F F
p q ¬p ¬q ¬p ∨ ¬q
T T
T F
F T
F F
30
Equivalence of p∨(q∧r) and (p∨q)∧(p∨r)
p q r q ∧ r p ∨ (q ∧ r) p ∨ q p ∨ r (p ∨ q) ∧ (p ∨ r)
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
31
Equivalence of p∧(q∨r) and (p∧q)∨(p∧r)
p q r q ∨ r p ∧ (q ∨ r) p ∧ q p ∧ r (p ∧ q) ∨ (p ∧ r)
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
32
Logical Eqivalences
p ∧ T ≡ p Identity Laws
p ∨ F ≡ p
p ∨ T ≡ T Domination Laws
p ∧ F ≡ F
p ∨ p ≡ p Idempotent Laws
p ∧ p ≡ p
p ∨ q ≡ q ∨ p Commutative Laws
p ∧ q ≡ q ∧ p
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r) Associative Laws
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
p ∨ (p ∧ q) ≡ p Absorption Laws
p ∧ (p ∨ q) ≡ p
33
Logical Eqivalences
¬(¬p) ≡ p Double Negation Law
p ∨ ¬p ≡ T Negation Laws
p ∧ ¬p ≡ F
¬(p ∧ q) ≡ ¬p ∨ ¬q De Morgan’s Laws
¬(p ∨ q) ≡ ¬p ∧ ¬q
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) Distributive Laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
34
Constructing New Equivalences
From the preceding laws, one can deduce
many other logical equivalences.
Example: Prove ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q
35
Tautologies, Contradictions, and Con-
tingencies
A compound proposition that is always true,
no matter what the truth values of the
propositional variables that occur in it, is
called a tautology. (Example: p ∨ ¬p)
A compound proposition that is always false
is called a contradiction. (Example: p∧¬p)
A compound proposition that is neither a
tautology nor a contradiction is called a
contingency. (Example: p→ q)
36
Predicates and Quantifiers
Quantifiers
Which of the following conditional state-
ments can be assigned a truth value?
• If 1+1 = 2, then 2+2 =4.
• If the sky is blue, then the grass is green.
• If pigs can fly, then birds can fly.
• If x > 7, then x > 5.
• If x is an odd integer, then 2|x.
37
Propositional Functions
A propositional function is a statement
which depends on one or more variables,
denoted P (x), Q(x, y), R(x, y, z), etc., which
takes the form of a proposition once a value
is assigned for each variable.
Examples:
P (x) : x > 3
Q(x, y) : x = y + 3
R(x, y, z) : x + y = z
38
Propositional Functions
Example: Given the propositional func-
tions
P (x) : x > 3
Q(x, y) : x = y + 3
R(x, y, z) : x + y = z,
express the following function values as propo-
sitions and determine their corresponding
truth-values.
• P (2) :
• Q(4,1) :
• R(2,−3,−1) :
39
Quantifiers
In English, the words all, some, many, none,
few are used to quantify a range of values
for which a propositional function is true.
Examples:
• All even integers are divisible by 2.
• Some people have green eyes.
• Many people will attend the concert.
• None of the odd integers are divisible
by 2.
• Few people will win the lottery.
40
Quantifiers
In mathematics we use the following quan-
tifiers:
• universal quantifier (∀)
• existential quantifier (∃)
41
Universal Quantification ( ∀xP (x) )
The universal quantification of P (x), de-
noted ∀xP (x), is the statement:
“For all x (in the domain of discourse), P (x).”
An element x for which P (x) is false is
called a counterexample of ∀xP (x).
42
Universal Quantification ( ∀xP (x) )
Alternate forms:
“For all x, P (x).”
“For every x, P (x).”
“For each x, P (x).”
“P(x), for all x.”
43
Existential Quantification ( ∃xP (x) )
The existential quantification of P (x),
denoted ∃xP (x), is the statement:
“There exists an element x (in the domain
of discourse) such that P (x).”
44
Existential Quantification ( ∃xP (x) )
Alternate forms:
“There exists an x such that P (x).”
“There is at least one value x such that P (x).”
“There is an x such that P (x).”
“For some x, P (x).”
“P (x), for some x.”
45
Truth-values and Quantification
Statement True when... False when...
∀xP (x) P (x) is true for every x. There is an x for which
P (x) is false.
∃xP (x) There is an x for which
P (x) is true.
P (x) is false for every x.
46
Truth-values and Quantification
Examples: Determine the truth-value of
each statement. (In all cases assume the
domain of discourse the set of real num-
bers.)
• ∀x (x + 1 > x)
• ∀x (3x > 2x)
• ∃x (2x + 5 = 0)
• ∃x (x2 = −1)
47
Uniqueness Quantifier ( ∃!xP (x) )
In mathematics, we often want to express
that an equation or problem has a unique
(one and only one) solution.
For this, we have a uniqueness quantifier,
denoted ∃!. The statement ∃!x P (x) reads
“There exists a unique element x such that P (x).”
48
Translating English Sentences
Express each statement in terms of quanti-
fiers and the given propositional functions.
Assume the domain of discourse is all peo-
ple.
P (x) : x is a college student.
Q(x) : x pays tuition.
(a) Some people are college students.
(b) All college students pay tuition.
(c) Some college students pay tuition.
(d) All people who pay tuition are college
students.
Bound Vs Free Variables
When a quantifier is used on a variable, we
say that this variable is bound. A variable
on which no quantifiers are used is called
free.
Examples:
• ∃x (x + y = 1)
• ∃z ∀y (x2 + y2 > z)
Logical Equivalences and Quantifiers
Statements involving predicates and quan-
tifiers are logically equivalent if and only if
they have the same truth value no matter
which predicates are substituted into these
statements and which domain of discourse
is used for the variables in these proposi-
tional functions.
Logical Equivalences and Quantifiers
Example:
∀x(P (x) ∧Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x)
Proof: First assume the statement ∀x(P (x)∧Q(x))
is true. This means that if a is in the domain, then
P (a) ∧ Q(a) is true. Hence, P (a) is true and Q(a)
is true. Because P (a) is true and Q(a) is true for
every element in the domain, we can conclude that
∀xP (x) and ∀xQ(x) are both true. This means that
∀xP (x) ∧ ∀xQ(x) is true.
Logical Equivalences and Quantifiers
Example:
∀x(P (x) ∧Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x)
Proof: (continued...) Conversely, suppose the state-
ment ∀xP (x)∧∀xQ(x) is true. It follows that ∀xP (x)
is true and ∀xQ(x) is true. Hence, if a is in the do-
main, then P (a) is true and Q(a) is true. It follows
that for all a, P (a) ∧ Q(a) is true. It follows that
∀x(P (x) ∧Q(x)) is true. Therefore we’ve shown:
∀x(P (x) ∧Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x)
Negation of Quantifiers
We often want to consider the negation of
a quantified statement.
Examples: Express the negation of each
statement.
• S: All students take calculus.
¬S:
• S: Some students like homework.
¬S:
49
Negation of Quantifiers
Let’s express the same statements in terms
of quantifiers. First we define the proposi-
tional functions
P (x) : x takes calculus.
Q(x) : x likes homework.
• S: All students take calculus.
S:
¬S:
¬S:
• S: Some students like homework.
S:
¬S:
¬S:
50
De Morgan’s Laws for Quantifiers
The previous examples illustrate the follow-
ing two equivalences known as De Mor-
gan’s laws for quantifiers.
• ¬(∀xP (x)) ≡ ∃x (¬P (x))
• ¬(∃xP (x)) ≡ ∀x (¬P (x))
51
De Morgan’s Laws for Quantifiers
Examples: Find the negation of each ex-
pression
• S: ∀x (x2 > x)
¬S:
• S: ∃x (x2 = 2)
¬S:
52
De Morgan’s Laws for Quantifiers
Example: Show that
¬(∀x (P (x)→ Q(x))) ≡ ∃x (P (x) ∧ ¬Q(x))
Proof:
¬(∀x (P (x)→ Q(x))) ≡
53
Nested Quantifiers
Nested quantifiers occur when one quan-
tifier is within the scope of another.
Examples (Assume the domain of discourse
is the set real numbers)
• ∀x∀y (x + y = y + x)
For all real numbers x and y, the sum
x + y is equal to the sum y + x.
• ∀x∃y (x + y = 0)
For each real number x, there exists a
real number y such that x + y = 0.
54
Order of Quantifiers
Note that changing the order of quantifiers
may change the meaning and truth-value
of an expression.
Example: Let Q(x, y) denote “x + y = 0.”
• ∀x∃y Q(x, y)
For each real number x, there exists a
real number y such that x + y = 0.
• ∃y ∀xQ(x, y)
There exists a real number y such that
for all real numbers x, x + y = 0.
55
Truth-values and Nested Quantifiers
Statement True when... False when...
∀x∀y P (x, y)
∀y ∀xP (x, y)
P (x, y) is true for every
pair x, y.
There is a pair x, y
for which P (x, y) is false.
∀x∃y P (x, y) For every x there is a y
for which P (x, y) is true.
There is an x for which
P (x, y) is false for all y.
∃x∀y P (x, y) There is an x for which
P (x, y) is true for all y.
For every x there is a y
for which P (x, y) is false.
∃x∃y P (x, y)
∃y ∃xP (x, y)
There is a pair x, y
for which P (x, y) is true.
P (x, y) is false for every
pair x, y.
56
Translating Nested Quantifiers
Example: Translate the following
• ∀x∀y ((x > 0) ∧ (y < 0)→ (xy < 0))
• ∀x∀y ((x + y < 0)→ (x < 0) ∨ (y < 0))
57
Translating Nested Quantifiers
Example: Translate the following
• If two numbers are unequal, then one
of the numbers is less than the other.
• Every nonzero real number has a mul-
tiplicative inverse.
58
Negating Nested Quantifiers
To negate a statement with nested quan-
tifiers we successively apply the rules for
negating statements involving a single quan-
tifier.
Example: Find the negation of
∀x∃y (xy = 1).
59
Negating Nested Quantifiers
Example: Find the negation of
∀x∃y (xy = 1).
To illustrate the process, we’ll use the predicates
P (x, y) : xy = 1.
Q(x) : ∃y (xy = 1)
¬∀x∃y (xy = 1) ≡
60
Rules of Inference
Arguments and Validity
A formal argument in propositional logic
is a sequence of propositions, starting with
a premise or set of premises, and ending
in a conclusion. We say that an argument
is valid if and only if the conclusion is true
when all premises are true.
61
Arguments and Validity
Example:
1. If I work, then I get paid.
2. If I get paid, then I pay the bills.
3. Therefore, if I work, then I pay the bills.
62
Argument Form
An argument form is a sequence of com-
pound propositions involving propositional
variables. An argument form is valid if
no matter which particular propositions are
substituted for the propositional variables
in its premises, the conclusion is true if the
premises are all true.
Example:
Argument Argument Form
1. If I work, then I get paid.
2. If I get paid, then I pay the bills.
3. Therefore, if I work, then I pay the bills.
1. p→ q
2. q → r
3. ∴ p→ r
63
Rules of Inference
Modus Ponens (Law of Detachment)
Example Argument Form
1. If it snows today, then we will go skiing.
2. It is snowing today.
3. Therefore, we will go skiing.
p→ q
p
∴ q
64
Rules of Inference
Modus Tollens
Example Argument Form
1. If it snows today, then we will go skiing.
2. We will not go skiing.
3. Therefore, it is not snowing today.
p→ q
¬q
∴ ¬p
65
Rules of Inference
Hypothetical Syllogism
Example Argument Form
1. If I work, then I get paid.
2. If I get paid, then I pay the bills.
3. Therefore, if I work, then I pay the bills.
p→ q
q → r
∴ p→ r
66
Rules of Inference
Disjunctive syllogism
Example Argument Form
1. It is sunny, or it is cloudy
2. It is not sunny.
3. Therefore, it is cloudy.
p ∨ q
¬p
∴ q
67
Rules of Inference
Addition
Example Argument Form
1. It is sunny.
2. Therefore, it is sunny, or it is cloudy.
p
∴ p ∨ q
68
Rules of Inference
Simplification
Example Argument Form
1. It is cloudy, and it is raining.
2. Therefore, it is cloudy.
p ∧ q
∴ p
69
Rules of Inference
Conjunction
Example Argument Form
1. It is cloudy.
2. It is raining.
3. Therefore, it is cloudy, and it is raining.
p
q
∴ p ∧ q
70
Rules of Inference
Resolution
Example Argument Form
1. It’s a weekday, or the kids are off of school.
2. It’s not a weekday, or Jim is working.
3. Therefore, the kids are off of school, or
Jim is working.
p ∨ q
¬p ∨ r
∴ q ∨ r
71
Rules of Inference
Rule of
Inference
Tautology Name
p
p→ q
∴ q
(p ∧ (p→ q))→ q Modus ponens
¬qp→ q
∴ ¬p
(¬q ∧ (p→ q))→ ¬p Modus tollens
p→ q
q → r
∴ p→ r
((p→ q) ∧ (q → r))→ (p→ r) Hypothetical
syllogism
p ∨ q
¬p∴ q
((p ∨ q) ∧ ¬p)→ q Disjunctive
syllogism
72
Rules of Inference
Rule of
Inference
Tautology Name
p
∴ p ∨ q
p→ (p ∨ q) Addition
p ∧ q
∴ p
(p ∧ q)→ p Simplification
p
q
∴ p ∧ q
(p ∧ q)→ (p ∧ q) Conjunction
p ∨ q
¬p ∨ r
∴ q ∨ r
((p ∨ q) ∧ (¬p ∨ r)→ (q ∨ r) Resolution
73
Rules of Inference
Examples: In each case identify the rule
of inference used.
• If it is cloudy, then it’s raining. It’s not
raining. Therefore, it’s not cloudy.
• If it rains today, then we will not have
a barbecue today. If we do not have a
barbecue today, then we will have a bar-
becue tomorrow. Therefore, if it rains
today, then we will have a barbecue to-
morrow.
74
Rules of Inference
Examples: In each case identify the rule
of inference used.
• It is below freezing now. Therefore, it
is either below freezing or raining now.
• It is below freezing and raining now.
Therefore, it is below freezing now.
• Jasmine is skiing, or it is not snow-
ing. It is snowing, or Bart is playing
hockey. Jasmine is skiing, or Bart is
playing hockey.
75
Rules of Inference
Examples:
• If you do every problem in this book,
then you will learn discrete mathemat-
ics. You learned discrete mathematics.
Therefore, you did every problem in this
book.
• If you do every problem in this book,
then you will learn discrete mathemat-
ics. You did not do every problem in
this book. Therefore, you did not learn
discrete mathematics.
76
Common Fallacies
Fallacy Name
p→ q
q
∴ p
Affirming the conclusion
p→ q
¬p∴ ¬q
Denying the hypothesis
77
Constructing Arguments
Example: For the given set of premises,
what conclusion can be drawn?
1. It is not sunny today, and it is colder
than yesterday.
2. We will go swimming only if it is sunny.
3. If we do not go swimming, then we will
take a canoe trip.
4. If we take a canoe trip, then we will be
home by sunset.
Conclusion:
78
Constructing Arguments
Premises
1. It is not sunny today, and it is colder than yesterday. (¬p ∧ q)
2. We will go swimming only if it is sunny. (r → p)
3. If we do not go swimming, then we will take a canoe trip. (¬r → s)
4. If we take a canoe trip, then we will be home by sunset. (s→ t)
Conclusion
We will be home by sunset. (t)
Argument
Statement Reason
1. ¬p ∧ q
2. ¬p3. r → p
4. ¬r5. ¬r → s
6. s
7. s→ t
8. t
Premise
Simplification (1)
Premise
Modus tollens (2 and 3)
Premise
Modus ponens (4 and 5)
Premise
Modus ponens (6 and 7)
79
Constructing Arguments
Premises
1. If you send me an e-mail, then I will finish the project. (p→ q)
2. If you do not send me an e-mail, then I will go home. (¬p→ r)
3. If I go home, then I will go to sleep early. (r → s)
Conclusion
If I do not finish the project, then I will go to sleep early. (¬q → s)
Argument
Statement Reason
1. p→ q
2. ¬q → ¬p3. ¬p→ r
4. ¬q → r
5. r → s
6. ¬q → s
Premise
Contrapositive (1)
Premise
Hypothetical syllogism (2 and 3)
Premise
Hypothetical syllogism (4 and 5)
80
Rules of Inference and Quantifiers
Rule of Inference Name
∀xP (x)
∴ P (c) for an arbitrary c
Universal instantiation
P (c) for an arbitrary c
∴ ∀xP (x)
Universal generalization
∃xP (x)
∴ P (c) for some element c
Existential instantiation
P (c) for some element c
∴ ∃xP (x)
Existential generalization
Rules of Inference and Quantifiers
Premises
1. Everyone taking discrete math has taken calculus. (∀x(D(x)→ C(x)))
2. Marla is taking discrete math class. (D(Marla))
Conclusion
Marla has taken calculus. (C(Marla))
Argument
Statement Reason
1. ∀x(D(x)→ C(x))
2. D(Marla)→ C(Marla)
3. D(Marla)
4. C(Marla)
Premise
Universal instantiation (1)
Premise
Modus ponens (2 and 3)
Rules of Inference and Quantifiers
Premises
1. A student in this class has not read the book. (∃x(C(x) ∧ ¬B(x)))
2. Everyone in this class passed the first exam. (∀x(C(x)→ P (x)))
Conclusion
Someone who passed the first exam has not read the book.
(∃x(P (x) ∧ ¬B(x)))
Argument
Statement Reason
1. ∃x(C(x) ∧ ¬B(x))
2. C(a) ∧ ¬B(a)
3. C(a)
4. ∀x(C(x)→ P (x))
5. C(a)→ P (a)
6. P (a)
7. ¬B(a)
8. P (a) ∧ ¬B(a)
9. ∃x(P (x) ∧ ¬B(x))
Premise
Existential instantiation (1)
Simplification (2)
Premise
Universal instantiation (4)
Modus ponens (3 and 5)
Simplification (2)
Conjunction (6 and 7)
Existential generalization (8)
Introduction to Proofs
Mathematical Proofs
The rules of inference for formal proofs in
propositional logic are the same as those
used in mathematical proofs. However,
in the latter case we allow for greater flex-
ibility in the presentation of the argument.
A mathematical proof often relies on many
premises corresponding to the axioms of
our mathematical system. For this reason,
certain steps of the argument may be com-
bined or assumed implicity for the sake of
readability.
81
Types of Mathematical Statements
Axioms (or postulates) are basic mathe-
matical statements that are assumed to be
true.
The conclusion of a mathematical argu-
ment is called a theorem, proposition,
lemma, or corollary depending on the rel-
ative importance of the statement. In par-
ticular, each represents a true mathemati-
cal statement supported by a proof.
A conjecture is mathematical statement
which is believed to be true, but is un-
proven.
82
Integers and Parity
Definitions
We say that a number n is an integer if it
belongs to the set
Z = {. . . ,−3,−2,−1,0,1,2,3, . . .}
We say that an integer n is odd if there
exists an integer k such that n = 2k + 1.
We say that an integer n is even if there
exists an integer k such that n = 2k.
83
Theorem Forms
Many mathematical theorems have the form
of a conditional or biconditional statement.
Examples:
1. If x > y > 0, then x2 > y2.
2. If x, y ∈ Q, then xy ∈ Q.
3. If n is an integer and 3n+2 is odd, then
n is odd.
4. An integer n is odd if and only if n2 is
odd.
84
Theorem Forms
Not all theorems have the form of a condi-
tional statement. Identify the form of each
of the following theorems.
Examples:
1. There are no perfect squares of the form
4k + 3, where k is an integer.
2. For any real number x there exists a
positive integer n, such that x ≤ n.
3.√
2 is an irrational number.
4. There are an infinite number of prime
numbers.
85
Proof of a Conditional Statement (p→ q)
Methods
1. Direct Proof
2. Proof By Contraposition
3. Proof By Contradiction
86
Direct proof of p→ q
Strategy
Assume p is true, then use rules of inference
to deduce q is true.
87
Direct Proof of p→ q
Theorem: If n is an odd integer, then
7n + 4 is odd.
Proof:
Direct proof of p→ q
Theorem: If x > y > 0, then x2 > y2.
Proof:
88
Direct proof of p→ q
Theorem: If x, y ∈ Q, then xy ∈ Q.
Proof:
89
Direct proof of p→ q
Theorem: If n is an integer and 3n+ 2 is
odd, then n is odd.
Proof:
90
Contraposition Proof of p→ q
Strategy
Assume ¬q is true, then use rules of infer-
ence to deduce ¬p is true.
What this shows...
This proves the contrapositive ¬q → ¬p,
which is logically equivalent to p→ q.
91
Contraposition Proof of p→ q
Theorem: If n is an integer and 3n+ 2 is
odd, then n is odd.
Proof:
92
Contradiction Proof of p→ q
Strategy
Assume p ∧ ¬q is true, then use rules of
inference to deduce a false statement (a
contradiction).
What this shows...
The fact that a valid argument produced
a false statement means that the premise
p ∧ ¬q is false. Hence, ¬(p ∧ ¬q), which is
equivalent to p→ q, is true.
93
Contradiction Proof of p→ q
Theorem: If n is an integer and 3n+ 2 is
odd, then n is odd.
Proof:
94
Proof of a Biconditional Statement (p↔ q)
Strategy
Prove that both p → q and its converse,
q → p, are true. That is, (Step 1) assume
p and deduce q, then (Step 2) assume q
and deduce p.
Special Case (Reversible proof)
If q can be deduced from p using only infer-
ences of the form “iff”, then the argument
is called reversible and only one step is re-
quired to complete the proof.
95
Proof of a Biconditional Statement (p↔ q)
Theorem: An integer n is odd if and only
if n2 is odd.
Proof:
96
Proof of a Biconditional Statement (p↔ q)
Theorem: x2 − 2x + 1 = 0 if and only if
x = 1.
Proof:
97
Contraposition Proof of p→ q
Theorem: If x2− 2x− 3 > 0, then x < −1
or x > 3.
Proof:
Proof by Cases
Theorem: n2−3n is even for all integers n.
Proof:
Proof by Contradiction (General Case)
Strategy
To prove a theorem of the form p by con-
tradiction, we assume ¬p, then use rules of
inference to deduce a false statement (a
contradiction).
What this shows...
The fact that a valid argument produced a
false statement means that the premise ¬pis false. Hence, ¬(¬p), which is equivalent
to p, is true.
98
Proof by Contradiction (General Case)
Theorem: There are no perfect squares
of the form 4k + 3, where k is an integer.
Proof:
99
Proof by Contradiction (General Case)
Theorem: For any real number x there
exists a positive integer n, such that x ≤ n.
Proof:
100
Proof by Contradiction (General Case)
Theorem:√
2 is an irrational number.
Proof:
101
Proof by Contradiction (General Case)
Theorem: There are an infinite number
of prime numbers.
Proof:
102
Theorems of Equivalence
Some theorems state the equivalence of a
set of propositions {p1, p2, . . . , pn}.
Proof strategy
To prove pi ↔ pj for all i and j, we use an
n-step proof to establish a circular chain of
implications
Step 1: p1 → p2
Step 2: p2 → p3...
Step n-1: pn−1 → pn
Step n: pn → p1
103
Basic Concepts of Set Theory
Definition
A set is an unordered collection of objects,
called elements or members of the set. A
set is said to contain its elements. We write
a ∈ A to denote that a is an element of the
set A. The notation a /∈ A denotes that a
is not an element of the set A.
1
Defining a Set
The roster method is a way of defining a
set by listing all of its members.
Examples
• The set of all vowels in the English al-
phabet is denoted by {a, e, i, o, u}.
• The set of odd positive integers is de-
noted by {1,3,5, . . .}.
• The set of positive integers less than
100 is denoted by {1,2,3, . . . ,99}.
2
Important Sets
Notation
N = {1,2,3, . . .}, the set of natural numbers, also
denoted Z+.
Z = {. . . ,−2,−1,0,1,2, . . .}, the set of integers
Q, the set of rational numbers
R, the set of real numbers
R+, the set of positive real numbers
C, the set of complex numbers
3
Defining a Set
Another way to describe a set is using set
builder notation which has the general form
S = {x ∈ U | P (x)},
where U is the universal set and P (x) is a
propositional function with domain U .
The set S consists of all elements in U such
that P (x) is true. This set is called the
truth set of P (x).
4
Defining a Set
Examples
S = {1,3,5,7,9}
= {x ∈ N | x is odd and x < 10}
= {x | x is an odd positive integer less than 10}
Q = {x ∈ R | Q(x)}
where Q(x): ∃p ∃q (p ∈ N ∧ q ∈ Z ∧ x =p
q)
= {x ∈ R | x =p
q, where p ∈ N and q ∈ Z}
5
Interval Notation
Recall the following notation for interval
subsets of R
(a, b) = {x ∈ R | a < x < b} open interval
[a, b] = {x ∈ R | a ≤ x ≤ b} closed interval
[a, b) = {x ∈ R | a ≤ x < b}(a, b] = {x ∈ R | a < x ≤ b}
(−∞, b] = {x ∈ R | x ≤ b}(−∞, b) = {x ∈ R | x < b}[a,∞) = {x ∈ R | x ≥ a}(a,∞) = {x ∈ R | x > a}
6
Defining a Set
Example: Express the following set using
set builder notation.
S = {. . . ,−12,−8,−4,0,4,8,12, . . .}
7
The Empty Set
A set with no elements is called the empty
set, or null set, and is denoted by Ø.
For example,
{x ∈ R | x2 = −1} = Ø.
8
Subsets
The set A is a subset of B if and only if
every element of A is also an element of B.
That is, A is a subset of B iff
∀x (x ∈ A → x ∈ B).
We use the notation A ⊆ B to indicate that
A is a subset of B.
9
Subsets
To show A ⊆ B
Assume x ∈ A, then show x ∈ B.
To show A * B
Show there exists an x ∈ A such that x 6= B.
10
Subsets
Example: Consider the sets A = {2,−3}and B = {x ∈ R | x3 + 3x2 − 4x − 12 = 0}.Prove that A ⊆ B.
Proof:
11
Special Subsets
Theorem: For every set S,
(i) Ø ⊆ S
(ii) S ⊆ S
Proof of (i): By definition, Ø ⊆ S iff
∀x (x ∈ Ø→ x ∈ S).
Since the premise x ∈ Ø is false for all x,
the conditional statement is true for all x.
This completes the proof of part (i).
Proof of (ii): By definition, S ⊆ S iff
∀x (x ∈ S → x ∈ S).
Since the propositional form p→ p is a tau-
tology, the conditional statement is true for
all x. This completes the proof of part (ii).
Proper Subsets
We say that A is a proper subset of B if
and only if A ⊆ B and A 6= B. That is, A
is a proper subset of B iff
∀x (x ∈ A → x ∈ B) ∧ ∃x (x ∈ B ∧ x /∈ A).
We use the notation A ( B to indicate that
A is a proper subset of B.
13
Equality of Sets
Two sets are equal if and only if they have
the same elements. Therefore, if A and B
are sets, then A = B if and only if
∀x (x ∈ A ↔ x ∈ B).
That is, A = B iff A ⊆ B and B ⊆ A.
14
Equality of Sets
To show A = B
Step 1. Assume x ∈ A, then show x ∈ B.
Step 2. Assume x ∈ B, then show x ∈ A.
15
Equality of Sets
Example: Consider the sets A = {−1,1}and B = {x ∈ R | x2 = 1}. Prove that
A = B.
Proof:
16
Equality of Sets
Remark
The sets {1,2,3} and {2,3,1} are equal,
because they have the same elements. Note
that the order in which the elements of a
set are listed does not matter.
17
Equality of Sets
Theorem: If A and B are sets with no
elements, then A = B.
Proof: By definition, A = B iff
∀x (x ∈ A↔ x ∈ B).
Since the sets A and B have no elements,
the statements x ∈ A and x ∈ B are false
for all x. Therefore, the biconditional state-
ment x ∈ A↔ x ∈ B is true for all x. This
completes the proof.
Power Sets
Let S be a set. The power set of S, de-
noted P(S), is the set of all subsets of S.
That is,
P(S) = {T | T ⊆ S}.
Example: Let S = {a, b, c}. Then, P(S) =
{Ø, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Note that the empty set Ø and the set S
itself are each members of P(S).
19
Power Sets
Examples: Find the power set of each of
the following sets.
• S = {1,2}
• S = Ø
• S = P(Ø)
20
Power Sets
Theorem: If S is a set with n elements,
then the power set P(S) is a set with 2n
elements.
Proof:
Let S = {s1, s2, s3, . . . , sn}. To construct a
subset T of S, we need to decide whether
or not si ∈ T for each i = 1,2, . . . , n. That
is, for each i = 1,2, . . . , n, there are two
possibilities, si ∈ T or si /∈ T , so there are
2 · 2 · 2 · · · · · 2︸ ︷︷ ︸n factors
= 2n
different ways of constructing a subset of
S. Therefore P(S) has 2n elements.
21
Set Operations
Union of Sets
Let A and B be sets. The union of the sets
A and B, denoted by A∪B, is the set that
contains those elements that are either in
A or in B, or in both. That is,
A ∪B = {x | x ∈ A ∨ x ∈ B}
1
Union of Sets
Venn Diagram
2
Intersection of Sets
Let A and B be sets. The intersection
of the sets A and B, denoted by A ∩ B, is
the set containing those elements in both
A and B. That is,
A ∩B = {x | x ∈ A ∧ x ∈ B}
3
Intersection of Sets
Venn Diagram
4
Union and Intersection
Example
Let A = {1,2,3} and B = {1,3,5}. Then,
A ∪B = {1,2,3,5}A ∩B = {1,3}
5
Disjoint Sets
Two sets are called disjoint if their inter-
section is the empty set.
Example
Let A = {1,3,5,7,9} and B = {2,4,6,8,10}.
A ∩B = ∅, therefore A and B are disjoint.
6
Difference of Sets
Let A and B be sets. The difference of A
and B, denoted by A−B (or A \B), is the
set containing those elements that are in A
but not in B. That is,
A−B = {x | x ∈ A ∧ x /∈ B}
The difference of A and B is also called the
complement of B with respect to A.
7
Difference of Sets
Venn Diagram
8
Complement of a Set
Let U be the universal set. The comple-
ment of the set A, denoted by Ac, is the
complement of A with respect to U . That
is
Ac = U −A = {x | x ∈ U ∧ x /∈ A}
9
Complement of a Set
Venn Diagram
10
Complement of a Set
Example
Let U be the set of letters in the English
alphabet, and let V = {a, e, i, o, u}. Then,
V c = U − V
= {b, c, d, f, g, h, j, k, l,m, n, p, q, r, s, t, v, w, x, y, z}.
11
Set Operations
Example
Consider the universal set
U = {0,1,2,3,4,5,6,7,8,9}.
If A = {1,2,4,5,7} and B = {1,3,5,9}, de-
termine the following:
A ∩B =
A ∪B =
A−B =
B −A =
Ac =
Bc =
12
Set Identities
Identity Name
A ∩ U = A
A ∪ ∅ = A
Identity Laws
A ∪ U = U
A ∩ ∅ = ∅
Domination Laws
A ∪A = A
A ∩A = A
Idempotent Laws
(Ac)c = A Double Complement Law
A ∪Ac = U
A ∩Ac = ∅
Complement Laws
13
Set Identities
Identity Name
A ∪B = B ∪A
A ∩B = B ∩A
Commutative Laws
A ∪ (B ∪ C) = (A ∪B) ∪ C
A ∩ (B ∩ C) = (A ∩B) ∩ C
Associative Laws
A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)
A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Distributive Laws
(A ∩B)c = Ac ∪Bc
(A ∪B)c = Ac ∩Bc
De Morgan’s Law
A ∪ (A ∩B) = A
A ∩ (A ∪B) = A
Absorption Laws
14
Set Identities
Example: Prove the distributive law
A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof:
15
Set Identities
Example: Prove that (A ∩B)c = Ac ∪Bc
Proof:
16
Set Identities
Example: Use set identities to show that
(A ∪ (B ∩ C))c = (Cc ∪Bc) ∩Ac
17
Sets and Proofs
Example: Prove that A ∩B ⊆ A.
Proof:
18
Sets and Proofs
Example: Prove that A ⊆ B iff A∩B = A.
Proof:
19
Sets and Proofs
Example: Prove that A ∩ (B −A) = Ø.
Proof:
20
Ordered n-tuples
An ordered n-tuple (a1, a2, . . . , an) is an
ordered collection that has a1 as its first
element, a2 as its second element, . . . , and
an as its nth element.
Ordered 2-tuples are called ordered pairs.
21
Ordered n-tuples
We say that two ordered n-tuples are equal
if and only if each corresponding pair of
their elements is equal. In other words,
(a1, a2, . . . , an) = (b1, b2, . . . , bn)
if and only if
ai = bi, for i = 1,2, . . . , n
22
Cartesian Product
Let A and B be sets. The Cartesian prod-
uct of A and B, denoted by A × B, is the
set of all ordered pairs (a, b), where a ∈ Aand b ∈ B. Hence,
A×B = {(a, b) | a ∈ A and b ∈ B}.
23
Cartesian Product
Example:
If A = {1,2} and B = {a, b, c}, then
A×B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}.
B×A = {(a,1), (a,2), (b,1), (b,2), (c,1), (c,2)}.
Note that A×B 6= B ×A, unless A = B.
25
Cartesian Product
The Cartesian product of the sets A1, A2, . . . , An,
denoted by A1×A2× · · · ×An, is the set of
ordered n-tuples (a1, a2, . . . , an), where ai
belongs to Ai for i = 1,2, . . . , n. In other
words,
A1×A2×· · ·×An = {(a1, a2, . . . , an) | ai ∈ Ai for i = 1,2, . . . , n}
26
Cartesian Product
Example:
If A = {1,2}, B = {a, b, c}, and C = {α, β},then
A×B × C = {(1, a, α), (1, a, β), (1, b, α), (1, b, β),
(1, c, α), (1, c, β), (2, a, α), (2, a, β),
(2, b, α), (2, b, β), (2, c, α), (2, c, β)}
28
Cartesian Product
Notation
If A is a set, then An denotes the Cartesian
product of n copies of A. That is,
An = A×A× · · · ×A︸ ︷︷ ︸n times
29
Extended Set Operations and
Indexed Families of Sets
Set of Sets
A set of sets is often called a family or
a collection of sets. We often use script
letters, A, B, C, . . . , to denote families of
sets. For example,
A = {Ø, {a}, {b}, {a, b}}
B = {{1}, {1,2}, {1,2,3}, . . .}
= {{1,2, . . . n} | n ∈ N}
= {Bn | n ∈ N}
C = {(−ε, ε) | ε > 0}
= {Cε | ε ∈ R+}
1
Union of Sets
Let A be a family of sets. The union over
A, denoted⋃A∈A
A, is the set of elements
contained in at least one set in the family
A. That is,
⋃A∈A
A = {x | x ∈ A for some A ∈ A}
2
Union of Sets
For a finite collection of sets A1, A2, . . . , An,
we use the notation
A1 ∪A2 ∪ · · · ∪An =n⋃i=1
Ai
For a collection of sets {Ai}∞i=1, we write
A1 ∪A2 ∪A3 ∪ · · · =∞⋃i=1
Ai
3
Union of Sets
Examples
1. A = {Ø, {a}, {b}, {a, b}} = {A1, A2, A3, A4}
⋃A∈A
A =4⋃i=1
Ai = A1 ∪A2 ∪A3 ∪A4 = {a, b}
2. B = {{1}, {1,2}, {1,2,3}, . . .} = {B1, B2, B3, . . .}⋃B∈B
B =∞⋃i=1
Bi = B1 ∪B2 ∪B3 ∪ . . . = N
3. C = {(−ε, ε) | ε > 0} = {Cε | ε ∈ R+}⋃C∈C
C =⋃ε∈R+
Cε = R
5
Intersection of Sets
Let A be a family of sets. The intersec-
tion over A, denoted⋂A∈A
A, is the set of
elements contained in every set in the fam-
ily A. That is,
⋂A∈A
A = {x | x ∈ A for every A ∈ A}
6
Intersection of Sets
For a finite collection of sets A1, A2, . . . , An,
we use the notation
A1 ∩A2 ∩ · · · ∩An =n⋂i=1
Ai
For a collection of sets {Ai}∞i=1, we write
A1 ∩A2 ∩A3 ∩ · · · =∞⋂i=1
Ai
7
Intersection of Sets
Examples
1. A = {Ø, {a}, {b}, {a, b}} = {A1, A2, A3, A4}
⋂A∈A
A =4⋂i=1
Ai = A1 ∩A2 ∩A3 ∩A4 = Ø
2. B = {{1}, {1,2}, {1,2,3}, . . .} = {B1, B2, B3, . . .}⋂B∈B
B =∞⋂i=1
Bi = B1 ∩B2 ∩B3 ∩ . . . = {1}
3. C = {(−ε, ε) | ε > 0} = {Cε | ε ∈ R+}⋂C∈C
C =⋂ε∈R+
Cε = {0}
9
Indexed Family of Sets
Let ∆ be a nonempty set such that for each
α ∈∆ there is a corresponding set Aα. The
family
{Aα | α ∈∆}
is an indexed family of sets. The set ∆
is called the indexing set and each α ∈ ∆
is an index.
10
Indexed Family of Sets
Examples
1. A = {Ø, {a}, {b}, {a, b}}
= {A1, A2, A3, A4}
= {An | n ∈ {1,2,3,4}}
2. B = {{1}, {1,2}, {1,2,3}, . . .}
= {B1, B2, B3, . . .}
= {Bn | n ∈ N}
3. C = {(−ε, ε) | ε > 0}
= {Cε | ε ∈ R+}
11
Indexed Family of Sets
Example Let ∆ = {0,1,2,3,4}, and let
Aα = {2α+ 4, 8, 12− 2α}
for each α ∈∆. Determine the following
1. A0 = {4,8,12}
2. A1 = {6,8,10}
3. A2 = {8}
4. A3 = {6,8,10}
5. A4 = {4,8,12}
6. A = {Aα | α ∈∆} = {{4,8,12}, {6,8,10}, {8}}
13
Indexed Family of Sets
Notation Let A = {Aα | α ∈∆}, then we
express the union and intersection over Aas follows ⋃
A∈AA =
⋃α∈∆
Aα
⋂A∈A
A =⋂α∈∆
Aα
14
Indexed Family of Sets
Example Let ∆ = Z, and let
Aα = (α, α+ 1)
for each α ∈∆. Determine the following:
1.⋃
α∈∆Aα =
2.⋂
α∈∆Aα =
15
Indexed Family of Sets
Example Let ∆ = R+, and let
Aα = (−∞,−α) ∪ (α,∞)
for each α ∈∆. Determine the following:
1.⋃
α∈∆Aα =
2.⋂
α∈∆Aα =
16
De Morgan’s Law
Theorem Let A = {Aα | α ∈ ∆} be an
indexed collection of sets. Then,
1.
( ⋃α∈∆
Aα
)c=
⋂α∈∆
Acα
2.
( ⋂α∈∆
Aα
)c=
⋃α∈∆
Acα
17
Proof of (1):
x ∈
⋃α∈∆
Aα
c
iff x /∈⋃α∈∆
Aα
iff it’s not the case that x ∈⋃α∈∆
Aα
iff it’s not the case that x ∈ Aα
for some α ∈∆
iff x /∈ Aα for every α ∈∆
iff x ∈ Acα for every α ∈∆
iff x ∈⋂α∈∆
Acα
Indexed Family of Sets
Example Let ∆ = R+, and let
Aα = (−∞,−α) ∪ (α,∞)
for each α ∈∆.
Verify Part 1 of De Morgan’s Law:
1.
( ⋃α∈∆
Aα
)c=
( ⋃α∈∆
(−∞,−α) ∪ (α,∞)
)c
= ((−∞,0) ∪ (0,∞))c
= {0}
2.⋂
α∈∆Acα =
⋂α∈∆
((−∞,−α) ∪ (α,∞))c
=⋂
α∈∆[−α, α]
= {0}
19
Pairwise Disjoint Sets
The sets in an indexed family
A = {Aα | α ∈∆}
are called pairwise disjoint if and only if
∀α ∀β [(Aα = Aβ) ∨ (Aα ∩Aβ = Ø)]
20
Pairwise Disjoint Sets
Example Let ∆ = Z, and let
Aα = (α, α+ 1)
for each α ∈∆.
The sets in A = {Aα | α ∈ ∆} are pairwise
disjoint since Aα ∩Aβ = Ø for all α 6= β.
21
Mathematical Induction
Peano Axioms
The set of natural numbers N = {1,2,3, . . .}has an implicit ordering, namely
1 < 2 < 3 < 4 < 5 < 6 < 7 < · · ·
We say that n + 1 is the successor of n.
For example, 2 is the successor of 1, 3 is
the successor of 2, and so on.
In terms of this notion of successor of an
element, one can give a axiomatic descrip-
tion of the natural numbers from which the
basic laws of arithmetic can be developed.
These axioms are called Peano Axioms.
Peano Axioms
The structure of the natural numbers as an
ordered set is characterized by the follow-
ing five axioms:
(i) 1 is a natural number.
(ii) Every natural number has a unique successor,
which is a natural number.
(iii) No two natural numbers have the same suc-
cessor.
(iv) 1 is not the successor of any natural number.
(v) If a subset of the natural numbers contains
the element 1 and contains the successors of
all of its elements, then that subset contains
all natural numbers.
Induction Axiom
Axiom (v) above is called the induction
axiom and can be reformulated as follows:
If S ⊆ Z+ such that
(i) 1 ∈ S,
(ii) ∀k (k ∈ S → k + 1 ∈ S),
then S = Z+.
Induction as a Rule of Inference
In the context of mathematical proofs, the
induction axiom serves as a rule of infer-
ence of the form
P (1)
∀k (P (k) → P (k + 1))
∴ ∀n (P (n))
where P is any propositional function with
domain Z+.
2
Mathematical Induction
Let P (n) is a propositional function with
domain Z+. To prove that P (n) is true
for all positive integers n, we complete two
steps:
1. (Base Case) Verify that P (1) is true.
2. (Inductive Step) Prove the conditional
statement P (k) → P (k + 1) is true for
all positive integers k.
To complete the inductive step, we assume
P (k) is true (this assumption is called the
induction hypothesis), then show P (k+1)
must also be true.
3
Mathematical Induction
Example: Show that if n is a positive
integer, then
1 + 2 + 3 + · · ·n =n(n + 1)
2
4
Mathematical Induction
Proof: Let P (n) be the proposition
1 + 2 + 3 + · · ·n =n(n + 1)
2.
We want to show P (n) is true for all n ≥ 1.
Base Step:
5
Mathematical Induction
Example: Conjecture a formula for the
sum of the first n positive odd integers.
Then prove your conjecture using mathe-
matical induction.
1 =
1 + 3 =
1 + 3 + 5 =
1 + 3 + 5 + 7 =
1 + 3 + 5 + 7 + 9 =
6
Mathematical Induction
Conjecture: For all positive integers n,
the following proposition P (n) holds
1 + 3 + 5 + · · ·+ 2n− 1 =
Proof:
7
Mathematical Induction
Example: Use mathematical induction to
prove the inequality
n < 2n
for all positive integers n.
8
Mathematical Induction
Proof: Let P (n) be the proposition n < 2n.
We want to show P (n) is true for all n ≥ 1.
Base Step:
9
Mathematical Induction
Example: Use mathematical induction to
prove n3 − n is divisible by 3 for all n ≥ 1.
10
Mathematical Induction
Proof: Let P (n) be the proposition
3 | (n3 − n).
We want to show P (n) is true for all n ≥ 1.
Base Step:
11
Generalized Induction
To prove that the propositional function
P (n) is true for all integers n ≥ b , we com-
plete two steps:
1. (Base Case) Verify that P (b) is true.
2. (Inductive Step) Prove the conditional
statement P (k) → P (k + 1) is true for
all positive integers k ≥ b.
Generalized Induction
Example: Use generalized induction to
show that for all nonnegative integers n
1 + 2 + 22 + · · ·+ 2n = 2n+1 − 1
Generalized Induction
Proof: Let P (n) be the proposition
1 + 2 + 22 + · · ·+ 2n = 2n+1 − 1.
We want to show P (n) is true for all inte-
gers n ≥ 0.
Generalized Induction
Example: Use generalized induction to
prove that the sum of the first n+ 1 terms
in a geometric progression with initial term
a and common ratio r 6= 1 is given by
a + ar + ar2 + · · ·+ arn =arn+1 − a
r − 1
Generalized Induction
Proof: Let P (n) be the proposition
a + ar + ar2 + · · ·+ arn =arn+1 − a
r − 1
We want to show P (n) is true for all inte-
gers n ≥ 0.
Generalized Induction
Example: Use generalized induction to
prove the inequality
2n < n!
for all integers n ≥ 4.
Generalized Induction
Proof: Let P (n) be the proposition
2n < n!.
We want to prove that P (n) is true for all
integers n ≥ 4.
Generalized Induction
Example: Use mathematical induction to
prove that 7n+2 + 82n+1 is divisible by 57
for all n ≥ 0.
Generalized Induction
Proof: Let P (n) be the proposition
∃m (m ∈ Z ∧ 7n+2 + 82n+1 = 57m).
We want to show P (n) is true for all n ≥ 0.
Generalized Induction
Generalized De Morgan’s Law
Let A1, A2, . . . , An be subsets of a univer-
sal set U , and let P (n) be the proposition n⋂j=1
Aj
c
=n⋃
j=1
Acj
Prove P (n) is true for all n ≥ 2.
Proof:
Base Step: The statement P (2) asserts
(A1 ∩A2)c = (A1)c ∪ (A2)c, which is true
by De Morgan’s Law.
Inductive Step: Assume P (k) is true for
some fixed integer k ≥ 2. That is, assume k⋂j=1
Aj
c
=k⋃
j=1
Acj
for any collection of k sets A1, A2, . . . , Ak.
Then,k+1⋂j=1
Aj
c
=
k⋂j=1
Aj
∩Ak+1
c
=
k⋂j=1
Aj
c
∪Ack+1
=
k⋃j=1
Acj
∪Ack+1
=k+1⋃j=1
Acj
This completes the inductive step.
Therefore, P (n) is true for all n ≥ 2.
Complete Induction and the Well-
Ordering Principle
Complete Induction as a Rule of Infer-
ence
In mathematical proofs, complete induc-
tion (PCI) is a rule of inference of the form
P (a) ∧ P (a + 1) ∧ · · · ∧ P (b)
∀k≥b ([P (a) ∧ P (a + 1) ∧ · · · ∧ P (k)] → P (k + 1))
∴ ∀n≥a (P (n))
where a and b are positive integers with
a ≤ b, and P is any propositional function
with domain n ≥ a.
Complete Induction
To prove that a propositional function P (n)
is true for all positive integers n ≥ a, we
complete two steps:
1. (Base Case) Verify the truth of
P (a) ∧ P (a + 1) ∧ · · · ∧ P (b)
2. (Inductive Step) Prove the conditional
statement
[P (a) ∧ P (a + 1) ∧ · · · ∧ P (k)] → P (k + 1)
is true for all positive integers k ≥ b.
To complete the inductive step, we assume
P (m) is true for all m = a, a+1, a+2, . . . , k,
then show P (k + 1) must also be true for
all k ≥ b.
Complete Induction
Special Case: a = b = 1
To prove that a propositional function P (n)
is true for all positive integers n, we com-
plete two steps:
1. (Base Case) Verify that P (1) is true.
2. (Inductive Step) Prove the conditional
statement
[P (1) ∧ P (2) ∧ P (3) ∧ · · · ∧ P (k)] → P (k + 1)
is true for all positive integers k.
Complete Induction
Special Case: a = b = 1
Example: Prove that every positive inte-
ger n has a binary expansion of the form
n = a0 + a12 + a222 + · · ·+ aj2j,
where j is a nonnegative integer, aj = 1,
and ai ∈ {0,1} for all i.
Complete Induction
Proof: Let P (n) be the proposition:
n = a0 + a12 + a222 + · · ·+ aj2j,
where j is a nonnegative integer, aj = 1,
and ai ∈ {0,1} for all i.
We want to show P (n) is true for all n ≥ 1.
Base Step: P (1) is true, since
1 = a020
where j = 0 and a0 = 1.
Inductive Step: Assume P (m) is true for
all positive integers m ≤ k.
Then, consider the integer k + 1. We have
two cases:
Case 1: (k+1 is even)
If k + 1 is even, then k + 1 = 2m where
m ≤ k. Therefore, P (m) is true and we
have
k + 1 = 2m
= 2(a0 + a12 + a222 + · · ·+ aj2j)
= 0 + a02 + a122 + a223 + · · ·+ aj2j+1
= a0 + a12 + a222 + a323 + · · ·+ aj+12j+1
where aj+1 = aj = 1, a0 = 0, and ai =
ai−1 ∈ {0,1} for all 1 ≤ i ≤ j. Therefore,
P (k + 1) is true in this case.
Case 2: (k+1 is odd)
If k + 1 is odd, then k = 2m where m < k.
Therefore, P (m) is true and we have
k + 1 = 1 + 2m
= 1 + 2(a0 + a12 + a222 + · · ·+ aj2j)
= 1 + a02 + a122 + a223 + · · ·+ aj2j+1
= a0 + a12 + a222 + a323 + · · ·+ aj+12j+1
where aj+1 = aj = 1, a0 = 1, and ai =
ai−1 ∈ {0,1} for all 1 ≤ i ≤ j.
Therefore, P (k + 1) is true in either case.
This completes the inductive step.
Therefore, it follows by complete induction
that P (n) is true for all n ≥ 1.
Complete Induction
Example: Prove that every positive inte-
ger n ≥ 2 can be expressed as a product of
prime numbers.
Complete Induction
Proof: Let P (n) be the proposition:
n = p1 p2 · · · pj,
where j ≥ 1 and pi is prime for all j.
We want to show P (n) is true for all n ≥ 2.
We will use complete induction correspond-
ing to the case a = b = 2.
Base Step: P (2) is true, since
2 = p1
is a prime number.
Inductive Step: Assume P (m) is true for
all integers m = a, a + 1, . . . , k. That is,
assume all integers m = 2,3, . . . , k have a
prime factorization.
Then, for k ≥ b = 2, we have two cases.
Case 1: (k+1 is prime)
If k+1 = p1 is prime, then P (k+1) is true.
Case 2: (k+1 is composite)
If k + 1 is composite, then there exist inte-
gers c and d with 1 < c ≤ d < k + 1, such
that
k + 1 = c · d
Then, 2 ≤ c ≤ k and 2 ≤ d ≤ k, and it
follows by the induction hypothesis that
c = p1 p2 · · · pjd = q1 q2 · · · q`
where pi and qi are prime for all i. Thus,
k + 1 = (p1 p2 · · · pj) · (q1 q2 · · · q`)
and we conclude that P (k + 1) is true.
This completes the inductive step, and it
follows by complete induction that P (n) is
true for all n ≥ 2.
Well-Ordering Principle
Axiom: Every nonempty subset of Z+ has
a least element.
That is, if S ⊆ Z+ and S 6= ∅, then S has a
smallest element.
Well-Ordering Principle
Example: Use well-ordering property to
prove the division algorithm:
If a is an integer and d is a positive integer,
then there exist (unique) integers q and r
with 0 ≤ r < d such that a = dq + r.
Well-Ordering Principle
Proof: Consider the set
S = {n ∈ Z+ | n = a− dq +1 where q ∈ Z}
This set is nonempty because −dq can be
made as large as desired (by taking q <
0 with |q| sufficiently large). By the well-
ordering principle, S has a least element
n0 = (a− dq0) + 1 where q0 ∈ Z. We claim
n0 ≤ d. If not, then
n1 = (a− d(q0 + 1)) + 1 = n0 − d > 0,
which implies n1 ∈ S and n1 < n0. This
contradicts the assumption that n0 is the
least element of S. Therefore, 1 ≤ n0 ≤ d.
This proves a = dq0 + r where r = n0−1
is an integer such that 0 ≤ r < d.
The proof that q0 and r are unique is left
as an exercise.
Well-Ordering Principle
Theorem: The Well-Ordering Principle (WOP)
and the Principle of Mathematical Induc-
tion (PMI) are equivalent.
WOP → PMI
Proof: Assume WOP holds. We want to
prove PMI holds. Let S ⊆ Z+ such that
(i) 1 ∈ S,
(ii) k ∈ S → k + 1 ∈ S for all k ∈ Z+.
We want to prove S = Z+. Assume for the
sake of contradiction that S 6= Z+. Then,
T = Z+ − S is a non-empty subset of Z+.
Therefore, by the well-ordering principle, T
has a least element m. That is, there exists
m ∈ T such that m ≤ n for all n ∈ T .
Since 1 ∈ S, we know m ≥ 2. Therefore
m−1 is a positive integer. Clearly m−1 /∈ T
(otherwise m−1 would be the least element
of T ). This means m − 1 ∈ S, and by as-
sumption (ii)
(m− 1) ∈ S → (m− 1) + 1 ∈ S.
Therefore, m ∈ S which contradicts the
fact that m ∈ T .
We conclude that S = Z+. Therefore PMI
holds.
Relations
Binary Relation
Let A and B be sets. A (binary) relation
from A to B is a subset of A×B.
Notation
Let R ⊆ A×B be a relation from A to B.
If (a, b) ∈ R, we write aR b.
1
Binary Relation
Example: Consider the sets A = {2,3,5,7}and B = {4,6,8,9,10}. Let R be the rela-
tion from A to B defined by
aR b iff b is divisible by a.
Then R consists of the ordered pairs
{(2,4), (2,6), (2,8), (2,10), (3,6), (3,9), (5,10)}.
2
Domain and Range
The domain of a relation R from A to B
is the set
Dom(R) = {x ∈ A | ∃y (y ∈ B and xRy)}.
The range of the relation R from A to B
is the set
Rng(R) = {y ∈ B | ∃x (x ∈ A and xRy)}.
3
Domain and Range
Example: Consider the sets A = {2,3,5,7}and B = {4,6,8,9,10}. Let R be the rela-
tion from A to B defined by
aR b iff b is divisible by a.
Then R consists of the ordered pairs
{(2,4), (2,6), (2,8), (2,10), (3,6), (3,9), (5,10)}.
Domain and Range
Example: Consider the sets A = {2,3,5,7}and B = {4,6,8,9,10}. Let R be the rela-
tion from A to B defined by
aR b iff b is divisible by a.
Then R consists of the ordered pairs
{(2,4), (2,6), (2,8), (2,10), (3,6), (3,9), (5,10)}.
Dom(R) = {2,3,5}
Rng(R) = {4,6,8,9,10}
4
Domain and Range
Example: Let X = Y = R, and consider
the relation R from X to Y defined by
xR y iffx2
16+
y2
9≤ 1.
That is, R =
{(x, y) ∈ R× R
∣∣∣∣∣ x2
16+
y2
9≤ 1
}.
5
Domain and Range
Example: Let X = Y = R, and consider
the relation R from X to Y defined by
xR y iffx2
16+
y2
9≤ 1.
That is, R =
{(x, y) ∈ R× R
∣∣∣∣∣ x2
16+
y2
9≤ 1
}.
Dom(R) = [−4,4]
Rng(R) = [−3,3]
6
Binary Relation on a Set
A (binary) relation on a set S is a relation
from the set S to S.
7
Binary Relation on a Set
Examples: Let S = R. The following are
examples of binary relations on S.
R1 = {(x, y) | x = y},
R2 = {(x, y) | x < y},
R3 = {(x, y) | x ≤ y},
R4 = {(x, y) | x > y},
R5 = {(x, y) | x ≥ y},
R6 = {(x, y) | x = y or x = y},
R7 = {(x, y) | x = y + 1},
R8 = {(x, y) | x + y ≤ 3}.
8
Identity Relation
The identity relation on S is the relation
from S to itself given by
IS = {(x, x) | x ∈ S}.
Example: Let S = {a, b, c}. The identity
relation on S is the relation
IS = {(a, a), (b, b), (c, c)}
9
Inverse Relation
If R is a relation from A to B, then the
inverse of R, denoted R−1, is the relation
R−1 = {(y, x) | (x, y) ∈ R}
Example: Consider the relation
R = {(2,4), (2,6), (2,8), (2,10), (3,6), (3,9), (5,10)}.
The inverse of R is the relation
R−1 = {(4,2), (6,2), (8,2), (10,2), (6,3), (9,3), (10,5)}.
10
Inverse Relation
Theorem: If R is a relation from A to B,
then
(a) Rng(R−1) = Dom(R).
(b) Dom(R−1) = Rng(R).
11
Proof:
Inverse Relation
Example
Let R be the relation on R given by
xR y iff y = ex.
The inverse of R is the relation given by
xR−1 y iff x = ey iff y = lnx.
12
Inverse Relation
Example
Let R be the relation on R given by
xR y iff y = ex.
The inverse of R is the relation given by
xR−1 y iff x = ey iff y = lnx.
The previous theorem gives
Rng(R−1) = Dom(R) = (−∞,∞).
Dom(R−1) = Rng(R) = (0,∞).
13
Composition of Relations
Let R be a relation from A to B, and let S
be a relation from B to C.
The composition of R and S, denoted S ◦R,
is a relation from A to C defined by
S ◦R = {(a, c) | ∃b ∈ B ( (a, b) ∈ R and (b, c) ∈ S )}
14
Composition of Relations
Example: Consider the sets
A = {1,2,3,4,5}
B = {p, q, r, s, t}
C = {x, y, z, w}
Let R be the relation from A to B given by
R = {(1, p), (1, q), (2, q), (3, r), (4, s)}.
Let S be the relation from B to C given by
S = {(p, x), (q, x), (q, y), (s, z), (t, z)}.
15
Composition of Relations
Example: Consider the sets
A = {1,2,3,4,5}
B = {p, q, r, s, t}
C = {x, y, z, w}
Let R be the relation from A to B given by
R = {(1, p), (1, q), (2, q), (3, r), (4, s)}.
Let S be the relation from B to C given by
S = {(p, x), (q, x), (q, y), (s, z), (t, z)}.
The composition S ◦ R is the relation from
A to C given by
S ◦ R = {(1, x), (1, y), (2, x), (2, y), (4, z)}.
16
Composition of Relations
Example: Consider the relations
R = {(x, y) ∈ R× R | y = x + 1}
S = {(x, y) ∈ R× R | y = x2}.
Determine the following:
S ◦ R =
R ◦ S =
17
Composition of Relations
Theorem: Suppose A, B, C, and D are
sets. Let R be a relation from A to B, S be
a relation from B to C, and T be a relation
from C to D.
(a) (R−1)−1 = R.
(b) T ◦ (S ◦R) = (T ◦ S) ◦R.
(c) IB ◦R = R and R ◦ IA = R.
(d) (S ◦R)−1 = R−1 ◦ S−1
18
Equivalence Relations
Reflexive Property
Let R be a relation on A. We say that
R is reflexive if and only if xR x for all
x ∈ A.
1
Reflexive Property
Examples: Let A = {a, b, c}. In each case,
decide if the given relation is reflexive.
• R = {(a, b), (b, a), (c, c)}.
• R = {(a, a), (a, c), (c, b), (a, b), (c, c)}.
• R = {(a, b), (b, b), (b, c)}.
• R = {(a, a), (a, b), (b, b), (b, a), (c, c)}.
• R = {(a, b), (a, c), (b, a), (b, c), (c, a), (c, b)}.
• R = {(a, a), (b, b), (c, c)}.
2
Symmetric Property
Let R be a relation on A. We say that R
is symmetric if and only if
xR y → y R x
for all x, y ∈ A.
3
Symmetric Property
Examples: Let A = {a, b, c}. In each case,
decide if the given relation is symmetric.
• R = {(a, b), (b, a), (c, c)}.
• R = {(a, a), (a, c), (c, b), (a, b), (c, c)}.
• R = {(a, b), (b, b), (b, c)}.
• R = {(a, a), (a, b), (b, b), (b, a), (c, c)}.
• R = {(a, b), (a, c), (b, a), (b, c), (c, a), (c, b)}.
• R = {(a, a), (b, b), (c, c)}.
4
Transitive Property
Let R be a relation on A. We say that R
is transitive if and only if
(xR y ∧ y R z) → xR z
for all x, y, z ∈ A.
5
Transitive Property
Examples: Let A = {a, b, c}. In each case,
decide if the given relation is transitive .
• R = {(a, b), (b, a), (c, c)}.
• R = {(a, a), (a, c), (c, b), (a, b), (c, c)}.
• R = {(a, b), (b, b), (b, c)}.
• R = {(a, a), (a, b), (b, b), (b, a), (c, c)}.
• R = {(a, b), (a, c), (b, a), (b, c), (c, a), (c, b)}.
• R = {(a, a), (b, b), (c, c)}.
6
Equivalence Relation
Let R be a relation on A. We say that
R is an equivalence relation if and only
if R is reflexive, symmetric, and transitive.
That is, R is an equivalence relation iff
1. (Reflexivity)
xRx, for all x ∈ A.
2. (Symmetry)
if xRy, then y Rx.
3. (Transitivity)
if xRy and y R z, then xR z.
7
Equivalence Relation
Example: Let A = {a, b, c}. List all equiv-
alence relations on A.
• R = {(a, a), (b, b), (c, c)}
• R = {(a, a), (b, b), (c, c), (a, b), (b, a)}
• R = {(a, a), (b, b), (c, c), (b, c), (c, b)}
• R = {(a, a), (b, b), (c, c), (a, c), (c, a)}
• R = {(a, a), (b, b), (c, c), (a, b), (b, a)
(a, c), (c, a), (b, c), (c, b)}
9
Equivalence Relation
Definition
Let n be a fixed positive integer. Given
x, y ∈ Z, we say that x is congruent to y
modulo n if x− y is divisible to n, and we
write
x ≡ y (mod n)
The number n is called the modulus of the
congruence.
10
Equivalence Relation
Example: Let R be the relation on Z
defined by
xR y iff x ≡ y (mod n)
where n is a fixed positive integer. Prove
that R is an equivalence relation.
11
Proof: Recall that x ≡ y (mod n) if and
only if x− y = nk for some integer k.
(Reflexivity)
(i) xRx, since x− x = 0 = n · 0.
(Symmetry)
(ii) Assume xRy. Then, x − y = nk for
some integer k. Therefore, y − x = n(−k),
where −k is an integer. Therefore, y Rx.
(Transitivity)
(iii) Assume xRy and y R z. Then, x−y =
nk for some integer k, and y − z = nj for
some integer j. Then,
x− z = (x− y) + (y − z) = nk + nj
That is, x− z = n(k + j) where k + j is an
integer. Therefore, xR z.
Equivalence Classes
Let R be an equivalence relation on a nonempty
set A. Given a ∈ A, we define
[a] = {x ∈ A | xRa}.
That is, [a] is the subset of elements in A
which are related to a with respect to R.
The set [a] is called the equivalence class
of a under R. An element x ∈ A is called
a representative of [a] if x ∈ [a].
The collection of all equivalence classes with
respect to R is called A modulo R, and is
denoted
A/R = {[a] | a ∈ A}
12
Equivalence Classes
Example
Find the equivalence class of each element
of the set A = {a, b, c} with respect to the
equivalence relation
R = {(a, a), (b, b), (c, c), (a, c), (c, a)}.
[a] = {a, c}
[b] = {b}
[c] = {a, c}
14
Equivalence Classes
Example
Let R be the relation on Z defined by
xR y iff x ≡ y (mod 4)
Then,
[0] = {. . . ,−8,−4, 0, 4, 8, . . .}
[1] = {. . . ,−7,−3, 1, 5, 9, . . .}
[2] = {. . . ,−6,−2, 2, 6, 10, . . .}
[3] = {. . . ,−5,−1, 3, 7, 11, . . .}
where 0, 1, 2, and 3 are representatives of
their respective equivalence classes.
16
Equivalence Classes
Theorem: Let R be an equivalence rela-
tion on a nonempty set A. For all x, y ∈ A,
(i) [x] ⊆ A and x ∈ [x].
Thus every equivalence class is a nonempty
subset of A.
(ii) [x] = [y] iff xR y.
Thus two elements of A have identical
equivalence classes if and only if they
are related.
(iii) [x] ∩ [y] = Ø iff (x, y) /∈ R.
Thus two elements of A have disjoint
equivalence classes if and only if they
are not related.
17
Proof: Assume R is an equivalence relation
on A. Then aRa for all a ∈ A. Therefore
a ∈ [a] for all a ∈ A. This proves (i).
Next, assume [x] = [y]. Since x ∈ [x], it
follows that x ∈ [y]. Therefore, xR y.
Conversely, assume xR y. We want to show
[x] = [y]. Assume z ∈ [x]. Then, z R x.
Since z R x and xR y, it follows by transi-
tivity that z R y. Therefore, z ∈ [y]. This
proves [x] ⊆ [y].
On the other hand, assume z ∈ [y]. Then
z R y. Also, by symmetry, y R x. Therefore,
by transitivity, z R x. Therefore, z ∈ [x].
This shows [y] ⊆ [x], which completes the
proof of (ii).
Finally, assume [x]∩ [y] = Ø. Since x ∈ [x],
it follows that x /∈ [y]. Therefore, (x, y) /∈ R.
It remains to prove that if (x, y) /∈ R, then
[x]∩[y] = Ø. We will use a proof by contra-
position. Assume [x]∩ [y] 6= Ø. Then there
exists an element a ∈ A such that a ∈ [x]
and a ∈ [y]. Therefore, aR x and aR y.
By symmetry, xR a and aR y. Therefore,
by transitivity, xR y. This completes the
proof of (iii).
Equivalence Classes
Theorem: Let R be the relation on Z
defined by
xR y iff x ≡ y (mod n)
where n is a fixed positive integer. Then,
the set of distinct equivalence classes with
respect to R, denoted Zn, is given by
Zn = {[0], [1], [2], . . . , [n− 1]}.
18
Proof: Let Zn denote the set of distinct
equivalence classes with respect to R. First
we will show Zn ⊆ {[0], [1], [2], . . . , [n − 1]}.Let [a] be the equivalence class of some
integer a. By the division algorithm, there
exist integers q and r such that a = qn + r
where 0 ≤ r < n. Therefore, a − r = qn,
which means a ≡ r (mod n). It follows by
the previous theorem that [a] = [r]. This
proves [a] ∈ {[0], [1], [2], . . . , [n− 1]}.
It remains to show that the equivalence
classes [0], [1], [2], . . . , [n−1] are all distinct.
Assume for the sake of contradiction that
there exist j, k ∈ Z such that [j] = [k] and
0 ≤ j < k < n. It follows by the previous
theorem that j ≡ k (mod n). Therefore k−jis divisible by n. However, 0 ≤ j < k < n
implies that 1 ≤ k − j ≤ n − 1. This is a
contradiction. Therefore [j] 6= [k] for all
integers j and k such that 0 ≤ j < k < n.
This completes the proof.
Partitions
Definition
Let A be a nonempty set. A partition of
A is a collection P of nonempty subsets of
A such that
(i)⋃
X∈PX = A, and
(ii) If X ∈ P and Y ∈ P, then X = Y or
X ∩ Y = Ø.
In other words, a partition of A is a collec-
tion of pairwise disjoint, nonempty subsets
of A whose union is A.
1
Partitions
Examples
• Let A = {1,2,3,4,5,6}. Then,
P = {{1,2}, {3,4,5}, {6}}
is a partition of A.
• Let A = Z. Then, P = {Ze, Zo} is a
partition of A where
Ze = {. . . ,−4,−2,0,2,4, . . .},
Zo = {. . . ,−3,−1,1,3,5, . . .}
are the set of even integers and odd
integers, respectively.
2
Partitions
Examples
• Let A = Z+. Then,
P = {{1}, {2,3}, {4,5,6}, {7,8,9,10}, . . .}
is a partition of A.
• Let A = R. Then,
P = {Gn | n ∈ Z}
is a partition of A where Gn = [n, n+ 1).
3
Equivalence Classes and Partitions
Theorem: If R is an equivalence relation
on a nonempty set A, then A/R, the set of
equivalence classes with respect to R is a
partition of A.
4
Proof: Assume R is an equivalence rela-
tion on a nonempty set A. Previously, we
proved that for all a, b ∈ A
(a, b) ∈ R iff [a] = [b],
and
(a, b) /∈ R iff [a] ∩ [b] = Ø.
Therefore, for all a, b ∈ A, we have
[a] = [b] or [a] ∩ [b] = Ø.
This proves that the set of equivalence classes
with respect to R are pairwise disjoint.
It remains to show that⋃[a]∈A/R
[a] = A.
Clearly,⋃
[a]∈A/R
[a] ⊆ A, since each equiva-
equivalence class [a] is a subset of A. Con-
versely, assume x ∈ A. Then,
x ∈ [x] ⊆⋃
[a]∈A/R
[a].
Therefore, A ⊆⋃
[a]∈A/R
[a]. This com-
pletes the proof.
Equivalence Classes and Partitions
Example
Let A = {a, b, c}. The distinct equivalence
classes of the equivalence relation
R = {(a, a), (b, b), (c, c), (a, c), (c, a)}.
are [a] = [c] = {a, c} and [b] = {b}. Hence,
A/R = {{a, c}, {b}}
is a partition of A.
5
Equivalence Classes and Partitions
Example
Let R be the relation on Z defined by
xR y iff x ≡ y (mod 4)
The distinct equivalence classes of R are
[0] = {. . . ,−8,−4, 0, 4, 8, . . .},
[1] = {. . . ,−7,−3, 1, 5, 9, . . .},
[2] = {. . . ,−6,−2, 2, 6, 10, . . .},
[3] = {. . . ,−5,−1, 3, 7, 11, . . .}.
Hence,
Z /R = {[0], [1], [2], [3]}
is a partition of Z.
6
Equivalence Classes and Partitions
Theorem: Assume P is a partition of a
nonempty set A. Let Q be the relation on
A defined by
xQy iff x ∈ S and y ∈ S for some S ∈ P.
Then,
(i) Q is an equivalence relation on A,
(ii) A/Q = P.
7
Proof of (i): Assume P is a partition of a
nonempty set A. Then, for all x ∈ A, there
exists a set S in the partition P such that
x ∈ S. Therefore, xQx for all x ∈ A. This
proves Q is reflexive.
Next assume xQy where x, y ∈ A. Then
there exists a set S in the partition P such
that x ∈ S and y ∈ S. Equivalently, we
have y ∈ S and x ∈ S. Hence, y Qx. This
proves Q is symmetric.
Finally, assume that xQy and y Q z where
x, y, z ∈ A. Then there exist sets S and T
in the partition P such that x ∈ S and
y ∈ S, and y ∈ T and z ∈ T . Since P is a
partition, we know S = T or S ∩ T = Ø.
Since y ∈ S ∩ T , it follows that S = T .
Therefore, x ∈ S and z ∈ S which means
xQz. This proves Q is transitive.
Lemma: Assume S ∈ P. Then, x ∈ S if
and only if [x] = S.
Proof: Assume S ∈ P. We will divide the
proof into two parts.
Part 1. (x ∈ S implies [x] = S) Assume
x ∈ S. We want to show that [x] = S.
First, assume y ∈ [x]. Then, y Qx. There-
fore there exists a set T in the partition
P such that y ∈ T and x ∈ T . Since
x ∈ S ∩ T , it follows that S = T . Hence
y ∈ S. This shows [x] ⊆ S. On the other
hand, assume y ∈ S. Then, y ∈ S and
x ∈ S. Hence y Qx. Therefore, y ∈ [x].
This proves S ⊆ [x]. Thus, [x] = S.
Part 2. ([x] = S implies x ∈ S) Assume
[x] = S. Then, x ∈ S, since x ∈ [x].
Proof of (ii):
First, we want to show A/Q ⊆ P. Assume
[x] ∈ A/Q. There exists a set S in the
partition P such that x ∈ S. Therefore,
by the previous lemma, [x] = S ∈ P.
Next, we want to show P ⊆ A/Q. As-
sume S ∈ P. Since S is nonempty, there
exists an element x ∈ S. Therefore, by the
previous lemma, S = [x] ∈ A/Q.
Therefore, A/Q = P, and the proof is com-
plete.
Ordering Relations
Comparability
Let R be a relation on a nonempty set A.
Given x, y ∈ A, we say that x and y are
comparable if xR y or y R x.
1
Comparability
Example
Let R be the relation on Z+ defined by
xR y iff x is divisible by y.
Then,
• x = 2 and y = 6 are comparable,
since (y, x) = (6,2) ∈ R.
• x = 3 and y = 8 are not comparable,
since (3,8) /∈ R and (8,3) /∈ R.
2
Comparability
Example
Let X = {1,2,3}, and let R be the relation
on P(X) defined by
AR B iff A ⊆ B.
Then,
• the sets A = {1,2,3} and B = {1,3}are comparable, since B ⊆ A.
• the sets A = {1,2} and B = {2,3}are not comparable, since A 6⊆ B and
B 6⊆ A.
3
Antisymmetric Property
Let R be a relation on A. We say that R
is antisymmetric if and only if
xR y ∧ y R x → x = y
for all x, y ∈ A.
4
Antisymmetric Property
Example
Let R be the relation on Z+ defined by
xR y iff x is divisible by y.
Then, R antisymmetric.
5
Antisymmetric Property
Example
Let R be the relation on Z+ defined by
xR y iff x is divisible by y.
Then, R antisymmetric.
Proof:
Assume x is divisible by y and y is divisi-
ble by x. Then, x = jy and y = kx where
j, k ∈ Z+. Then, x = j(kx). Therefore,
jk = 1. Since j and k are positive integers,
follows that j = k = 1. Hence, x = y.
6
Antisymmetric Property
Example
Let R be the relation on R defined by
xR y iff x ≤ y.
Then, R antisymmetric, since x ≤ y and
y ≤ x implies x = y.
7
Antisymmetric Property
Example
Let R be the relation on R defined by
xR y iff x < y.
Then, R antisymmetric, since the premise
x < y and y < x is always false.
8
Antisymmetric Property
Example
Let X be a set, and let R be the relation
on P(X) defined by
AR B iff A ⊆ B.
Then, R antisymmetric, since A ⊆ B and
B ⊆ A implies A = B.
9
Partially Ordered Set
Let R be a relation on A. We say that
R is a partial order if and only if R is
reflexive, antisymmetric, and transitive.
A set A with partial order R is called a
partially ordered set, or poset.
10
Partially Ordered Set
Example
Let R be the relation on Z defined by
xR y iff x ≤ y and x + y is even.
Then, R is a partial order on Z.
Note that xR y if and only if x ≤ y and x
and y have the same parity.
11
Proof:
(i) (R is reflexive.) For all x ∈ Z, we
have x ≤ x and x + x = 2x is even.
Therefore, xR x.
(ii) (R is antisymmetric.) Assume xR y
and y R x. Then, x ≤ y and y ≤ x.
Therefore, x = y.
(iii) (R is transitive.) Assume xR y and
y R z. Then, x ≤ y and y ≤ z. There-
fore, x ≤ z. Also, there exist integers
j and k such that x + y = 2j and
y + z = 2k. Therefore,
x + z = (2j − y) + (2k − y)
= 2j + 2k − 2y
= 2(j + k − y).
where (j +k−y) is an integer. Hence,
x + z is even.
Digraphs
If A is a small finite set, we can use a
directed graph or digraph to represent a
relation R on A. Each element of A cor-
responds to a node in the graph called a
vertex. Each ordered pair (x, y) ∈ R is
represented as a directed arrow from x to
y called an arc. An arc from a vertex to
itself is called a loop.
12
Digraphs
Example: In each case, draw the digraph
for the given relation on A = {a, b, c}.
• R = {(a, b), (b, c), (c, a)}
• R = {(a, b), (b, a), (b, b), (c, b)}
13
• R = {(a, a), (b, b), (c, c), (a, b), (b, a)
(a, c), (c, a), (b, c), (c, b)}
• R = {(a, a), (b, b), (c, c), (a, b), (b, a)}
• R = {(a, a), (b, b), (c, c)}
Partially Ordered Set
Theorem: Let R be a partial order on a
nonempty set A. If
xR x1, x1 R x2, x2 R x3, . . . , xnR x,
where x, x1, x2, . . . xn ∈ A, then
x = x1 = x2 = · · · = xn.
This means that the digraph of a partial or-
der can never contain a closed path except
for loops at individual vertices.
14
Proof: Let R be a partial order on a
nonempty set A.
Base Step: Let n = 1. Assume xR x1 and
x1 R x. Then, by antisymmetry, x = x1.
This proves the proposition when n = 1.
Inductive Step: Assume that the proposi-
tion holds when n = k is a fixed integer
positive integer. We want to prove that
the proposition also holds when n = k + 1.
Assume
xR x1, x1 R x2, x2 R x3, . . . , xk R xk+1, xk+1 R x,
where x, x1, x2, . . . xk, xk+1 ∈ A. Since R is
transitive, xkR xk+1 and xk+1 R x implies
xkR x. Therefore we have
xR x1, x1 R x2, x2 R x3, . . . , xk R x,
and it follows by the inductive hypothesis
that
x = x1 = x2 = · · · = xk.
In particular, x = xk. Therefore, xR xk+1,
since xkR xk+1. Then, by antisymmetry,
xR xk+1 and xk+1 R x implies x = xk+1.
Therefore,
x = x1 = x2 = · · · = xk = xk+1,
which proves the proposition is true for n =
k + 1.
Therefore, by induction, the proposition is
true for all positive integers n.
Immediate Predecessor
Let R be a partial order on a nonempty set
A, and let a, b ∈ A with a 6= b. Then, a is
an immediate predecessor of b iff aR b
and there does not exist c ∈ A with c 6= a
such that aR c and cR b.
15
Immediate Predecessor
Example
Let A = {1,2,3}, and consider the partial
order
R = {(1,1), (2,2), (3,3), (1,2), (2,3), (1,3)}.
Then,
• 1 is an immediate predecessor of 2.
• 2 is an immediate predecessor of 3.
• 1 is not an immediate predecessor of 3.
16
Immediate Predecessor
Example
Let A = {1,2,3}, and consider the partial
order ⊆ on the power set P(A). Then,
• Ø is an immediate predecessor of {1},{2}, and {3}.
• {1} is an immediate predecessor of {1,3}and {1,2}.
• {1,3} is an immediate predecessor of
{1,2,3}.
• {1} is not an immediate predecessor of
{1,2,3}, since {1} ⊆ {1,2} ⊆ {1,2,3}.
17
Upper and Lower Bounds
Let R be a partial order on a nonempty set
A, and let B ⊆ A. We say that an element
a ∈ A is an upper bound for B iff
bR a for all b ∈ B.
We say that an element a ∈ A is an lower
bound for B iff
aR b for all b ∈ B.
18
Upper and Lower Bounds
Example
Let A = P(X) where X = {1,2,3,4} and
consider the partial order ⊆ on A. Let
B = {{1,4}, {2,4}}. Then,
• {1,2,3,4} is an upper bound for B.
• {1,2,4} is an upper bound for B.
• Ø is a lower bound for B.
• {4} is a lower bound for B.
19
Supremum
Let R be a partial order on a nonempty
set A, and let B ⊆ A. We say that an el-
ement a ∈ A is a least upper bound or
supremum for B iff
(i) a is an upper bound for B.
(ii) aR x for every upper bound x of B.
The supremum of B is denoted sup(B).
20
Infimum
Let R be a partial order on a nonempty
set A, and let B ⊆ A. We say that an ele-
ment a ∈ A is a greatest lower bound or
infimum for B iff
(i) a is a lower bound for B.
(ii) xR a for every lower bound x of B.
The infimum of B is denoted inf(B).
21
Infimum and Supremum
Example
Let A = P(X) where X = {1,2,3,4} and
consider the partial order ⊆ on A. Let
B = {{1,4}, {2,4}}. Then,
• {1,2,3,4} is not a least upper bound
for B.
• {1,2,4} is a least upper bound for B.
• Ø is not a greatest lower bound for B.
• {4} is a greatest lower bound for B.
22
Infimum and Supremum
Theorem: Let R be a partial order on a
nonempty set A, and let B ⊆ A. If sup(B)
exists, it is unique. Also, if inf(B) exists,
it is unique.
23
Proof:
Maximum and Minimum
Let R be a partial order on a nonempty
set A, and let B ⊆ A. If sup(B) exists
and sup(B) ∈ B, then sup(B) is called the
largest element, or greatest element, or
maximum element of B.
If inf(B) exists and inf(B) ∈ B, then inf(B)
is called the smallest element, or least el-
ement, or minimum element of B.
24
Maximum and Minimum
Example
Let A = R and consider the partial order
≤ on A. Let B = [0,1). Then,
• Any real number a ≥ 1 is an upper
bound for B.
• Any real number a ≤ 0 is a lower bound
for B.
• inf(B) = 0 and sup(B) = 1.
• B does not have a maximum element,
since 1 = sup(B) /∈ B
• The minimum element of B is 0, since
0 = inf(B) ∈ B
25
Total Order
A partial order R on A is called a total
order, or linear order, on A if any two
elements x and y of A are comparable
(xR y or y R x).
26
Total Order
Examples
• The relation ≤ is a total order on each
of the sets Z+, Z, R. (Alternatively,
we say these sets are totally, or linearly,
ordered by the relation ≤.)
• The relation ⊆ on the set P(A) where
A = {1,2,3} (or any set A with two
or more elements) is not a total order,
since not all pairs of subsets are com-
parable. For example, {1,2} 6⊆ {2,3}and {2,3} 6⊆ {1,2}.
27
Well Ordering
A total order R on a nonempty set A is
called a well ordering on A iff every non-
empty subset B of A contains a smallest
element.
28
Well Ordering
Examples
• The relation ≤ is a well-ordering on the
set Z+, since every collection of pos-
itive integers has a smallest element.
(This is the Well Ordering Principle.)
• The relation ≤ is not a well ordering
on the set Z, since there are subsets
of Z that are unbounded below (e.g.,
A = {. . . ,−3,−2,−1,0} has no smallest
element.)
• The relation ≤ is not a well ordering on
the set R (or even [0,1]), since there
are subsets of R that have no smallest
29
element (e.g., A = (0,1) has no small-
est element.)
Well Ordering
Well-Ordering Theorem
Every set can be well ordered by some total
order relation.
Proof: The proof requires the Axiom of
Choice and will be revisited later.
30
Functions as Relations
Definition
Recall that if A and B are sets, then a re-
lation from A to B is a subset of A×B.
A function from A to B is a relation f
from A to B with the following properties
(i) The domain of f is A.
(ii) If (x, y) ∈ f and (x, z) ∈ f , then y = z.
In other words, for each a ∈ A, there is a
unique element b ∈ B such that (a, b) ∈ f .
1
Function Notation
If f is a function from A to B, we write
f : A→ B,
and we say that A is the domain of f and
B is the codomain of f .
2
Functions
Example: Let A = {1,2,3} and B =
{4,5,6}. Determine which of the follow-
ing relations are functions from A to B..
• R = {(1,4), (2,5), (3,6), (2,6)}
• R = {(1,4), (2,6), (3,5)}
• R = {(1,5), (2,5), (3,4)}
• R = {(1,4), (3,6)}
3
Functions
Example: Let A = {1,2,3} and B =
{4,5,6}. Determine which of the follow-
ing relations are functions from A to B.
• R = {(1,4), (2,5), (3,6), (2,6)}
R is not a function, since R is
not “single-valued:”
(2,5) ∈ R and (2,6) ∈ R
• R = {(1,4), (2,6), (3,5)}
Function
• R = {(1,5), (2,5), (3,4)}
Function
4
• R = {(1,4), (3,6)}
R is not a function from A to B, since
Dom(R) = {1,3} 6= A.
Functions
Example: Let F be the relation from Z to
Z defined by
F = {(x, y) ∈ Z× Z | y = x2}.
Prove that F is a function from Z to Z.
Proof:
5
Functions
Example: Let F be the relation from Z to
Z defined by
F = {(x, y) ∈ Z× Z | y = x2}.
Prove that F is a function Z to Z.
Proof: First we’ll show that Dom(F ) = Z.
Assume x ∈ Z. Let y = x2. Then, y ∈ Z.
Therefore, (x, y) ∈ Z× Z and y = x2, which
means (x, y) ∈ F . Therefore, x ∈ Dom(F ).
This proves Dom(F ) = Z.
Next, we’ll show that F is “single-valued.”
Assume (x, y) ∈ F and (x, z) ∈ F where
x, y, z ∈ Z. Then y = x2 and z = x2. There-
fore y = z. This completes the proof.
6
Functions
Example: Let F be the relation from R
to R defined by
F = {(x, y) ∈ R× R | x = y3}.
Prove that F is a function R to R.
Proof:
7
Functions
Example: Let F be the relation from R
to R defined by
F = {(x, y) ∈ R× R | x = y3}.
Prove that F is a function R to R.
Proof: First we’ll show that Dom(F ) = R.
Assume x ∈ R. Let y = 3√x. Then, y ∈ R.
Therefore, (x, y) ∈ R× R and x = ( 3√x)3 =
y3, which means (x, y) ∈ F . Therefore, x ∈Dom(F ). This proves Dom(F ) = R.
Next, we’ll show that F is “single-valued.”
Assume (x, y) ∈ F and (x, z) ∈ F where
x, y, z ∈ R. Then x = y3 and x = z3. There-
fore y3 = z3. Therefore, y = z. This com-
pletes the proof.
8
Functions
Example: Let F be the relation from R
to R defined by
F = {(x, y) ∈ R× R | x = y2}.
Explain why F is not a function from R to
R.
9
Functions
Example: Let F be the relation from R
to R defined by
F = {(x, y) ∈ R× R | x = y2}.
Explain why F is not a function from R to
R.
Solution:
If (x, y) ∈ F , then x = y2 ≥ 0. Therefore
the domain of F is [0,∞), not R.
Also, F is not single-valued. For example,
when x = 4, we have y = ±2. That is,
(4,2) ∈ F and (4,−2) ∈ F . Hence, F is not
a function.
10
Range of a Function
If f : A → B and the ordered pair (a, b)
belongs to f , then we write
f(a) = b
and we say b the image of a under f .
The range of f , denoted Rng(f), is the set
of all images of elements of A. That is,
Rng(f) = {b ∈ B | (a, b) ∈ f for some a ∈ A}
11
Range of a Function
Example: Find the range of each function.
• F : Z→ Z defined by F (x) = x2.
Rng(F ) = {0,1,4,9,16, . . .}
• F : R→ R defined by F (x) = sin(x).
Rng(F ) = [−1,1]
• F : {1,2,3} → {4,5,6} defined by
F = {(1,5), (2,5), (3,4)}.
Rng(F ) = {4,5}
12
Composition of Functions
Theorem
Assume f : A→ B and g : B → C are func-
tions. Then the composite relation g ◦ f ,
given by
{(x, z) ∈ A×C
∣∣∣ ∃y [(x, y) ∈ f and (y, z) ∈ g]}
is a function from A to C.
14
Proof: Assume f : A → B and g : B → C
are functions. We want to show that the
relation g ◦ f is a function from A to C.
First we want to show that the domain of
g ◦ f is A. Since g ◦ f ⊆ A × C, we have
Dom(g ◦ f) ⊆ A. Conversely, assume x ∈ A.
Since f : A→ B is a function, there exists
y ∈ B such that (x, y) ∈ f . Then, since
g : B → C is a function, there exists z ∈ Csuch that (y, z) ∈ g. Therefore, (x, z) ∈ g◦f ,
which shows x ∈ Dom(g ◦ f). This proves
Dom(g ◦ f) = A.
Next, we want to show that g ◦ f is single-
valued. Assume (x, z1) ∈ g ◦ f and (x, z2) ∈g ◦ f . Then, there exist y1 ∈ B such that
(x, y1) ∈ f and (y1, z1) ∈ g, and there exists
y2 ∈ B such that (x, y2) ∈ f and (y2, z2) ∈ g.
In particular, (x, y1) ∈ f and (x, y2) ∈ f ,
and since f is single-valued, it follows that
y1 = y2. Then, (y1, z1) ∈ g and (y1, z2) =
(y2, z2) ∈ g, and since g is single-valued, it
follows that z1 = z2. This proves g ◦ f is
single-valued.
Therefore, g ◦ f is a function from A to B.
Composition of Functions
Theorem: Assume f : A → B, g : B → C,
and h : C → D are functions. Then,
(h ◦ g) ◦ f = h ◦ (g ◦ f).
That is, composition of functions is asso-
ciative.
15
Proof: By the previous theorem, we have
Dom((h ◦ g) ◦ f) = Dom(f) = A,
Dom(h ◦ (g ◦ f)) = Dom((g ◦ f))
= Dom(f)
= A.
This shows that the domains of (h ◦ g) ◦ fand h ◦ (g ◦ f) are the same. Next, assume
x ∈ A. Then,
((h ◦ g) ◦ f)(x) = (h ◦ g)(f(x))
= h(g(f(x)))
= h((g ◦ f)(x))
= (h ◦ (g ◦ f))(x).
Therefore, (h ◦ g) ◦ f = h ◦ (g ◦ f).
Composition of Functions
Example: Let A = {1,2,3,4,5} and con-
sider the functions f, g : A→ A given by
f = {(2,4), (5,1), (3,2), (1,2), (4,3)}
g = {(4,1), (5,4), (1,2), (2,1), (3,4)}
Determine the following.
(g ◦ f)(1) =
(g ◦ f)(2) =
(g ◦ f)(3) =
(g ◦ f)(4) =
(g ◦ f)(5) =
g ◦ f =
Rng(g ◦ f) =
16
Composition of Functions
Example: Let A = {1,2,3,4,5} and con-
sider the functions f, g : A→ A given by
f = {(2,4), (5,1), (3,2), (1,2), (4,3)}
g = {(4,1), (5,4), (1,2), (2,1), (3,4)}
Determine the following.
(g ◦ f)(1) = g(f(1)) = g(2) = 1
(g ◦ f)(2) = g(f(2)) = g(4) = 1
(g ◦ f)(3) = g(f(3)) = g(2) = 1
(g ◦ f)(4) = g(f(4)) = g(3) = 4
(g ◦ f)(5) = g(f(5)) = g(1) = 2
g ◦ f = {(1,1), (2,1), (3,1), (4,4), (5,2)}
Rng(g ◦ f) = {1,2,4}
17
One-To-One Function
Let f : A → B. We say that f is one-to-
one, or injective, if and only if
(x1, y) ∈ f ∧ (x2, y) ∈ f → x1 = x2
for all x1, x2 ∈ A and y ∈ B.
18
One-To-One Function
Equivalently, f : A → B is one-to-one if
and only if for all x1, x2 ∈ A
f(x1) = f(x2) → x1 = x2
If f is one-to-one, we say f is an injection.
19
Onto Function
Let f : A → B. We say that f is onto,
or surjective, if and only if for each y ∈ Bthere exists x ∈ A such that f(x) = y.
That is, f is onto if and only if the range
of f is equal to the codomain of f .
If f is onto, we say that f is a surjection.
20
Examples
Let A = {1,2,3,4}, B = {a, b, c}, C = {α, β, γ}
Determine if the given functions are one-
to-one, onto, both or neither.
1. f : A→ B defined by
f(1) = a
f(2) = b
f(3) = a
f(4) = b
2. f : B → C defined by
f(a) = β
f(b) = γ
f(c) = α
3. f : B → A defined by
f(a) = 3
f(b) = 1
f(c) = 4
4. f : A→ C defined by
f(1) = α
f(2) = β
f(3) = β
f(4) = γ
21
Proof Strategy
To show f is injective
Show that if f(x) = f(y), then x = y.
To show f is not injective
Show that there exist x and y such that
f(x) = f(y) and x 6= y.
To show f is surjective
Show that for each element y in the codomain
there exists an element x in the domain
such that f(x) = y.
To show f is not surjective
Show there exists an element y in the codomain
such that y 6= f(x) for any x in the domain.
22
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) = 2n− 3
is injective.
23
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) = 2n− 3
is injective.
f is injective.
Proof: For all n,m ∈ Z we have
f(n) = f(m) iff 2n− 3 = 2m− 3
iff 2n = 2m
iff 2n− 2m = 0
iff 2(n−m) = 0
iff (n−m) = 0
iff n = m.
24
In particular, f(n) = f(m) implies n = m
for all n,m ∈ Z, which proves that f is in-
jective.
Note that we did not multiply both sides
of the equation 2n = 2m by 1/2, since the
codomain of f is Z and 1/2 is not an inte-
ger.
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) = 2n− 3
is surjective.
25
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) = 2n− 3
is surjective.
f is not surjective.
The range of f contains only odd integers,
therefore Rng(f) 6= Z. For example,
0 /∈ Rng(f)
since the equation f(n) = 2n − 3 = 0 has
no solution in the domain Z.
26
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) =
n+ 1 if n is odd
n/2 if n is even
is injective.
27
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) =
n+ 1 if n is odd
n/2 if n is even
is injective.
f is not injective.
Let n = 1 and m = 4. Then,
f(n) = f(1) = 1 + 1 = 2,
and
f(m) = f(4) = 4/2 = 2.
Therefore f(m) = f(n), but m 6= n. This
proves f is not injective.
28
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) =
n+ 1 if n is odd
n/2 if n is even
is surjective.
29
Example
Prove or disprove:
The function f : Z→ Z defined by
f(n) =
n+ 1 if n is odd
n/2 if n is even
is surjective.
f is surjective.
Proof: We want to show that for all m ∈ Z
(codomain), there exists n ∈ Z (domain)
such that f(n) = m.
Assume m ∈ Z. Let n = 2m. Then, n is an
even integer. Therefore,
f(n) = n/2 = 2m/2 = m.
30
This proves there exists an integer n, namely
n = 2m, such that f(n) = m. Therefore, f
is surjective.
Note that if n is odd, then f(n) = n + 1
is even. So if m is an even number in the
codomain, then there are both even and
odd values of n that map to m. Either
n = 2m (even) as above, or n = m − 1
(odd), which gives
f(n) = n+ 1 = (m− 1) + 1 = m.
Since the former choice works even in the
case when m is odd, there was no need to
consider the latter choice for n.
Bijection
A function f : A→ B is said to be a bijec-
tion, or one-to-one correspondence if f
is both one-to-one and onto.
Examples
• f : Z→ Z defined by f(n) = n+ 1
• f : R→ R defined by f(x) = 2x
• f : Z+ → Z+ defined by f(n) ={n+ 1 if n is odd
n− 1 if n is even
31
Bijection
Example: Prove that f : R+ → (0,1),
defined by
f(x) =1
1 + x
is a bijection.
32
Proof: We want to show that f is one-to-
one (injective) and onto (surjective).
Step 1. (f is one-to-one.) For all x1, x2 ∈R+ we have
f(x1) = f(x2) iff1
1 + x1=
1
1 + x2
iff 1 + x1 = 1 + x2
iff x1 = x2
In particular, f(x1) = f(x2) implies x1 = x2
for all x1, x2 ∈ R+, which proves that f is
one-to-one.
Step 2. (f is onto.) Let y = 11+x. Solving
for x in terms of y we obtain
x =1
y− 1.
Note that if 0 < y < 1, then
x =1
y− 1 >
1
1− 1 = 0.
Therefore, for all y ∈ (0,1), there exists
x ∈ R+, namely x = 1y − 1, such that
f(x) =1
1 + x=
1
1 + (1y − 1)
=11
y
= y
This proves f is onto.
Therefore, f is a bijection.
Image and Preimage
If f : A→ B and S ⊆ A, then the image of
S under f is the set
f(S) = {b ∈ B | b = f(s) for some s ∈ S}
If T ⊆ B, then the preimage of T is the set
f−1(T ) = {a ∈ A | f(a) ∈ T}
33
Image and Preimage
Example: Consider the function f : R→ R
defined by f(x) = x2.
• codomain of f :
• range of f :
• If S = [−2,3), then f(S) =
• If T = (−1,4], then f−1(T ) =
34
Image and Preimage
Example: Consider the function f : R→ R
defined by f(x) = x2.
• codomain of f : R
• range of f : [0,∞)
• If S = [−2,3), then f(S) = [0,9)
• If T = (−1,4], then f−1(T ) = [−2,2]
35
Image and Preimage
Example: Consider the function f : R→ R
defined by f(x) = |x− 2|.
(a) Let S = [−2,3). Find f(S).
36
(b) Let T = (−1,4]. Find f−1(T ).
Image and Preimage
Let f : A→ B, where A and B are nonempty
sets. Prove that if S1, S2 ⊆ A, then
f(S1 ∪ S2) = f(S1) ∪ f(S2).
37
Proof: First assume y ∈ f(S1 ∪ S2). Then,
there exists an element s ∈ S1 ∪ S2 such
that y = f(s). Therefore y = f(s) for
some s ∈ S1, or y = f(s) for some s ∈S2. That is, y ∈ f(S1) or y ∈ f(S2).
Therefore, y ∈ f(S1) ∪ f(S2). This proves
f(S1 ∪ S2) ⊆ f(S1) ∪ f(S2).
Conversely, assume y ∈ f(S1)∪f(S2). Then,
y ∈ f(S1) or y ∈ f(S2). Therefore, y = f(s)
for some s ∈ S1, or y = f(s) for some s ∈S2. Therefore, there exists s ∈ S1∪S2 such
that y = f(s). This proves f(S1)∪ f(S2) ⊆f(S1 ∪ S2).
Therefore, f(S1) ∪ f(S2) = f(S1 ∪ S2).
38
Image and Preimage
Let f : A→ B, where A and B are nonempty
sets. Prove that if T1, T2 ⊆ B, then
f−1(T1 ∩ T2) = f−1(T1) ∩ f−1(T2)
39
Proof: For all a ∈ A, we have
a ∈ f−1(T1 ∩ T2) iff f(a) ∈ T1 ∩ T2
iff f(a) ∈ T1 and f(a) ∈ T2
iff a ∈ f−1(T1) and a ∈ f−1(T2)
iff a ∈ f−1(T1) ∩ f−1(T2).
Therefore, f−1(T1∩T2) = f−1(T1)∩f−1(T2).
40
Identity Function
Let A be a set. The identity function on
A is the function iA : A→ A defined by
iA(x) = x
for all x ∈ A. That is,
iA = {(x, x) | x ∈ A}.
The identity function iA is one-to-one and
onto, so it is a bijection.
41
Inverse Function
Let f : A→ B be a bijection. The inverse
function of f , denoted by f−1, is the func-
tion that assigns to an element b ∈ B the
unique element a ∈ A such that f(a) = b.
That is,
f−1(b) = a if and only if f(a) = b
If f has an inverse function, we say that f
is invertible.
Note that we use the notation f−1(T ) to
denote the preimage of a set T ⊆ B, even
when f is not invertible.
42
Examples
Let A = {1,2,3,4}, B = {a, b, c}, C = {α, β, γ}.
Determine if each function invertible. If so,
find f−1.
1. f : B → C defined by
f(a) = β
f(b) = γ
f(c) = α
2. f : A→ B defined by
f(1) = a
f(2) = b
f(3) = a
f(4) = b
43
Example
Determine if each function invertible. If so,
find f−1.
1. f : Z→ Z defined by f(n) = n+ 1
2. f : R→ R defined by f(x) = 2x+ 3
3. f : R→ R defined by f(x) = x2
44
Functions with Restricted Domains
If f : A→ B is a function, and D ⊆ A, then
the restriction of f to D, denoted f∣∣∣D
is the function
f∣∣∣D
={
(x, y) ∈ f | x ∈ D}.
If g and h are functions and g is a restric-
tion of h, we say h is an extension of g.
45
Functions with Restricted Domains
Example: Let f : R → R be the function
defined by f(x) = x2. If D = [0,∞), then
f∣∣∣D
={
(x, y) ∈ R× R | y = x2 and x ≥ 0}.
The graph of f∣∣∣D
is shown below.
46
Functions with Restricted Domains
Example: Let f : R → R be the function
defined by f(x) = sin(x). If D = [−π2,π2],
then f |D is given by
{(x, y) ∈ R×R | y = sin(x) and −
π
2≤ x ≤
π
2
}.
The graph of f∣∣∣D
is shown below.
47
Piecewise-Defined Functions
If f1 : A1 → B1 and f2 : A2 → B2 are func-
tions, and A1 ∩ A2 = Ø, then the function
f : A1 ∪A2 → B1 ∪B2 defined by
f(x) =
f1(x) if x ∈ A1,
f2(x) if x ∈ A2.
is called a piecewise-defined function.
As a set of ordered pairs, note that
f = f1 ∪ f2.
48
Piecewise-Defined Functions
Example: f(x) = |x|
The absolute value function, denoted by
f(x) = |x| is the piecewise defined function
|x| =
x if x ≥ 0,
−x if x < 0.
In other words,
f(x) =
f1(x) if x ∈ [0,∞),
f2(x) if x ∈ (−∞,0).
where f1 : [0,∞)→ R and f2 : (−∞,0)→ R
are defined by f1(x) = x and f2(x) = −x.
49
Characteristic Functions
Let U be the universal set, and let A ⊆ U .
Then, χA : U → R, defined by
χA(x) =
1 if x ∈ A
0 if x ∈ U −A
is called the characteristic function on A.
50
Characteristic Functions
Example
Let U = R and let A = [0,1]. Then,
χ[0,1] : R→ R, is given by
χ[0,1](x) =
1 if x ∈ [0,1]
0 otherwise
51
Piecewise-Defined Functions
More generally, if
F = {fα : Aα → Bα | α ∈∆}
is a family of functions with pairwise dis-
joint domains {Aα | α ∈∆}, then
f =⋃α∈∆
fα
is the piecewise-defined function
f(x) = fα(x) iff x ∈ Aα.
52
Piecewise-Defined Functions
Example f(x) = bxc
Let Ak = [k, k + 1) for each k ∈ Z, and let
fk : Ak → R be the constant function
fk(x) = k.
Then, the greatest integer function or
floor function, denoted f(x) = bxc is the
piecewise defined function
f =⋃k∈Z
fk
That is,
bxc = k iff x ∈ Ak.
53
Sequence
Let S be a set. A sequence with values
in S is a function s : Z+ → S. If n ∈ Z+,
then s(n) ∈ S represents the nth term in
the sequence, which we denote by sn.
57
Sequence
Example
Let S = R, and let s : Z+ → S be the
function defined by s(n) = 2−n. Then s
corresponds to the sequence
s1 =1
2,
s2 =1
4,
s3 =1
8,
s4 =1
16,
s5 =1
32,
...
58
Cardinality of Sets
Cardinality
We say the sets A and B have the same
cardinality if and only if there is a one-to-
one correspondence (bijection) from A to
B. When A and B have the same cardinal-
ity, we write |A| = |B|.
1
Cardinality
If there is a one-to-one function from A to
B, the cardinality of A is less than or the
same as the cardinality of B and we write
|A| ≤ |B|. Moreover, when |A| ≤ |B| and
A and B have different cardinality, we say
that the cardinality of A is less than the
cardinality of B and we write |A| < |B|.
2
Countable Set
A set that is either finite or has the same
cardinality as the set of positive integers
Z+ is called countable. A set that is not
countable is called uncountable.
When an infinite set S is countable, we de-
note the cardinality of S by ℵ0 (where ℵ is
aleph, the first letter of the Hebrew alpha-
bet). We write |S| = ℵ0 and say that S has
cardinality aleph null.
3
Countable Set
Example: Prove the set of odd positive
integers is a countable set.
Solution: Let O = {1,3,5, . . .} be the
set of odd positive integers. To show O
is countable we must find a bijection from
Z+ to O.
The function f : Z+ → O defined by
f(n) = 2n− 1
is a bijection. Hence O is a countable set.
4
Countable Set
Hilbert’s Grand Hotel
Consider a “Grand Hotel”, which has a count-
ably infinite number of rooms, numbered
1,2,3, . . .
Question: How can we accommodate a
new guest arriving at a fully occupied Grand
Hotel without removing any of the current
guests?
5
Countable Set
Hilbert’s Grand Hotel
Question: How can we accommodate a new guest
arriving at a fully occupied Grand Hotel without re-
moving any of the current guests?
Solution: Because the rooms of the Grand Hotel
are countable, we can list them as Room 1, Room
2, Room 3, and so on. When a new guest arrives,
we move the guest in Room 1 to Room 2, the guest
in Room 2 to Room 3, and in general, the guest in
Room n to Room n + 1, for all positive integers n.
This frees up Room 1, which we assign to the new
guest, and all the current guests still have rooms.
6
Countable Set
Hilbert’s Grand Hotel
Equivalent problem: Show that the union of count-
able set and a singleton set is countable.
Solution: Let A be a countable set. Then, there is
a bijective function f : Z+ → A. Let A = {a1, a2, a3, . . .}where we define an = f(n) for all n ∈ Z+.
Let the singleton set be represented by {a0}. Then,
the function g : Z+ → A∪{a0} defined by g(n) = an−1
is a bijection, which shows that A∪{a0} is countable.
(To relate this problem to the previous one, think
of A as the set of hotel guests and a0 as the new
guest. Then, prior to the arrival of a0, f(n) = an
means room n is occupied by guest an.)
7
Countable Set
Example: Prove the set of integers is
countable.
Solution: Consider the function f : Z+ →Z defined by
f(n) =
n
2if n is even
−(n− 1)
2if n is odd
Since f is a bijection, this shows that the
set Z is countable.
8
Countable Set
Example: Prove the set of positive ratio-
nal numbers is countable.
Solution: While we will not give an ex-
plicit bijective function from Z+ to Q+, we
will show how to list the positive rationals
as a sequence {r1, r2, r3, . . .}. First we ar-
range the rationals in an infinite grid as
shown below, where the ith row contains
the sequence {1i ,
2i ,
3i , . . .}
9
1
1
2
1
3
1
4
1
5
1· · ·
1
2
2
2
3
2
4
2
5
2· · ·
1
3
2
3
3
3
4
3
5
3· · ·
1
4
2
4
3
4
4
4
5
4· · ·
1
5
2
5
3
5
4
5
5
5· · ·
...
We first list the positive rational numbers
p/q with p + q = 2, followed by those with
p+ q = 3, followed by those with p+ q = 4,
and so on, following the path shown above.
Whenever we encounter a number p/q that
is already listed (e.g. 2/2), we do not list
it again.
Since Q+ can be represented as a sequence,
it is a countable set.
Uncountable Set
Example: Prove the set of real numbers
is uncountable.
Solution: The proof relies on a Cantor
diagonalization argument. Assume for
the sake of contradiction that R is count-
able. Then, the subset (0,1) must also be
countable and can be represented as se-
quence of numbers
r1 = 0. d11 d12 d13 d14 . . .
r2 = 0. d21 d22 d23 d24 . . .
r3 = 0. d31 d32 d33 d34 . . .
r4 = 0. d41 d42 d43 d44 . . .
...
10
Then, form a new real number with dec-
imal expansion r = 0.d1 d2 d3 d4 . . ., where
the decimal digits are determined by the
following rule:
di ={
4 if dii 6= 4
5 if dii = 4
Therefore, the real number r is not equal to
any of the numbers {r1, r2, r3, . . .} because
the decimal expansion of r differs from the
decimal expansion of ri in the ith place to
the right of the decimal point, for each i.
Because there is a real number r between 0
and 1 that is not in the list, the assumption
that all the real numbers between 0 and 1
could be listed must be false. Therefore,
all the real numbers between 0 and 1 can-
not be listed, so the set of real numbers
between 0 and 1 is uncountable.
Countable Set
Theorem: If A and B are countable sets,
then A ∪B is also countable.
11
Countable Set
Example: Prove the set of positive inte-
gers not divisible by 4 is a countable set.
12