0% found this document useful (0 votes)
34 views

1 0 Set Relation Function

Discrete mathematics deals with discrete or separated sets of objects rather than continuous sets, and processes with individual steps rather than continuously changing processes. Some problems addressed in discrete mathematics include calculating probabilities, analyzing social networks, and finding optimal paths. Discrete mathematics is important for computer science as information is stored discretely. It also applies to many other areas and develops reasoning skills. The document then provides an outline of topics in discrete mathematics and references.

Uploaded by

Quan Nguyen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

1 0 Set Relation Function

Discrete mathematics deals with discrete or separated sets of objects rather than continuous sets, and processes with individual steps rather than continuously changing processes. Some problems addressed in discrete mathematics include calculating probabilities, analyzing social networks, and finding optimal paths. Discrete mathematics is important for computer science as information is stored discretely. It also applies to many other areas and develops reasoning skills. The document then provides an outline of topics in discrete mathematics and references.

Uploaded by

Quan Nguyen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

Discrete Mathematics

Discrete Mathematics
Discrete Mathematics deals with
• “Separated” or discrete sets of objects
(rather than continuous sets)
• Processes with a sequence of individual steps
(rather than continuously changing processes)
Kind of problems solved by discrete mathematics
• How many ways are there to choose a computer password?

• What is the probability of winning a lottery?

• Is there a link between two users in a social network?

• What is the shortest path between two cities using a transportation system?

• How can a list of integers sorted in increasing order? How many steps are
required to do such a sorting?
Importance of Discrete Mathematics
• Information is stored and manipulated by computers in a discrete fashion
• Applications in many different areas
• Discrete mathematics is a gateway to more advanced courses
• Develops mathematical reasoning skills
Text book

Rosen K.H. Discrete Mathematics and its


Applications (8th Editions). McGraw - Hill
Book Company, 2019.

Use lecture notes as study guide.


Text book

Nguyễn Đức Nghĩa,


Nguyễn Tô Thành
TOÁN RỜI RẠC
(in lần thứ ba)
Nhà xuất bản Đại học Quốc gia Hà
nội, 2003, 290 trang
References
1. Johnsonbaugh R. Discrete Mathematics. Prentice Hall Inc., N. J.,
1997.
2. Grimaldi R.P. Discrete and Combinatorial Mathematics (an Applied
Introduction), Addison-Wesley, 5th edition, 2004.
3. R. Graham, O. Patashnik, and D.E. Knuth. Concrete Mathematics,
Second Edition. Addison-Wesley, 1994.
References
4. Nguyễn Hữu Anh. Toán rời rạc, NXB Giáo dục,1999.
5. Nguyễn Xuân Quỳnh. Cơ sở Toán rời rạc và ứng dụng. NXB KHKT, Hà nội,
1996.
6. Đỗ Đức Giáo. Toán rời rạc. NXB KHKT, Hà nội, 2001.
Outline
• Part 1. Combinatorial Theory
• Sets, Relations, Functions
• Counting Problems
• Existence Problems
• Enumeration Problems
• Combinatorial Optimization Problems

• Part 2. Graph Theory


• Basic concepts
• Graph representation
• Graph traversal
• Euler and Hamilton cycles
• Tree and Minimum Spanning Tree Problems
• Shortest Path Problems
• Max Flows
Part 1
Chapter 0: Sets, Relations, Functions
Chapter 1: Counting problem
Chapter 2: Existence problem
Chapter 3: Enumeration problem
Chapter 4: Combinatorial optimization problem

10
Part 1
Chapter 0: Sets, Relations, Functions
Chapter 1: Counting problem
Chapter 2: Existence problem
Chapter 3: Enumeration problem
Chapter 4: Combinatorial optimization problem

11
Definitions
• Set and element
• Specification of set

12
Set and element
• Definition:
A set is an unordered collection of (unique) objects
The objects in a set are called elements or members of a set.
A set is said to contain its elements.
• Notation, for a set A:
x  A: x is an element of A
x  A: x is not an element of A
• Example:
V={a, e, i, o, u} (vowels in English)
C = all students subscribed to IT3020E in Winter 2020
• Note:
We often denote sets with capitals
{.} is used to define the set.

13
Set and element
• Definition: A multi-set is a set where you specify the number of occurrences
of each element: {m1a1,m2a2,…,mrar} is a set where:
• Element m1 occurs a1 times
• Element m2 occurs a2 times
• 
• Element mr occurs ar times

14
Definitions
• Set and element
• Specification of set

15
Specification of set
• A set is defined in extension when you enumerate all the elements:
O={0,2,4,6,8}
• The set-builder notation
A = {x | conditions(x)}.
this could be read as “all x such that the conditions hold true”.

• Example: O={ x | (xZ)  (x=2k) for some kZ}


reads: O is the set that contains all x such that x is an integer and x is even
• A set is defined in intension when you give its set-builder notation
O={ x | (xZ)  (0  x  8)  (x = 2k) for some k  Z }

16
Specification of set
Well-known sets in math:
N = {0,1,2,3,...}
Z = {...,-2,-1,0,1,2,...}
Z+ = {1,2,3,...}
Q = {p/q | p in Z, q in Z, q is not 0}
R = {x | x is a real number}.

{,...} is used to indicate the rest of the sequence once it’s clear how to proceed
Example: {1,2,3,4,...}

17
Specification of set
• There is a set with no elements. It is called the empty set (or null set) and
denoted {} or .
• A set that has one element is called a singleton set.
For example: {a}, with brackets, is a singleton set
a, without brackets, is an element of the set {a}
• Note the subtlety in   {} ??why
The left-hand side is the empty set
The right hand-side is a singleton set, and this set contains a set

• Universal set contains everything under consideration (depends on the


context)

18
Specification of set
• If there are exactly n distinct elements in a set S, with n is a nonnegative
integer, we say that:
S is a finite set, and
The cardinality of S is n. Notation: |S| = n.
• Definition. A set is a finite set if it has a finite number of elements. A set
that is not finite is an infinite set.
• Let A be a finite set. The number of different elements in A is called its
cardinality and is denoted by |A|. Other notations commonly used for the
cardinality of A are N(A), #A.
• If A is an infinite set, then we write |A| = .
• Example:
• || = 0 since  contains no elements.
• |{π, 2, Newton}| = 3.
• If Nn = {0, 1, …, n} then | Nn | = n + 1.
• |{n: n is a prime number}| = ∞.

19
Content
• Definitions
• Set operations
• The algebra of sets
• Relations
• Functions

20
Set operations
• Set comparison
• Venn diagram
• Set operations
• Partition and cover

21
Set comparison
• Definition: Two sets, A and B, are equal if they contain the same elements.
We write A = B.
• Example:
{2,3,5,7} = {3,2,7,5}, because a set is unordered
Also, {2,3,5,7}={2,2,3,5,3,7} because a set contains unique elements
However, {2,3,5,7}  {2,3}

22
Set comparison
• if P(x) and Q(x) are propositional functions which are true for the same
objects x, then the sets they define are equal, i.e.
{x : P(x)} = {x : Q(x)}.

• Example: there are 2 sets


• A = {x: (x − 4)2 = 25}
• B = {x: (x + 1)(x − 9) = 0}
• Question: A = B ?
• Yes: A = B, since the two propositional functions P(x): (x − 4)2 = 25 and
Q(x): (x + 1)(x − 9) = 0 are true for the same values of x, namely −1 and
5.

23
Set comparison
• Definition: A is said to be a subset of B, if and only if every element of A is
also an element of B
that is:  x (x  A  x  B)
• Denote A  B or B  A,

• Example: S =  1, 2, 3,  , 11, 12  and T =  1, 2, 3, 6  then T  S.

• For any set S:


•   S and
• SS

24
Set comparison
• Definition: If A  B and A  B then set A is called a proper subset of set
B (that is there is an element xB such that xA)
• Denote: A  B

• Example 1: A = { 1, 2, 3 }, B = { 2, 3, 1 }, C = { 3 }. Then:
B = A, C  A, C  B.

25
Set comparison
Examples:
N = {0, 1, 2, 3, ...} the set of natural numbers.
Z = {...,−2,−1, 0, 1, 2, ...} the set of integers.
Z+ : the set of positive integers
Q = {p/q : p, q  Z and q ≠ 0} the set of fractions or rational numbers.
Q+ : the set of positive rational numbers
R = the set of real numbers;
R+ : the set of positive real numbers
C = {x + iy : x, y  R and i2 = −1} the set of complex numbers.

Clearly the following subset relations hold amongst these sets:


N ⊆ Z ⊆ Q ⊆ R ⊆ C.
Question: ??? N = Z+
Note that N is not equal to Z+ since 0 belongs to the first but not the second

26
Set operations
• Set comparison
• Venn diagram
• Set operations
• Partition and cover

27
Venn diagram
• Example: Draw the Venn diagram that represents 3 sets:
A = {1, 2, …, 10},
B = {2, 4, 6, 8, 12, 13},
C = {2, 3, 5, 7, 11, 13}

28
Set operations
• Set comparison
• Venn diagram
• Set operations
• Partition and cover

29
Set operations
• Union
A  B = {x | x  A or x  B}
• Intersection
A  B = {x | x  A and x  B}

• Set Subtraction
A – B (or A \ B) = {x | x  A and x  B}

30
Set Complement: Absolute & Relative
• Given the Universe U, and A,B  U.
• The (absolute) complement of A is 𝐴ҧ = 𝑈\A
• The (relative) complement of A in B is B\A

U U
A A B
A
Set operations
• Set comparison
• Venn diagram
• Set operations
• Partition and cover

32
Partition and cover
• Let E ={𝐸𝑖 }𝑖∈𝐼 be a collection of subsets of the set M, 𝐸𝑖 𝑀. Collection E
will be called a cover of M if each element of M must be an element of at
least one of the sets of E :

• The disjoint cover E of M is called a partition of M, i.e.

• Example: M = {1, 2, 3, 4}
• E1 = {{1, 2}, {3, 4}} is a partition of M
• E2 = {{1, 2, 3}, {3, 4}} is not a partition of M

33
Content
• Definitions
• Set operations
• The algebra of sets
• Relations
• Functions

34
Power Set
• Definition: The power set of a set A, denoted P(A), is the set of all subsets
of A.
Examples {
Let A = { } →P (A) = {} ,
Let A = {a} →P (A) = {, {a}} {a}, {b}, {c},
Let A = {a, b} → P(A)= {, {a}, {b}, {a, b}} {a, b}, {a, c}, {b, c},
Let A = {a, b, c} → P(A) = ? {a, b, c}
}

• Note: the empty set  and the set itself are always elements of the power
set.
Power Set
• Theorem: Let A be a set such that |A|=n, then |P(A)| = 2n
• Proof ?
Power Set
• For all sets A and B, the statement “A  B if and only if P(A)  P(B)” is
TRUE or FALSE?
Power Set
• For all sets A and B, the statement “A  B if and only if P(A)  P(B)” is
TRUE or FALSE?

• For all sets A and B, the statement “P(A) ∩ P(B) = P(A ∩ B)” is TRUE or
FALSE?
Power Set
• For all sets A and B, the statement “A  B if and only if P(A)  P(B)” is
TRUE or FALSE?

• For all sets A and B, the statement “P(A) ∩ P(B) = P(A ∩ B)” is TRUE or
FALSE?

• For all sets A and B, the statement “P(A)  P(B) = P(A  B)” is TRUE or
FALSE?
Power Set
• For all sets A and B, the statement “A  B if and only if P(A)  P(B)” is
TRUE or FALSE?

• For all sets A and B, the statement “P(A) ∩ P(B) = P(A ∩ B)” is TRUE or
FALSE?

• For all sets A and B, the statement “P(A)  P(B) = P(A  B)” is TRUE or
FALSE?

• For all sets A and B, the statement “P(A)  P(B)  P(A  B)” is TRUE or
FALSE?
Properties of set operations
• Let A, B and C be any sets. The following laws hold
Equality Name
A=A Identity laws
AU=A
AU=U Domination laws
A=
AA=A Idempotent laws
AA=A
A  𝐴ҧ = U Complementation laws
A ∩ 𝐴ҧ = 
ഥ =U

ഥ 
𝑈=
( A) = A Involution laws
Properties of set operations
Equality Name
AB=BA Commutative laws
AB=BA
A  (B  C) = (A  B)  C Associative laws
A  (B  C) = (A  B)  C
A  (B  C) = (A  B)  (A  C) Distributive laws
A  (B  C) = (A  B)  (A  C)
AB = A B De Morgan’s laws
AB = A B
A ∩ (A  B) = A Absorption laws
A  (A ∩ B) = A.
Content
• Definitions
• Set operations
• The algebra of sets
• Relations
• Functions

43
Relations
• Ordered pair
• Cartesian product
• Binary relation
• Relation representation
• Operations on relations
• Properties of relations

44
Ordered pair
• An ordered pair is a set of a pair of objects with an order associated with
them.
• In general (x, y) is different from (y, x).
• Definition (equality of ordered pairs): Two ordered pairs (a, b) and (c, d)
are equal if and only if a = c and b = d.

• Example: if the ordered pair (a, b) is equal to (1, 2), then a=1, and b=2. (1,
2) is not equal to the ordered pair (2, 1).

45
Relations
• Ordered pair
• Cartesian product
• Binary relation
• Relation representation
• Operations on relations
• Properties of relations

46
Cartesian product René Descartes
(1596-1650)
• Let A1, A2, …, An be any sets, where n  ℤ+ and n  3.
• Cartesian product of n sets A1, A2, …, An is defined as follows:
A1  A2  …  An def {(a1, a2, …, an) | ai  Ai, 1  i  n}.

• When A1 = A2 = …= An = A, it is usually to denote A  A  …  A by An

• An element of A1  A2  …  An is called an ordered n-tuple.


• When n=3, we have a triple.

• Example: A = {1, 2}, B = {a, b} and C = {α, β} then


• A × B × C = {(1, a, α), (1, a, β), (1, b, α), (1, b, β), (2, a, α), (2, a, β), (2, b, α),
(2, b, β)}.

47
Relations
• Ordered pair
• Cartesian product
• Binary relation
• Relation representation
• Properties of relations

48
Binary Relation
• Definition (binary relation): Let A and B be sets. A binary relation from a
set A to a set B is a set of ordered pairs (a, b) where a is an element of A
and b is an element of B.
• A binary relation from A to B is a subset R  A  B
• A relation on a set A is a relation from A to A, i.e., a subset R  A  A
• Notation: When an ordered pair (a, b) is in a relation R, we write a R b, or
(a, b)  R. It means that element a is related to element b in relation R. We
will write aR b when a element a is not related to element b in relation R.

49
Binary Relation
Example:
Let A be the students in a the CS major
A = {Tan, Bob, Michel, Amy}
Let B be the courses the department offers
B = {CS101, CS201, CS202}
We specify relation R = A  B as the set that lists all students a  A
enrolled in class b  B
R = { (Tan, CS101), (Bob, CS201), (Bob, CS202),
(Amy, CS201), (Amy, CS202) }

50
Representing relations

We can represent We can represent


relations graphically: relations in a table:
CS101 CS201 CS202

Tan Tan X
Bob X X
CS101
Bob Michel
Amy X X
CS201
Michel

CS202
Amy
Relations on a Set
• A relation on a set A is a relation from A to A.

Examples of relations on Z+: R<, R, R> :


• R< = {(x, y)| x < y} (R< is relation “strictly less than”).
• R= {(x, y)| x  y} (R is relation “greater or equal”).
• R>= {(x, y)| x > y} (R> is relation “strictly greater than”).

52
Relations on a Set
Consider the following relations on Z:
• R1 = {(a, b) | a  b} (1,1) (1,2) (2,1) (1,-1) (2,2)
• R2 = {(a, b) | a > b} R1   
• R3 = {(a, b) | a = b or a = -b} R2  
• R4 = {(a, b) | a = b}  
R3 
• R5 = {(a, b) | a = b+1} 
R4 
• R6 = {(a, b) | a + b  3}
R5 
R6    

For each the following ordered pairs


(1,1), (1,2), (2,1), (1,-1), and (2,2)
show which relation it belongs to.

53
Properties of Binary Relations
• A binary relation R  A x A is called
• Reflexive iff (x,x)  R
• Symmetric iff (x,y)  R → (y,x)  R
• Antisymmetric iff ((x,y)  R  (y,x)  R) → x = y
• Transitive iff (x,y)  R and (y,z)  R → (x,z)  R
• A binary relation is called equivalence relation iff it is reflexive, symmetric,
and transitive

54
Contents
• Definitions
• Set operations
• The algebra of sets
• Relations
• Functions

55
Functions
• Definitions
• Properties of function
• Injective, surjective and bijective function
• Function representation

56
Functions
Definition: A function f from a set A to a set B, denote it by f: A→B, is a
relation from A to B that satisfies:
for each element a in A, there is an element b in B such that (a, b) is in the
relation, and
if (a, b) and (a, c) are in the relation, then b = c. ➔ 1 to 1:
For every input there is exactly one output.
A function is also called a mapping or a transformation.

57
Functions
• Definition: A function f from a set A to a set B, denote it by f: A→B, is a
relation from A to B that satisfies:
• for each element a in A, there is an element b in B such that (a, b) is in
the relation, and
• if (a, b) and (a, c) are in the relation, then b = c.
• A function is also called a mapping or a transformation. ➔ 1 to 1
• The set A in the above definition is called the domain of the function and B
its codomain.

• Question: Let A and B be two sets in which |A| = m, |B| = n. The statement
“the number of possible functions from A to B is nm” is TRUE or FALSE?

58
Functions
• The image of the set S under function f : A→B, denoted by f(S) is:
f(S) = { f(a) | a  S }
• The image of the domain under function f : A→B, denoted by range f is:
range f = f(A)
(is also called the range of f )
• In general case: range f = f(A)  B.

59
Example: Are the following relations also functions?

0
0
-4 -4
-2
-2
5 5
3
3
8 8
-7
-7

Each element of the domain is only


3 is used twice.
used once.

FUNCTION NOT A
FUNCTION
Functions
• Definitions
• Properties of function
• Injective, surjective and bijective function
• Function representation

61
Properties of function
f: A→B is a function from a set A to a set B, S ⊆ A, and T ⊆ A.
Statement f( S ∪ T ) = f(S) ∪ f(T) is TRUE or FALSE ?

→ Proof ?

62
Properties of function
f: A→B is a function from a set A to a set B, S ⊆ A, and T ⊆ A.
Statement f( S ∩ T ) ⊆ f(S) ∩ f(T) is TRUE or FALSE?

Statement f( S ∩ T ) = f(S) ∩ f(T) is TRUE or FALSE?

→ Proof ?

63
Functions
• Definitions
• Properties of function
• Injective, surjective and bijective function
• Function representation

64
Injective, surjective and bijective function
A function f from a set A to a set B is said to be injective (one-to-one) if and
only if:
for all elements a1, a2  A
if f (a1) = f (a2) then a1 = a2 no two inputs have the same output.

The function f is not injective


a1, a2  A, a1  a2  f(a1)  f(a2)
The function g is injective
65
Injection

f : A→B is an injection iff no two inputs have the same output.

≤ 1 arrow in
f( ) =
A B
|A| ≤ |B|
Injective, surjective and bijective function
A function f from a set A to a set B is said to be surjective (onto), if and only if:
bB,  aA: b = f(a) .

that is: f is onto if and only if f( A) = B. every output is possible.

Example: A = {1, 2, 3, 4} and B = {x, y, z}. Then the functions:


f1 = {(1, z), (2, y), (3, x), (4, y)} ; g={(1, x), (2, x), (3, y), (4, y)}

The function g is not onto because g(A)={x,y}B


The function f1 is onto 67
Surjection

f : A→B is a surjection iff every output is possible.

1 arrow in
f( ) =

A B

|A| ≥ |B|
Injective, surjective and bijective function
A function is called a bijection, if it is injective (1-1) and surjective (onto).

69
Bijection

f : A→B is a bijection iff it is surjective and injective.

exactly one arrow in

f( ) =
A B

|A| = |B|
Injective, surjective and bijective function
A function is called a bijection, if it is injective (1-1) and surjective (onto).

Examples:
1) Linear functions: f(x)=ax+b when a0
(with domain and co-domain R)
2) Exponential functions: f(x)=bx (b>0, b1)
(with domain R and co-domain R+)
3) Logarithmic functions: f(x)=logbx (b>0, b1)
(with domain R+ and co-domain R)

71
Functions
• Definitions
• Properties of function
• Injective, surjective and bijective function
• Function representation

72
Function representation
Functions can be represented four different ways:

mapping
1. ______________

graph
2. ______________
table
3. ______________

matrix
4. ______________

You might also like