Professional Documents
Culture Documents
3a57b3a
Dr. Saifuddin Md.Tareeq
Professor, Dept of CSE, DU
smtareeq@cse.du.ac.bd
1
Course Contents
Topic Chapters and Lecture Sequence
sections
Logic 1.1,1.3-1.6 6
Algorithm 3.1-3.3 4
Counting 6.1-6.5 5
Probability 7.1-7.3 9
Relation 9.1,9.3,9.5 2
Graph 10.1-10.6 7
Book Kenneth H. Rosen. Discrete Mathematics and Its
Applications, 7th Edition, McGraw Hill. 2
Course Lecture Sequence
Topic Chapters and Lecture Sequence
sections
Set, Function 2.1-2.3 1
Relation 9.1,9.3,9.5 2
Algorithm 3.1-3.3 4
Counting 6.1-6.5 5
Logic 1.1,1.3-1.6 6
Graph 10.1-10.6 7
Probability 7.1-7.3 9
Book Kenneth H. Rosen. Discrete Mathematics and Its
Applications, 7th Edition, McGraw Hill. 3
Course evaluation
4
Discrete mathematics
Discrete mathematics
– study of mathematical structures and objects that are
fundamentally discrete rather than continuous.
6
Set
Definition:
• Examples:
– Vowels in the English alphabet
V = { a, e, i, o, u }
Example:
• Even integers between 50 and 63.
1) E = {50, 52, 54, 56, 58, 60, 62}
2) E = {x| 50 <= x < 63, x is an even integer}
• Integers
– Z = {…, -2,-1,0,1,2, …}
• Positive integers
– Z+ = {1,2, 3.…}
• Rational numbers
– Q {p / q | p Z,q Z,q 0}
• Real numbers
–R 9
Equality of Set
Definition: Two sets are equal if and only if they have the
same elements.
Example:
• {1,2,3} = {3,1,2} = {1,2,1,3,2}
Example:
• {1,2,3} = {3,1,2} = {1,2,1,3,2}
12
Venn Diagram
A set can be visualized using Venn Diagrams:
– V={ A, B, C }
13
A subset
Definition: A set A is said to be a subset of B if and only
if every element of A is also an element of B. We use A B
to indicate A is a subset of B.
15
Problem
B A
16
Problem
CA
17
Problem
CD
18
Empty set/subset property
Theorem : S
U
A
20
Subset property
Theorem: S S
• Any set S is a subset of itself
Proof:
• the definition of a subset says: all elements of a set A must
be also elements of B: x ( x A x B )
• End of proof
Note on equivalence:
• Two sets are equal if each is a subset of the other set. 21
A proper Subset
Definition:
Examples:
• V={1 2 3 4 5}
|V|=5
• A={1,2,3,4, …, 20}
|A| =20
•|Ø|=0
24
Problem
25
Problem
a) 1
26
Problem
a) 1
b) 1
27
Problem
a) 1
b) 1
c) 2
28
Problem
a) 1
b) 1
c) 2
d) 3
29
Infinite set
Definition: A set is infinite if it is not finite.
Examples:
• The set of natural numbers is an infinite set.
• N = {1, 2, 3, ... }
30
Power set
Definition: Given a set S, the power set of S is the set of all
subsets of S. The power set is denoted by P(S).
Example
Assume {1,2,3}
• P({1,2,3}) = {Ø, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
• |P({1,2,3} | = 8
Example
Assume {1,2,3}
• P({1,2,3}) = {Ø, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
• |P({1,2,3} | = 8
• S x T = { (s,t) | s ϵ S ˄ t ϵ T}.
Examples:
• S = {1,2} and T = {a,b,c}
• Is S x T and T x S equal?
34
Cartesian Product
Definition: Let S and T be sets. The Cartesian product of S
and T, denoted by S x T, is the set of all ordered pairs (s,t),
where s ϵ S and t ϵ T. Hence,
• S x T = { (s,t) | s ϵ S ˄ t ϵ T}.
Examples:
• S = {1,2} and T = {a,b,c}
• Is S x T ≠ T x S !!!!
35
Cardinality of a Cartesian Product
• |S x T| = |S| * |T|.
Example:
• A= {John, Peter, Mike}
• B ={Jane, Ann, Laura}
• |A x B| = 9
• |A|=3, |B|=3 → |A| |B|= 9
36
Set Operation
Definition: Let A and B be sets. The union of A and B, denoted
by A U B, is the set that contains those elements that are in
both A andB.
• Alternate: A U B = { x | x ϵ A V x ϵ B }.
Example:
• A = {1,2,3,6} and B = { 2,4,6,9}
•AU B=? 37
Set Operation: Union
Definition: Let A and B be sets. The union of A and B, denoted
by A U B, is the set that contains those elements that are in
both A andB.
• Alternate: A U B = { x | x ϵ A V x ϵ B }.
Example:
• A = {1,2,3,6} and B = { 2,4,6,9}
• A U B = { 1,2,3,4,6,9 } 38
Set Operation: Intersection
Definition: Let A and B be sets. The intersection of A and B,
denoted by A ∩ B, is the set that contains those elements that
are in both A andB.
• Alternate: A ∩ B = { x | x ϵ A ˄ x ϵ B }.
Example:
• A = {1,2,3} and B = { 2,4,6,9}
•A∩ B=? 39
Set Operation : Intersection
Definition: Let A and B be sets. The intersection of A and B,
denoted by A ∩ B, is the set that contains those elements that
are in both A andB.
• Alternate: A ∩ B = { x | x ϵ A ˄ x ϵ B }.
Example:
• A = {1,2,3} and B = { 2,4,6,9}
•A∩ B={2} 40
Disjoin Set
Definition: Two sets are called disjoint if their intersection is
empty.
Example:
• A={1,2,3,6} B={4,7,8} Are these disjoint?
41
Disjoin Set
Definition: Two sets are called disjoint if their intersection is
empty.
Example:
• A={1,2,3,6} B={4,7,8} Are these disjoint?
• Yes.
•A∩B=Ø 42
Cardinality of set union
Cardinality of the set union.
43
Cardinality of set union
Cardinality of the set union.
44
Set Difference
Definition: Let A and B be sets. The difference of A and B,
denoted by A - B, is the set containing those elements that
are in but not in B. The difference of A and B is also called
the complement of B with respect to A.
• Alternate: A B {x | x A x B}
• Alternate: A B {x | x A x B}
47
Problem
a) A ∪ B = {a, b, c, d, e, f, g, h}
48
Problem
a) A ∪ B = {a, b, c, d, e, f, g, h} = B
b) B – A = {f, g, h}
49
Complement of a Set
Definition: Let U be the universal set: the set of all objects
under the consideration.
Definition: The complement of the set A, denoted by Ã, is the
complement of A with respect to U.
• Alternate: Alternate:
A {x | x A}
Example:
A1 = {1}
• Let Ai= {1,2,...,i} i =1,2,...,n
A2= {1,2}
n A3= {1,2,3}
Ai {1,2,..., n} …………..
i 1
…………..
52
An ={1,2,3,4,...,n}
Generalized intersection
Definition: The intersection of a collection of sets is the set
that contains those elements that are members of all sets in
the collection.
n
Ai { A1 A2 ... An }
i 1
Example:
• Let Ai= {1,2,...,i} i =1,2,...,n
A1 = {1}
n A2= {1,2}
Ai {1} A3= {1,2,3}
i 1
…………..
…………..
53
An ={1,2,3,4,...,n}
Computer representation of set
How to represent sets in the computer?
• One solution: Data structures like a list
Example:
All possible elements: U={1 2 3 4 5}
• Assume A={2,5}
– Computer representation: A = 01001
• Assume B={1,5}
– Computer representation: B = 10001 54
Computer representation of set
Example:
• A = 01001
• B = 10001
55
Thank You
56