0% found this document useful (0 votes)
54 views51 pages

MATH 1240: Elementary Discrete Math Notes

Uploaded by

wendee1911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views51 pages

MATH 1240: Elementary Discrete Math Notes

Uploaded by

wendee1911
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Elementary Discrete Mathematics

Notes for MATH 1240


Elementary Discrete Mathematics
Notes for MATH 1240

Andrii Arman
University of Manitoba

Robert Craigen
University of Manitoba

Michelle Davidson
University of Manitoba

Karen Gunderson
University of Manitoba

November 6, 2024
©2024 Robert Craigen, Michelle Davidson, Karen Gunderson2
This work is licensed under Creative Commons Attribution-NonCommercial-
ShareAlike 4.0 International. To view a copy of this license, visit https://
[Link]/licenses/by-nc-sa/4.0/.
Contents

1 Introduction 1
1.1 Review . . . . . . . . . . . . . . . . . . . . . 2

2 Fundamentals of Logic 4
2.1 Logical propositions and truth tables. . . . . . . . . . . 4
2.2 Laws of logic . . . . . . . . . . . . . . . . . . . 5
2.3 Logical implication . . . . . . . . . . . . . . . . . 7
2.4 Quantifiers . . . . . . . . . . . . . . . . . . . . 8
2.5 Definitions and proofs . . . . . . . . . . . . . . . . 9
2.6 Principle of mathematical induction . . . . . . . . . . . 10
2.7 Recursive definitions. . . . . . . . . . . . . . . . . 12

3 Set Theory 13
3.1 Sets and subsets . . . . . . . . . . . . . . . . . . 13
3.2 Cartesian Products . . . . . . . . . . . . . . . . . 14
3.3 Set operations and laws . . . . . . . . . . . . . . . 14

4 Properties of the Integers 16


4.1 Divisibility and prime numbers . . . . . . . . . . . . . 16
4.2 Greatest common divisors and the Euclidean algorithm . . . . 19
4.3 Fundamental theorem of arithmetic . . . . . . . . . . . 21

5 Principles of Counting 22
5.1 Rules of Sum and Product . . . . . . . . . . . . . . 22
5.2 Permutations . . . . . . . . . . . . . . . . . . . 22
5.3 Combinations and the Binomial Theorem . . . . . . . . . 23
5.4 Cardinalities of unions . . . . . . . . . . . . . . . . 24

6 Graph Theory 25
6.1 Graphs, vertices, and edges . . . . . . . . . . . . . . 25
6.2 Special graphs and new graphs from old . . . . . . . . . 27
6.3 Adjacency, neighbourhoods, and degrees . . . . . . . . . 28
6.4 Graph isomorphism . . . . . . . . . . . . . . . . . 30
6.5 Walks and connected graphs . . . . . . . . . . . . . . 30
6.6 Trees . . . . . . . . . . . . . . . . . . . . . . 32

iv
CONTENTS v

7 Functions and cardinality 34


7.1 Function images and pre-images . . . . . . . . . . . . 34
7.2 Composition and inverses . . . . . . . . . . . . . . . 35
7.3 Functions on finite sets and the Pigeonhole principle . . . . . 35
7.4 Countable and uncountable sets . . . . . . . . . . . . 36

8 Relations 37
8.1 Relations . . . . . . . . . . . . . . . . . . . . . 37
8.2 Properties of relations . . . . . . . . . . . . . . . . 37
8.3 Equivalence relations . . . . . . . . . . . . . . . . 38

9 Modular Arithmetic 39
9.1 Integers modulo n and modular arithmetic . . . . . . . . 39

Appendices

A List of Definitions and Theorems 40

B List of Proof templates 44

Back Matter

References 45
Chapter 1

Introduction

This document contains the precise statements of definitions and theorems


used in this course. It will be used together with your lecturer’s notes and
the recommended textbook to present the material in the course. This docu-
ment is a slight edit from previous documents called Local Notes [1, 3]. The
content is based on the textbook by Grimaldi [4], and lecture notes from previ-
ous years by R. Borgersen, R. Craigen, M. Davidson, M. Doob, T. Ghaswala,
K. Gunderson, J. Nir, E. Timko, and C.M. van Bommel [2] and notes by
D. Gunderson [5].
The Grimaldi textbook will be used as a source for exercises, further expla-
nations and examples, and an alternative presentation of the concepts in this
course. Based on their expertise in the subject area and experience teaching
this course, your instructors have compiled this document as a list of precise
definition statements and core theorems for this course. Do note that these
will sometimes differ from what is given in the Grimaldi textbook (or other
references). We have endeavoured to make the definitions and theorems in this
document as precise as possible, within the scope of the course, and to be as
consistent as possible with modern usage that you will see in further courses
in Mathematics, Computer Science, Statistics, or others in the mathematical
sciences. The definitions and theorems stated in this document are the final
arbiter of which is accepted in this course; you may lose marks by failing
to conform to the conventions, definitions and notations used herein. You are
expected to learn the statements of all theorems and the exact statement of
all definitions, and to use notation introduced here, correctly, as appropriate,
on quizzes, tests, and exams. In many cases, no other forms will be accepted
even if considered correct in another context.
Despite occasional differences you will find the exposition, examples, proofs,
and exercises found in Grimaldi helpful in learning and practising the material
in this course.
This document is currently considered complete for this term, however edits
may be considered during the term. Therefore it is expected that occasional
changes happen even after a topic is covered in class, and however unlikely, it
may be that the numbering of some items might change during the term. The
most up-to-date revision of this document will always be available
on UMLearn, and you should be careful to always work from that version.
On assessments, you may be asked to state the definitions of any of the
terms given in this document or to state any of the theorems. Unless otherwise
indicated, you may also be asked to provide proofs of the theorems or proofs
of similar statements.

1
CHAPTER 1. INTRODUCTION 2

1.1 Review
1.1.1 Sigma Notation
Pn
Notation 1.1.1 Sigma notation. The sigma notation expression i=1 Xi ,
X
n
also written Xi , is an abbreviation for the expression X1 + X2 + · · · + Xn ;
i=1
that is, the sum of terms X1 , X2 , . . . , Xn .

1.1.2 Set Theory Basics


Definition 1.1.2 Universe. A universe is a collection of objects, out of
which other collections of objects may be formed. “The universe” in any context
is either understood, a priori, to be some default collection (such as the real
numbers, or the integers), or it may be explicitly specified. In some contexts
one may refer (explicitly) to more than one universe. ♢
Definition 1.1.3 Set, element. A set S is a collection of items in some
universe. These items are called elements of S. If x is an element of S, write
x ∈ S (read “x in S”) and if x is not an element of S, write x ∈ / S (read “x is
not in S”). It is understood that the elements of a set come from some universe
U , and that for any x ∈ U it is possible to determine whether or not x ∈ S. ♢
Notation 1.1.4 Set notation. A set can be specified by listing its elements
in braces (e.g. A = {2, 3, 5, 6}).
Another approach is to use set builder notation: A = {x | p(x)} where
the open statement p(x) asserts a condition equivalent to membership in A or
relative to previously defined sets in the form A = {x ∈ S | p(x)}, adding that
x is restricted to set S.
Note that sets are unordered—the set {1, 2, 7} is the same as the set {7, 1, 2}.
Example 1.1.5 Set example. There can be many ways to denote the same
set:
B = {x | x is an integer and −3 ≤ x ≤ 2}
= {x ∈ Z | −3 ≤ x ≤ 2}
= {−3, −2, −1, 0, 1, 2}
= {0, 1, −1, 2, −2, −3}.

Definition 1.1.6 Standard sets. Some standard notations for sets:

Real numbers R
Integers Z = {0, ±1, ±2, . . .}
na o
Rational Q= | a, b ∈ Z, b ̸= 0
numbers b
CHAPTER 1. INTRODUCTION 3

Intervals • [a, b] = {x ∈ R | a ≤ x ≤ b}
• (a, b) = {x ∈ R | a < x < b}

• [a, b) = {x ∈ R | a ≤ x < b}
• (a, b] = {x ∈ R | a < x ≤ b}
• [a, ∞) = {x ∈ R | a ≤ x}

• (a, ∞) = {x ∈ R | a < x}
• (−∞, b) = {x ∈ R | x < b}
• (−∞, b] = {x ∈ R | x ≤ b}
• (−∞, ∞) = R (doubly infinite)

The positive integers are denoted Z+ = {1, 2, 3, . . .} = {x ∈ Z | x > 0}.


Similarly, Q+ and R+ denote the positive rational numbers and positive real
numbers, respectively. The nonnegative integers, real numbers, rationals (etc)
may be denoted Z≥0 , Q≥0 , R≥0 (etc). ♢

1.1.3 Standard Function Definitions


Definition 1.1.7 Function. Suppose X and Y are sets. A function f from
X to Y , denoted f : X → Y (read “f maps X to Y ”), is a rule that assigns to
each element of X a unique element of Y . That is, for each x ∈ X, there is a
unique y ∈ Y with f (x) = y (“f (x)” is read “f of/at/evaluated at x”). X is
the domain of f and Y is the co-domain of f . The range of f is the set
{y ∈ Y | for some x ∈ X, f (x) = y}. ♢
Definition 1.1.8 Onto or surjection. A function f : X → Y is called onto
(or a surjection) if for every y ∈ Y , there is at least one x ∈ X with f (x) = y.

Definition 1.1.9 One-to-one or injection. A function f : X → Y is
called one-to-one (or 1:1 or an injection) if for every a, b ∈ X with a ̸= b,
f (a) ̸= f (b). ♢
Definition 1.1.10 Bijection. A function that is both one-to-one and onto
is called a bijection. ♢
Chapter 2

Fundamentals of Logic

2.1 Logical propositions and truth tables


Note: Grimaldi uses the term “statement” where we use the more standard
term “proposition”. Be aware of this reading when Grimaldi’s section on Logic
and translate accordingly. In a few places “statement” can be problematic as
it leads to interpretation difficulties.
Definition 2.1.1 Proposition. A proposition is a declarative sentence
that is either true or false. ♢
In the following definitions, p and q represent propositions. We shall use
the convention of using 0 to represent “false” and 1 to represent “true”. With
this, we can present the possible truth values of a proposition in a table called
a truth table.
Definition 2.1.2 Negation. The negation of p, ¬p (read “not p”), is true
if and only if the proposition p is false.

p ¬p
0 1
1 0

Definition 2.1.3 Conjunction. The conjunction of p and q, p ∧ q (read
“p and q”), is true if and only if both p and q are true.

p q p∧q
0 0 0
0 1 0
1 0 0
1 1 1

Definition 2.1.4 Disjunction. The disjunction of p and q, p ∨ q (read “p
or q”), is true if and only if p is true or q is true (or both are true).
p q p∨q
0 0 0
0 1 1
1 0 1
1 1 1

4
CHAPTER 2. FUNDAMENTALS OF LOGIC 5


Definition 2.1.5 Implication. The implication p → q (read “p implies q”
or “if p, then q”) is true if and only if p being true implies q is true.

p q p→q
0 0 1
0 1 1
1 0 0
1 1 1

Definition 2.1.6 Biconditional. The biconditional p ↔ q (read “p if and
only if q”) is true if and only if (p → q) and (q → p) are both true.
The phrase “if and only if” is commonly abbreviated “iff”.

p q p↔q
0 0 1
0 1 0
1 0 0
1 1 1

Definition 2.1.7 Compound and primitive propositions. A proposition
is called a compound proposition if it is formed by connecting two propo-
sitions with conjunction, disjunction, implication, or biconditional or by the
negation of a proposition. A proposition that is not a compound proposition
is called a primitive proposition. The primitive propositions used in the
formation of a compound proposition are called its components. ♢
Remark 2.1.8 When building compound propositions from other compound
propositions, parentheses are required to make the definition unambiguous. For
example, the disjunction of the propositions a ∧ b and c is written (a ∧ b) ∨ c.
These are required as the proposition (a ∧ b) ∨ c is different from a ∧ (b ∨ c).
The expression a ∧ b ∨ c is ambiguous and ‘ill-formed’. The convention is that
¬ negates the first proposition to its right in an expression so for example,
¬p → q is unambiguous: It means (¬p) → q, not ¬(p → q).
In Section 2.2 we shall see some situations where some further parentheses
can be dropped.
Definition 2.1.9 Tautology and Contradiction. A compound proposition
is a tautology if and only if it is true for all truth value assignments of its
components. A tautology is usually denoted T0 .
A compound proposition is a contradiction if and only if it is false for all
truth value assignments of its components. A contradiction is usually denoted
by F0 . ♢

2.2 Laws of logic


Definition 2.2.1 Logical equivalence. Propositions s1 and s2 are logically
equivalent (written s1 ⇔ s2 ) if s1 is true whenever s2 is true, and vice versa.

Remark 2.2.2 Alternatively, we can say that propositions s1 and s2 are logi-
cally equivalent if and only if the proposition s1 ↔ s2 is a tautology.
CHAPTER 2. FUNDAMENTALS OF LOGIC 6

Definition 2.2.3 Converse, inverse and contrapositive of an implica-


tion. For the implication p → q:
• the converse implication is q → p.

• the contrapositive implication is ¬q → ¬p.


• the inverse implication is ¬p → ¬q.

Theorem 2.2.4 The Laws of Logic. For any propositions p, q, r:

Law of Double ¬¬p ⇔ p


Negation
DeMorgan’s ¬(p ∨ q) ⇔ ¬p ∧ ¬q
Laws ¬(p ∧ q) ⇔ ¬p ∨ ¬q
Commutative p∨q ⇔q∨p
Laws p∧q ⇔q∧p
Associative p ∧ (q ∧ r) ⇔ (p ∧ q) ∧ r
Laws p ∨ (q ∨ r) ⇔ (p ∨ q) ∨ r
Distributive p ∨ (q ∧ r) ⇔ (p ∨ q) ∧ (p ∨ r)
Laws p ∧ (q ∨ r) ⇔ (p ∧ q) ∨ (p ∧ r)
Idempotent p∨p⇔p
Laws p∧p⇔p
Identity Laws p ∨ F0 ⇔ p
p ∧ T0 ⇔ p
Inverse Laws p ∨ ¬p ⇔ T0
p ∧ ¬p ⇔ F0
Domination p ∨ T0 ⇔ T0
Laws p ∧ F0 ⇔ F 0
Absorption p ∨ (p ∧ q) ⇔ p
Laws p ∧ (p ∨ q) ⇔ p

Remark 2.2.5 Given the Associative Laws for both conjunction and disjunc-
tion, it is common place to drop the parentheses in compound expressions
where all connectives are conjunctions or all connective are disjunctions. The
expression p ∧ q ∧ r is used to mean either p ∧ (q ∧ r) or (p ∧ q) ∧ r (which are
logically equivalent). Similarly, p ∨ q ∨ r is used to mean either p ∨ (q ∨ r) or
(p ∨ q) ∨ r.
Theorem 2.2.6 Implication as disjunction.

p → q ⇔ ¬p ∨ q
Theorem 2.2.7 Contrapositive of an implication.

p → q ⇔ ¬q → ¬p
Note that applying Theorem 2.2.7 to the converse of a proposition shows
that the converse of p → q (which is q → p) is logically equivalent to the inverse
of p → q (which is ¬p → ¬q). However, one can check (for example using truth
tables) that an implication is not logically equivalent to either its converse nor
its inverse.
CHAPTER 2. FUNDAMENTALS OF LOGIC 7

2.3 Logical implication


Definition 2.3.1 Argument, premise, conclusion, validity. Given
propositions p1 , p2 , . . . , pn , q, the compound proposition (p1 ∧ p2 ∧ · · · ∧ pn ) → q
is called an argument, also denoted as follows:
p1 • p1 , …, pn are the premises.
p2 • q is the conclusion.
..
.
• The argument is called valid iff
pn
the conclusion is true whenever all
q of the premises are true.

Definition 2.3.2 Logical implication. p logically implies proposition q,
written p ⇒ q, if the proposition p → q is a tautology. ♢
Theorem 2.3.3 Rules of Inference. For any propositions p and q, each
rule of inference in the following list is a valid argument.
Each named rule in the following list is presented as an argument and its
associated implication.
• Modus Ponens.
p [p ∧ (p → q)] ⇒ q
p→q
q
• Law of Syllogism.
p→q [(p → q) ∧ (q → r)] ⇒ (p →
q→r r)
p→r
• Modus Tollens.
p→q [(p → q) ∧ ¬q] ⇒ ¬p
¬q
¬p
• Rule of Disjunctive Syllogism.
p∨q [(p ∨ q) ∧ ¬p] ⇒ q
¬p
q
• Rule of Conjunctive Simplification.
p∧q (p ∧ q) ⇒ p
p
• Rule of Contradiction.
¬p → F0 (¬p → F0 ) ⇒ p
p
• Rule of Proof by Cases.
p→r [(p → r) ∧ (q → r)] ⇒ [(p ∨
q→r q) → r]
(p ∨ q) → r
CHAPTER 2. FUNDAMENTALS OF LOGIC 8

• Rule of Conjunction.
p (p ∧ q) → (p ∧ q)
q
p∧q
• Rule of Disjunctive Amplification.
p p ⇒ (p ∨ q)
p∨q
• Rule of Conditional Proof.
p∧q [(p ∧ q) ∧ [p → (q → r)]] ⇒ r
p → (q → r)
r
• Rule of the Constructive Dilemma.
p→q [(p → q)∧(r → s)∧(p∨r)] ⇒
r→s (q ∨ s)
p∨r
q∨s
• Rule of the Destructive Dilemma.
p→q [(p → q) ∧ (r → s) ∧ (¬q ∨
r→s ¬s)] ⇒ (¬p ∨ ¬r)
¬q ∨ ¬s
¬p ∨ ¬r
Proof template 2.3.4 Proof template for proof by rules of inference.
In a proof of the validity of an argument by the rules of inference, the format
is numbered lines given in two columns. The left column contains statements
and the right column contains justifications. The last line of the proof is the
conclusion of the argument.
• Premises are introduced with justification Premise.

• Statements that are logically equivalent to an earlier statement are justi-


fied by the appropriate Law of Logic and a reference to the line number
of the earlier statement.
• Statements that are the conclusion of a rule of inference are justified by
the appropriate Rule of Inference and a reference to the line numbers of
the premises.

2.4 Quantifiers
Definition 2.4.1 Open statement. A declarative sentence is an open
statement if
• It contains one or more variables.

• Replacing variables with allowable values makes it a proposition.



Note that both the Grimaldi textbook and previous versions of the Local
Notes included a condition that an open statement not be itself a proposition.
CHAPTER 2. FUNDAMENTALS OF LOGIC 9

This requirement could cause problems for us later. In particular, we often


define statements that contain variables and we would like to prove that they
are true for all input of variables from the allowable universe. It will be a
convention to call these open statements also.
Definition 2.4.2 Universal and existential quantifiers. There are two
types of quantifiers which may be added to an open statement in order to
specify whether a variable refers to one, generally unspecified, value, or all
values:
• Existential quantifiers: The existential quantifier applied to p(x), de-
noted ∃xp(x) (read “for some x” or “for at least one x” or “there exists
an x such that” p(x)) is true if and only if p(x) is true for at least one
value of x.
• Universal quantifiers: The universal quantifier applied to p(x), de-
noted ∀xp(x) (read “for all x” or “for any x” or “for each x” p(x)) is true
if and only if p(x) is true for all possible values of x.

The scope of a quantifier is the open statement immediately to its right in


an expression and it is said to quantify the specified variable throughout that
expression. ♢
Remark 2.4.3 Parentheses are required when applying quantifiers to com-
pound statements. For example, the universal quantifier applied to the open
statement q(x) → p(x) should be written as ∀x(q(x) → p(x)). The expression
∀xq(x) → p(x) may be ambiguous.
Definition 2.4.4 Free and bound variables. In an expression, a variable
x is a bound variable if it is in the scope of a quantifier (∃x or ∀x). Otherwise
x is a free variable. ♢
Remark 2.4.5 If all variables of an open statement are bound by quantifiers,
then that expression is a proposition, otherwise it is an open statement. For
example, given p(x, y), an open statement involving variables x and y, then
∃xp(x, y) which quantifies x leaving y free is regarded as open.
Multiple quantifiers can bind distinct variables in an open statement. For
example ∀x ∃y p(x, y) is understood to be the proposition ∀x (∃ yp(x, y)).
When multiple quantifiers are of the same type, then order will not matter.
That is ∀x ∀y p(x, y) ⇔ ∀y ∀x p(x, y), and ∃x ∃y p(x, y) ⇔ ∃y ∃x p(x, y). In
these cases, the shorthand ∀x, y p(x, y), and ∃x, y p(x, y) are used respectively.
When multiple quantifiers are not of the same type, then order will matter.
For example ∀x ∃y p(x, y) is is distinct from, and may be logically inequivalent
to, ∃ y∀ xp(x, y).
Theorem 2.4.6 Rules for negating propositions with one quantifier.
For any open statement p(x), involving only the variable x:

¬[∀x p(x)] ⇔ ∃x ¬p(x)


¬[∃x p(x)] ⇔ ∀x ¬p(x)

2.5 Definitions and proofs


Theorem 2.5.1 Rule of universal generalization. If an open statement
p(x) is proved to be true when x is replaced by any arbitrarily chosen element
c from the universe, then the universally quantified proposition ∀x p(x) is true.
CHAPTER 2. FUNDAMENTALS OF LOGIC 10

Theorem 2.5.2 Rule of universal specification. If an open statement


becomes true for all replacements by the members in a given universe, then that
open statement is true for each specific individual member in that universe.
Proof template 2.5.3 Template for a direct proof. To prove a statement
p → q directly:
1. Introduction: Assume p is true. Introduce all necessary variables.
2. Justification: Use definitions and previously proven results to deduce q.

3. Conclusion: Conclude that p → q is true.


Proof template 2.5.4 Template for a proof by contradiction. To prove
a statement p → q by contradiction:
1. Introduction: Assume p is true and that q is false. Introduce all necessary
variables.

2. Justification: Use definitions and previously proven results to deduce a


contradiction (often deducing both r and ¬r for some statement r).
3. Conclusion: Conclude that p → q is true.

2.6 Principle of mathematical induction


Remark 2.6.1 Proving the Principle of Mathematical Induction requires con-
siderations of the axioms (foundational assumptions) of the integers, not cov-
ered by this course. For more information, read about the ‘Well-Ordering Prin-
ciple’ (§4.1 in Grimaldi) and the historical review at the end of the chapter
(§4.6).
Theorem 2.6.2 Principle of Mathematical Induction. Suppose N ∈ Z
and let p(n) be an open statement defined for the (integer) variable n ≥ N . If
(i) p(N ) is true, and
(ii) ∀k ≥ N , p(k) → p(k + 1) is true
then ∀n ≥ N , p(n) is true.
Definition 2.6.3 Base step, inductive step, inductive hypothesis. In a
proof invoking the Principle of Mathematical Induction, (i) is called the base
step, (ii) is called the inductive step and within the inductive step, p(k) is
called the inductive hypothesis. ♢
Theorem 2.6.4 Principle of Mathematical Induction – strong form.
Let S(n) be an open statement involving one or more occurrences of the variable
n, and let n0 , n1 ∈ Z+ with n0 ≤ n1 . Suppose that
1. S(n0 ), S(n0 + 1), S(n0 + 2), . . . , S(n1 − 1), S(n1 ) are true, and

2. For any k ≥ n1 , k ∈ Z+ , if we assume that S(n0 ), . . . , S(k) are all true,


 + 1) is also true (that is, S(n0 ) ∧ S(n0 + 1) ∧
then it follows that S(k
· · · ∧ S(k − 1) ∧ S(k) → S(k + 1) ).

then for all n ≥ n0 , n ∈ Z+ , S(n) is true.


Proof template 2.6.5 Template for an induction proof.
• Introduction: For all n ≥ N let S(n) be the statement “[open statement
CHAPTER 2. FUNDAMENTALS OF LOGIC 11

involving n]”

• Base case: S(N ) is true because . . . [Justification]


• Inductive step
◦ Inductive hypothesis (IH): Let k ≥ N and suppose S(k) is true;
◦ [justification, stating “(by IH)” where appropriate] and so S(k + 1)
is true.
◦ Conclusion of induction step: Therefore S(k) → S(k + 1)
• PMI conclusion: By the Principle of Mathematical Induction, S(n) is
true for all integers n ≥ N .
Remark 2.6.6 Notes on induction proofs.
1. The end of the induction step generally does not show the implied appli-
cation of the Law of Universal Generalization: ∀x ≥ N, S(x) → S(x + 1).
Stating this step explicitly is optional.
2. Italicized elements in square parentheses are for you to supply, and will
depend on the specifics of the thing being proven.
3. Underlined elements are headings explaining the template. Showing some
or all these is optional.
4. All other elements of the template must appear in an induction proof
in this course; equivalent wording is acceptable but we recommend ex-
actly as shown or close to it. If you miss any essential part or restate
things so the meaning is different you may lose marks! Obviously names
(N, n, k, x, S) are arbitrary; other names may be used.
5. Some find it helpful not merely to write “S(k)” in the inductive hypothesis
but to write out S(k) in full. This is optional.
6. Some also find it helpful to state, immediately afterwards, “S(k + 1) says
...”. This shows you where you are going. You may do this but it is
important to avoid invoking S(k + 1) as an assumption at any point! If
you do so it invalidates the inductive step. If it even has the appearance
that you are making such assumption, you may lose marks in this course.
Proof template 2.6.7 Template for a strong induction proof.
• Introduction: For all n ≥ n0 let S(n) be the statement “[open statement
involving n]”
• Base case: S(n0 ), . . . , S(n1 ) are true because . . . [Justification]

• ◦ Inductive hypothesis (IH): Let k ≥ n1 and suppose S(n0 ), S(n0 +


1), . . . , S(k) are true;
◦ [justification, stating “(by IH)” where appropriate] and so S(k + 1)
is true.
◦ Conclusion of induction step: Therefore (S(n0 ) ∧ · · · ∧ S(k)) →
S(k + 1)
• PMI conclusion: By the Principle of Mathematical Induction, S(n) is
true for all integers n ≥ n0 .
CHAPTER 2. FUNDAMENTALS OF LOGIC 12

2.7 Recursive definitions


Definition 2.7.1 Fibonacci numbers. The Fibonacci numbers
F0 , F1 , . . . are the sequence defined recursively by

• F0 = 0, F1 = 1, and
• for n > 1, Fn = Fn−1 + Fn−2 .

Chapter 3

Set Theory

Recall the definitions in Definition 1.1.2, Definition 1.1.3, Notation 1.1.4, and
Definition 1.1.6

3.1 Sets and subsets


Definition 3.1.1 subsets, set equality, proper subsets. If C, D are sets
with elements from a universe U , then
• C is a subset of D, denoted C ⊆ D, if every element of C is an element
of D. (Formally: ∀x[(x ∈ C) → (x ∈ D)])
• C and D are equal, denoted C = D, if C ⊆ D and D ⊆ C. (Formally:
(C ⊆ D) ∧ (D ⊆ C); equivalently, ∀x[(x ∈ C) ↔ (x ∈ D)].) If C and D
are not equal, write C ̸= D.
• C is a proper subset of D, denoted C ⊊ D, if C ⊆ D and C ̸= D.
(Formally: (C ⊆ D) ∧ ¬(C = D))

Definition 3.1.2 empty set, null set. The empty set, denoted ∅, is the
set containing no elements. This is also called the null set. ♢
Definition 3.1.3 Power set of A. For any set A from the universe U , the
power set of A, denoted P(A), is the collection of all subsets of A. In set
notation,
P(A) = {B ⊆ U | B ⊆ A}.

Definition 3.1.4 Finite sets, Cardinality. If A is a set from the universe
U , then A is finite iff either A = ∅ or there is an n ∈ Z+ and distinct elements
a1 , a2 , . . . , an ∈ U such that A = {a1 , a2 , . . . , an }, and the cardinality of A is
the number of elements in A, denoted |A| = n. If A = ∅, then the cardinality
of A is defined as |A| = 0.
A set that is not finite is said to be infinite. ♢
In the case that a set A is infinite, we do not assign a value to |A| here.
There is some discussion of cardinalities of infinite sets in Section 7.4.

13
CHAPTER 3. SET THEORY 14

3.2 Cartesian Products


Definition 3.2.1 Cartesian product. The Cartesian product of A and B,
written A × B:
A × B = {(a, b) | a ∈ A and b ∈ B}.

Definition 3.2.2 n-fold product of sets. The n-fold product of
A1 , A2 , . . . , An is

A1 × A2 × · · · × An = {(a1 , a2 , . . . , an ) | ai ∈ Ai , 1 ≤ i ≤ n}.


Notation 3.2.3 For a set A, the n fold product A1 × A2 × · · · × An where for
all 1 ≤ i ≤ n, A = Ai is sometimes denoted Ak .

3.3 Set operations and laws


Definition 3.3.1 Union, intersection, and symmetric difference. For
any universe U and sets A, B ⊆ U ,

Union: A ∪ B = {x | (x ∈ A) ∨ (x ∈ B)}
Intersection: A ∩ B = {x | (x ∈ A) ∧ (x ∈ B)}
Symmetric A ∆ B = {x | (x ∈ A ∪ B) ∧ (x ∈
/ A ∩ B)}
difference:

Definition 3.3.2 Disjoint sets. For any universe U and S, T ⊆ U , then S
and T are disjoint if and only if S ∩ T = ∅. ♢
Definition 3.3.3 Complement of a set. For a set A ⊆ U , the complement
of A, denoted A, is {x | (x ∈ U ) ∧ (x ∈
/ A)}. ♢
Definition 3.3.4 Relative complement of a set. For sets A, B ⊆ U , the
relative complement of A in B, denoted B \ A, is {x | (x ∈ B) ∧ (x ∈
/ A)}.

Remark 3.3.5 Notice that the complement of a set is its relative complement
in the universe, A = U \ A.
Definition 3.3.6 Union or intersection over an index set. Let I be a
nonempty set and U a universe. For each i ∈ I let Ai ⊆ U . Then I is called
an index set and each i ∈ I is called an index. Under these conditions,
[
Ai = {x ∃i [x ∈ Ai ]}
i∈I
\
Ai = {x ∀i [x ∈ Ai ]}
i∈I


Definition 3.3.7 Partition. Let A be a set and let {Ai | i ∈ I} be a
collection of nonempty subsets A. Then {Ai | i ∈ I} is a partition of A iff
S
• A = i∈I Ai , and
CHAPTER 3. SET THEORY 15

• for every i, j ∈ I with i ̸= j, Ai ∩ Aj = ∅.


For each i ∈ I, the set Ai is called a part of the partition. ♢
Theorem 3.3.8 The laws of set theory. For any sets A, B and C, taken
from the universe U , the following set identities hold.

Law of Double A=A


Complement
DeMorgan’s A∪B =A∩B
laws A∩B =A∪B
Commutative A∪B =B∪A
laws A∩B =B∩A
Associative A ∪ (B ∪ C) = (A ∪ B) ∪ C
laws A ∩ (B ∩ C) = (A ∩ B) ∩ C
Distributive A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
laws A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Idempotent A∪A=A
laws A∩A=A
Identity laws A∪∅=A
A∩U =A
Inverse laws A∪A=U
A∩A=∅
Domination A∪U =U
laws A∩∅=∅
Absorption A ∪ (A ∩ B) = A
laws A ∩ (A ∪ B) = A

Theorem 3.3.9 Generalized DeMorgan’s Laws. Let I be an index set


where for each i ∈ I, Ai ⊆ U . Then
[ \
• Ai = Ai
i∈I i∈I
\ [
• Ai = Ai
i∈I i∈I

Proof template 3.3.10 Template for set theory proofs. To prove a set
theory identity X = Y there are two steps: proving X ⊆ Y and Y ⊆ X.
1. To prove X ⊆ Y : Let x ∈ X. Use definitions and previously proven
results to show that x ∈ Y . Conclude that X ⊆ Y .
2. To prove Y ⊆ X: Let y ∈ Y . Use definitions and previously proven
results to show that y ∈ X. Conclude that Y ⊆ X.

3. Conclusion: Conclude that since X ⊆ Y and Y ⊆ X then X = Y .


Chapter 4

Properties of the Integers

4.1 Divisibility and prime numbers


Definition 4.1.1 b divides a. Let a, b ∈ Z. Then b divides a, written b | a,
if there exists an integer n such that a = bn. In this case we also say that a is
a multiple of b. ♢
Definition 4.1.2 Prime and composite numbers. An integer p > 1 is
prime iff it has exactly two positive divisors, namely, 1 and p. An integer
n > 1 that is not prime is composite. ♢
Theorem 4.1.3 Divisibility properties. For all a, b, c ∈ Z
(1) 1 | a and a | 0.
Proof. Indeed, a = 1 · a and 0 = a · 0. ■

(2) If a | b and b > 0 then −b ≤ a ≤ b.


Proof. If a | b and b > 0, then there is n ∈ Z such that b = na.
If n > 0, then a > 0, and so b = na ≥ 1 · a and a > 0 > −b. So
−b ≤ a ≤ b in this case.
If n < 0, then a < 0, and so b > 0 > a and b + a = (n + 1)a ≥ 0. So
−b ≤ a ≤ b in this case as well.
If n = 0, then b = na = 0, contradicting to the assumption that b > 0. So
this case never happens. ■

(3) If a | b and b | a, then a = ±b.


Proof. By Theorem 4.1.3(2.), a ≤ b and b ≤ a. So, a = b. ■

(4) If a | b and b | c then a | c.


Proof. Let a | b and b | c, then there are x, y ∈ Z such that b = xa and
c = yb.
Then c = (yx)a, and since xy ∈ Z, we get a | c. ■

(5) If a | b, then for all x ∈ Z, a | bx.


Proof. If a | b, then there exists n ∈ Z such that b = na.
Now, for all x ∈ Z, we have bx = (xn)a, and since xn ∈ Z we get a | bx.

(6) If x, y, z are integers satisfying x = y + z, and a divides two of x, y, z,
then a also divides the third one.

16
CHAPTER 4. PROPERTIES OF THE INTEGERS 17

Proof. There are three cases to consider.


If a | x and a | y, then there are q, r ∈ Z such that x = qa and y = ra.
Then z = x − y = (q − r)a. Since q − r ∈ Z, a | z.
If a | x and a | z, the case is similar to the previous one. There are
q, r ∈ Z such that x = qa and z = ra. Then y = x − z = (q − r)a. Since
q − r ∈ Z, a | y.
Finally, if a | y and a | z, there are q, r ∈ Z such that y = qa and z = ra.
Then x = y + z = (q + r)a. Since q + r ∈ Z, a | x. ■

(7) If a | b and a | c, then for any x, y ∈ Z, a | (bx + cy).


Proof. If a | b and a | c, then for any x, y ∈ Z, by Theorem 4.1.3(5.),
a | bx and a | cy.
By Item 6, we conclude that a | bx + cy. ■

(8) If for all i ∈ {1, 2, . . . , n}, a | ci , then for all x1 , x2 , . . . , xn ∈ Z, a |


(c1 x1 + c2 x2 + · · · + cn xn ).
Proof. The proof is by induction on n. Assume that a is fixed throughout
the proof. For every n ∈ Z+ , let S(n) be the statement: If for all
i ∈ {1, 2, . . . , n}, a | ci , then for all x1 , x2 , . . . , xn ∈ Z

a | (c1 x1 + c2 x2 + · · · + cn xn ).

Base case n = 1 follows from Theorem 4.1.3(5.).


Assume, for some integer k ≥ 1, that S(k) is true. Let c1 , . . . , ck+1 ∈ Z
be such that a | ci for all i ∈ {1, 2, . . . , k + 1}.
Let x1 , x2 , . . . , xk+1 ∈ Z, and let

x = c1 x1 + . . . + ck+1 xk+1 ,
y = c 1 x1 + . . . + c k xk ,
z = ck+1 xk+1 .

Then, x = y + z. By S(k) (inductive hypothesis), a | y. By Theo-


rem 4.1.3(5.), a | z, so by Theorem 4.1.3(6.), a | x.
Therefore, S(k + 1) holds, and this finishes the proof of inductive step.
By PMI,S(n) is true for all n ∈ Z+ . ■
Theorem 4.1.4 Any n > 1 has a prime divisor. For any integer n > 1
there exists a prime p such that p | n.
Proof. The proof is by mathematical induction (strong form). For every n ≥ 2
let S(n) be the statement that there is a prime number pn (depending on n)
such that pn | n
Base case S(2) holds since for p2 = 2 we have p2 | 2.
Now for some integer k ≥ 2 assume that S(2), S(3), . . . , S(k) are all true. We
try to prove S(k + 1).
If k + 1 is prime, then S(k + 1) is true as in this case, for pk+1 = k + 1 we have
pk+1 | k + 1.
If k+1 is composite, then k+1 has a positive divisor d such that d ̸= 1, d ̸= k+1.
So 1 < d < k + 1, and d | (k + 1). Since 2 ≤ d ≤ k, by inductive hypothesis,
the statement S(d) is correct, so there is a prime number pd such that pd | d.
Since pd | d, and d | (k + 1), by Theorem 4.1.3, pd | (k + 1). We set pk+1 = pd
in this case, then pk+1 | k + 1.
So in both cases (k + 1 being prime or composite), S(k + 1) holds. This finishes
the proof of the inductive step.
Therefore, by the Principle of Mathematical Induction (strong form), for all
CHAPTER 4. PROPERTIES OF THE INTEGERS 18

n ≥ 2 there exsists a prime p such that p | n. ■


Theorem 4.1.5 Euclid’s infinitude of primes. The set of prime numbers
is infinite.
Proof. The proof is by contradiction. Assume that there are finitely many
prime numbers, and let P = {p1 , p2 , . . . , pk } be the set of all prime numbers.
Consider integer N defined by

N = p1 · p2 · · · · · pk + 1.

By Theorem 4.1.4, N has a prime divisor p. Then p ∈ P , so for some i ∈


{1, 2, . . . , k}, we have p = pi . Therefore p | N and p | p1 · · · · · pk , and so by
Theorem 4.1.3, p | N − p1 · · · · · pk .
So, p | 1, and therefore p = ±1. Since p also has to be a prime number, we
obtain a contradiction with the assumption that there are finitely many prime
numbers.
Therefore, the set of prime numbers is infinite. ■
Theorem 4.1.6 The division algorithm. If a ∈ Z, b ∈ Z+ , then there exist
unique integers q and r satisfying

a = bq + r, 0 ≤ r < b.
Proof. We start with showing uniqueness, namely that for every integers a, b
the quotient q and remainder r from the statement of the theorem are unique
(if they exist at all). Next we prove the theorem for the case a ≥ 0 using strong
mathematical induction, and finally prove the theorem for the negative values
of a.
To show uniqueness assume that a ∈ Z, b ∈ Z+ and let q1 , q2 , r1 , r2 with 0 ≤
r1 , r2 < b be such that
q 1 b + r1 = a = q 2 b + r2 .
Then (q1 − q2 )b = r2 − r1 . So b | r2 − r1 . Now, since 0 ≤ r1 , r2 ≤ b − 1, we
have −(b − 1) ≤ r2 − r1 ≤ b − 1.
If r2 − r1 > 0, by Theorem 4.1.3(2), b ≤ r2 − r1 ≤ b − 1, a contradiction. So
this case is impossible.
Similarly, if r1 −r2 > 0, by Theorem 4.1.3(2), b ≤ r1 −r2 ≤ b−1, a contradiction.
So this case is impossible.
Therefore, r1 = r2 . From bq1 + r1 = bq2 + r2 we conclude q1 = q2 . So, r1 = r2
and q1 = q2 , this finishes the proof of uniqueness.
Let b ∈ Z+ be fixed for the remainder of the proof. For every a ≥ 0 let
S(a) be the statement that there exist integers q, r, such that a = bq + r and
0 ≤ r ≤ b − 1. We cannot use induction to prove that S(a) is true for all a ∈ Z,
but we can show that S(a) is true for all a ≥ 0 using strong mathematical
induction.
Indee, start by considering base cases S(0), S(1), . . . , S(b − 1). For each i ∈
{0, 1, 2, . . . , b − 1} we can take q = 0 and r = i. Then i = qb + r with
0 ≤ r ≤ b − 1. Therefore, for every i ∈ {0, 1, . . . , b − 1}, the proposition S(i) is
true.
Now, let k ≥ b − 1 be an integer, and assume that all propositions
S(0), S(1), . . . , S(k) are true.
Consider k + 1 = (k + 1 − b) + b. Since k ≥ b − 1, we have 0 ≤ k + 1 − b ≤ k.
So S(k + 1 − b) is true (by inductive hypothesis).
Therefore, there are q, r ∈ Z such that k + 1 − b = qb + r and 0 ≤ r ≤ b − 1.
Then k + 1 = (q + 1)b + r. So S(k + 1) holds.
This finishes the proof of inductive step. By PMI (strong form), S(a) is true
CHAPTER 4. PROPERTIES OF THE INTEGERS 19

for all a ≥ 0.
Finally, if a < 0, then −a > 0, so S(−a) holds.
Then there are q, r such that −a = qb + r and 0 ≤ r ≤ b − 1.
If r = 0, then a = (−q)b + 0, so S(a) also is true.
If r ≥ 1, then 1 ≤ r ≤ b − 1, so −a = −(qb + r) = (−q − 1)b + b − r. S(a) is
true in this case as well (with a choice of quotient −q − 1 and remainder b − r).

One of the applications of the Division Algorithm is expressing numbers in
other than decimal numeral systems.
Theorem 4.1.7 Base b representation of n. Let b ≥ 2, n ≥ 1 be integers.
Then there is unique sequence r0 , r1 , r2 , . . . , rk ∈ {0, 1, 2, . . . , b − 1} with rk ̸= 0
such that
n = rk bk + rk−1 bk−1 + · · · + r2 b2 + r1 b + r0 .
In this case we write n = (rk rk−1 rk−2 . . . r2 r1 r0 )b and say that
rk rk−1 rk−2 . . . r2 r1 r0 is base b representation of n.
Remark 4.1.8 If base b is not defined, by default we take b = 10. For example,

4692 = (4692)10 = 4 · 103 + 6 · 102 + 9 · 10 + 2.


Remark 4.1.9 A few commmon bases are binary (b = 2), decimal (b = 10),
and hexadecimal (b = 16). In hexadecimal system, symbols A, B, C, D, E, F
are used to represent the values 10, 11, 12, 13, 14, 15 respectively.
Example 4.1.10 Write (110011)2 in base 10.
(110011)2 = 1 · 25 + 1 · 24 + 0 · 23 + 0 · 22 + 1 · 2 + 1

= 32 + 16 + 3 + 1 = 51.
Example 4.1.11 Write (2A9)16 in base 10. (2A9)16 = 2·162 +10·161 +9 =
512 + 160 + 9 = 681. □
Example 4.1.12 Write (41F )16 in base 10. (41F )16 = 4·162 +1·161 +15 =
1024 + 16 + 15 = 1055. □

4.2 Greatest common divisors and the Euclidean


algorithm
Definition 4.2.1 Common Divisor. For a, b ∈ Z, a positive integer c is a
common divisor of a and b if c | a and c | b. ♢
Definition 4.2.2 Greatest Common Divisor. Let a, b ∈ Z with at least
one of a, b nonzero. Then c ∈ Z+ is the greatest common divisor of a and
b, denoted gcd(a, b) if
• c is a common divisor of a and b, and

• if d is any common divisor of a and b, then d ≤ c.



Remark 4.2.3 Note that for every nonzero a ∈ Z, gcd(a, 0) = a. However,
gcd(0, 0) is not defined as 0 does not have the greatest divisor.
Lemma 4.2.4 Let a, b ∈ Z, not both equal to zero. Then for every x ∈ Z,

gcd(a, b) = gcd(a − bx, b)


CHAPTER 4. PROPERTIES OF THE INTEGERS 20

Proof. Let a, b, x ∈ Z, set d = gcd(a, b) and c = gcd(a − bx, b).


Since d | a and d | b, by Theorem 4.1.3 we have d | bx and d | a − bx. So d is a
common divisor of a − bx and b. By definition of gcd, d ≤ gcd(a − bx, b) = c.
Since c | a−bx and c | b, by Theorem 4.1.3 we have c | bx and c | (a−bx)+bx, or
c | a. So c is a common divisor of a and b. By definition of gcd, c ≤ gcd(a, b) =
d.
Finally, as c ≤ d and d ≤ c, we conclude that c = d. ■
Theorem 4.2.5 Euclidean algorithm. Let a, b ∈ Z+ with a ≥ b and define
non-negative integer sequences r1 , r2 , . . . rk and q1 , q2 , . . . , qk , qk+1 recursively
by
a = q 1 b + r1 0 < r1 < b
b = q 2 r1 + r2 0 < r2 < r1
r1 = q 3 r2 + r3 0 < r3 < r2
..
.
rk−2 = qk rk−1 + rk 0 < rk < rk−1
rk−1 = qk+1 rk + 0,
halting when the remainder from the division algorithm is 0. Then, rk =
gcd(a, b).
Proof. Let a, b ∈ Z+ with a ≥ b and the non-negative integer sequences
r1 , r2 , . . . rk and q1 , q2 , . . . , qk , qk+1 be defined as in the statement of the The-
orem. The existence of unique qi and ri for the step i is guaranteed by the
division algorithm. Since the sequence of nonzero remainders r1 , r2 , . . . , rk is
strictly decreasing, the algorithm takes finitely many steps (at most b steps) to
terminate.
Since a = q1 b + r1 , by Lemma 4.2.4,

gcd(a, b) = gcd(a − bq1 , b) = gcd(r1 , b) = gcd(b, r1 ).

Since b = q2 r1 + r2 , we similarly conclude

gcd(b, r1 ) = gcd(r1 , r2 ).

For every i ∈ {1, . . . , k − 3}, since ri = qi+2 ri+1 + ri+2 , we conclude

gcd(ri , ri+1 ) = gcd(ri+1 , ri+2 ).

Finally, since rk−1 = qk+1 rk + 0, we derive

gcd(rk−1 , rk ) = gcd(rk , 0) = rk .

Combining all of the obtained equations, we finally conclude

gcd(a, b) = gcd(b, r1 ) = gcd(r1 , r2 ) = . . . = gcd(rk−1 , rk ) = rk .


Remark 4.2.6 Note that for each step in the Euclidean algorithm, the exis-
tence of a unique qi and ri for that step is guaranteed by the division algorithm.
Lemma 4.2.7 Bézout’s Lemma. Let a, b ∈ Z, not both equal to zero, and
let d = gcd(a, b). Then there are x0 , y0 ∈ Z such that

ax0 + by0 = d
CHAPTER 4. PROPERTIES OF THE INTEGERS 21

Remark 4.2.8 The equation ax + by = d has infinitely many integer solutions.


Indeed, if d = gcd(a, b), then there are a1 , b1 ∈ Z such that a = a1 d, b = b1 d.
If x0 , y0 is some integer solution to ax + by = d, then for every integer t,

xt = x0 + tb1 , yt = y0 − ta1

is also an integer solution.


Theorem 4.2.9 Solving a linear Diophantine equation. If a, b, c ∈ Z+ ,
the Diophantine equation ax + by = c has an integer solution x = x0 , y = y0 if
and only if the gcd(a, b) divides c.

4.3 Fundamental theorem of arithmetic


Theorem 4.3.1 A prime dividing a product of two integers divides
one of them. If a, b ∈ Z+ and p is a prime with p | ab, then p | a or p | b.
Proof. Let a, b ∈ Z+ and p is a prime with p | ab. Consider d = gcd(a, p).
Since p is prime, and d | p, we have two options: d = p, or d = 1.
If d = p, then d | a, so p | a in this case.
If d = 1, then gcd(a, p) = 1, so by Lemma 4.2.7, there are x, y ∈ Z such that

ax + py = 1.

Multiplying the last equation by b, we get

abx + pby = b.

Since p | ab, we have p | abx. Also p | pby, so by Theorem 4.1.3, p | abx + pby,
and so p | b in this case. ■
Theorem 4.3.2 A prime dividing a product of integers divides one
of them. Let p be a prime and {ai | 1 ≤ i ≤ n} ⊆ Z+ with p | a1 a2 · · · an .
Then, there exists i with 1 ≤ i ≤ n so that p | ai .
Theorem 4.3.3 Fundamental Theorem of Arithmetic. Every integer
n > 1 can be written uniquely as a product of primes (up to the order of the
primes).
Chapter 5

Principles of Counting

5.1 Rules of Sum and Product


Definition 5.1.1 Factorial. For any integer n ≥ 0,
(
1 if n = 0
n! =
n · (n − 1) · (n − 2) · · · · · 2 · 1 if n > 0


Theorem 5.1.2 Rule of Sum, or ROS. Suppose one is to perform a task
T , which can be broken into two disjoint cases, which we shall call task A and
task B. If A can be performed in m ways and B can be performed in n ways
then the number of ways in which T can be performed is m + n.
Theorem 5.1.3 Rule of Product, or ROP. Suppose task T can be broken
into a sequence of steps—task A and then task B—where A can be performed
in m ways and B can be performed in n ways regardless of the way in which A
is performed, then the number of ways of performing T is mn.
Theorem 5.1.4 Cardinalities of power sets. Let U be any universe and
A ⊆ U be any finite set. Then,

|P(A)| = 2|A| .

5.2 Permutations
Definition 5.2.1 Permutation. A permutation of a finite set X is a linear
arrangement of the elements of X. ♢
Remark 5.2.2 It is possible to extend the notion of permutations to infi-
nite sets. The necessary material and applications of that will come up in
Sections Chapter 7 and Section 7.4.
Definition 5.2.3 Permutation of size r. For any non-negative integers n,
r, and a collection of n distinct objects, a permutation of size r is is a linear
arrangement of r of the n objects. ♢
Notation 5.2.4 The number of permutations of size r ≥ 0 from a set of size
n is denoted P (n, r).
Note that while the notation P (n, r) is useful in stating problems and per-
forming your work it is generally not acceptable for use in the final form of a

22
CHAPTER 5. PRINCIPLES OF COUNTING 23

solution in this course.


Theorem 5.2.5 Number of permutations. Let n and r be integers with
0 ≤ r ≤ n. Then
n!
P (n, r) = .
(n − r)!
Theorem 5.2.6 Linear arrangements with repetition. Let n and r
be integers with 1 ≤ r ≤ n. If there are n objects with n1 indistinguishable
objects of a first type, n2 indistinguishable objects of a second type, …, and nr
indistinguishable objects of an r-th type, where n1 + n2 + · · · + nr = n, then
there are n1 ! nn!
2 !···nr !
(linear) arrangements of the given n objects.

5.3 Combinations and the Binomial Theorem


Definition 5.3.1 Combination. Let n, r be non-negative integers. Given
a set of n distinct objects, a combination (of size r) is any set of r objects
from the n objects (where the order is not significant). ♢
Definition 5.3.2 Binomial coefficient.  For any non-negative integers n
and r, the binomial coefficient nr (read “n choose r”), is the number of
distinct combinations of size r from a set of size n. ♢
Theorem 5.3.3 Formula for binomial coefficients. For any integers n
and r with 0 ≤ r ≤ n,  
n n!
= .
r r!(n − r)!
Theorem 5.3.4 Pascal’s identity. For positive integers n, r with r ≤ n.
     
n+1 n n
= + .
r r r−1
For the next theorem, recall Sigma notation from Notation 1.1.1.
Theorem 5.3.5 Binomial Theorem. If x and y are variables, then for any
non-negative integer n,
         
n 0 n n 1 n−1 n 2 n−2 n n n 0
n
(x + y) = x y + x y + x y + ··· + x n−1 1
y + x y
0 1 2 n−1 n
Xn  
n k n−k
= x y .
k
k=0

Theorem 5.3.6 Multinomial Theorem – Statement only. Sup-


pose that x1 , x2 , . . . , xt are variables, n and t are positive integers and
0 ≤ n1 , n2 , . . . , nt ≤ n with n1 + n2 + · · · + nt = n. The coefficient of
xn1 1 xn2 2 xn3 3 · · · xnt t in the expansion of

(x1 + x2 + · · · + xt )n

is
n!
.
n 1 ! n 2 ! n3 ! · · · n t !

Notation 5.3.7 The notation r1 , r2 ,n..., rn may be used to denote the multi-
nomial coefficient n1 ! n2 !n!
n3 !···nt ! .
CHAPTER 5. PRINCIPLES OF COUNTING 24

5.4 Cardinalities of unions


Theorem 5.4.1 Cardinality of A ∪ B. Let U be any universe and A and
B ⊆ U be finite sets. Then

|A ∪ B| = |A| + |B| − |A ∩ B|.


Chapter 6

Graph Theory

6.1 Graphs, vertices, and edges


Definition 6.1.1 Graph. A graph is an ordered pair G = (V, E), where
V = V (G) is a non-empty set, and E = E(G) is a set of two element subsets
of V . An element of V is called a vertex (plural is vertices) and elements of
E are called edges. ♢
Notation 6.1.2 Given a graph G, the vertex set is sometimes denoted by V (G)
and the edge set is sometimes denoted by E(G).
Remark 6.1.3 Graphs are often represented by a drawing: a set of points (dots
or circles) representing the vertices connected by lines or curves representing
the edges. The drawing is a visual representation of the graph, but the graph
itself is the ordered pair (V, E).
In a drawing of a graph, the edges may cross. This is unavoidable for some
graphs. It is important to be clear about the location of vertices.
Example 6.1.4 Let G = (V, E) be the graph with vertex set V = {a, b, c, d}
and edge set E = {{a, b}, {b, c}, {b, d}}.
c d
a b
b

c d
Figure 6.1.5 Two different drawings of the same graph
These are two valid drawings of the graph G. Depending on the context or
application, one particular drawing may be preferable to another. □
Definition 6.1.6 Directed graph. A directed graph (or digraph) G is
an ordered pair (V, E) with V ̸= ∅ and E ⊆ V × V . An element of V is called
a vertex (plural is vertices) and elements of E are called directed edges or
arcs.
A directed edge of the form (a, a) is called a loop. ♢
Like graphs, digraphs are drawn with dots or circles for the vertices. Di-
rected edges/arcs are drawn as lines or curves with an arrow. A directed edge
(x, y) is drawn with an arrow pointing from x to y.

25
CHAPTER 6. GRAPH THEORY 26

y z

x
Figure 6.1.7 Example of a digraph
Definition 6.1.8 Multigraph. A multigraph is an ordered pair (V, E),
where V is a non-empty set and E is a collection of unordered pairs (that can
repeat the same vertex) from E. In a multigraph, E need not be a set; a pair
{x, y} may occur more than once. ♢

Figure 6.1.9 Example of a multigraph


Remark 6.1.10 In other references, you may sometimes see the word ‘graph’
used to mean any of graph, directed graph, or multigraph (as defined here). In
those cases, the term simple graph is sometimes used to specify what is given
in Definition 6.1.1. In this course, the term graph is exclusively used for the
structures satisfying Definition 6.1.1.
Note that there are many further variations of graphs including the possi-
bility of directed graphs with multiple edges, multigraphs with loops, weighted
graphs, hypergraphs and many more!

Figure 6.1.11 Variations of graphs

3.5 2.1

200
Figure 6.1.12 Weighted graph and hypergraph
CHAPTER 6. GRAPH THEORY 27

6.2 Special graphs and new graphs from old


Definition 6.2.1 Complete graph. A complete graph on n vertices,
denoted Kn , is the graph with vertex set V = {1, 2, . . . , n} and edge set E =
{{i, j} : 1 ≤ i < j ≤ n}. ♢

K1
K2

K3 K4
K5
Figure 6.2.2 Complete graphs
There is also the empty graph En on n vertices, which has no edges.
Note that in a drawing of a graph, dashed lines are sometimes used to
indicate the absence of edges. For example, the first few empty graphs can be
drawn as follows:

E1
E2

E3 E4
E5
Figure 6.2.3 Empty graphs
Definition 6.2.4 Bipartite graph. A graph G = (V, E) is bipartite iff
there exist disjoints sets X, Y with V = X ∪ Y so that each edge in G contains
one vertex from each of X and Y . In such a case, the sets X and Y are called
partite sets.
For m, n ∈ Z+ , the complete bipartite graph Km,n is a bipartite graph
with two sets V = X ∪ Y , X ∩ Y = ∅, where if |X| = m, |Y | = n, and contains
all possible mn edges. ♢
In a drawing of a bipartite graph, vertices are sometimes drawn in two
columns with no edges between vertices in the same column. The first graph
below is redrawn on the right to more clearly show the bipartite structure.

Figure 6.2.5 Two drawings of a bipartite graph


CHAPTER 6. GRAPH THEORY 28

K3,3
K1,3 K2,3 K4,3

Figure 6.2.6 First few complete bipartite graphs


Definition 6.2.7 Sugraph. If G and H are graphs, H is a (weak) subgraph
of G if V (H) ⊆ V (G) and E(H) ⊆ E(G), and H is an induced subgraph of G
if further, for every x, y ∈ V (H) with {x, y} ∈ E(G), then {x, y} ∈ E(H) also.
A subgraph H of a graph G is called a spanning subgraph iff V (H) = V (G).

Remark 6.2.8 If the word “induced” is not mentioned, a subgraph is, in
general, considered to be a weak subgraph.
Definition 6.2.9 Complement. If G = (V, E) is a graph, the complement
of G, denoted G, is the graph with vertex set V and edge set {{x, y} | x, y ∈
V, x ̸= y}\E. ♢
Definition 6.2.10 Hypercube. For any k ∈ Z+ , the hypercube graph
Qk is the graph defined on V = {0, 1}k where two vertices (a1 , . . . , ak ) and
(b1 , . . . , bk ) are adjacent iff there is exactly one i so that ai ̸= bi . ♢
01 11 011 111
0 1
010 110
001 101
Q1 00 10
000 100
Q4
Q2 Q3

Figure 6.2.11 First few hypergraphs

6.3 Adjacency, neighbourhoods, and degrees


Definition 6.3.1 Adjacency. In a graph (or multigraph) G, vertices x, y ∈
V (G) are adjacent iff {x, y} ∈ E(G). An edge e = {x, y} is said to join x and
y; also, x and y are endpoints of e, x and y are incident with e. ♢
Definition 6.3.2 Neighbourhood. In a graph G, the neighbourhood of a
vertex x is NG (x) = {y ∈ V (G) : {x, y} ∈ E(G)}, the set of vertices adjacent
to x. ♢
Note that when the graph G is understood, the neighbourhood of a vertex
x is sometimes simply denoted N (x).
Definition 6.3.3 Degree. For a (simple) graph G and x ∈ V (G), the degree
of x is degG (x) = |{y ∈ V (G) : {x, y} ∈ E(G)}| = |NG (x)|.
If G is a multigraph (possibly with loops), the degree of a vertex x is the
number of edges incident with x, where loops are counted twice. ♢
Definition 6.3.4 Outdegree, indegree. For a vertex x in a digraph D, the
outdegree of x, denoted deg+ (x) is the number of arcs incident from x, that
is, the number of arcs of the form (x, y), where y ∈ V (D). Similarly, define the
CHAPTER 6. GRAPH THEORY 29

indegree deg− (x) to be the number of arcs to x. ♢


Definition 6.3.5 Regular graph. A graph G is k-regular iff every vertex
has degree k. ♢
Definition 6.3.6 Minimum, maximum degree. The minimum degree
of a graph G is denoted δ(G), and the maximum degree is denoted ∆(G).

Definition 6.3.7 Isolated, pendant. In a graph G, a vertex x with deg(x) =
0 is called isolated. A vertex x with deg(x) = 1 is called a pendant vertex
(or leaf), and the edge incident to a leaf is called a pendant edge. ♢
Theorem 6.3.8 Handshaking lemma. Let G = (V, E) be a graph with
finitely many edges. Then
X
deg(v) = 2|E|.
v∈V

Proof. Let G = (V, E) be a graph with finitely many edges. Count each edge
once for each of its endpoints in two different ways.
On the one hand, there are |E| edges and each edge has 2 endpoints, so the
total count is 2|E|.
On the other hand, for every vertex v, count the number of incident edges. For
any v ∈ V , there are deg(v) neighbours and soPdeg(v) incident edges. Therefore,
summing over all vertices, the total count is v∈V deg(v).
Since both methods count the same thing, they are equal and so 2|E| =
P
v∈V deg(v). ■
Note that the same proof of Theorem 6.3.8 can P be applied to graphs with
multiple edges and loops. In that setting again v∈V deg(v) = 2|E|. In the
case of directed graphs, onePcan instead countPeach arc once for either endpoint
to show that in a digraph v∈V deg+ (v) = v∈V deg− (v) = |E|.
Example 6.3.9 Prove that in a graph G = (V, E), P the sum of the degrees of
the vertices is [Link] the Handshaking lemma, v∈V deg(v) = 2|E|. Since
2|E| is even, the sum of the degrees of the vertices is even. □
Example 6.3.10 Prove that if G = (V, E) is a finite graph, then G has an
even number of vertices of odd [Link] G = (V, E) be a finite graph and let
Ve be the set of vertices of G with even degree and let V0 be the set of vertices
of G with odd degree.
By the Handshaking Lemma,
X X X
2|E| = deg(v) = deg(v) + deg(v).
v∈V v∈Ve v∈Vo
P P
Since 2|E| is even and v∈Ve deg(v) is even, by Item 6, v∈Vo deg(v) is also
even. Since a sum of odd integers is even only if there are an even number of
summands, |Vo | is even.
Therefore, G has an even number of vertices of odd degree. □
Example 6.3.11 Prove that if k ≥ 0 and G = (V, E) is a k-regular graph,
|
then |E| = k|V
2 .Let k ≥ 0 and let G = (V, E) is a k-regular graph. By the
Handshaking Lemma,
X X
2|E| = deg(v) = k = k|V |
v∈V v∈V

k|V |
which can be rearranged to give |E| = 2 .Note that this shows that if k is
CHAPTER 6. GRAPH THEORY 30

odd and G = (V, E) is a k-regular graph, then |V | is even. So, for example,
there are no 3-regular graphs on 9 vertices. □
Example 6.3.12 Prove that for every n ≥ 1, the hypercube Qn has 2n ver-
tices and is n-regular. Deduce that Qn has n2n−1 [Link] any n ≥ 1, the
hypercube Qn has 2n vertices because there are 2n different strings of length
n with entries in {0, 1}.
To show that Qn is n-regular, consider any vertex v = (v1 , v2 , . . . , vn ).
There are n different coordinates of v, and for each coordinate i, there is a
unique vertex v′ that differs from v in the i-th coordinate. Therefore, v is
adjacent to n other vertices.
For example, in Q4 , the neighbours of 1101 are: 0101, 1001, 1111, 1100.
Since Qn is n-regular and has 2n vertices, by a previous example, Qn has
n2n
2 = n2
n−1
edges. □

6.4 Graph isomorphism


Definition 6.4.1 Isomorphism. Let G and H be graphs. An isomor-
phism from G to H is a bijection f : V (G) → V (H) so that for every pair of
vertices x, y ∈ V (G), {x, y} ∈ E(G) iff {f (x), f (y)} ∈ E(H). Two graphs are
isomorphic iff there exists an isomorphism from one to the other. ♢
Example 6.4.2 Consider the following two graphs:

d c z w

a b x y
Figure 6.4.3 Two isomorphic graphs
One function showing that these two graphs are isomorphic is the function
f : {a, b, c, d} → {x, y, z, w} defined by f (a) = x, f (b) = y, f (c) = z, and
f (d) = w. This function is a bijection, and it preserves both edges and non-
edges. □

6.5 Walks and connected graphs


Definition 6.5.1 Walk. For each k ≥ 0, a walk of length k in a graph (or
multigraph) G = (V, E) is an alternating sequence of (not necessarily distinct)
vertices and edges v0 , e1 , v1 , e2 , v2 , · · · ek , vk so that for each i = 1, 2, . . . , k,
ei = {vi−1 , vi } ∈ E. Such a walk is closed iff v0 = vk , and open otherwise.

Definition 6.5.2 Trail, Path, Circuit, Cycle.
• A trail in a graph is a walk with no edge repeated.
• A path in a graph is a trail with no vertex repeated.

• A circuit in a graph is a closed trail.


• A cycle is a circuit of length at least 3 where only the first and last vertex
CHAPTER 6. GRAPH THEORY 31

of the walk are the same, and no other vertices are repeated. A cycle on
n vertices is denoted by Cn .

In this reference a path with n vertices is denoted by Pn ; as in Figure
Figure 6.5.3. Note that this notation is not universal and some references will
use Pn to denote a path with n edges.

P1
P3 P4
P2
Figure 6.5.3 Small paths

C3 C4 C6
C5
Figure 6.5.4 Small cycles
Theorem 6.5.5 δ(G) ≥ 2 implies a cycle. If G is a graph with δ(G) ≥ 2,
then G contains a cycle.
Proof. Let P = (x0 , x1 , . . . , xk ) be any path in G of maximum length. Suppose,
in hopes of a contradiction, that x0 had a neighbour y, not contained in the path
P . Then, (y, x0 , x1 , . . . , xk ) is a path in G that is longer than P , contradicting
the assumption that P has maximum length.

···
x0 x1 x2 xk−1 xk
Therefore, every neighbour of x0 is in the set {x1 , x2 , . . . , xk }. We know that x0
is adjacent to x1 and since deg(x0 ) ≥ δ(G) ≥ 2, x0 has some other neighbour.
Let i ∈ {2, 3, . . . , k} with {x0 , xi } ∈ E.

··· ···
x0 x1 x2 xi−1 xi xk−1 xk
Then (x0 , x1 , x2 , . . . , xi−1 , xi , x0 ) is a cycle in G, completing the proof. ■
Proof template 6.5.6 Proof template with instantiation of a useful
structure. Within the justification of a proof, it can sometimes be useful to
instatiate a structure not mentioned in the proof statement. These are often
largest or smallest structures with some property.
CHAPTER 6. GRAPH THEORY 32

For example, the proof of Theorem 6.5.5, uses the instantiation “Let
v1 , v2 , . . . , vk be a longest path in the graph”. Such a path must exist since
every graph contains paths and so in a finite graph, some must be longest.
This path is then used to construct a cycle.
Definition 6.5.7 Connected. A graph G is connected iff for any two
vertices x and y, there exists a path from x to y (called an x-y path). If a
graph is not connected, it is disconnected. ♢
Definition 6.5.8 Connected component. A connected component of
a graph is a maximal connected subgraph. ♢

6.6 Trees
Definition 6.6.1 Acyclic. A graph is called acyclic iff it contains no cycles.

Definition 6.6.2 Tree, forest. A tree is a connected acyclic graph.
A forest is an acyclic graph. ♢
Theorem 6.6.3 Most trees have leaves. Every tree with at least 2 vertices
has at least two leaves.
Proof. This proof follows the same idea as Theorem 6.5.5. Let T = (V, E) be
a tree with at least two vertices. Let P = (x0 , x1 , . . . , xk ) be any path in T
of maximum length. Since T has at least 2 vertices, k ≥ 1. Since P is a path
of maximum length, all of the neighbours of each of x0 and xk are contained
in the path (since otherwise the path could be extended, contradicting its
maximality).
Suppose, in hopes of a contradiction, that x0 had a neighbour in the path,
other than x0 , call it xi . Then, (x0 , x1 , . . . , xi−1 , xi , x0 ) would be a cycle in T ,
contradicting the assumption that T is a tree. Thus, the only neighbour of x0
is x1 , and so x0 is a leaf.
A similar argument shows that the only neighbour of xk is xk−1 and so xk is
a leaf. Therefore, T has at least two leaves. ■
Theorem 6.6.4 Number of edges in a tree. For every finite tree T =
(V, E), |V | = |E| + 1.
Proof. We prove this by induction on the number of vertices. For any n ≥ 1,
let S(n) be the statement that every tree with n vertices has n − 1 edges.
Base case: S(1) is true since the only tree with one vertex is isomorphic to K1
and has 0 edges.
Inductive step: Fix k ≥ 1 and suppose that S(k) is true. That is, suppose
every tree with k vertices has k − 1 edges.
Let T = (V, E) be a tree with k + 1 vertices. By Theorem 6.6.3, T has a
leaf, call it x. Let T ′ = (V ′ , E ′ ) be the tree obtained by removing x and its
incident edge from T . Then, T ′ has k + 1 − 1 = k vertices and by the inductive
hypothesis, S(k), T ′ has exactly k − 1 edges. Since T has one more vertex and
one more edge than T ′ , we have |V | = (k − 1) + 1 = (k + 1) − 1. Since T was
an arbitrary tree with k + 1 vertices, S(k + 1) is true and so S(k) → S(k + 1)
is true, completing the induction step.
Therefore, by the principle of mathematical induction, for every n ≥ 1, S(n)
is true and so for every finite tree T = (V, E), |E| = |V | − 1, which can be
rearranged to get |V | = |E| + 1. ■
CHAPTER 6. GRAPH THEORY 33

Theorem 6.6.5 Equivalent conditions for trees. Let G = (V, E) be a


finite graph. The following are equivalent:
1. G is a tree.

2. for every pair of distinct vertices, u, v ∈ V , there is a unique u − v path


in G.
3. G is connected and |V | = |E| + 1.
4. G is acyclic and |V | = |E| + 1.
Chapter 7

Functions and cardinality

7.1 Function images and pre-images


Recall the definition of a function, Definition 1.1.7, and the properties of be-
ing surjective, injective, or bijective, Definition 1.1.8, Definition 1.1.9, Defini-
tion 1.1.10, in the preliminary section.
Definition 7.1.1 Image, Preimage. For any function f : A → B and
a ∈ A, b ∈ B with f (a) = b, b is the image of a under f , and a is in the
preimage of b. ♢
Definition 7.1.2 Image of a set. If f : A → B and A1 ⊆ A, then the
image of A1 under f is

f (A1 ) = {b ∈ B | b = f (a) for some a ∈ A1 }.


Definition 7.1.3 Preimage of a set. If f : A → B and B1 ⊆ B, then

f −1 (B1 ) = {x ∈ A | f (x) ∈ B1 }.

The set f −1 (B1 ) is called the preimage of B1 under f . ♢


Remark 7.1.4 Be careful that the notation for pre-image can be confused
with the inverse of a function (see Section 7.2). Pre-images of sets are defined
for any function, not just invertible functions.
Definition 7.1.5 Restriction, Extension. If f : A → B and A1 ⊆ A, then
the restriction of f to A1 , written f |A1 : A1 → B, is the function satisfying

f |A1 (a) = f (a) for all a ∈ A1 .

For any function g : A1 → B, f is called an extension of g to A iff f |A1 = g.



Theorem 7.1.6 Functions, unions, and intersections. Let f : A → B
with A1 , A2 ⊆ A. Then

• f (A1 ∪ A2 ) = f (A1 ) ∪ f (A2 ).


• f (A1 ∩ A2 ) ⊆ f (A1 ) ∩ f (A2 ).
• If, further, f is one-to-one, then f (A1 ∩ A2 ) = f (A1 ) ∩ f (A2 ).

34
CHAPTER 7. FUNCTIONS AND CARDINALITY 35

7.2 Composition and inverses


Definition 7.2.1 Identity function. For any set A, the identity function
on A, denoted 1A : A → A, is defined, for all a ∈ A, by

1A (a) = a.


Definition 7.2.2 Equality of functions. Two functions f, g : A → B are
said to be equal, written f = g, iff for all a ∈ A, f (a) = g(a). ♢
Definition 7.2.3 Composition. For functions f : A → B and g : B → C,
the composition of f and g, denoted g ◦ f : A → C, is the function defined
for a ∈ A, by (g ◦ f )(a) = g(f (a)) for all a ∈ A. ♢
Definition 7.2.4 Inverse of a function. A function f : A → B is called
invertible if there is a function g : B → A such that g ◦ f = 1A and f ◦ g = 1B .
In this case, g is called an inverse of f . ♢
Theorem 7.2.5 The composition of one-to-one and onto functions.
Let f : A → B and g : B → C.

• If both f and g are one-to-one, then so is g ◦ f .


• If both f and g are onto, then so is g ◦ f .
Theorem 7.2.6 Associativity of composition of functions. Let f : A →
B, g : B → C and h : C → D. Then (h ◦ g) ◦ f = h ◦ (g ◦ f ).
Theorem 7.2.7 Uniqueness of the inverse. If f is an invertible function,
then the inverse is unique.
Theorem 7.2.8 Invertibility, one-to-one and onto. A function f : A → B
is invertible if and only if it is one-to-one and onto.
Theorem 7.2.9 The inverse of a composition. If f : A → B and g : B →
C are invertible functions, then so is g ◦ f , and (g ◦ f )−1 = f −1 ◦ g −1 .

7.3 Functions on finite sets and the Pigeonhole


principle
Theorem 7.3.1 One-to-one, onto, invertibility for finite sets. Let
f : A → B where A and B are finite sets with |A| = |B|. Then the following
statements are equivalent:
• f is one-to-one.
• f is onto.

• f is invertible.
Theorem 7.3.2 Pigeonhole principle. Let n ∈ Z+ . If n + 1 objects are
placed into n holes, then at least one hole contains at least 2 objects.
CHAPTER 7. FUNCTIONS AND CARDINALITY 36

7.4 Countable and uncountable sets


Definition 7.4.1 Same size or cardinality. Two sets A and B have the
same size or same cardinality iff there exists a bijection f : A → B. When
this happens, write A ∼ B. ♢
Recall Definition 3.1.4 for the definition of finite and infinite sets.
Definition 7.4.2 Countable set. A set A is countable if A is finite or
A ∼ Z+ . ♢
Theorem 7.4.3 The integers are countable. The set Z is countable.
Theorem 7.4.4 Subsets of countable sets. Any subset of a countable set
is countable.
Theorem 7.4.5 Union of countable sets. If A and B are both countable
sets, then A ∪ B is countable.
Theorem 7.4.6 Cartesian Product of countable sets. If A and B are
both countable sets, then A × B is countable.
Theorem 7.4.7 The rationals are countable. The set Q is countable.
Theorem 7.4.8 Unit interval in uncountable. The set (0, 1] = {x ∈ R |
0 < x ≤ 1} is not countable.
Chapter 8

Relations

Recall the definitions of the Cartesian products: Definition 3.2.1, Defini-


tion 3.2.2.

8.1 Relations
Definition 8.1.1 (binary) relation from A to B. For sets A, B, a (binary)
relation from A to B is any subset of A × B. ♢
Definition 8.1.2 (binary) relation on A. For a set A, a (binary) relation
on A is any subset of A × A. ♢
Definition 8.1.3 Converse of a relation. If R is a relation from A to B,
then the converse relation Rc is the relation from B to A defined by

Rc = {(b, a) | (a, b) ∈ R}.

8.2 Properties of relations


Definition 8.2.1 Reflexive, symmetric, antisymmetric and transitive
relations. A relation R on a set A
• is reflexive iff for every x ∈ A, (x, x) ∈ R,
• is symmetric iff for every x, y ∈ A with (x, y) ∈ R, then (y, x) ∈ R also,

• is antisymmetric iff for every x, y ∈ A with (x, y) ∈ R and (y, x) ∈ R,


then x = y,
• is transitive iff for every x, y, z ∈ A with (x, y), (y, z) ∈ R, then (x, z) ∈
R also.

Definition 8.2.2 Partial order. A relation R on A is a partial order iff
it is reflexive, antisymmetric and transitive. ♢
Definition 8.2.3 Equivalence relation. A relation R on A is an equiva-
lence relation iff it is reflexive, symmetric and transitive. ♢

37
CHAPTER 8. RELATIONS 38

8.3 Equivalence relations


Recall the definition of a partition. See Definition 3.3.7. Note that the symbol
∼ is often used for an equivalence relation (see Definition 8.2.3).
Definition 8.3.1 Equivalence class of x. Let ∼ be an equivalence relation
on the set A. Then the equivalence class of x, written [x], is defined by

[x] = {y ∈ A | y ∼ x}.


Theorem 8.3.2 An equivalence relation defines a partition. Let ∼ be
an equivalence relation on the set A. Then the equivalence classes

[x] x ∈ A

define a partition of A.
Theorem
S 8.3.3 A partition defines an equivalence relation. Let A =
A
i∈I i be a partition of a set A. Define a relation, ∼, on A by

x ∼ y if and only if x, y ∈ Ai for some i ∈ I.

Then ∼ is an equivalence relation.


Chapter 9

Modular Arithmetic

In this section, we define a special equivalence relation called the congruence


relation and discuss operations built from addition and multiplication that we
can perform on the equivalence classes.

9.1 Integers modulo n and modular arithmetic


Theorem 9.1.1 Equivalence modulo n. For every n ∈ Z+ , the relation

{(a, b) ∈ Z × Z : n | (a − b)}

is an equivalence relation on Z.
Definition 9.1.2 Integers Modulo n. Let n ∈ Z+ and n > 1. For a, b ∈ Z,
a is congruent to b modulo n, written a ≡ b (mod n), iff n | a − b, or,
equivalently, if there exists k ∈ Z with a = b + kn.
The set of equivalence classes for this relation is denoted Zn . ♢
Theorem 9.1.3 Addition and multiplication in Zn . Let n ∈ Z+ and
a, b, c, d ∈ Z with a ≡ c (mod n) and b ≡ d (mod n). Then,
• (a + b) ≡ (c + d) (mod n) and
• ab ≡ cd (mod n),
Theorem 9.1.4 Multiplicative inverses in Zn . Let n ∈ Z+ and a ∈ Z.
Then there exists b ∈ Z with ab ≡ 1 (mod n) if and only if gcd(a, n) = 1.

39
Appendix A

List of Definitions and The-


orems

Chapter 1 Introduction
Definition 1.1.2 Universe
Definition 1.1.3 Set, element
Definition 1.1.6 Standard sets
Definition 1.1.7 Function
Definition 1.1.8 Onto or surjection
Definition 1.1.9 One-to-one or injection
Definition 1.1.10 Bijection

Chapter 2 Fundamentals of Logic


Definition 2.1.1 Proposition
Definition 2.1.2 Negation
Definition 2.1.3 Conjunction
Definition 2.1.4 Disjunction
Definition 2.1.5 Implication
Definition 2.1.6 Biconditional
Definition 2.1.7 Compound and primitive propositions
Definition 2.1.9 Tautology and Contradiction
Definition 2.2.1 Logical equivalence
Definition 2.2.3 Converse, inverse and contrapositive of an implication
Theorem 2.2.4 The Laws of Logic
Theorem 2.2.6 Implication as disjunction
Theorem 2.2.7 Contrapositive of an implication
Definition 2.3.1 Argument, premise, conclusion, validity
Definition 2.3.2 Logical implication
Theorem 2.3.3 Rules of Inference
Definition 2.4.1 Open statement
Definition 2.4.2 Universal and existential quantifiers
Definition 2.4.4 Free and bound variables
(Continued on next page)

40
APPENDIX A. LIST OF DEFINITIONS AND THEOREMS 41

Theorem 2.4.6 Rules for negating propositions with one quantifier


Theorem 2.5.1 Rule of universal generalization
Theorem 2.5.2 Rule of universal specification
Theorem 2.6.2 Principle of Mathematical Induction
Definition 2.6.3 Base step, inductive step, inductive hypothesis
Theorem 2.6.4 Principle of Mathematical Induction – strong form
Definition 2.7.1 Fibonacci numbers

Chapter 3 Set Theory


Definition 3.1.1 subsets, set equality, proper subsets
Definition 3.1.2 empty set, null set
Definition 3.1.3 Power set of A
Definition 3.1.4 Finite sets, Cardinality
Definition 3.2.1 Cartesian product
Definition 3.2.2 n-fold product of sets
Definition 3.3.1 Union, intersection, and symmetric difference
Definition 3.3.2 Disjoint sets
Definition 3.3.3 Complement of a set
Definition 3.3.4 Relative complement of a set
Definition 3.3.6 Union or intersection over an index set
Definition 3.3.7 Partition
Theorem 3.3.8 The laws of set theory
Theorem 3.3.9 Generalized DeMorgan’s Laws

Chapter 4 Properties of the Integers


Definition 4.1.1 b divides a
Definition 4.1.2 Prime and composite numbers
Theorem 4.1.3 Divisibility properties
Theorem 4.1.4 Any n > 1 has a prime divisor
Theorem 4.1.5 Euclid’s infinitude of primes
Theorem 4.1.6 The division algorithm
Theorem 4.1.7 Base b representation of n
Definition 4.2.1 Common Divisor
Definition 4.2.2 Greatest Common Divisor
Theorem 4.2.5 Euclidean algorithm
Theorem 4.2.9 Solving a linear Diophantine equation
Theorem 4.3.1 A prime dividing a product of two integers divides one of them
Theorem 4.3.2 A prime dividing a product of integers divides one of them
Theorem 4.3.3 Fundamental Theorem of Arithmetic

Chapter 5 Principles of Counting


Definition 5.1.1 Factorial
Theorem 5.1.2 Rule of Sum, or ROS
Theorem 5.1.3 Rule of Product, or ROP
Theorem 5.1.4 Cardinalities of power sets
Definition 5.2.1 Permutation
Definition 5.2.3 Permutation of size r
(Continued on next page)
APPENDIX A. LIST OF DEFINITIONS AND THEOREMS 42

Theorem 5.2.5 Number of permutations


Theorem 5.2.6 Linear arrangements with repetition
Definition 5.3.1 Combination
Definition 5.3.2 Binomial coefficient
Theorem 5.3.3 Formula for binomial coefficients
Theorem 5.3.4 Pascal’s identity
Theorem 5.3.5 Binomial Theorem
Theorem 5.3.6 Multinomial Theorem – Statement only
Theorem 5.4.1 Cardinality of A ∪ B

Chapter 6 Graph Theory


Definition 6.1.1 Graph
Definition 6.1.6 Directed graph
Definition 6.1.8 Multigraph
Definition 6.2.1 Complete graph
Definition 6.2.4 Bipartite graph
Definition 6.2.7 Sugraph
Definition 6.2.9 Complement
Definition 6.2.10 Hypercube
Definition 6.3.1 Adjacency
Definition 6.3.2 Neighbourhood
Definition 6.3.3 Degree
Definition 6.3.4 Outdegree, indegree
Definition 6.3.5 Regular graph
Definition 6.3.6 Minimum, maximum degree
Definition 6.3.7 Isolated, pendant
Theorem 6.3.8 Handshaking lemma
Definition 6.4.1 Isomorphism
Definition 6.5.1 Walk
Definition 6.5.2 Trail, Path, Circuit, Cycle
Theorem 6.5.5 δ(G) ≥ 2 implies a cycle
Definition 6.5.7 Connected
Definition 6.5.8 Connected component
Definition 6.6.1 Acyclic
Definition 6.6.2 Tree, forest
Theorem 6.6.3 Most trees have leaves
Theorem 6.6.4 Number of edges in a tree
Theorem 6.6.5 Equivalent conditions for trees

Chapter 7 Functions and cardinality


Definition 7.1.1 Image, Preimage
Definition 7.1.2 Image of a set
Definition 7.1.3 Preimage of a set
Definition 7.1.5 Restriction, Extension
Theorem 7.1.6 Functions, unions, and intersections
Definition 7.2.1 Identity function
Definition 7.2.2 Equality of functions
Definition 7.2.3 Composition
(Continued on next page)
APPENDIX A. LIST OF DEFINITIONS AND THEOREMS 43

Definition 7.2.4 Inverse of a function


Theorem 7.2.5 The composition of one-to-one and onto functions
Theorem 7.2.6 Associativity of composition of functions
Theorem 7.2.7 Uniqueness of the inverse
Theorem 7.2.8 Invertibility, one-to-one and onto
Theorem 7.2.9 The inverse of a composition
Theorem 7.3.1 One-to-one, onto, invertibility for finite sets
Theorem 7.3.2 Pigeonhole principle
Definition 7.4.1 Same size or cardinality
Definition 7.4.2 Countable set
Theorem 7.4.3 The integers are countable
Theorem 7.4.4 Subsets of countable sets
Theorem 7.4.5 Union of countable sets
Theorem 7.4.6 Cartesian Product of countable sets
Theorem 7.4.7 The rationals are countable
Theorem 7.4.8 Unit interval in uncountable

Chapter 8 Relations
Definition 8.1.1 (binary) relation from A to B
Definition 8.1.2 (binary) relation on A
Definition 8.1.3 Converse of a relation
Definition 8.2.1 Reflexive, symmetric, antisymmetric and transitive relations
Definition 8.2.2 Partial order
Definition 8.2.3 Equivalence relation
Definition 8.3.1 Equivalence class of x
Theorem 8.3.2 An equivalence relation defines a partition
Theorem 8.3.3 A partition defines an equivalence relation

Chapter 9 Modular Arithmetic


Theorem 9.1.1 Equivalence modulo n
Definition 9.1.2 Integers Modulo n
Theorem 9.1.3 Addition and multiplication in Zn
Theorem 9.1.4 Multiplicative inverses in Zn
Appendix B

List of Proof templates

Chapter 2 Fundamentals of Logic


Proof template 2.3.4 Proof template for proof by rules of inference
Proof template 2.5.3 Template for a direct proof
Proof template 2.5.4 Template for a proof by contradiction
Proof template 2.6.5 Template for an induction proof
Proof template 2.6.7 Template for a strong induction proof

Chapter 3 Set Theory


Proof template 3.3.10 Template for set theory proofs

Chapter 6 Graph Theory


Proof template 6.5.6 Proof template with instantiation of a useful structure

44
References

[1] Robert Craigen, Michelle Davidson, Local Notes, course notes, Winter
2021.
[2] Robert Borgersen, Robert Craigen, Michelle Davidson, Michael Doob,
Tyrone Ghaswala, Karen Gunderson, Edward Timko, MATH 1240 De-
finitions and Theorems, course notes, Winter 2019, Fall 2019, Winter
2020, Fall 2020.
[3] Michelle Davidson, Definitions and Theorems for MATH 1240 Fall 2021:
Also known as the (Math 1240) Local Notes, course notes, Fall 2021.
[4] Ralph P. Grimaldi, Discrete and combinatorial mathematics: an applied
introduction, Fifth edition, New York, N.Y., Pearson, 2017.
[5] David Gunderson, Tentative definitions and theorems for MATH 1240,
lecture notes, 10 January 2018.

45
Colophon
This book was authored in PreTeXt.

Common questions

Powered by AI

The Handshaking Lemma states that in any graph, the sum of the degrees of all vertices is equal to twice the number of edges, expressed as \( \sum_{v \in V} \deg(v) = 2|E| \). This lemma helps understand graphs by ensuring the balance of incidences in the graph structure, verifying that every edge contributes two degrees overall. It is often used to justify calculations related to network structure and confirm the consistency of vertex degrees and edge counts .

In graph theory, a regular graph is one where every vertex has the same degree. When a graph is k-regular, every vertex has the degree k exactly. The significance lies in their uniform edge distribution, which can simplify analysis and provide symmetries useful in applications like network design and symmetry operations. Regular graphs often have properties that make them easier to analyze mathematically, and understanding their structure helps in exploring connectivity and completeness in network models .

The principle of mathematical induction is a proof technique for establishing that a statement p(n) holds for all integers n greater than or equal to a specific value N. It involves two main steps: the base step, where the statement is proved for the initial value N, and the inductive step, where it is assumed that the statement holds for an arbitrary integer k, and from this assumption, it is shown that it holds for k + 1. This principle is foundational because it relies on the well-ordering of integers and allows for the establishment of properties across all integers from a base case and an inductive step .

A variable in a logical expression is bound if it is within the scope of a quantifier such as ∃x or ∀x, otherwise it is considered free. The distinction is crucial because if all variables in an open statement are bound by quantifiers, the expression is classified as a proposition, meaning it has a definite truth value, as opposed to an open statement, which does not have a truth value assigned without specific variable assignments .

A graph is defined as an ordered pair G = (V, E) where V is a non-empty set of vertices, and E is a set of unordered pairs of vertices called edges. A multigraph differs in that its edge set allows multiple occurrences of the same unordered pair of vertices. A directed graph, or digraph, is characterized by having a set of vertices and a set of ordered pairs of vertices (called directed edges or arcs), where the direction of connection between vertices is significant .

The order of quantifiers can significantly change the meaning of logical statements, especially when they are not of the same type. For instance, the statements ∀x∃y p(x, y) and ∃y∀x p(x, y) are distinct because the first implies that for every x there exists a y such that p(x, y) holds, whereas the second suggests there is a single y that works for all x. However, when quantifiers are of the same type, such as ∀x∀y or ∃x∃y, the order does not matter, and thus they are logically equivalent .

A bipartite graph is a graph whose vertices can be divided into two disjoint sets X and Y such that every edge connects a vertex in X to one in Y, and no edge connects two vertices within the same set. It can be identified by checking if the vertex set can indeed be partitioned into these two subsets without violating the edge-condition requirement. Graphs redrawn to visually display this partition with vertices from different sets typically placed in opposing columns can help verify the bipartite nature .

The Euclidean algorithm finds the greatest common divisor (GCD) by exploiting the property that gcd(a, b) = gcd(b, a mod b) for integers a and b. The process involves repeated calculations of the remainder of division until a remainder of zero is reached, with the last non-zero remainder being the GCD. This method is efficient because it reduces the size of the numbers rapidly through division, requiring only logarithmic time complexity relative to the number of digits in the smaller number, thus offering a quick computational approach to determining GCDs .

The power set of a set A, denoted P(A), is the collection of all subsets of A, including the empty set and A itself. The significance of its cardinality being 2 raised to the power of the cardinality of A lies in the fact that it ensures that each element of A can either be included or not included in a subset, corresponding to the binary choice (0 or 1) for each element, resulting in 2^|A| possible subsets .

In a regular mathematical induction proof, after establishing the base case, the inductive step assumes the statement is true for a particular n and proves it for n + 1. Strong induction, however, allows the assumption that the statement is true for all integers up to n (not just for a single n) when proving it for n + 1. Strong induction is preferred when the statement depends on multiple preceding cases rather than just the immediately preceding one, making it useful for problems like proving properties about sequences where each element depends on several previous ones .

You might also like