Chapter 2:sets: School of Computer Science & Engg
Chapter 2:sets: School of Computer Science & Engg
Introduction
Set Operations
Functions: One-to-One Functions
Onto Functions
Inverse Functions
Compositions of Functions
Cardinality
.
School Of Computer Science & Engg. 5
Definition: A set is an unordered collection of objects
• Two sets are equal if and only if they have the same elements.
Therefore, 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.
• Note :The order in which the elements of a set are listed does not
matter and also an element of a set can appear many times,
i.e {1, 3, 3, 3, 5, 5, 5, 5}={1, 3, 5} .
Definition: Two sets are equal if and only if they have the same
elements. i.e x [x A ↔ x B].A=B if A and B are equal
sets.
Ex: Let A be the set of odd positive integers less than 10. Then |A| = 5.
Let S be the set of letters in the English alphabet. Then |S| = 26.
The null set has no elements, it follows that |∅| = 0
• A set is said to be infinite if it is not finite.
Ex: Suppose that A = {1, 2}. It follows that A2 = {(1, 1), (1, 2), (2, 1),
(2, 2)} and A3 ={(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1,
2), (2, 2, 1), (2, 2, 2)}.
School Of Computer Science & Engg. 34
Actvity
1.What is the Cartesian product A × B × C, where A is the set of all
airlines and B and C are both the set of all cities in the United
States? Give an example of how this Cartesian product can be
used.
2. Find A2 if a) A = {0, 1, 3}. b) A = {1, 2, a, b}.
3. How many different elements does A × B have if A has m
elements and B has n elements?
Let A and B be sets. The Union of the sets A and B, denoted by A⋃B,
is the set contains those elements that are either in A or in B or
both.
A ⋃ B={x|x A ⋁ x B}
The symbol for denoting union of sets is ‘∪’.
Venn Diagram:
•
U
A
Ā
(A U B) = AB
• f(a) = Z
• the image of d is Z A B
• the domain of f is A = {a, b, c, d} a
• the codomain is B = {X, Y, Z} X
• f(A) = {Y, Z}
b
Y
• the preimage of Y is b c
• the preimages of Z are a, c and d Z
d
• f({c,d}) = {Z}
A f B
fj One-to-One Onto
f1(n)=n2
f2(n)=n+3
f3(n)= n-1,odd n
n+1,even n
• Let g be the function from the set {a, b, c} to itself such that g(a) = b, g(b)
= c, and g(c) = a.Let f be the function from the set {a, b, c} to the set {1, 2,
3} such that f (a) = 3, f (b) = 2, andf (c) = 1. What is the composition of f
and g, and what is the composition of g and f ?