Professional Documents
Culture Documents
CH2 Relations
CH2 Relations
Chapter 2:Relations
Sets Section
Chapter 2: Relations
1. Logic and proofs 2
The way to describe a set:roster method:all members are listed between braces.
S = {a,b,c,d}
Order not important
S = {a,b,c,d}={b,c,a,d}
Each distinct object is either a member or not; listing more than once does not change the set.
S = {a,b,c,d} = {a,b,c,b,c,d}
Elipses (…) may be used to describe a set without listing all of the members when the pattern
is clear.
S = {a,b,c,d, ……,z }
Set of all positive integers less than 100:S = {1,2,3,……..,99}
Set of all integers less than 0:
S = {…., -3,-2,-1}
Some important sets Section
Chapter 2: Relations
1. Logic and proofs 4
Universal set U,which contains all the objects under consideration, is represented
by a rectangle.
Note: the univeral set varies depending on which objects are of interest
The empty set is the set with no elements,and is denoted by but {} are also used.
A=
Question: What are the difference between ?
Section
Chapter 2: Relations
1. Logic and proofs 7
Definition 2: 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 . We write
A=B if A and B are equal sets
Example:A={1,3,5},B={1,3,3,5},C={3,1,5}
Subsets Section
Chapter 2: Relations
1. Logic and proofs 8
x x A x B
Using logical equivalences we have that A = B iff
x x A x B x B x A
This is equivalent to A ⊆ B and B ⊆ A
Subsets Section
Chapter 2: Relations
1. Logic and proofs 11
set A is a subset of a set B but , we write and say that A is a proper subset of B.
A is a proper suyset of B if and only if
Example:
1. Let A be the set of odd positive integers less than 10. Then |A|=5
2. ||= 0
3.|{ø}| = 0
4. |{1,a,{1},{1,a}}|= 4
5. The set of positive integers is infinite.
Section
Chapter 2: Relations
1. Logic and proofs 13
Definition 5: Given a set S. 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).
Example:
1.What is the power set of the set {1,2,3}?
2.What is the power set of the set ?
3.What is the power set of the set ?
Remark: If a set has n elements, then its power set has elements
Section
Chapter 2: Relations
1. Logic and proofs 14
Section
Chapter 2: Relations
1. Logic and proofs 15
Exercise:
Make sure whether they are true or false
(1)
(2)
(3) {}
(4) {}
(5) { a, b } { a, b, c, {a, b, c}}
(6) { a, b } { a, b, c, {a, b}}
(7) { a, b} { a, b, {{a, b}}}
(8) { a, b} { a, b, {{a,b}}}
Cartesian products Section
Chapter 2: Relations
1. Logic and proofs 16
Definition 6: The ordered n-tuple is the ordered collection that has as its first
element,as its second element,...,as its nth element.
Two n-tuples are equal if and only if their corresponding elements are equal.
= if and only if = for i=1,2,...,n.
2-tuples are called ordered pairs.
The ordered pairs (a,b) and (c,d) are equal if and only if a = c and b = d.
Example: If (x+y,4)=(5,2x-y), then what are the values of x and y, respectively?
Section
Chapter 2: Relations
1. Logic and proofs 17
Definition 7: Let A and B be sets. The Cartesian product of A and B, denoted by, is
the set of all ordered pairs(x,y), where . Hence
𝐴× 𝐵≠ 𝐵× 𝐴
Example:
A = {a,b} B = {1,2,3}
A × B = {(a,1),(a,2),(a,3), (b,1),(b,2),(b,3)}
How about ?
Example: Let A represent the set of all students at a university, and B represent the set of
all courses offered at the university. What is the Cartesian product and how can it be
used?
Section
Chapter 2: Relations
1. Logic and proofs 18
Definition 8: The Cartesian product of the sets denoted by is the set of ordered n-
tuples where belong to for i=1,2,...,n. In other words,
Remark : We use the notation to denote , the cartesian product of set A with
itself.
A subset R of the Cartesian product is called a relation from the set A to set B. The
elements of R are ordered pairs, where the first element belongs to A, the second
element belongs to B
Example:
1.Suppose A={1,2}, B={a,b,c}, what about .
2. What are the ordered pairs in the less than or equal to relation, which contains
(a,b) if , on the set {1,2,3}
Set Operation Section
Chapter 2: Relations
1. Logic and proofs 20
Definition: Let A and B be sets. The union of the sets A and B, denoted
by A ∪ B, is the set that contains those elements that are either in A or in
B, or in both.
𝐴∪ 𝐵={𝑥∨𝑥∈ 𝐴∨ 𝑥∈ 𝐵}
Venn Diagram for A ∪ B
Example: Suppose A={1,3,5} and B={1,2,3}.
Then
Section
Chapter 2: Relations
1. Logic and proofs 21
𝐴 ∩ 𝐵 ={𝑥∨ 𝑥 ∈ 𝐴 ∧ 𝑥 ∈ 𝐵 }
Example: What is {1,2,3} ∩ {3,4,5} ? Venn Diagram for A ∩B
Solution: {3}
Example:What is {1,2,3} ∩ {4,5,6} ?
Solution: ∅
Section
Chapter 2: Relations
1. Logic and proofs 22
Definition: Two sets are called disjoint if their intersection is the empty set.
Definition: Let U be the universal set. The complement of the set A, denoted by , is
the complement of A with respect to U. Therefore, the complement of the set A is U-
A.
𝐴={𝑥∨ 𝑥 ∈ 𝑈 ∧ 𝑥 ∉ 𝐴 }
Inclusion-Exclusion : |A ∪ B| = |A| + | B| − |A ∩ B|
Example: Let A be the math majors in your class and B be the CS majors. To count the
number of students who are either math majors or CS majors, add the number of math
majors and the number of CS majors, and subtract the number of joint CS/math majors.
Solution: {1,2,3,6,7,8}
Section
Chapter 2: Relations
1. Logic and proofs 26
Exercise:
1. Let } , . Find
Domination laws
Idempotent laws
Complementation law
Commutative laws
Associative laws
Distributive laws
De Morgan’s laws
Absorption laws
Complement laws
Proving Set Identities Section
Chapter 2: Relations
1. Logic and proofs 29
Definition: The union of a collection of sets is the set that contains those elements
that are members of at least one set in the collection.
The intersection of a collection of sets is the set that contains those elements that are
members of all the sets in the collection.
n
A A A
i 1
i 1 2 An
n
A A A
i 1
i 1 2 An
Example: For i = 1,2,…, let Ai = {i, i + 1, i + 2, ….}. Then,
n n
We use the notation to denote that , and to denote that . When , is said to be
related to by . In the following, we will omit the word binary.
Section
Chapter 2: Relations
1. Logic and proofs 34
Example:
Let A = {0,1,2} and B = {a,b}, then R={(0, a), (0, b), (1,a) , (2, b)} is a relation
from A to B.
Question: How many relations are there from set A to set B, if |A|=n, |B|=m?
Section
Chapter 2: Relations
1. Logic and proofs 35
Example:
1. Suppose that A = {a,b,c}. Then R = {(a,a),(a,b), (a,c)} is a relation on A.
2. Let A = {1, 2, 3, 4}. The ordered pairs in the relation R = {(a,b) | a divides b}.
Then R= {(1,1), (1, 2), (1,3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.
Section
Chapter 2: Relations
1. Logic and proofs 36
Exercise:
List the ordered pairs in the relation from to ,where if and only if
1)
2)
3)
Representing Relations Using Matrices Section
Chapter 2: Relations
1. Logic and proofs 39
Example : Suppose that A = {1,2,3} and B = {1,2}. Let R be the relation from A to B
containing (a,b) if a ∈ A, b ∈ B, and a > b. What is the matrix representing R
(assuming the ordering of elements is the same as the increasing numerical order)?
Solution: Because R = {(2,1), (3,1),(3,2)}, the matrix is
0 0
MR 1 0
1 1
Section
Chapter 2: Relations
1. Logic and proofs 41
Example: Let A = {a1,a2, a3} and B = {b1,b2, b3,b4, b5}. Which ordered pairs
are in the relation R represented by the matrix
0 1 0 0 0
M R 1 0 1 1 0 ?
1 0 1 0 1
Solution: Because R consists of those ordered pairs (ai,bj) with mij = 1, it follows that:
R a , b , a , b , a , b , a , b , a , b , a , b , a , b .
1 2 2 1 2 3 2 4 3 1 3 3 3 5
Section
Chapter 2: Relations
1. Logic and proofs 42
Solution: The ordered pairs in the relation is R={(1, 3), (1, 4), (2, 1), (2, 2), (2, 3),
(3, 1), (3, 3),(4, 1), (4, 3)}
Properties of Relations Section
Chapter 2: Relations
1. Logic and proofs 44
Definition: A relation R on a set A such that for all a,b ∊ A if (a,b) ∊ R and (b,a) ∊ R,
then a = b is called antisymmetric.
y(x∈A∧y∈A∧(<x,y>∈R∧<y,x>∈R)→x=y)
R6 a, b a b 3 note that both 2,1 and 1, 2 belongs to R , but not 2, 2 .
6
Section
Chapter 2: Relations
1. Logic and proofs 49
If R is a reflexive relation, all the elements on the main diagonal of MR are equal to 1.
1 1 0
M R 1 1 1 .
0 1 1
Is R reflexive, symmetric, and/or antisymmetric?
Solution: Because all the diagonal elements are equal to 1, R is
reflexive. Because MR is symmetric, R is symmetric and not
antisymmetric because both m1,2 and m2,1 are 1.
Section
Chapter 2: Relations
1. Logic and proofs 51
Solution:
The relation R={(1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (3, 1), (3, 3),(4, 1), (4, 3)}
Section
Chapter 2: Relations
1. Logic and proofs 53