Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 48

Chapter 2

Basic Structures
Sets, Functions
Sequences, and Sums
Objectives
 Sets
 Set operations
 Functions
 Sequences
 Summations
2.1- Sets
 An unordered collection of objects
 The objects in a set are called the elements, or members.
A set is said to contain its elements.
 Some important sets in discrete mathematics
N = { 0,1,2,3,4,… }
Z = { … , -2,-1,0,1,2,…} Z+ = {1,2,…}
R: the set of real numbers G. Cantor

 p 
Q  r  p  Z , 0  q  Z 
 q 
V  a, u , o, i, e
aV : a is an element of the set V // a belongs to V
cV: a is not an element of V
2.1- Sets
Definitions:
 Finite set: Set has n elements, n is a nonnegative integer.
 A set is an infinite set if it is not finite.
 Cardinality of a set |S|: Number of elements of S.
 Examples:
A  2, 4,1 finite set A 3
  0,1, 2,... infinite set
B  0,1,...,8,9 finite set B  10
C  a, b finite set C 2
  ..., 2, 1,0,1, 2,... infinite set
2.1- Sets
Definitions:
  : empty set (null set), the set with no element.
 What is ?


 0


  1
2.1- Sets
Definitions:
 Two sets are equal  they have the same elements
A = B if and only if x (xA  x B)
Ex:

1, 4,5  4,5,1  1,1, 4,5,5, 4,5 True


1, 2,3  2,3, 4,1 False
2.1- Sets
Definitions:
 A  B: the set A is a subset of the set B
A  B if and only if x (xA  x B)

 A  B: A is a proper subset of B Venn diagram shows that A


A  B if and only if (A  B) ^ (A ≠ B) is a subset of B

 Examples: 1, 4,5  2,3, 4,5,1 True


1, 4,5  2,3, 4,5,1 True
1, 4,5,6  2,3, 4,5,1 False
   True

  True
Theorem 1
For every set S,
i)   S ii) S  S

Proof:
i ) (x  )  False
So x  x   x  S   True
ii) x  x  S  x  S   True
Power Sets
 Given a set S, power set P(S) of S is a set of all
subsets of the set S.
 If the set S has n elements, then the power set P(S)
has 2n elements. P  S   2 S

Ex1: S  1, 2,3


P  S   {Ø , 1, 2, 3,{1, 2},{1,3},{2,3},{1, 2,3}}
S  3  P  S   23  8
Ex2:
S    P  S   
S    P  S   , 
Cartesian Products
 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.
 Let A and B be sets. The Cartesian product of A and
A B
B, denoted by ,
A  B   a, b  a  A, b  B

Ex: A= a, b, B= 1, 2,3


A  B   a,1 ,  a, 2  ,  a,3 , b,1 , b, 2  , b,3 
A B  A  B  2 3  6
Cartesian Products
 The Cartesian product of A1,A2,…,An , denoted
A1xA2x…xAn, is the set of ordered n- tuples
(a1,a2,…,an),
A1  A2  ...  An  a , a ,..., a  a  A , i  1, n
1 2 n i i

Ex: A= a, b, B= 1, 2,3, C  0,1


A  B  C  { a,1,0  ,  a,1,1 ,  a, 2,0  ,  a, 2,1 ,  a,3,0  ,  a,3,1 ,
b,1,0  , b,1,1 , b, 2,0 , b, 2,1, b,3,0 , b,3,1}
A  B  C  A  B  C  2  3  2  12
Cartesian Products

Note that:
S   
 S  
For non-empty sets A and B:
A  B  A B  B  A
A B  A  B
Cartesian Products
11. Let A = {a, b, c}, B = {x, y}, and C = {0, 1}. Find
a) A × B. b) B × A.
c) A × B × C. d) (A × B) × C.
a) A  B   a, x ,  a, y , b, x , b, y , c, x , c, y 
b) B  A   x, a  ,  x, b  ,  x, c  ,  y , a  ,  y , b  ,  y , c 
c) A  B  C   a, x,0  ,  a, x,1 ,  a, y,0  ,  a, y,1,
b, x,0 , b, x,1, b, y,0 , b, y,1,
c, x,0 , c, x,1, c, y,0 , c, y,1
d)  A  B   C   a, x  ,0  ,  a, x  ,1 ,  a, y  ,0  ,  a, y  ,1,
b, x ,0 , b, x ,1, b, y ,0 , b, y ,1,
c, x ,0 , c, x ,1, c, y ,0 , c, y ,1
2.2- Set Operations
The Union of sets A and B, denoted by A  B
A  B  x x  A  x  B

Intersection : A  B  x x  A  x  B

The difference of A and B, denoted by A  B


A  B = x x  A  x  B
The symmetric difference of A and B, denoted by A  B
A  B = A  B-A  B = x ( x  A  x  B)  ( x  A  B)

U is the universal set, complement of A is denoted by A


A = U  A = x x  A
2.2- Set Operations
Ex: Let U  x x    x  10. We have :
A= 1,3,5, B= 1, 2,3
A  B  1, 2,3,5
A  B  1,3
A- B  5
A B  2,5
A  0, 2, 4, 6, 7,8,9
Let C  4,5  C  B    B and C are disjoint.
Set Identities
Identity – See proofs : pages 125, 126 Name

A  = A AU=A Identity laws


A U = U A  =  Domination laws
A A = A A A = A Idempotent laws

 A  A Complementation law
A B = B  A A B = B A Commutative laws
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 A B = A B De Morgan laws
A  (A B) = A A  (A B) = A Absorption
AA =U A A =  Complement laws
Generalized Unions and Intersections
n
A1  A2  A3  ...  An   Ai  x x  Ai , i  1, 2,..., n
i 1
n
A1  A2  A3  ...  An  Ai
i 1

 x x  A1  x  A2  x  A3  ...  x  An 
Computer Representation of Sets

• Use bit string U = {1,2,3,4,5,6,7,8,9,10}


• A = {1,3,5,7,9 }  A = “1010101010”
• B = {1,8,9}  B = “1000000110”
• C = “0101010101”  C = {2,4,6,8,10}

- The universal set U is represented by the string


1111111111
Computer Representation of Sets

• A = {1,3,5,7,9 }  A = “1010101010”
• B = {1,8,9}  B = “1000000110”
A  B  1010101010  1000000110
1 2 3 4 5 6 7 8 9 10
1 0 1 0 1 0 1 0 1 0
1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 0

 A  B  1000000010
 A  B  1,9
Computer Representation of Sets

• A = {1,3,5,7,9 }  A = “1010101010”
• B = {1,8,9}  B = “1000000110”

A  B  1010101010  1000000110

1 2 3 4 5 6 7 8 9 10
1 0 1 0 1 0 1 0 1 0
1 0 0 0 0 0 0 1 1 0
1 0 1 0 1 0 1 1 1 0

 A  B  1010101110
 A  B  1,3,5,7,8,9
Computer Representation of Sets

• A = {1,3,5,7,9 }  A = “1010101010”
• B = {1,8,9}  B = “1000000110”

A  B  1010101010  1000000110

1 2 3 4 5 6 7 8 9 10
1 0 1 0 1 0 1 0 1 0
1 0 0 0 0 0 0 1 1 0
0 0 1 0 1 0 1 1 0 0

 A  B  0010101100
 A  B  3,5,7,8
2.3. Functions / Mappings /Transformations…

 A function f from a set A to a set B is an assignment of


exactly one element of B to each element of A.

f : A  B : function f from A to B (or function f maps A to B)


A: domain of f
B: codomain of f

f :   , f  x   x 2 True
f :   , f  x    x False
2.3. Functions / Mappings /Transformations…

Example:

Assignment of Grades in a Discrete Mathematics Class.

domain  Adams, Chou, Goodfriend, Rodriguez, Stevens


codomain   A, B, C , D, E , F 
Functions as sets of ordered pairs
2.3. Functions / Mappings /Transformations…

What are functions?


a) f :   , f  x   x  2
2
True
1
b) f :   , f  x    5x False
 x  1
2

2x  5
c) f :   , f  x   True
7
d) f :   , f  x  
 2 x  5 2
True
7  2x
Some Important Functions
Floor function
f:  → such that f(x)= x = largest integer that less than or
equal to x, x x
Ceiling function
f:  → such that f(x)= x = smallest integer that greater than
or equal to x, xx

Ex1: x  2,7  floor  x    x   2


ceiling  x    x   3
Ex2: 1  0
 2  3,1  4
One-to-One/ Injective functions
Function f is one-to-one (or injective) if and only if
a  b  f  a   f b 
for all a and b in the domain of f.

Ex:
f :   , f  x   x  3 is one-to-one
f :   , f  x   x 2 is not one-to-one (we have f(-1) = f(1))
Onto/ Surjective functions
A function f from A to B is called onto, or surjective, iff
for every element b in B there is an element a in A with f  a .  b

Ex: f :   , f  x   x  1 is onto
3

f :   , f  x   x 2  1 is not onto
because 0  B, x  A : f  x   0
One-to-one Correspodent/
Bijective Functions
Function f is a one-to-one corespondence or a
bijection if it is both one-to-one and onto.

bijection
A B
One-to-one Correspodent/
Bijective Functions
Inverse Functions
Let f is a bijection from A to B. The inverse function,
1
denoted by f , of f is the function that assigns to an
element b belonging to B the unique element a in A such
that f  a   b . Hence f b   a when f  a   b .
1
Inverse Functions
Ex1: Let f be the function from {a, b, c, d} to {1, 2, 3, 4} such
that f(a) = 4, f(b) = 1, f(c) = 3 and f (d) = 2. Is f invertible, and if
it is, what is its inverse?

The function f is invertible because it is a one-to-one correspondence.


Inverse function f
1
: f 1 1  b, f 1  2   d , f 1 3  c, f 1  4   a
Inverse Functions
Ex2: Let f :   such that f  x   x  1
Is f invertible, and if it is, what is its inverse?

Step 1: Show that f is one-to-one


f  a   a  1  f b   b  1  a  b
 f is one-to-one
Step 2: Show that f is onto
f  x   y for all y
 f is onto
 f is bijection  f is invertible
Step 3: Find inverse function
f  x   y  x  1  x  y  1  f 1  y   y  1
Composition of Functions
f : X  Y g :Y  Z
Let , . The composition of f and g,

denoted by g o f, is defined by:  g o f   x   g  f  x 

 g o f   x   g  f  x 
 f o g   x   f  g  x 
Composition of Functions
Ex:
f :   , f  x   x  1
g :   , g  x   x 2

 f o g   x   f  g  x   f ( x2 )  x2  1

 go f   x   g  f  x   g  x  1   x  1 2

 f o f   x   f  f  x   f ( x  1)  ( x  1)  1  x  2

 g o g   x   g  g  x   g  x   
2
2 2
 x  x4
2.4- Sequences (dãy số)
Sequence: a1, a2, a3,…, an,…
Ex: 1,3,5,8 : Finite sequence (dãy hữu hạn)
Ex: 1, 1, 2, 3, 5, 8, 13,… : Infinite sequence (dãy vô hạn)
 A sequence is a function from a subset of integers to a set S.
 an : image of the integer n
 ai : a term of the sequence

 1
an   :   
Ex: The sequence

 n
1 1 1 1
 1, , , , ,
2 3 4 5
2.4- Sequences
Geometric progression: (cấp số nhân)
f(n) = arn  a, ar, ar2, ar3, …, arn
Arithmetic progression : (cấp số cộng)
f(n) = a + nd  a, a+d, a+2d, … , a+nd
a: initial term,
r: common ratio, a real number
d: common difference, real number
Do yourself
bn= (-1)n , n>=0 cn= 2(5)n , n>=0
tn= 7-3n, n>=0 an= -1 + 4n, n>=0
Summations
n
am  am 1  am  2  ...  an   a j   j  m a j  m j  n a j
n

j m

a : Sequence // 1 + 2 +3+4+…+n
j : Index of summation long sum1 ( int n) // n additions
{ long S=0;
m: Lower limit for (int i=1; i<=n; i++) S+= i;
n : Upper limit return S;
}
// 1 addition, 1 multiplication, 1 division
long sum2 (int n)
{ return ((long)n) * (n+1)/2;
}
Summations
Ex1:

Ex2:
Summations
Summation of arithmetic series:

n  a1  an   an  a1 
S where n 1
2 d

Summation of geometric series:

S

a 1 rn  if r  1
1 r
Cardinality
 Cardinality = number of elements in a set.
 The sets A and B have the same cardinality if and only if
there is a one-to-one correspondence from A to B
 A set that is either finite or has the same cardinality as
the set of positive integers is called countable.
 A set that is not countable is called uncountable.
 When a infinite set S is countable, we denote the
cardinality of S is |S|= 0‫( א‬aleph null)
 For example, |0‫ א‬because  is countable and infinite
but  is uncountable and infinite, and we say |0‫א‬
Examples p.159, 160
sets countable uncountable cardinality
{a, b, …, z}, {x| x5 - 3x2 – 11 = 0}, …   <

{0, 2, 4, …, }   0‫א‬
N, Z+, Z, Q, ZZ, …   0‫א‬
{x| 0 < x < 1}, R,…   20‫א‬
Review chapter 2
Two sets are equal  they have the same elements
A  B: the set A is a subset of the set B
A  B if and only if x (xA  x B)

A  B: A is a proper subset of B
A  B if and only if (A  B) ^ (A ≠ B)

For every set S: i)   S ii) S  S


  0   1
 Given a set S, power set P(S) of S is a set of all subsets of
the set S.

P S   2
S

power set contain exactly n elements: C nS


 Cartesian product:
A  B   a, b  a  A, b  B
A B  A  B
A  B  A B  B  A
 S  S   
A1  A2  ...  An  a , a ,..., a  a  A , i  1, n
1 2 n i i

A1  A2    An  A1  A2    An

Floor function: x Ceiling function: x


Functions

one-to-one onto, Bijection


(or injective) (or surjective) one-to-one and onto

a  b  f  a   f b 

 Inverse Functions: f  x   y  f 1  y   x
 Composition of Functions:  g o f   x   g  f  x 
 f o g   x   f  g  x 
Summation of arithmetic series:

n  a1  an   an  a1 
S where n 1
2 d

Summation of geometric series:

S

a 1 rn  if r  1
1 r
Thanks

You might also like