Lect 4
Lect 4
Lecture 4
1
CHAPTER 2:
Basic Structures: Sets, Functions, Sequences, Sums,
and Matrices
Introduction
⚫ Sets are used to group objects together. Often the objects in a
set have similar properties.
DEFINITION 1
A set is an unordered collection of objects, called elements or
members of the set. A set is said to contain its elements.
We write a ∈ A to denote that a is an element of the set A.
The notation a ∉ A denotes that a is not an element of the set A.
2
2.1 Sets
DEFINITION 2
The objects in a set are called the elements, or members, of the set. A set is
said to contain its elements.
A = {𝑎, 𝑏, 𝑐, 𝑑}
• a A: a is an element of the set A.
• v A: a is not an element of the set A.
• Note: lower case letters are used to denote elements.
3
2.1 Sets
Ways to describe a set:
Use { … }
⚫ E.g. {a, b, c, d} – A set with four elements.
⚫ V = {a, e, i, o, u} – The set V of all vowels in English
alphabet.
⚫ O = {1, 3, 5, 7, 9} – The set O of odd positive integers less
than 10.
⚫ X={1, 2, 3, …, 99} – The set X of positive integers less
than 100.
Another way to describe a set is to use set builder notation :
characterize all the elements in the set by stating the property or
properties.
⚫ E.g. O = { x | x is an odd positive integer less than 10}
⚫ O={x Z+| x is odd and x < 10}
4
2.1 Sets
Commonly accepted letters to represent sets
⚫ N = {0, 1, 2, 3, …}, the set of natural numbers
⚫ Z = {…, -2, -1, 0, 1, 2, …}, the set of integers
⚫ Z+ = {1, 2, 3, …}, the set of positive integers
⚫ Q = {p/q | p Z, q Z, and q ≠ 0}, the set of rational
numbers
⚫ R, the set of real numbers
Sets can have other sets as members
Example:
The set {N, Z, Q, R} is a set containing four elements, each of
which is a set.
5
2.1 Sets
Interval Notation
2.1 Sets
DEFINITION 3
Two sets are equal if and only if they have the same elements. That is, if A and
B are sets, then A and B are equal if and only if
x(x A↔ x B).
We write A = B if A and B are equal sets.
Example:
• Are sets {1, 3, 5} and {3, 5,1} equal?
• Are sets {1, 3, 3, 3, 5, 5, 5, 5} and {1, 3, 5} equal?
The sets {1, 3, 5} and {3, 5, 1} are equal, because they have the same
elements. The order in which the elements of a set are listed does not matter.
It does not matter if an element of a set is listed more than once, so
{1,3,3,3,5,5,5,5} is the same as the set{1, 3, 5} because they have the same
element
7
2.1 Sets
Venn Diagrams
⚫ Represent sets graphically
⚫ The universal set U, which contains all the objects under U
u a
consideration, is represented by a rectangle. The set varies
V e
depending on which objects are of interest. o i
⚫ Inside the rectangle, circles or other geometrical figures are
used to represent sets.
⚫ Sometimes points are used to represent the particular
elements of the set.
Example:
𝐴 = {1,2,3,4,7} U
𝐵 = {0,3,5,7,9} 1 2
𝐶 = {1,2 }
4
3 7 0 5 9
8
2.1 Sets
⚫ Empty Set (null set): a set that has no elements,
denoted by ф or {}.
Example: The set of all positive integers that are greater than
their squares is an empty set.
⚫ Singleton set: a set with one element
⚫ Compare: ф and {ф}
⚫ Ф: an empty set. Think of this as an empty folder
⚫ {ф}: a set with one element. The element is an empty set.
Think of this as an folder with an empty folder in it.
9
2.1 Sets
subset
DEFINITION 4
The set A is said to be a subset of B if and only if every element of A is
also an element of B.
We use the notation A B to indicate that A is a subset of the set B.
p ↔ q=(p → q) Λ (q → p)
10
2.1 Sets
For every non-empty set S is guaranteed to have at least two subset,
the empty set and the set S itself, that is ф S and S S.
THEOREM 1
For every set S,
(i) ф S and (ii) S S
⚫
U
A B
11
2.1 Sets
finite & infinite set
DEFINITION 5
Let S be a set. If there are exactly n distinct elements in S where n is a
nonnegative integer, we say that S is a finite set and that n is the cardinality
of S.
The cardinality is the number of distinct elements in 𝑆. The cardinality of S is
denoted by |S|.
⚫ Example:
⚫ Let A be the set of odd positive integers less than 10. Then |A| = 5.
⚫ Let A be the set of letters in the English alphabet. Then |A| = 26.
⚫ Null set has no elements, | ф | = 0.
⚫ Let A be the set of 𝐴 = {1, 2, 3, 7, 9}. Then |𝐴| = 5
⚫ Let A be the set of A = {𝑎, 𝑏, 𝑐, 𝑑, {2}} Then |𝐴| = 5
⚫ Let A be the set of A = {1, 2, 3, {2,3}, 9}. Then |𝐴| = 5
DEFINITION 6
12
A set is said to be infinite if it is not finite.
Example: The set of positive integers is infinite.
2.1 Sets
the power set P(S)
DEFINITION 7
Given a set, the power set of S is the set of all subsets of the set S. The power
set of S is denoted by P(S).
If a set has n elements, its power set |P(S)| has 2n elements or 2|S|.
Example:
⚫ What is the power set of the set {0,1,2}?
Solution: P({0,1,2}) = {ф, {0}, {1}, {2}, {0,1}, {0,2}, {1,2}, {0,1,2}}
⚫ What is the power set of the empty set? What is the power set of the set
{ф}?
Solution: The empty set has exactly one subset, namely, itself.
P(ф ) = {ф}
The set {ф} has exactly two subsets, namely, ф and the set {ф}.
P({ф}) = {ф, {ф}}
13
2.1 Sets
Cartesian Products
⚫ Sets are unordered, a different structure is needed to represent an
ordered collections – ordered n-tuples.
DEFINITION 8
The ordered n-tuple (a1, a2,…, an) is the ordered collection that has a1
as its first element, a2 as its second element, …, and an as its nth
element.
⚫ Two ordered n-tuples are equal if and only if each corresponding
pair of their elements is equal.
⚫ (a1, a2,…, an) = (b1, b2,…, bn) if and only if ai = bi for i = 1, 2, …, n
14
2.1 Sets
Cartesian product
DEFINITION 9
Let A and B be sets. The Cartesian product of A and B, denoted by A×B, is the set
of all ordered pairs (a, b), where a A and b B. Hence,
A × B = {(a,b)| a A Λ b B}.
⚫ Example:
What is the Cartesian product of A = {1,2} and B = {a,b,c}?
Solution:
A × B = {(1,a), (1,b), (1,c), (2,a), (2,b), (2,c)}
|𝐴| × |𝐵| = |𝐴| ∗ |𝐵| = 2 ∗ 3 = 6
⚫ Cartesian product of A × B and B × A are not equal, unless A = ф or B =
ф (so that A × B = ф ) or A = B.
B × A = {(a,1),(a,2),(b,1),(b,2),(c,1),(c,2)}
⚫ Example:
What is the Cartesian product of A × B × C where A= {0,1}, B = {1,2},
and C = {0,1,2}?
Solution:
|𝐴| × |𝐵| × |C|= |𝐴| ∗ |𝐵| ∗ |C| = 2*2*3 = 12
A × B × C= {(0,1,0), (0,1,1), (0,1,2), (0,2,0), (0,2,1), (0,2,2), (1,1,0),
(1,1,1), (1,1,2), (1,2,0), (1,2,1), (1,2,2)}
16
Using Set Notation with Quantifiers
∀x ∈S(P (x)) denotes the universal quantification of P(x) over all elements in
the set S.
∀x∈ S(P (x)) is shorthand for ∀x(x∈S→P(x)).
∃x∈S(P(x)) denotes the existential quantification of P(x) over all elements in
S.
∃x∈ S(P (x)) is shorthand for ∃x(x∈S ∧ P(x)).
Example:
What do the statements ∀x∈ R (x2≥0) and ∃x∈Z (x2 =1) mean?
Solution:
⚫ The statement ∀x∈R(x2≥0). states that for every real number x, x2≥0. This
statement can be expressed as “The square of every real number is
nonnegative.” This is a true statement.
⚫ The statement ∃x∈Z(x2=1) states that there exists an integer x such that
x2=1.This statement can be expressed as “There is an integer whose square is
1.” This is also a true statement because x=1 is such an integer (as is -1).
Truth Sets of Quantifiers
Given a predicate P , and a domain D, we define the truth set of P to
be the set of elements x in D for which P(x)is true.
The truth set of P(x)is denoted by { x ∈ D | P(x)}.
Example:
What are the truth sets of the predicates P(x), Q(x), and R(x), where the
domain is the set of integers and P(x) is “ |x| =1,” Q(x) is “x2=2,” and R(x) is
“|x| = x.”
Solution:
The truth set of P , { x ∈ Z | |x| =1} , is the set of integers for which |x|=1.
Because |x| = 1 when x = 1or x = -1, and for no other integers x, we see
that the truth set of P is the set {-1,1}.
The truth set of Q,{x ∈ Z | x2=2}, is the set of integers for which x2=2.
This is the empty set because there are no integers x for which x2=2.
The truth set of R,{x ∈ Z| |x|=x}, is the set of integers for which |x| = x.
Because |x| = x if and only if x ≥ 0, it follows that the truth set of R is N,
the set of nonnegative integers.
2.2 Set Operations
Union A U B
DEFINITION 1
Let A and B be sets. The union of the sets A and B, denoted by A U B, is the
set that contains those elements that are either in A or in B, or in both.
⚫ A U B = { x | x A v x B}
⚫ Shaded area represents A U B.
⚫ The union of the sets {1,3,5} and {1,2,3} is the set {1,2,3,5};
that is {1,3,5} U {1,2,3} = {1,2,3,5}
⚫ The union of the set of all computer science majors at your school
and the set of all mathematics majors at your school is the set of
students at your school who are majoring either in mathematics or in
computer science (or in both). 19
2.2 Set Operations
Intersection A ∩ B
DEFINITION 2
Let A and B be sets. The intersection of the sets A and B, denoted by A ∩ B,
is the set containing those elements in both A and B.
⚫ A∩B={x|x AΛx B}
⚫ Shaded area represents A ∩ B.
21
2.2 Set Operations
Difference A – B= complement of B with respect to A
DEFINITION 4
Let A and B be sets. The difference of A and B, denoted by A – B, is the set
containing those elements that are in A but not in B.
The difference of A and B is also called the complement of B with respect to A.
⚫ A–B={x|x AΛ x B}
⚫ A – B is shaded.
Example:
⚫ {1,3,5} - {1,2,3} = {5}
⚫ {1,2,3} – {1,3,5} = {2}
⚫ The difference of the set of computer science majors at your school and
the set of mathematics majors at your school is the set of all computer
science majors at your school who are not mathematics majors.
22
2.2 Set Operations
Complement Ā : the complement of A with respect to U
DEFINITION 5
Let U be the universal set. The complement of the set A, denoted by Ā, is the
complement of A with respect to U. In other words, the containing those
complement of the set A is U – A.
⚫ Ā = { x | x A }= {x| ¬ x∈A}
⚫ Ā is shaded.
Example:
⚫ Let A be the set of positive integers greater than 10 (with universal set the
set of all positive integers.) Then Ā = {1,2,3,4,5,6,7,8,9,10}
23
AUB
Set Operations
⚫ A U B = { x | x ∈ A v x ∈ B}
A∩B
⚫ A∩B={x|x∈AΛx∈B}
⚫ A – B = { x | x ∈ A Λ x ∉ B}
={ x | x ∈ A Λ ¬ x∈ B} A–B
⚫ Ā = { x | x ∉ A }= {x| ¬ x∈A}=U – A