Unit 4 Set Theory and Functions
Unit 4 Set Theory and Functions
• E-sources:
NPTEL course on Discrete Mathematics.
Contents
• Unit 4: Set Theory & Function
• Set Theory: Definitions and the Element Method of Proof
Disproofs,
• Functions: Defined on General Sets, One-to-One and Onto,
Inverse Functions, Composition of Functions, Cardinality with
Applications to Computability
• (Chapter 6: Set Theory and Chapter 7: Functions from
Susanna S. Epp, “Discrete Mathematics with Applications”
4th Edition)
Set Theory Definitions
• The words set and element are undefined terms of set theory.
• According to Cantor’s notation, let S denote a set and a an
element of S.
• Then, a ∈ S means that a is an element of S,
• a ∉ S means that a is not an element of S.
• {1, 2, 3} refers to the set whose elements are 1, 2, and 3, and
• {1, 2, 3, . . .} refers to the set of all positive integers.
• If S is a set and P(x) is a property that elements of S may or may
not satisfy, then a set A may be defined as:
• A = {x ∈ S | P(x)},
• which is read “the set of all x in S such that P of x.”
Subsets: Proof and Disproof
• Consider a set A to be a subset of a set B as a formal universal
conditional statement:
• A ⊆ B ⇔ ∀x, if x ∈ A then x ∈ B.
• The negation is, therefore, existential:
• A⊄ B ⇔ ∃x such that x ∈ A and x ∉ B.
• A proper subset of a set is a subset that is not equal to its
containing set. Thus
• A is a proper subset of B ⇔
1) A⊆B, and
2) there is at least one element in B that is not in A.
Subsets: Proof and Disproof
• Testing Whether One Set Is a Subset of Another:
• Let A = {1} and B = {1, {1}}.
• a. Is A ⊆ B?
• b. If so, is A a proper subset of B?
• Solution
a. Because A = {1}, A has only one element, namely the symbol 1. This
element is also one of the elements in set B.
Hence every element in A is in B, and so A ⊆ B.
b. B has two distinct elements, the symbol 1 and the set {1} whose only
element is 1.
Since 1 = {1}, the set {1} is not an element of A, and so there is an element of
B that is not an element of A. Hence A is a proper subset of B.
Set Equality
• Given sets A and B, A equals B, written A = B, if, and only if,
every element of A is in B and every element of B is in A.
• Symbolically:
• A = B ⇔ A ⊆ B and B ⊆ A.
Ven Diagrams
• If sets A and B are represented as regions in the plane,
relationships between A and B can be represented by
pictures, called Venn diagrams.
• The relationship A ⊆ B can be pictured in one of two ways,
Ven Diagrams
• The relationship A ⊄ B can be represented in three different
ways with Venn diagrams, as shown
Relations among Sets of Numbers
• Since Z, Q, and R denote the sets of integers, rational
numbers, and real numbers, respectively,
• Z is a subset of Q because every integer is rational (any
integer n can be written in the form n/1 )
• Q is a subset of R because every rational number is real
• Z is a proper subset of Q because there are rational
numbers that are not integers (for example, 1/2)
• Q is a proper subset of R because there are real
numbers that are not rational (for example, √2).
Operations on Sets
• Definition
• Let A and B be subsets of a universal set U.
1. The union of A and B, denoted A ∪ B, is the set of all elements that are in at least
one of A or B.
2. The intersection of A and B, denoted A ∩ B, is the set of all elements that
are common to both A and B.
3. The difference of B minus A, denoted B − A, is the set of all elements that are in B
and not A.
4. The complement of A, denoted Ac, is the set of all elements in U that are not in A.
• Symbolically: A ∪ B = {x ∈ U | x ∈ A or x ∈ B},
• A ∩ B = {x ∈ U | x ∈ A and x ∈ B},
• B − A = {x ∈ U | x ∈ B and x ∉ A},
• Ac = {x ∈ U | x ∉ A}.
Operations on Sets
•Venn diagram representations for union, intersection, difference,
and complement are shown in Figure:
Unions, Intersections, Differences, and
Complements
•Let the universal set be the set U = {a, b, c, d, e, f, g} and
let A = {a, c, e, g} and B = {d, e, f, g}. Find A ∪ B, A ∩ B, B −
A, and Ac.
Solution
A ∪ B = {a, c, d, e, f, g}
A ∩ B = {e, g}
B − A = {d, f }
Ac = {b, d, f }
Unions, Intersections, Differences, and
Complements
Unions, Intersections, Differences, and
Complements
Unions, Intersections, Differences, and
Complements
The empty Set
• The empty set (or null set) is denoted as ∅.
• {1, 3} ∩ {2, 4} = ∅
• {x ∈ R| x2 = −1} = ∅.
• D = {x ∈ R| 3 < x < 2}.
• a < x < b means that a < x and x < b.
• So, D consists of all real numbers that are both greater
than 3 and less than 2.
• Since there are no such numbers, D has no elements and
so D = ∅.
Partitions of Sets
• Definition
• Two sets are called disjoint if, and only if, they have
no elements in common.
• Symbolically:
• A and B are disjoint ⇔ A ∩ B = ∅.
Disjoint Sets
• Disjoint Sets
• Let A = {1, 3, 5} and B = {2, 4, 6}. Are A and B disjoint?
• Solution Yes. By inspection A and B have no elements
in common, or, in other words,
• {1, 3, 5} ∩ {2, 4, 6} = ∅.
Mutually Disjoint Sets
• Definition
• Sets A1, A2, A3 . . . are mutually disjoint (or pairwise
disjoint or nonoverlapping) if, and only if, no two
sets Ai and Aj with distinct subscripts have any
elements in common.
• More precisely, for all i, j = 1, 2, 3, . . .
• Ai ∩ Aj = ∅ whenever i ≠ j.
Mutually Disjoint Sets
• a. Let A1 = {3, 5}, A2 = {1, 4, 6}, and A3 = {2}. Are A1, A2,
and A3 mutually disjoint?
• b. Let B1 = {2, 4, 6}, B2 = {3, 7}, and B3 = {4, 5}. Are B1, B2,
and B3 mutually disjoint?
• Solution
• a. Yes. A1 and A2 have no elements in common, A1 and
A3 have no elements in common, and A2 and A3 have no
elements in common.
• b. No. B1 and B3 both contain 4.
Mutually Disjoint Sets
• Suppose A, A1, A2, A3, and A4 are the sets of
points represented by the regions shown in
Figure 6.1.5.
• Then A1, A2, A3, and A4 are subsets of A, and
A = A1 ∪ A2 ∪ A3 ∪ A4.
• These sets are mutually disjoint. Then A is
called a union of mutually disjoint subsets,
and the collection of sets {A1, A2, A3, A4} is
said to be a partition of A.
Mutually Disjoint Sets
• Definition
• A finite or infinite collection of nonempty sets {A1,
A2, A3 . . .} is a partition of a set A if, and only if,
• 1. A is the union of all the Ai
• 2. The sets A1, A2, A3, . . . are mutually disjoint.
Partition of Sets
• a. Let A = {1, 2, 3, 4, 5, 6}, A1 = {1, 2}, A2 = {3, 4}, and
A3 = {5, 6}. Is {A1, A2, A3} a partition of A?
• b. Let Z be the set of all integers and let
• T0 = {n ∈ Z| n = 3k, for some integer k},
• T1 = {n ∈ Z| n = 3k + 1, for some integer k}, and
• T2 = {n ∈ Z| n = 3k + 2, for some integer k}.
• Is {T0, T1, T2} a partition of Z?
Partition of Sets
• a. Let A = {1, 2, 3, 4, 5, 6}, A1 = {1, 2}, A2 = {3, 4}, and
A3 = {5, 6}. Is {A1, A2, A3} a partition of A?
• Solution
• a. Yes. By inspection, A = A1 ∪ A2 ∪ A3 and the sets
A1, A2, and A3 are mutually disjoint.
Partition of Sets
• Solution
• b.
• Yes. By the quotient-remainder theorem, every integer n can
be represented in exactly one of the three forms
• n = 3k or n = 3k +1 or n = 3k + 2,
• for some integer k. This implies that no integer can be in any
two of the sets T0, T1, or T2.
• So T0, T1, and T2 are mutually disjoint.
• It also implies that every integer is in one of the sets T0, T1, or
T2.
• So Z = T0 ∪ T1 ∪ T2.
Power Sets
• There are various situations in which it is useful to
consider the set of all subsets of a particular set. The
power set axiom guarantees that this is a set.
• Definition
• Given a set A, the power set of A, denoted P (A), is
the set of all subsets of A.
Power Sets
• Power Set of a Set
• Find the power set of the set {x, y}.
• That is, find P({x, y}).
• Solution P({x, y}) is the set of all subsets of {x, y}.
• ∅ is a subset of every set, and so ∅ ∈ P({x, y}).
• Also any set is a subset of itself, so {x, y} ∈ P({x, y}).
The only other subsets of {x, y} are {x} and {y}, so
• P({x, y}) = {∅, {x}, {y}, {x, y}}.
Cartesian Product
• Definition
• Given sets A1, A2, . . . , An, the Cartesian product of A1,
A2, . . . , An denoted A1 × A2 × . . . × An, is the set of all
ordered n-tuples (a1, a2, . . . , an) where a1 ∈ A1, a2 ∈ A2, .
. . , an ∈ An.
• Symbolically:
• A1 × A2 ×· · ·× An = {(a1, a2, . . . , an) | a1 ∈ A1, a2 ∈ A2, . . .
, an ∈ An}.
• In particular,
• A1 × A2 = {(a1, a2) | a1 ∈ A1 and a2 ∈ A2}
• is the Cartesian product of A1 and A2.
Cartesian Product
• Let A1 = {x, y}, A2 = {1, 2, 3}, and A3 = {a, b}.
• a. Find A1 × A2.
• b. Find(A1 × A2) × A3.
• c. FindA1 × A2 × A3.
• Solution
• a. A1 × A2 = {(x, 1), (x, 2), (x, 3), (y, 1), (y, 2), (y, 3)}
Cartesian Product
• Let A1 = {x, y}, A2 = {1, 2, 3}, and A3 = {a, b}.
• b. Find (A1 × A2) × A3.
• Solution
• b.
• (A1 × A2) × A3 = {(u, v) | u ∈ A1 × A2 and v ∈ A3}
• = {((x, 1), a), ((x, 2), a), ((x, 3), a), ((y, 1), a),
• ((y, 2), a), ((y, 3), a), ((x, 1), b), ((x, 2), b), ((x, 3), b),
• ((y, 1), b), ((y, 2), b), ((y, 3), b)}
Cartesian Product
• Let A1 = {x, y}, A2 = {1, 2, 3}, and A3 = {a, b}.
• c. FindA1 × A2 × A3.
• Solution
• c.
• A1 × A2 × A3 = {(u, v, w) | u ∈ A1, v ∈ A2, and w ∈ A3}
• = {(x, 1, a), (x, 2, a), (x, 3, a), (y, 1, a), (y, 2, a),
• (y, 3, a), (x, 1, b), (x, 2, b), (x, 3, b), (y, 1, b),
• (y, 2, b), (y, 3, b)}.
Exercise 6.1
• 1, 10, 11, 14, 17
Definition
A one-to-one correspondence (or bijection) from a set X to a set Y is a
function F: X → Y that is both one-to-one and onto.
Inverse Functions
• If F is a one-to-one correspondence from a set X to a set Y, then there
is a function from Y to X that “undoes” the action of F; that is, it sends
each element of Y back to the element of X that it came from.
• This function is called the inverse function for F.
• Solution The arrow diagram for h−1 is obtained by tracing the h-arrows
back from S to P({a, b}) as shown below.
One to one, onto Function examples
One to one, onto Function examples
One to one, onto Function examples
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
Functions
• Figure is not a function,
because it sends an element
to two different elements.
Exercise set 7.2
6. Let X = {1, 5, 9} and Y = {3, 4, 7}.
a. Define f : X → Y by specifying that
f (1) = 4, f (5) = 7, f (9) = 4.
Is f one-to-one? Is f onto? Explain your answers.
b. Define g: X → Y by specifying that
g(1) = 7, g(5) = 3, g(9) = 4.
Is g one-to-one? Is g onto? Explain your answers.
Answers:
a. Not one to one and not onto
b. one to one and onto
Exercise set 7.2
7. Let X = {a, b, c, d} and Y = {e, f, g}. Define functions F and G by
the arrow diagrams below.
Then f is one-to-one and onto. Thus f−1 exists and is found by tracing the
arrows backwards.
Composing a Function with its Inverse
•Now f−1 ◦ f is found by following the arrows from
X to Y by f and back to X by f −1.
•( f−1 ◦ f )(a) = f−1( f (a)) = f−1(z) = a
•( f−1 ◦ f )(b) = f−1( f (b)) = f−1(x) = b
•( f−1 ◦ f )(c) = f−1( f (c)) = f−1(y) = c.
•Thus, the composition of f and f−1 sends each
element to itself.
•So by definition of the identity function,
•f−1 ◦ f = IX .
•In a similar way,
•f ◦ f−1 = IY .
Cardinality with Applications to
Computability
•Let A and B be any sets. A has the same cardinality as B if, and only if,
there is a one-to-one correspondence from A to B.
•In other words, A has the same cardinality as B if, and only if, there is
a function f from A to B that is one-to-one and onto.
•For all sets A, B, and C:
a. Reflexive property of cardinality: A has the same cardinality as A.
b. Symmetric property of cardinality: If A has the same cardinality as
B, then B has the same cardinality as A.
c. Transitive property of cardinality: If A has the same cardinality as B
and B has the same cardinality as C, then A has the same
cardinality as C.
Cardinality with Applications to
Computability
Proof:
• Part (a), Reflexivity: Suppose A is any set.
• Consider the identity function IA from A to A. This function is one-
to-one because if x1 and x2 are any elements in A with I A(x1) =
IA(x2), then, by definition of IA, x1 = x2.
• The identity function is also onto because if y is any element of A,
then y = IA(y) by definition of IA.
• Hence IA is a one-to-one correspondence from A to A.
Cardinality with Applications to
Computability
Proof:
•Part (b), Symmetry: Suppose A and B are any sets and A has the same
cardinality as B.
•Since A has the same cardinality as B, there is a function f from A to B
that is one-to-one and onto.
•But then, by Theorems there is a function f−1 from B to A that is also
one-to-one and onto.
•Hence B has the same cardinality as A.
Cardinality with Applications to
Computability
Proof:
•Part (c), Transitivity: Suppose A, B, and C are any sets and A has the
same cardinality as B and B has the same cardinality as C.
•Since A has the same cardinality as B, there is a function f from A to B
that is one-to-one and onto, and since B has the same cardinality as C,
there is a function g from B to C that is one-to-one and onto.
•But then, by Theorems g ◦ f is a function from A to C that is one-to-
one and onto.
•Hence A has the same cardinality as C.
Cardinality with Applications to
Computability
Definition
A and B have the same cardinality if, and only if, A has the same
cardinality as B or B has the same cardinality as A.