0% found this document useful (0 votes)
19 views72 pages

Topic 1 Lecture Notes (Gardiner)

Uploaded by

tonyho2003
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)
19 views72 pages

Topic 1 Lecture Notes (Gardiner)

Uploaded by

tonyho2003
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
You are on page 1/ 72

MATH1081 – Discrete Mathematics

Topic 1 – Set theory and functions


Lecture 1.01 – Set notation

Lecturer: Dr Sean Gardiner – [email protected]


Introduction to set theory and functions
The mathematical study of set theory began in 1874, founded by Georg
Cantor. Mathematical sets underlie almost all branches of mathematics, and
set theory provides an important framework for describing and understanding
formal logic.
In MATH1081, we will encounter sets throughout all 5 topics of the course.
In this first topic, we will also use sets to motivate the investigation of
functions, another fundamental mathematical concept that appears in
almost all branches of mathematics.
Much of our study of Topic 1 will be focused on definitions and results
about sets and functions. Probably the most difficult part of this topic is
understanding and applying the different methods of proof regarding
properties of sets and functions. We will revisit these ideas in a more
generalised sense in Topic 3 (Proofs and logic).

MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 1/7
Set notation
Definition. A set is a well-defined, unordered collection of distinct objects.
The objects contained in a set are called its elements.
Notation. A set can be represented by writing its elements surrounded by
braces (curly brackets). For example, the set S with just the elements 1, 2,
and 3 can be written as S = {1, 2, 3}.
Since sets are unordered collections, this set S can also be written as
S = {3, 1, 2} = {1, 2, 3}.
Since the elements of a set are distinct, repetition of elements is ignored, so
the set S can also be written as S = {1, 2, 2, 3, 3, 3} = {1, 2, 3}.
Example. Simplify each of the following sets.
• {x, a, y , x, a, y } = {a, x, y }.
• {even numbers between 1 and 9} = {2, 4, 6, 8}.

• {letters in BANANA} = {A, B, N}.

Notice that the elements of a set can be numbers, letters, or any other
object, and can be given explicitly or descriptively.
MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 2/7
Defining sets
Notation. The set membership symbol ∈ is used to indicate that an object
is an element of a set. We write x ∈ S to mean “x is an element of S”. We
can also use the symbol ̸∈ to indicate non-membership of a set.
For example, writing S = {1, 2, 3}, we have 1 ∈ S but 0 ̸∈ S. Similarly, we
have a ∈ {a, x, y } while b ̸∈ {a, x, y }.
We can properly define a set by writing out all its elements, or by giving a
careful description of its elements. So long as there is no ambiguity, we can
also use the ellipsis symbol (... ) to help describe a set. For example:
• {letters in the English alphabet} = {A, B, C, ... , Z}.

• {positive even numbers} = {2, 4, 6, 8, ... }.

Notation. A colon (:) or vertical bar (|) symbol can be used to introduce
additional properties that define the elements of a set. We write
{x ∈ S : (some property of x)} or {x ∈ S | (some property of x)}
to mean “the set of elements in S that satisfy the property”, or literally, “all
x in S such that x satisfies the property”.
For example, writing S = {1, 2, 3}, we have {x ∈ S : x > 1} = {2, 3}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 3/7
Numeric sets
Notation. The following are some important and commonly-used sets of
numbers.
• N = {0, 1, 2, 3, ... }, the set of natural numbers. Note here that 0 ∈ N.

• Z = {... , −3, −2, −1, 0, 1, 2, 3, ... }, the set of integers.


• Z+ = {x ∈ Z : x > 0} = {1, 2, 3, ... }, the set of positive integers.
n o n o
p
• Q= : p, q ∈ Z, q ̸= 0 = qp : p ∈ Z, q ∈ Z+ , the set of
q
rational numbers. The rational numbers include all integers and fractions.
• R = {all points on the real number line}, the set of real numbers. The
real √
numbers include all rational numbers as well as all irrational numbers
like 2, π, and e.
• C = {a + bi : a, b ∈ R, i 2 = −1}, the set of complex numbers. The
complex numbers include all real numbers as well as imaginary numbers
(real multiples of the imaginary unit i) and their sums.
Much of this course is focused on the sets N, Z, and Z+ . In fact, the study
of number theory (seen in Topic 2) is exclusively concerned with integers.
MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 4/7
The empty set and cardinality
Example. Write out the following sets explicitly.
• A = {x ∈ N | x < 5} = {0, 1, 2, 3, 4}.

• B = {n ∈ Z | n2 = 4} = {−2, 2}.
• C = {x ∈ Z+ : x
2 ∈ Z} = {2, 4, 6, 8, ... }.
• D = {2k : k ∈ Z+ } = {2, 4, 6, 8, ... } = C .

• E = {x ∈ D : x ̸∈ R} = {}.

Definition. The set with no elements is called the empty set, which is
written as {} or ∅.
Definition. The cardinality or size of a set is the number of distinct
elements it contains. We write |S| to mean “the cardinality of the set S”.
Note that if S is finite, then |S| ∈ N.
Example. Find the cardinality of each of the sets from the previous example.
• |A| = 5. • |C | = |D| = ∞.
• |B| = 2. • |E | = 0.

MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 5/7
Sets within sets
We have seen that sets can contain elements of any type. In particular, sets
themselves can be contained in other sets. For example, if we think of
tutorials as sets of students, then the set of all MATH1081 tutorials is a set
containing sets.
For another example, consider the set S = {1, 2, {3, 4}}. It contains the
elements 1, 2, and {3, 4}. This means we can write that {3, 4} ∈ S. This
also tells us that the cardinality of S is given by |S| = 3. Notice that the
elements of {3, 4} are not related to the elements of S nor the cardinality
of S. So in particular, in this case 3 ̸∈ S and 4 ̸∈ S.
Example. Find the cardinality of each of the following sets.
• | {x, {x}} | = 2.
• | {x, y , {x}, {y }, {x, y }, N} | = 6.

• | {x, {x}, {x, x}} | = | {x, {x}, {x}} | = | {x, {x}} | = 2.

• | {{}} | = 1.

• | {{{}}} | = 1.

MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 6/7
Case study: Russell’s paradox
Occasionally we will encounter “case studies”, which are included to give
more context to the topics we are studying.
These case studies are considered additional content and are not examinable.
In 1901, logician Bertrand Russell posed a problem that is now known as
Russell’s paradox (also attributed to Ernst Zermelo):
Problem. (Russell’s paradox)
Let S = {sets which are not elements of themselves}. Is S an element of S?
• By the definition, any element X ∈ S must satisfy X ̸∈ X . Replacing X
with S, we see that if S ∈ S, then S ̸∈ S, which is a contradiction.
• Similarly, by the definition, any set such that X ̸∈ X must satisfy X ∈ S.
Replacing X with S, we see that if S ̸∈ S, then S ∈ S, which is again a
contradiction.
So neither “S ∈ S” nor “S ̸∈ S” can be true statements!
We mentioned earlier that a set must be well-defined. Russell’s paradox
provides an example of a set that is not well-defined, in this case due to its
definition being self-referential.
MATH1081 Topic 1 – Set theory and functions Lecture 1.01 – Set notation 7/7
MATH1081 – Discrete Mathematics
Topic 1 – Set theory and functions
Lecture 1.02 – Subsets and power sets

Lecturer: Dr Sean Gardiner – [email protected]


Subsets
Note: The phrase “if and only if” is used in mathematical definitions to
indicate equivalence of statements.
Definition. A set S is a subset of a set T if and only if every element of S
is also an element of T .
Notation. We write S ⊆ T to mean “S is a subset of T ”. Similarly, we
write S ̸⊆ T to indicate S is not a subset of T .
For example, we have {1, 3} ⊆ {1, 2, 3} and {1, 2, 3} ⊆ {1, 2, 3}, but
{1, 2, 3, 4} ̸⊆ {1, 2, 3}. We can also see that Z+ ⊆ N ⊆ Z ⊆ Q ⊆ R ⊆ C.
Definition. Two sets S and T are equal (written S = T ) if and only if they
contain exactly the same elements. This means that every element of S is
an element of T , and every element of T is an element of S. So we have
that S = T if and only if S ⊆ T and T ⊆ S.
Definition. A set S is a proper subset of a set T if and only if S ⊆ T and
S ̸= T . (Equivalently, S ⊆ T and T ̸⊆ S.)
Notation. We write S ⊂ T or S ⊊ T to mean “S is a proper subset of T ”.
For example, we have {1, 3} ⊂ {1, 2, 3}, but {1, 2, 3} ̸⊂ {1, 2, 3}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 1/9
Example – Identifying elements and subsets
Example. Decide whether each of the statements below is true or false.
• 1 ∈ {1, {1}} is a true statement since 1 is an element of {1, {1}}.

• 1 ⊆ {1, {1}} is a false statement since 1 is not a set, so it cannot be a


subset.
• {1} ∈ {1, {1}} is a true statement since {1} is an element of {1, {1}}.

• {1} ⊆ {1, {1}} is a true statement since every element of {1} is an


element of {1, {1}}.
• {{1}} ∈ {1, {1}} is a false statement since {{1}} is not an element
of {1, {1}}.
• {{1}} ⊆ {1, {1}} is a true statement since every element of {{1}} is an
element of {1, {1}}.
Theorem. For any set S, we have S ⊆ S and {} ⊆ S.
Proof. Clearly S ⊆ S, since every element of S is again an element of S.
The statement {} ⊆ S is vacuously true since every element of {} (of which
there are none) is an element of S.
MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 2/9
Proving statements about set containment
Suppose that S and T are sets. To prove that S is a subset of T , we must
show that every element of S is also an element of T . If S is very large, it
might be impractical to check each element of S individually. So we
typically prove that any arbitrary element of S also belongs to T by working
with a general element x ∈ S.
That is, to prove that S ⊆ T , we write a proof with the following structure:
Let x ∈ S be an arbitrary element of S.
..
.
Then x ∈ T .
Thus S ⊆ T .
To prove that S ̸⊆ T , we only have to show that there is some particular
element in S that is not in T . Such a proof would have the structure:
Choose x ∈ S to be the particular element...
..
.
Then x ∈
̸ T.
Thus S ⊈ T.
MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 3/9
Example – Proving set containment
Example. Let S = {2k + 1 : k ∈ Z} and T = {4n − 1 : n ∈ Z}.
Prove that S ̸⊆ T .
Solution. Consider the number 1. Clearly 1 ∈ S, since 1 = 2 × 0 + 1 and
0 ∈ Z. However 1 ̸∈ T , since the only solution to 1 = 4n − 1 is n = 12 ,
which is not an integer. Thus 1 is an element of S that is not an element
of T , meaning that S ̸⊆ T .

Example. Let S = {6k + 1 : k ∈ Z} and T = {3n − 2 : n ∈ Z}.


Prove that S ⊆ T .
Solution. Let x ∈ S be an arbitrary element of S. Then x = 6k + 1 for
some integer k. We can rewrite this as

x = 6k + 1 = 3(2k + 1) − 2,

so x = 3n − 2 where n = 2k + 1 is some integer. This means that x ∈ T , so


any element of S is also an element of T , and thus S ⊆ T .

MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 4/9
Proving further statements about set containment
To prove that S = T , we must prove that S ⊆ T and that T ⊆ S. Note
that this means we must provide two separate proofs (using the structure
shown on the previous slide).
To prove that S ̸= T , we must prove that S ̸⊆ T or that T ̸⊆ S. Note that
this just means we have to show there is some particular element that
belongs to one of the sets but not the other.
To prove that S ⊂ T , we must prove that S ⊆ T and that S ̸= T . Note
that this means after proving that S ⊆ T , we just have to find some
particular element of T that is not in S.
(To prove that S ̸⊂ T , we must prove that S ̸⊆ T or that S = T .)
Example. Let S = {6k + 1 : k ∈ Z} and T = {3n − 2 : n ∈ Z}.
We have already shown that S ⊆ T . Prove that S is a proper subset of T .
Solution. To prove that S ⊂ T , it remains to show that S ̸= T .
Consider the number 4. Clearly 4 ∈ T , since 4 = 3 × 2 − 2 and 2 ∈ Z.
However 4 ̸∈ S, since the only solution to 4 = 6k + 1 is k = 12 , which is not
an integer. Thus 4 is an element of T that is not an element of S, meaning
that S ̸= T . Since we already know S ⊆ T , we can conclude that S ⊂ T .
MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 5/9
Example – Proving set equality
Example. Let S = {6k + 1 : k ∈ Z} and T = {6n − 5 : n ∈ Z}.
Prove that S = T .
Solution. We need to prove both that S ⊆ T and that T ⊆ S.
Proving S ⊆ T : Let x ∈ S be an arbitrary element of S. Then x = 6k + 1
for some integer k. We can rewrite this as

x = 6k + 1 = 6(k + 1) − 5,

so x = 6n − 5 where n = k + 1 is some integer. This means that x ∈ T , so


any element of S is also an element of T , and thus S ⊆ T .
Proving T ⊆ S: Let x ∈ T be an arbitrary element of T . Then x = 6n − 5
for some integer n. We can rewrite this as

x = 6n − 5 = 6(n − 1) + 1,

so x = 6k + 1 where k = n − 1 is some integer. This means that x ∈ S, so


any element of T is also an element of S, and thus T ⊆ S.
Since we have now shown that both S ⊆ T and T ⊆ S, we can conclude
that S = T .
MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 6/9
Power sets
Definition. The power set of a set S, written as P(S) or just P(S), is the
set of all possible subsets of S.
For example, the subsets of {1, 2} are {}, {1}, {2}, and {1, 2}, so the power
set of {1, 2} is P({1, 2}) = { {}, {1}, {2}, {1, 2} }.
Example. Find P({a, b, c}).
Solution. We first list the subsets of {a, b, c} in increasing size order:
• The only subset of size 0 is {}.

• The subsets of size 1 are {a}, {b}, and {c}.

• The subsets of size 2 are {a, b}, {a, c}, and {b, c}.

• The only subset of size 3 is {a, b, c}.

Thus P({a, b, c}) = { {}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }.

Notice that |P({1, 2})| = 4 = 22 , while |P({a, b, c})| = 8 = 23 . We can


also easily check that |P({1})| = 21 and |P({})| = 20 . This seems to
indicate a connection between cardinalities of power sets and powers of 2...

MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 7/9
Cardinality of power sets
Theorem. For any finite set S, the cardinality of its power set is given by
|P(S)| = 2|S| .
Proof. Since S is finite, we may write S = {x1 , x2 , x3 , ... , xn } where n = |S|
and each xi is a different element of S. We can think of creating a subset of
S by choosing for each element whether it is included or excluded in the
subset. These branching choices can be represented by the tree diagram:
x3
l ud
e x2
inc x3
x1 ···
exc x3
lud
e x2
x3

Each path from left to right produces a different subset of S, and all
possible subsets are accounted for. At each step, the number of branches
doubles, and the last choice is for xn at the nth step. So there are 2n = 2|S|
total different paths available, and thus there are 2|S| different subsets of S.
Example. Find the following cardinalities:
1
• |P({1, 2, 3, 4})| = 24 = 16. • |P(P({1}))| = 2|P({1})| = 22 = 4.
MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 8/9
Proofs involving power sets
The following fact follows straight from our definition of a power set, and
can be useful when proving properties of power sets.
Fact. For any sets S and T , we have S ⊆ T if and only if S ∈ P(T ).
In order to prove a statement involving power sets, we first introduce a
lemma about sets. (“Lemma” in mathematics means a minor theorem.)
Lemma. Suppose A, B, and C are sets such that A ⊆ B and B ⊆ C .
Then A ⊆ C .
Proof. Try this yourself! (See tutorial Problem Set 1, Question 7.)
Example. Suppose that S and T are sets such that S ⊆ T .
Prove that P(S) ⊆ P(T ).
Solution. Let X ∈ P(S) be an arbitrary element of P(S). Then X ⊆ S by
the definition of a power set. Since S ⊆ T , by the above lemma we know
that X ⊆ T . This means that X ∈ P(T ), so any element of P(S) is also an
element of P(T ), and thus P(S) ⊆ P(T ).

MATH1081 Topic 1 – Set theory and functions Lecture 1.02 – Subsets and power sets 9/9
MATH1081 – Discrete Mathematics
Topic 1 – Set theory and functions
Lecture 1.03 – Venn diagrams and set operations

Lecturer: Dr Sean Gardiner – [email protected]


Venn diagrams
Definition. When working with related sets, it can be useful to define a
universal set which contains all elements relevant to these sets. The
universal set is usually denoted by U or just U. In particular, all the related
sets are subsets of U.
For example, if our sets are MATH1081 tutorials, then an appropriate
universal set might be the set of all MATH1081 students. If our sets are
intervals on the real number line, then the universal set would be R.
Definition. A Venn diagram is a diagrammatic tool for visualising
relationships between related sets. Sets are represented as overlapping closed
figures (usually circles) within a larger figure (usually a rectangle)
representing the universal set. Elements can be represented as points placed
within different sections of the diagram to show which sets they belong to.

U
For example, here is a general Venn A B
diagram for two sets A and B with
universal set U:

MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 1/12
Venn diagram example
Example. Consider the following Venn diagram:
w U
A B
x
y
z

For each of the elements w , x, y , z ∈ U, we can make the following


conclusions:
• w ̸∈ A and w ̸∈ B.
• x ∈ A and x ̸∈ B.
• y ∈ A and y ∈ B.
• z ̸∈ A and z ∈ B.
In order to more easily refer to the different sections in a Venn diagram, we
shall introduce new notation that allows us to perform operations on sets.

MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 2/12
Union
Definition. The union of two sets A and B, written as A ∪ B, is the set of
all elements in A or B (or both). That is,
A ∪ B = {x ∈ U : x ∈ A or x ∈ B}.
(Note: The word “or” in mathematics is always treated as inclusive.)

In a Venn diagram, A ∪ B is U
A B
represented by this shaded region:

Example. Given that R = {a, c, e}, S = {b, d}, and T = {d, e, f }, find the
following:
• R ∪ S = {a, b, c, d, e}.
• R ∪ T = {a, c, d, e, f }.
• S ∪ T = {b, d, e, f }.
• R ∪ S ∪ T = {a, b, c, d, e, f }.
MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 3/12
Intersection
Definition. The intersection of two sets A and B, written as A ∩ B, is the
set of all elements in both A and B. That is,

A ∩ B = {x ∈ U : x ∈ A and x ∈ B}.

In a Venn diagram, A ∩ B is U
A B
represented by this shaded region:

Example. Given that R = {a, c, e}, S = {b, c, d}, and T = {a, b, d, e},
find the following:
• R ∩ S = {c}.
• R ∩ T = {a, e}.
• S ∩ T = {b, d}.
• R ∩ S ∩ T = {}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 4/12
Complement
Definition. The complement of a set A, written as Ac (or sometimes A), is
the set of all elements in the universal set that are not in A. That is,

Ac = {x ∈ U : x ̸∈ A}.

In a Venn diagram, Ac is represented U


A B
by this shaded region:

Example. Given that U = {a, b, c, d, e}, R = {a, c, e}, S = {b}, and


T = {}, find the following:
• R c = {b, d}.
• S c = {a, c, d, e}.
• T c = {a, b, c, d, e}.

MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 5/12
Set difference
Definition. The difference of two sets A and B, written as A − B (or
sometimes A \ B), is the set of all elements in A which are not in B. That is,

A − B = {x ∈ U : x ∈ A and x ̸∈ B}.

In a Venn diagram, A − B is U
A B
represented by this shaded region:

Example. Given that R = {a, b, c, d}, S = {b, c, d}, and T = {b, d, e},
find the following:
• R − S = {a}.
• R − T = {a, c}.
• S − T = {c}.
• S − R = {}. (Notice that in general, A − B ̸= B − A for sets A and B.)
MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 6/12
Symmetric difference
Definition. The symmetric difference of two sets A and B, written as A ⊖ B
(or sometimes A △ B or A ⊕ B), is the set of all elements in A or B, but not
both. That is,

A ⊖ B = {x ∈ U : x ∈ A ∪ B and x ̸∈ A ∩ B}.

In a Venn diagram, A ⊖ B is U
A B
represented by this shaded region:

Example. Given that R = {a, b, c}, S = {b}, and T = {b, c, d}, find the
following:
• R ⊖ S = {a, c}.
• R ⊖ T = {a, d}.
• S ⊖ T = {c, d}.

MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 7/12
Combining set operations
A general Venn diagram for three sets A, A B U
B, and C with universal set U is shown
to the right.
Venn diagrams for four or more sets can
become unwieldy or impossible to draw,
so they are normally avoided. C

Set operations can be applied to multiple sets, so long as the order of


operations is clearly indicated by the use of brackets.
Example. Shade the regions indicated by the following set expressions.
(A ∪ B) ∩ C (A ∩ B)c − C
A B U A B U

C C
MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 8/12
Disjoint sets
Definition. Two sets A and B are disjoint if their intersection is empty, that
is, if A ∩ B = ∅.
Definition. The sets A1 , A2 , A3 , ... , Ak are pairwise disjoint if every pair of
sets is disjoint, that is, if Ai ∩ Aj = ∅ for all i ̸= j.
Definition. The sets A1 , A2 , A3 , ... , Ak partition the set B if they are
pairwise disjoint and A1 ∪ A2 ∪ A3 ∪ · · · ∪ Ak = B.

For example, in the Venn diagram on A U


the right, U is partitioned by the sets B
A, B, and C .
C
Example. Complete the following sentences regarding general sets A and B:
• A and Ac partition U.
• A and B − A partition A ∪ B.
• A ∩ B and A ⊖ B partition A ∪ B.
• A ∩ B and A − B partition A.
MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 9/12
Cardinalities in Venn diagrams
Another way to represent information in a Venn diagram is by writing the
cardinality of each individual section in the diagram. Cardinalities can be
represented as numbers placed within each section (without points, to
distinguish set cardinalities from set elements).
Example. Consider the following Venn diagram:
U
A B

5 2 4

Find each of the following:


• |A ∩ B| = 2.
• |A| = 7.
• |A ∪ B| = 11.
• |U| = 14.

MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 10/12
Example – Finding cardinalities with a Venn diagram
Example. 30 people were asked to select their preferred ice-cream flavours
from a list, where more than one selection was allowed. 16 people selected
chocolate, 16 selected vanilla, and 16 selected strawberry. 12 people selected
both chocolate and vanilla, 8 people selected both chocolate and strawberry,
and 7 people selected both vanilla and strawberry. 5 people selected all three
flavours. How many surveyed people selected none of the three flavours?
Solution. Let C , V , and S be the set of people who selected chocolate,
vanilla, and strawberry respectively. Drawing up a Venn diagram, we can fill
out the cardinalities by working from the innermost section outwards:

C V U
1 7 2
3 5 2
6
S 4
So the answer is 4.

MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 11/12
Inclusion-exclusion principle
Theorem. (Inclusion-exclusion principle)
The cardinality of a union of sets can be expressed in terms of cardinalities
of their intersections. For example,
• For any two sets A and B, we have

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


• For any three sets A, B, and C , we have

|A ∪ B ∪ C | = |A| + |B| + |C | − (|A ∩ B| + |A ∩ C | + |B ∩ C |) + |A ∩ B ∩ C |.


Proof (sketch). In the case of two sets, finding |A| + |B| counts each
element of A ∪ B at least once, but elements that belong to both A and B
are counted twice. To account for this, we subtract the size of A ∩ B. The
cases for three or more sets work similarly.
Example. Solve the previous problem using the inclusion-exclusion principle.
Solution. Using the inclusion-exclusion principle, we have
|C ∪ V ∪ S| = |C | + |V | + |S| − |C ∩ V | − |C ∩ S| − |V ∩ S| + |C ∩ V ∩ S|
= 16 + 16 + 16 − 12 − 8 − 7 + 5 = 26,
so the number of people who chose none of the flavours is 30 − 26 = 4.
MATH1081 Topic 1 – Set theory and functions Lecture 1.03 – Venn diagrams and set operations 12/12
MATH1081 – Discrete Mathematics
Topic 1 – Set theory and functions
Lecture 1.04 – Laws of set algebra

Lecturer: Dr Sean Gardiner – [email protected]


Proofs involving set operations
There are three main ways to justify or prove a statement involving set
operations:
• Using Venn diagrams.

◦ Venn diagrams are a useful visual aide, but are not generally
considered valid tools for rigorous proofs.
• Using set operation definitions, and thinking in terms of arbitrary
elements.
◦ This method is reliable and a good tool for most proofs. Using this
method to prove equivalence of sets can sometimes become unwieldy,
since two containment proofs are required.
• Using the laws of set algebra.

◦ We will soon introduce the laws of set algebra, which are especially
helpful in simplifying expressions.

MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 1/12
Example 1
Example. Is A ∩ B a subset of A ∪ B for all sets A and B?
Working: Considering the Venn diagrams for both sets, we have:
U U
A B A B

A∩B A∪B

Since the shaded region on the left is completely contained within the
shaded region on the right, this indicates that it is true in general that
A ∩ B ⊆ A ∪ B.
Proof. Let x ∈ A ∩ B be an arbitrary element of A ∩ B. Then x ∈ A and
x ∈ B. Since x ∈ A, we can certainly say x ∈ A or x ∈ B. So x ∈ A ∪ B.
Thus since any element of A ∩ B is an element of A ∪ B, we have that
A ∩ B ⊆ A ∪ B.

MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 2/12
Example 2
Example. Prove that for any sets A and B, we have A − B = A ∩ B c .
Proof. We need to show both that A − B ⊆ A ∩ B c , and that
A ∩ B c ⊆ A − B.
First, let x ∈ A − B. Then x ∈ A and x ̸∈ B. So x ∈ A and x ∈ B c .
Thus x ∈ A ∩ B c , meaning that A − B ⊆ A ∩ B c .
Next, let x ∈ A ∩ B c . Then x ∈ A and x ∈ B c . So x ∈ A and x ̸∈ B.
Thus x ∈ A − B, meaning that A ∩ B c ⊆ A − B.
Hence since the sets are subsets of each other, we know A − B = A ∩ B c .
Alternative proof. We have
A − B = {x ∈ U : x ∈ A and x ̸∈ B}
= {x ∈ U : x ∈ A and x ∈ B c }
= A ∩ Bc ,
as required.
Note that this second style of proof is more efficient, but may not always be
applicable depending on the problem.
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 3/12
Example 3
Example. Are the sets (A ∩ B)c and Ac ∩ B c equal for all sets A and B?
Working: Considering the Venn diagrams for both sets, we have:
U U
A B A B

(A ∩ B)c Ac ∩ B c
Since the shaded regions on the left and right are not identical, this indicates
that in general (A ∩ B)c ̸= Ac ∩ B c . To prove this, we just need to provide
an example where a non-matching section contains at least one element.
Proof. Consider the case where A = {1} and B = {2}, with universal set
U = {1, 2, 3}. Then we have (A ∩ B)c = ({})c = {1, 2, 3}, while
Ac ∩ B c = {2, 3} ∩ {1, 3} = {3}. Since these two sets are not the same, we
know (A ∩ B)c ̸= Ac ∩ B c in general.
Note that this is one of many valid cases that demonstrate inequality.
An even simpler case is A = {1}, B = {}, and U = {1}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 4/12
Example 4
Example. Are the sets (A ∩ B)c and Ac ∪ B c equal for all sets A and B?
Working: Considering the Venn diagrams for both sets, we have:
U U
A B A B

(A ∩ B)c Ac ∪ B c

Since the shaded regions on the left and right are identical, this indicates
that it is true in general that (A ∩ B)c = Ac ∪ B c .

MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 5/12
Example 4 (continued)
Example. Are the sets (A ∩ B)c and Ac ∪ B c equal for all sets A and B?
Proof. We claim that the sets are equal, so we want to show both that
Ac ∪ B c ⊆ (A ∩ B)c , and that (A ∩ B)c ⊆ Ac ∪ B c .

First, let x ∈ Ac ∪ B c . Then x ∈ Ac or x ∈ B c , so we can say x ̸∈ A or


x ̸∈ B. So x certainly can’t be an element of both A and B at once,
meaning x ̸∈ A ∩ B. So x ∈ (A ∩ B)c , and thus Ac ∪ B c ⊆ (A ∩ B)c .

Next, let x ∈ (A ∩ B)c . Then x ̸∈ A ∩ B. Either x ∈ A or x ̸∈ A, so we


consider these two cases in turn.
Case 1: If x ∈ A, then since x ̸∈ A ∩ B, we must have that x ̸∈ B. So
x ∈ B c , meaning that x ∈ Ac ∪ B c .
Case 2: If x ̸∈ A, then x ∈ Ac , meaning that x ∈ Ac ∪ B c .
Since x ∈ Ac ∪ B c in both cases, we can conclude that (A ∩ B)c ⊆ Ac ∪ B c .

Hence since the sets are subsets of each other, we can conclude that
(A ∩ B)c = Ac ∪ B c .

MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 6/12
Example 5
Example. Are A ∩ (B ∪ C ) and (A ∩ B) ∪ C equal for all sets A, B, and C ?
Working: Considering the Venn diagrams for both sets, we have:

A B U A B U

C C
A ∩ (B ∪ C ) (A ∩ B) ∪ C

Since the shaded regions on the left and right are not identical, this indicates
that in general A ∩ (B ∪ C ) ̸= (A ∩ B) ∪ C . To prove this, we just need to
provide an example where a non-matching section contains an element.
Proof. Consider the case where A = B = {} and C = {1}. Then we have
A ∩ (B ∪ C ) = {} ∩ {1} = {}, while (A ∩ B) ∪ C = {} ∪ {1} = {1}. Since
these two sets are not the same, we conclude A ∩ (B ∪ C ) ̸= (A ∩ B) ∪ C
in general.
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 7/12
Example 6
Example. Are A ∩ (B ∪ C ) and (A ∩ B) ∪ (A ∩ C ) equal for all sets A, B, C ?
Working: Considering the Venn diagrams for both sets, we have:

A B U A B U

C C
A ∩ (B ∪ C ) (A ∩ B) ∪ (A ∩ C )

Since the shaded regions on the left and right are identical, this indicates
that it is true in general that A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ).
Proof. Try this yourself! (Use similar methods to Examples 2 and 4.)

MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 8/12
Laws of set algebra
For any sets A, B, C with universal set U and empty set ∅, we have the
following laws of set algebra:
Commutativity: Identity:
A ∪ B = B ∪ A, A ∪ ∅ = A,
A ∩ B = B ∩ A. A ∩ U = A.
Associativity: Domination:
A ∪ (B ∪ C ) = (A ∪ B) ∪ C , A ∪ U = U,
A ∩ (B ∩ C ) = (A ∩ B) ∩ C . A ∩ ∅ = ∅.
Distributivity: Complement law:
A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ), A ∪ Ac = U,
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ). A ∩ Ac = ∅.
Absorption: Double complement law:
A ∪ (A ∩ B) = A, (Ac )c = A.
A ∩ (A ∪ B) = A. De Morgan’s law:
Idempotence: (A ∪ B)c = Ac ∩ B c ,
A ∪ A = A, (A ∩ B)c = Ac ∪ B c .
A ∩ A = A.
We also have the following definitions:
Difference: Symmetric difference:
A − B = A ∩ Bc . A ⊖ B = (A ∪ B) − (A ∩ B).
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 9/12
Comments on the laws of set algebra
The laws of set algebra completely describe the behaviour of sets under the
basic set operations. It is possible to verify any statements involving set
expressions by using only these laws, though doing so can take a lot of work.
While there are many laws to learn here, almost all of them are easily
justified by considering them in terms of Venn diagrams.
When simplifying expressions or proving statements using the laws of set
algebra, we should always state which laws are being used at each step. If
you do not remember the name of a particular law, you may instead describe
it in words and/or provide its general definition.
Definition. The dual of a set expression is the expression obtained by
replacing every instance of ∪ with ∩, ∩ with ∪, ∅ with U, and U with ∅.
Theorem. (Duality principle)
Any statement involving only sets and the union, intersection, and
complement operations is true if and only if its dual statement is true.
Proof. This is a consequence of the fact that every law of set algebra
consists of a pair of dual statements (except for the double complement law,
which is self-dual).
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 10/12
Example – Simplifying set expressions
Example. Simplify the set expression A ∩ (A ∩ B c )c .
Solution. We proceed using the laws of set algebra:

A ∩ (A ∩ B c )c = A ∩ (Ac ∪ (B c )c ) (De Morgan’s law)


c
= A ∩ (A ∪ B) (double complement law)
= (A ∩ Ac ) ∪ (A ∩ B) (distributivity)
= ∅ ∪ (A ∩ B) (complement law)
= (A ∩ B) ∪ ∅ (commutativity)
=A∩B (identity).

Notice that some of these steps could have been performed at the same
time, for example the commutativity and identity applications.
We could also have checked this by using a Venn diagram, though remember
that a Venn diagram explanation would not constitute a rigorous proof.
The dual of this result must also be true, so we now also know that:
A ∪ (A ∪ B c )c = A ∪ B.

MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 11/12
Example – Proving equivalence of set expressions
Example. Show that (A − B) ∩ (A − C ) = A − (B ∪ C ) for all sets A, B, C .
Solution. We proceed using the laws of set algebra. Simplifying the
left-hand side yields:

(A − B) ∩ (A − C ) = (A ∩ B c ) ∩ (A ∩ C c ) (def’n of difference)
c c
= A ∩ (B ∩ A) ∩ C (associativity)
= A ∩ (A ∩ B c ) ∩ C c (commutativity)
= (A ∩ A) ∩ B c ∩ C c (associativity)
= A ∩ Bc ∩ C c (idempotence).

Simplifying the right-hand side yields:

A − (B ∪ C ) = A ∩ (B ∪ C )c (def’n of difference)
c c
= A ∩ (B ∩ C ) (De Morgan’s law)
= A ∩ Bc ∩ C c (associativity).

Since both expressions simplify to give the same set, they must be equal. So
we have shown that (A − B) ∩ (A − C ) = A − (B ∪ C ).
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 12/12
MATH1081 – Discrete Mathematics
Topic 1 – Set theory and functions
Lecture 1.05 – Cartesian product and functions

Lecturer: Dr Sean Gardiner – [email protected]


Cartesian product
Definition. A tuple is a finite, ordered collection of objects. Unlike for a set,
the order of the elements in a tuple is important, and elements may be
repeated. A tuple with exactly n elements is sometimes called an n-tuple. A
tuple with exactly 2 elements is also called an ordered pair.
Notation. A tuple can be represented by writing its elements surrounded by
parentheses. For example, (1, 2, 1) is a 3-tuple, and it is different to (1, 1, 2).
Definition. The Cartesian product of two sets A and B, denoted A × B, is
the set containing all ordered pairs (2-tuples) for which the first element is
an element of A, and the second element is an element of B. That is,
A × B = { (a, b) : a ∈ A and b ∈ B }.
Notation. We sometimes refer to the Cartesian product A × A as A2 . For
example, the real coordinate plane is often referred to as R2 .
Example. Suppose A = {1, 2} and B = {x, y , z}. Evaluate the following.
• A × B = { (1, x), (1, y ), (1, z), (2, x), (2, y ), (2, z) }.

• A2 = { (1, 1), (1, 2), (2, 1), (2, 2) }.

Fact. For any sets A and B, we have |A × B| = |A| × |B|.


MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 1/13
Functions
We typically think of a function as a rule that converts input values to
output values. To properly define what this means, we will use the language
of set theory.
Definition. Given sets X and Y , a function from X to Y is a subset of
X × Y which contains exactly one ordered pair (x, y ) for each x ∈ X .
Notation. A function f from a set X to a set Y is declared as f : X → Y .
If (x, y ) ∈ f , we can say “f maps x to y ”. Instead of writing (x, y ) ∈ f , we
can also write f : x 7→ y , or (more commonly) f (x) = y . We sometimes
refer to x as an input value of f , and y as the output value of x under f .
For example, if X = {a, b, c} and Y = {1, 2}, then a valid function
f : X → Y is given by f = {(a, 1), (b, 2), (c, 2)}. This means we can write
that f (a) = 1, f (b) = 2, and f (c) = 2.
We can also define a function using a formula. For example, consider the
function g : R → R given by g (x) = x 2 for all x ∈ R. This function when
2
interpreted as a subset
√ of R has infinitely many elements, including (1, 1),
(2, 4), (−2, 4), and ( 2, 2).

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 2/13
Example – Identifying functions
Example. Suppose X = {1, 2, 3} and Y = {a, b, c, d}. Which of the
following represent functions from X to Y ?
• {(1, a), (2, b), (3, a)} is a function, since there is exactly one output value
for each possible input value. The fact that c and d are never returned
as output values has no effect on whether f is a function.
• {(1, a), (2, b), (3, c), (d, 1)} is not a function, since it includes the
element (d, 1), but d ̸∈ X is not a valid possible input and 1 ̸∈ Y is not a
valid possible output.
• {(1, a), (2, b)} is not a function, since it does not define an output for the
input value 3 ∈ X ; that is, it does not include the element (3, y ) for any
y ∈ Y.
• {(1, a), (2, b), (3, c), (3, d)} is not a function, since it defines more than
one output for the input value 3 ∈ X ; that is, it includes the elements
(3, c) and (3, d) where the first element is the same but the second
element is different.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 3/13
Arrow diagrams
It can sometimes be useful to represent a function f : X → Y visually. One
way this can be done is by using arrow diagrams. Just like for Venn
diagrams, the sets X and Y are represented as separate closed figures, and
their elements are represented as labelled points. The function is then
represented by a series of arrows, each pointing from an input value in X to
its corresponding output value in Y .
For example, in the case with sets X = {a, b, c} and Y = {1, 2}, and
function f : X → Y given by f = {(a, 1), (b, 2), (c, 2)}, the function f can
be represented with an arrow diagram as follows:
X f Y
a
1
b
2
c

In the special case that X = Y and we have f : X → X , we can draw just


one set of elements and represent the function as arrows pointing between
elements in X . This is known as a directed graph, and we will investigate
such structures further in Topic 5.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 4/13
Coordinate graphs
Another way to represent functions visually is by using a coordinate graph.
In a coordinate graph for a function f : X → Y , the elements of X are listed
along a horizontal axis, and the elements of Y are listed along a vertical axis.
Elements (x, y ) of the function are then marked as points at the coordinates
corresponding with axis values x and y . This method of representation is
particularly useful for cases where X and Y are each R or a subset of R.
For example, for the function g : R → R given by g (x) = x 2 , the function g
can be represented with a coordinate graph as follows:

g (x) g (x)
4 4
3 3
2 2
1 1
x x
−2 −1 1 2 −2 −1 1 2

When given a coordinate graph, we can determine whether it represents a


function by using the vertical line test: the graph represents a function if and
only if every possible vertical line touches the graph at exactly one point.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 5/13
Domain, codomain, and range
Definition. For a function f : X → Y , the set of all input values X is called
the domain of f , and the set of potential output values Y is called the
codomain of f .
Definition. For a function f : X → Y , the set of all output values actually
obtained when evaluating all input values is called the range or image of f .
The range of f can be denoted as f (X ) or range(f ) or im(f ). So the range
of f is given by
f (X ) = {f (x) : x ∈ X } ⊆ Y .
For example, again consider the sets X = {a, b, c} and Y = {1, 2}, with
function f : X → Y given by f = {(a, 1), (b, 2), (c, 2)}. Clearly the domain
of f is X and the codomain of f is Y . Furthermore, the range of f is {1, 2},
which happens to be the same as the codomain in this case.
Consider also the function g : R → R given by g (x) = x 2 for all x ∈ R.
Clearly the domain and codomain of g are both R. The range of g is the set
of all non-negative real numbers, so we have

im(g ) = g (R) = {y ∈ R : y ≥ 0}.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 6/13
Image and pre-image
Definition. Suppose f : X → Y is a function and A ⊆ X . The image of A
under f , written as f (A), is the set of all output values attained by mapping
all the input values in A under f . That is,
f (A) = {f (x) : x ∈ A} ⊆ Y .
Note that the image of the domain X under f is just the range (or image)
of f , which justifies using the notation f (X ).
Definition. Suppose f : X → Y is a function and B ⊆ Y . The pre-image of
B under f , written as f −1 (B), is the set of all input values that map to the
output values in B under f . That is,
f −1 (B) = {x ∈ X : f (x) ∈ B} ⊆ X .
Consider again the example with sets X = {a, b, c} and Y = {1, 2}, and
function f : X → Y given by f = {(a, 1), (b, 2), (c, 2)}.
The image of {a, b} under f is f ({a, b}) = {1, 2}, while f ({b, c}) = {2}.
The pre-image of {1} under f is f −1 ({1}) = {a}, while f −1 ({2}) = {b, c}.
Consider also the function g : R → R given by g (x) = x 2 for all x ∈ R.
Then g ({−1, 0, 1}) = {0, 1}, while g −1 ({4, 9}) = {−3, −2, 2, 3}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 7/13
Venn and arrow diagrams
We can visualise images and pre-images for functions by adapting
characteristics of Venn diagrams to our arrow diagrams.
For example, for a function f : X → Y with a subset of the domain A ⊆ X
and a subset of the codomain B ⊆ Y , we can draw the following:
X f Y

A f (A)

f (X )

f −1 (B) B

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 8/13
Example 1
Example. Suppose the students Altair, Bayek, Connor, Desmond, Ezio, and
Frye are studying MATH1081 this term. Bayek is in tutorial 1, Frye is in
tutorial 2, and the other four students are in tutorial 3.
(i) Define a function g that maps the students to their tutorials.
(ii) Draw the arrow diagram representing g .
(iii) Find the range of g .
(iv) Find the pre-image of each of the tutorials under g .
Solution. Labelling the students by their initials, we can define the set of
students S = {a, b, c, d, e, f } and the set of tutorials T = {1, 2, 3}. Then
the function g : S → T that maps students to tutorials is given by the set
g = { (a, 3), (b, 1), (c, 3), (d, 3), (e, 3), (f , 2) }.
The arrow diagram for g is provided to the right. S
a g
We can see from the diagram that the range of g T
is g (S) = {1, 2, 3} = T . b
1
We can also see that the pre-images are given by c
2
• g −1 ({1}) = {b}, d
• g −1 ({2}) = {f }, and
3
e
−1
• g ({3}) = {a, c, d, e}.
f
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 9/13
Example 2
Example. Let the set S = {a, b, c, d, e, f } represent the set of students
Altair, Bayek, Connor, Desmond, Ezio, and Frye respectively. The function
h : S → S mapping each student to their best friend is given by
h = {(a, e), (b, f ), (c, e), (d, e), (e, e), (f , b)}.
(i) Interpret this function h.
(ii) Draw the arrow diagram representing h.
(iii) Find the range of h.
(iv) Find h({a, c}) and h−1 ({a, c}).
Solution. Ezio is the best friend of Altair, Connor, Desmond, and himself.
Bayek and Frye are each other’s best friends.
The arrow diagram for h is provided to the right. S h S
a a
We can see from the diagram that the range of h
is h(S) = {b, e, f }. b b
We can also see that h({a, c}) = {e} while c c
h−1 ({a, c}) = {}. d d
e e
f f

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 10/13
Floor and ceiling functions
Definition. The floor function is a function with domain R and codomain Z
defined as follows: for any x ∈ R, the floor of x is written as ⌊x⌋ and is
given by the largest integer less than or equal to x.
Definition. The ceiling function is a function with domain R and codomain
Z defined as follows: for any x ∈ R, the ceiling of x is written as ⌈x⌉ and is
the smallest integer greater than or equal to x.
Example. Evaluate the following:
• ⌊3.14⌋ = 3.
• ⌈3.14⌉ = 4.
• ⌊−0.5⌋ = −1.
• ⌈−0.5⌉ = 0.
• ⌊1⌋ = 1.
• ⌈1⌉ = 1.

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 11/13
Example 3
Example. Let f : R → R be the function given by f (x) = ⌊x⌋, and let
g : R → R be the function given by g (x) = ⌈x⌉.
(i) Draw the coordinate graphs representing f and g .
(ii) Find the range of f and of g .
(iii) Let S = { n1 : n ∈ Z+ } = {1, 12 , 13 , 14 , ... }. Find each of f (S), g (S),
f −1 (S), and g −1 (S).
Solution. The coordinate graphs are provided below.

f (x) g (x)
4 4
3 3
2 2
1 1
x x
−4 −3 −2 −1 1 2 3 4 −4 −3 −2 −1 1 2 3 4
−1 −1
−2 −2
−3 −3
−4 −4

MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 12/13
Example 3 (continued)
Example. Let f : R → R be the function given by f (x) = ⌊x⌋, and let
g : R → R be the function given by g (x) = ⌈x⌉.
(i) Draw the coordinate graphs representing f and g .
(ii) Find the range of f and of g .
(iii) Let S = { n1 : n ∈ Z+ } = {1, 12 , 13 , 14 , ... }. Find each of f (S), g (S),
f −1 (S), and g −1 (S).
Solution. The coordinate graphs indicate that the range of both f and of g
is Z. To confirm this, notice that for any k ∈ Z, we have f (k) = g (k) = k,
so there is at least one input value that returns any integer k as an output.
Notice that f (S) = {f (1), f ( 21 ), f ( 13 ), f ( 14 ), ... } = {1, 0, 0, 0, ... } = {0, 1}.
Similarly, g (S) = {g (1), g ( 21 ), g ( 31 ), g ( 14 ), ... } = {1, 1, 1, 1, ... } = {1}.
Since the range of both f and of g is Z, no input value can return a
non-integer output. So in particular, the pre-image of any non-integer is
empty, that is, f ( 21 ) = g ( 12 ) = {}, f ( 13 ) = g ( 13 ) = {}, and so on.
So f −1 (S) = f −1 ({1, 21 , 13 , ... }) = f −1 ({1}) = {x ∈ R : 1 ≤ x < 2}.
Similarly, g −1 (S) = g −1 ({1, 21 , 13 , ... }) = g −1 ({1}) = {x ∈ R : 0 < x ≤ 1}.
MATH1081 Topic 1 – Set theory and functions Lecture 1.05 – Cartesian product and functions 13/13
MATH1081 – Discrete Mathematics
Topic 1 – Set theory and functions
Lecture 1.06 – Properties of functions and inverses

Lecturer: Dr Sean Gardiner – [email protected]


Functions (again)
Recall that a set f ⊆ X × Y is a function if and only if there is exactly one
ordered pair (x, y ) ∈ f for each x ∈ X .
Equivalently, we could say that a set f ⊆ X × Y is a function if and only if
every possible input value in X has exactly one corresponding output value
in Y . That is, a set f ⊆ X × Y is a function if and only if for every x ∈ X ,
there is exactly one y ∈ Y such that f (x) = y .
In terms of arrow diagrams, a set f ⊆ X × Y is a function if and only if each
element of the domain X has exactly one outgoing arrow.
In terms of coordinate graphs, a set f ⊆ R × R is a function if and only if
every possible vertical line touches the graph at exactly one point.
f (x) f (x) f (x)

x x x

(function) (not a function) (not a function)

MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 1/12
Injectivity
Definition. A function f : X → Y is injective (or one-to-one) if and only if
every possible output value in Y has at most one corresponding input value
in X . Equivalently, a function f : X → Y is injective if and only if any of the
following are true:
• For every y ∈ Y , there is at most one x ∈ X such that f (x) = y .

• For every x1 , x2 ∈ X , if f (x1 ) = f (x2 ) then we must have that x1 = x2 .

• For every x1 , x2 ∈ X , if x1 ̸= x2 then we must have that f (x1 ) ̸= f (x2 ).

In terms of arrow diagrams, a function f : X → Y is injective if and only if


each element of the codomain Y has at most one incoming arrow.
In terms of coordinate graphs, a function f : R → R is injective if and only if
every possible horizontal line touches the graph at at most one point.

x3 2x x 3 −x

x x x

(injective) (injective) (not injective)

MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 2/12
Injectivity – examples
Example. Decide whether each function below is injective, and prove your
claim.
• f : {1, 2, 3} → {1, 2, 3, 4}, f = {(1, 2), (2, 3), (3, 4)} is injective since for
every possible output value (1, 2, 3, 4), there is at most one
corresponding input value (none, 1, 2, 3 respectively).
• f : {1, 2, 3} → {1, 2, 3, 4}, f = {(1, 2), (2, 4), (3, 2)} is not injective since
there is an output value with more than one corresponding input value.
Specifically, f (1) = 2 = f (3) but 1 ̸= 3.
• f : Z → Z, f (x) = x 2 is not injective since there exists an output value
with more than one corresponding input value. For example, 2 ̸= −2 but
f (2) = 4 = f (−2).
• f : Z → Z, f (x) = 2x + 1 is injective since for every x1 , x2 ∈ Z, if
f (x1 ) = f (x2 ) then we have 2x1 + 1 = 2x2 + 1, which after rearrangement
implies x1 = x2 .
Notice that to prove a function is injective when its domain is infinite (or
very large), we need to give a proof for arbitrary domain elements x1
and x2 .
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 3/12
Surjectivity
Definition. A function f : X → Y is surjective (or onto) if and only if every
possible output value in Y has at least one corresponding input value in X .
Equivalently, a function f : X → Y is surjective if and only if any of the
following are true:
• For every y ∈ Y , there is at least one x ∈ X such that f (x) = y .

• The range of f and the codomain of f are equal, that is, f (X ) = Y .

In terms of arrow diagrams, a function f : X → Y is surjective if and only if


each element of the codomain Y has at least one incoming arrow.
In terms of coordinate graphs, a function f : R → R is surjective if and only
if every possible horizontal line touches the graph at at least one point.

x3 x 3 −x 2x

x x x

(surjective) (surjective) (not surjective)

MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 4/12
Surjectivity – examples
Example. Decide whether each function below is surjective, and prove your
claim.
• f : {1, 2, 3, 4} → {1, 2, 3}, f = {(1, 2), (2, 3), (3, 1), (4, 2)} is surjective
since for every possible output value (1, 2, 3), there is at least one
corresponding input value (3, 1 and 4, 2 respectively).
• f : {1, 2, 3, 4} → {1, 2, 3}, f = {(1, 1), (2, 2), (3, 1), (4, 2)} is not
surjective since there is an output value with less than one corresponding
input value. Specifically, 3 is in the codomain but f (x) = 3 has no
solution for any x ∈ {1, 2, 3, 4}.
• f : N → N, f (x) = x 2 is not surjective since there exists an output value
with less than one corresponding input value. For example, 2 ∈ Z but
f (x) = 2 has no solution for any x ∈ Z.
• f : Z → Z, f (x) = 2 − x is surjective since for every y ∈ Z, the equation
f (x) = y has a solution for some x ∈ Z, namely x = 2 − y .
Notice that to prove a function is surjective when its codomain is infinite
(or very large), we need to give a proof for an arbitrary codomain
element y .
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 5/12
Bijectivity
Definition. A function f : X → Y is bijective (or a one-to-one
correspondence) if and only if every possible output value in Y has
exactly one corresponding input value in X . Equivalently, a function
f : X → Y is bijective if and only if any of the following are true:
• For every y ∈ Y , there is exactly one x ∈ X such that f (x) = y .

• The function f is both injective and surjective.

In terms of arrow diagrams, a function f : X → Y is bijective if and only if


each element of the codomain Y has exactly one incoming arrow.
In terms of coordinate graphs, a function f : R → R is bijective if and only if
every possible horizontal line touches the graph at exactly one point.

x3 x 3 −x 2x

x x x

(bijective) (not bijective) (not bijective)

MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 6/12
Cardinalities of domain and codomain
Theorem. Suppose f : X → Y is a function for some sets X and Y .
• If f is injective, then |X | ≤ |Y |.
• If f is surjective, then |X | ≥ |Y |.
• If f is bijective, then |X | = |Y |.
Proof. For ease of reference, we describe f in terms of its arrow diagram
representation. Since f is a function, we know there must be exactly one
outgoing arrow for each element in the domain, so there are exactly |X |
arrows in the diagram.
If f is injective, then there must be at most one incoming arrow for each
element in the codomain, so there are at least |X | elements in the codomain.
If f is surjective, then there must be at least one incoming arrow for each
element in the codomain, so there are at most |X | elements in the codomain.
If f is bijective, then f is both injective and surjective, meaning both
|X | ≤ |Y | and |X | ≥ |Y |, so we must have that |X | = |Y |.
Notice that the converse (opposite direction) statements are not true in
general. For example, if |X | ≤ |Y | then this does not guarantee that
f : X → Y is injective.
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 7/12
Function composition
Definition. Given two functions f : X → Y and g : Y → Z for any sets
X , Y , Z , the composition of f and g is the function g ◦ f : X → Z defined by
(g ◦ f )(x) = g (f (x)) for all x ∈ X .
More generally, the composition of functions f and g is defined whenever
the range of f is a subset of the domain of g .
Notice that the order in which the component functions are applied is from
right to left, since applying g ◦ f to x returns the result of applying f to x
and then g to this output.
Example. Suppose f : Z → Z and g : Z → Z are functions defined by
f (x) = x 2 and g (x) = 2 − x. Find g ◦ f and f ◦ g .
Solution. For all x ∈ Z, we have (g ◦ f )(x) = g (f (x)) = g (x 2 ) = 2 − x 2 ,
while (f ◦ g )(x) = f (g (x)) = f (2 − x) = (2 − x)2 = 4 − 4x + x 2 .
Theorem. Given two functions f : X → Y and g : Y → Z :
• if f and g are both injective, then g ◦ f is also injective.
• if f and g are both surjective, then g ◦ f is also surjective.
Proof. Try this yourself! (See tutorial Problem Set 1, Question 34.)
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 8/12
Identity and inverse functions
Definition. For any set X , the identity function for X , denoted ιX (Greek
letter iota) or idX , is the function ιX : X → X defined by ιX (x) = x for all
x ∈ X.
Theorem. For any function f : X → Y , we have f ◦ ιX = f and ιY ◦ f = f .
Proof. For all x ∈ X , we have (f ◦ ιX )(x) = f (ιX (x)) = f (x).
Similarly for all x ∈ X , we have (ιY ◦ f )(x) = ιY (f (x)) = f (x).
Definition. The inverse of a function f : X → Y , if it exists, is the function
g : Y → X satisfying g ◦ f = ιX and f ◦ g = ιY . That is, (g ◦ f )(x) = x for
all x ∈ X , and (f ◦ g )(y ) = y for all y ∈ Y .
Notation. We write f −1 for the inverse of f (if it exists). This looks the
same as our notation for the pre-image of a set, but we can distinguish the
two notations by the fact that the inverse function takes elements of Y as
inputs, whereas the pre-image takes subsets of Y as inputs.

MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 9/12
Properties of inverses
In terms of sets of ordered pairs, if f ⊆ X × Y is a function and its inverse
f −1 exists, then f −1 = {(y , x) ∈ Y × X : (x, y ) ∈ f }. This justifies the
following properties of the inverse function:
Lemma. If a function f has an inverse, its inverse must be unique.
Proof. It is clear that given any function f ⊆ X × Y , its inverse f −1 is
defined uniquely as a subset of Y × X in terms of f .
Lemma. If a function f has an inverse f −1 , then the inverse of f −1 is f .
That is, (f −1 )−1 = f .
Proof. Suppose f ⊆ X × Y has inverse f −1 = {(y , x) : (x, y ) ∈ f }. Then
(f −1 )−1 = {(x, y ) : (y , x) ∈ f −1 } = {(x, y ) : (x, y ) ∈ f } = f .
Theorem. Suppose f : X → Y and g : Y → Z are functions such that their
composition g ◦ f has an inverse. Then (g ◦ f )−1 = f −1 ◦ g −1 .
Proof. Let h = f −1 ◦ g −1 . Then we have
h ◦ (g ◦ f ) = f −1 ◦ (g −1 ◦ g ) ◦ f = f −1 ◦ ιY ◦ f = f −1 ◦ f = ιX ,
(g ◦ f ) ◦ h = g ◦ (f ◦ f −1 ) ◦ g −1 = g ◦ ιX ◦ g −1 = g ◦ g −1 = ιY .
So indeed h is the unique inverse of g ◦ f , that is, (g ◦ f )−1 = f −1 ◦ g −1 .
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 10/12
Finding inverses
If the output values of f : X → Y are defined by a formula y = f (x) for all
x ∈ X , then if the inverse f −1 exists, it satisfies the formula x = f −1 (y ) for
all y ∈ Y .
Example. Find the inverse, if it exists, of the following functions.
• f : R → R, f (x) = 2x + 1.
Solution. We write y = 2x + 1 and rearrange to make x the subject,
giving x = y −1
2 . So the inverse f
−1
: R → R exists and is given by
−1 y −1 −1
f (y ) = 2 . (Or equivalently, f (x) = x−1 2 .)
• g : Z → Z, g (x) = 2x + 1.
Solution. If the inverse exists, it is given by g −1 : Z → Z, g −1 (y ) = y −1
2 .
But this formula returns non-integer outputs for even integer inputs, so it
is not well-defined. So the inverse function does not exist.
• h : R → R+ , h(x) = x 2 .
Solution. Writing y = x 2 and rearranging to make x the subject gives
√ −1 +
x = ± y . So √ if the inverse of h exists, it is given by h : R → R,
−1
h (x) = ± x. But this formula returns more than one output for any
positive real input, so it is not well-defined as a function. So the inverse
function does not exist.
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 11/12
Inverses and bijective functions
Theorem. The inverse of a function f : X → Y exists if and only if f is
bijective.
Proof. For ease of reference, we describe f and f −1 in terms of their arrow
diagram representations. Since f is a function, we know there must be
exactly one outgoing arrow for each element in the domain X .
Proof that if its inverse function exists, then f must be bijective:
The arrow diagram representation for the inverse function f −1 is formed by
reversing the direction of all the arrows in the arrow diagram for f . Since
f −1 : Y → X is a function, every element of Y must have exactly one
outgoing arrow. This means that in the arrow diagram for f , every element
of Y must have exactly one incoming arrow. So f is bijective.
Proof that if f is bijective, then it must have an inverse function:
Since it is bijective, the arrow diagram for f must have exactly one incoming
arrow for every element in Y . Reversing the direction of all the arrows in the
diagram will create a representation for a new function g : Y → X , since
every element in its domain Y will have exactly one outgoing arrow.
Furthermore, this function g must be the inverse of f , since g (f (x)) = x for
all x ∈ X and f (g (y )) = y for all y ∈ Y .
MATH1081 Topic 1 – Set theory and functions Lecture 1.06 – Properties of functions and inverses 12/12
Laws of set algebra
For any sets A, B, C with universal set U and empty set ∅, we have the
following laws of set algebra:
Commutativity: Identity:
A ∪ B = B ∪ A, A ∪ ∅ = A,
A ∩ B = B ∩ A. A ∩ U = A.
Associativity: Domination:
A ∪ (B ∪ C ) = (A ∪ B) ∪ C , A ∪ U = U,
A ∩ (B ∩ C ) = (A ∩ B) ∩ C . A ∩ ∅ = ∅.
Distributivity: Complement law:
A ∪ (B ∩ C ) = (A ∪ B) ∩ (A ∪ C ), A ∪ Ac = U,
A ∩ (B ∪ C ) = (A ∩ B) ∪ (A ∩ C ). A ∩ Ac = ∅.
Absorption: Double complement law:
A ∪ (A ∩ B) = A, (Ac )c = A.
A ∩ (A ∪ B) = A. De Morgan’s law:
Idempotence: (A ∪ B)c = Ac ∩ B c ,
A ∪ A = A, (A ∩ B)c = Ac ∪ B c .
A ∩ A = A.
We also have the following definitions:
Difference: Symmetric difference:
A − B = A ∩ Bc . A ⊖ B = (A ∪ B) − (A ∩ B).
MATH1081 Topic 1 – Set theory and functions Lecture 1.04 – Laws of set algebra 0/0

You might also like