SlideShare a Scribd company logo
1 of 58
1
CSE 173: Discrete Mathematics
Dr. Saifuddin Md.Tareeq
Professor, Dept of CSE, DU
smtareeq@cse.du.ac.bd
2
Course Contents
Topic Chapters and
sections
Lecture Sequence
Logic 1.1,1.3-1.6 6
Set, Function 2.1-2.3 1
Algorithm 3.1-3.3 4
Number Theory 4.1-4.3 8
Induction Recursion 5.1-5.2 3
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.
3
Course Lecture Sequence
Topic Chapters and
sections
Lecture Sequence
Set, Function 2.1-2.3 1
Relation 9.1,9.3,9.5 2
Induction Recursion 5.1-5.2 3
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
Number Theory 4.1-4.3 8
Probability 7.1-7.3 9
Book Kenneth H. Rosen. Discrete Mathematics and Its
Applications, 7th Edition, McGraw Hill.
4
Course evaluation
Topic Marks Comment
Homework (3/3) 10 Subject to
NSU
evaluation
policy
Quizzes (2/3) 20
Mid term (2) 30
Final 40
5
Discrete mathematics
Discrete mathematics
– study of mathematical structures and objects that are
fundamentally discrete rather than continuous.
• Examples of objects with discrete values are
– integers, graphs, or statements in logic.
• Discrete mathematics and computer science.
– Concepts from discrete mathematics are useful for
describing objects and problems in computer
algorithms and programming languages. These
have applications in cryptography, automated
theorem proving, and software development.
Set : Basic Discrete Structure
6
Discrete math =
– study of the discrete structures used to represent discrete objects
Many discrete structures are built usingsets
– Sets = collection of objects
Examples of discrete structures built with the help ofsets:
• Relations
• Graphs
• Combinations
Set
7
Definition:
A set is a (unordered) collection ofobjects.
These objects are sometimes called elements or
members of the set.
• Examples:
– Vowels in the English alphabet
V = { a, e, i, o, u }
– First seven prime numbers.
X = { 2, 3, 5, 7, 11, 13, 17 }
Representing Set
• A= {1,2,3 …,100}
8
Representing a set by:
1) Listing (enumerating) the members of the set.
2) Definition by property, using the set builder notation
{x| x has property P}.
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}
If enumeration of the members is hard we often use ellipses.
Example: a set of integers between 1 and 100
9
Important set in discrete math
• Natural numbers:
– N = {0,1,2,3, …}
• Integers
– Z = {…, -2,-1,0,1,2, …}
• Positive integers
– Z+ = {1,2, 3.…}
• Rational numbers p is in Z | p is a member ofZ
– Q {p / q | p Z,q Z,q  0}
• Real numbers
– R
10
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}
Note: Duplicates don't contribute anything new to a set, so
remove them. The order of the elements in a set doesn't
contribute anything new.
Example: Are {1,2,3,4} and {1,2,2,4}equal?
11
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}
Note: Duplicates don't contribute anything new to a set, so
remove them. The order of the elements in a set doesn't
contribute anything new.
Example: Are {1,2,3,4} and {1,2,2,4}equal?
No!
Universal set
12
Special sets:
–The universal set is denoted by U: the set of all objects
under consideration.
– The empty set is denoted as Ø or { }.
U={1,2,3,4,5}
A={1,2,3,4,5}
B={1,2,3,4,5,6}
C={}
Venn Diagram
A set can be visualized using VennDiagrams:
– V={ A, B, C }
13
Subset
14
P Q PVQ P^Q P→Q
T→F
Q→P
T→F
~PV
Q
~QV
P
F F F F T T T T
F T T F T F T F
T F T F F T F T
T T T T T T T T
Statement: Arifis smart (T/F) How are you?
Proposition: T
Symbolic representation: p = Arif is smart(T/F)
OR
P= 4 is prime
Q= Today is Thursday
If p then q
P only if q
q whenever p
A subset
et of B:
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.
Alternate way to define A is asubs
U={1,2,3,4,5,6,7,8}
A={}
B={1,2,3}
A  B
x(x  A)  (x  B)
15
Problem
Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6},
and D = {4, 6, 8}. Determine which of these sets
are subsets of which other of these sets.
16
Problem
Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6},
and D = {4, 6, 8}. Determine which of these sets
are subsets of which other of these sets.
B  A
17
Problem
Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6},
and D = {4, 6, 8}. Determine which of these sets
are subsets of which other of these sets.
C  A
18
Problem
Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6},
and D = {4, 6, 8}. Determine which of these sets
are subsets of which other of these sets.
C  D
19
20
Empty set/subset property
End of proof
• Recall the definition of a subset: all elements of a setA
must be also elements of B: x(x  A  x B)
• We must show the following implication holds forany
• F -> (T/F) T
x(x   x S)
• Since the empty set does not contain any element, is x
always False
• Then the implication is always True. (F → T/F =T)
Theorem :  S
•Empty set is a subset of anyset.
Proof:
T → F F
Venn diagram of Empty set
Theorem :   S
• Empty set is a subset of any set. A={1,2,3}
U
Ø
A
21
Subset property
Theorem:
• 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:
• End of proof
A={1,2,3} B={1,2,3}
Note on equivalence:
• Two sets are equal if each is a subset of the other set.
x(x  A  x B)
• Applying this to S we get:
• x(x  S  x S) which is trivially True
S  S
T → T T
F → F T
22
23
A proper Subset
Definition:
A set A is said to be a proper subset of B if and only if
. We denote that Ais a proper
A  B and A  B
subset of B with the notation Α  Β .
Example: A={1,2,3} B ={1,2}
Is: Α  Β ?
24
A proper Subset
Definition:
A set A is said to be a proper subset of B if and only if
. We denote that Ais a proper
A  B and A  B
subset of B with the notation Α  Β .
Example: A={1,2,3} B ={1,2,3,4,5,6}
Is: Α  Β ? Yes.
Cardinality
25
Definition: Let S be a set. If there are exactly n distinct
elements in S, where n is a nonnegative integer, we say S is
a finite set and that n is the cardinality of S. The cardinalityof
S is denoted by | S |.
Examples:
• V={1, 2, {3, 4}, 5}
| V | = 4
• A={a,b,c,d,e,f,g}
|A| =7
• | Ø | = 0
What is the cardinality of each of these sets?
a){a}
b){{a}}
c) {a, {a}}
d) {a, {a}, {a, {a}}}
26
Problem
What is the cardinality of each of these sets?
a){a}
b){{a}}
c) {a, {a}}
d) {a, {a}, {a, {a}}}
a) 1
27
Problem
What is the cardinality of each of these sets?
a){a}
b){{a}}
c) {a, {a}}
d) {a, {a}, {a, {a}}}
a) 1
b) 1
28
Problem
What is the cardinality of each of these sets?
a){a}
b){{a}}
c) {a, {a}}
d) {a, {a}, {a, {a}}}
a) 1
b) 1
c) 2
29
Problem
What is the cardinality of each of these sets?
a){a}
b){{a}}
c) {a, {a}}
d) {a, {a}, {a, {a}}}
a) 1
b) 1
c) 2
d) 3
30
Problem
Infinite set
31
Definition: Aset is infinite if it is not finite.
Examples:
• The set of natural numbers is an infinite set.
• N = {1, 2, 3, ... }
• The set of real numbers is an infinite set.
32
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
• What is the power set of Ø ? P(Ø ) = {Ø}
• What is the cardinality of P(Ø) ? | P(Ø) | =1.
Assume B={1,2}
• P(B) = {Ø, {1}, {2}, {1,2}}
•|P(B) | = 4
AssumeA={1,2,3}
• P(A) = {Ø, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} }
• |P(A) | = 8
If S is a set with |S| = n then | P(S) | = ?
33
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
• What is the power set of Ø ? P(Ø ) ={Ø}
• What is the cardinality of P(Ø) ? | P(Ø) | =1.
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
If S is a set with |S| = n then | P(S) | = ? 2n
34
N-tuple
Example: Coordinates of a point in the 2-D plane (12, 16)
Sets are used to represent unordered collections.
•Ordered-n tuples are used to represent an ordered
collection.
Definition: An ordered n-tuple (x1, x2, ..., xN) is the ordered
collection that has x1 as its first element, x2 as its second
element, ..., and xN as its N-th element, N ˃=2.
(5,10)
(10,5)
35
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}.T x
S = { (t,s) | t ϵT ˄sϵS}.
Examples:
• S = {1,2} and T = {a,b,c}
• S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c)}
• T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) }
• Is S x T and T x S equal?
Cartesian Product
36
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}
• S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c)}
• T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) }
• Is S x T ≠ T x S!!!!
Cardinality of a Cartesian Product
37
• |S x T| = |S| * |T|.
|A|=2 |P(A)|=4
Example:
• A= {roll, name}
• B ={m1, m2}
• A x B= {(roll, m1),(roll, m2) (name, m1),(name, m2)}
• |A x B| = 4
• |A|=2, |B|=2 → |A| |B|= 4
Relation as a subset of a Cartesian
Product
38
A= {roll, name}
• B ={m1, m2}
• A x B= {(roll, m1),(roll, m2) (name, m1),(name, m2)}
R1={(roll,m1)}
Definition:A subset of the Cartesian productA x B is called a relation from
the set A to the set B.
roll m1
123 34
124 56
125 67
39
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 AandB.
• 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 = ?
40
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 AandB.
• 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 }
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 AandB.
• Alternate: A ∩ B = { x |x ϵ A ˄ x ϵ B }.
Example:
• A = {1,2,3} and B = { 2,4,6,9}
• A∩ B = ? 41
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 AandB.
• Alternate: A ∩ B = { x |x ϵ A ˄ x ϵ B }.
Example:
• A = {1,3,7} and B = { 2,4,6,9}
• A∩ B = ? 42
43
Disjoin Set
Definition: Two sets are called disjoint if their intersection is
empty.
• Alternate:A and B are disjoint if and only if A ∩ B = Ø.
Example:
• A={1,2,3,6} B={4,7,8} Are these disjoint?
44
Disjoin Set
Definition: Two sets are called disjoint if their intersection is
empty.
• Alternate:A and B are disjoint if and only if A ∩ B = Ø.
Example:
• A={1,2,3,6} B={4,7,8} Are these disjoint?
• Yes.
• A ∩ B = Ø
45
Cardinality of set union
Cardinality of the set union.
• |AU B| = |A| + |B| - |A ∩ B|
Why this formula? A={1,2,3,4} B={5,6}
A={1,2,3,4} B={3,4, 5,6}
|AU B| =
= |A| + |B| - |A ∩ B|
= 4 + 4 - 2
|AU B| = |A|+|B| - |A ∩ B|
= 4+2-0
46
Cardinality of set union
Cardinality of the set union.
• |AU B| = |A| + |B| - |A ∩ B|
Why this formula? Correct for an over-count.
A = {1,2,3,6} and B = { 2,4,6,9}
• A U B = { 1,2,3,4,6,9 }
|AU B| = |A| + |B| - |A∩ B| = 4+4-2 =6
47
Set Difference
Example: A= {1,2,3,5,7} B ={1,5,6,8}
• A - B = ?
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 toA.
•Alternate: A B {x | x A x B}
48
Set Difference
Example: A= {1,2,3,5,7} B ={1,5,6,8}
• A - B ={2,3,7}
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 toA.
•Alternate: A B {x | x A x B}
Let A = {a, b, c, d, e} and B = {a, b, c, d, e, f, g, h}.
Find
a) A ∪B.
b) B − A.
49
Problem
Let A = {a, b, c, d, e} and B = {a, b, c, d, e, f, g, h}.
Find
a) A ∪B.
b) B − A.
a) A ∪ B = {a, b, c, d, e, f, g, h}
50
Problem
Let A = {a, b, c, d, e} and B = {a, b, c, d, e, f, g, h}.
Find
a) A ∪B.
b) B − A.
a) A ∪ B = {a, b, c, d, e, f, g, h} = B
b) B – A = {f, g,h}
A – B = {}
51
Problem
52
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 toU.
• Alternate:Alternate:
Example: U={1,2,3,4,5,6,7,8} A={1,3,5}
• Ã=?
A {x | x A}
53
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 toU.
• Alternate:Alternate:
Example: U={1,2,3,4,5} A={1,3,5}
• Ã={2,4}
A {x | x A}
54
Generalized union
Example:
i
• Let A= {1,2,...,i} i =1,2,...,n
Definition: The union of a collection of sets is the set that
contains those elements that are members of at least oneset
in the collection.
n
Ai  {A1  A2  . . .  An }
i  1
n
i  1
A i  { 1 , 2 , . . . , n }
A1 = {1}
A2= {1,2}
A3= {1,2,3}
…………..
…………..
An ={1,2,3,4,...,n}
55
Generalized intersection
• Let Ai= {1,2,...,i} i =1,2,...,n
Definition: The intersection of a collection of sets is the set
that contains those elements that are members of all setsin
the collection.
n
Ai  {A1  A2  . . .  An }
i  1
Example:
n
i  1
A i  { 1 }
A1 = {1}
A2= {1,2}
A3= {1,2,3}
…………..
…………..
An ={1,2,3,4,...,n}
56
Computer representation of set
How to represent sets in the computer?
• One solution: Data structures like a list
•A better solution: Assign a bit in a bit string to each element
in the universal set and set the bit to 1 if the element is
present otherwise use 0
Example:
All possible elements: U={1 2 3 4 5} = {00000}
• AssumeA={2,5}
– Computer representation: A =01001
• Assume B={1,5}
– Computer representation: B = 10001
57
Computer representation of set
Example:
• A = 01001
• B = 10001
• The union is modeled with a bitwise or
•A U B = 11001
A-B ={01000}
B-A = {10000}
• The intersection is modeled with a bitwise and
• A ∩ B = 00001
• The complement is modeled with a bitwisenegation
• Ã =10110
58
Thank You

More Related Content

Similar to file_5.pptx

Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptxMoazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptxKhalidSyfullah6
 
SETS - Vedantu.pdf
SETS - Vedantu.pdfSETS - Vedantu.pdf
SETS - Vedantu.pdfAneeshRenu
 
Set theory and its operations
Set theory and its operations Set theory and its operations
Set theory and its operations Pankaj Das
 
Set theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaningSet theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaningDipakMahurkar1
 
Sets functions-sequences-exercises
Sets functions-sequences-exercisesSets functions-sequences-exercises
Sets functions-sequences-exercisesRoshayu Mohamad
 
Set theory
Set theorySet theory
Set theoryGaditek
 
Grade 7 Sets.ppt
Grade 7 Sets.pptGrade 7 Sets.ppt
Grade 7 Sets.pptRayRabara
 
Class7 converted
Class7 convertedClass7 converted
Class7 convertedshouryasree
 
Discrete mathematic
Discrete mathematicDiscrete mathematic
Discrete mathematicNaralaswapna
 
Set theory-ppt
Set theory-pptSet theory-ppt
Set theory-pptvipulAtri
 
Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Kwonpyo Ko
 

Similar to file_5.pptx (20)

Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptxMoazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
Moazzzim Sir (25.07.23)CSE 1201, Week#3, Lecture#7.pptx
 
Set Theory.pdf
Set Theory.pdfSet Theory.pdf
Set Theory.pdf
 
SETS - Vedantu.pdf
SETS - Vedantu.pdfSETS - Vedantu.pdf
SETS - Vedantu.pdf
 
Question bank xi
Question bank xiQuestion bank xi
Question bank xi
 
Set theory
Set theorySet theory
Set theory
 
Set theory and its operations
Set theory and its operations Set theory and its operations
Set theory and its operations
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Set theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaningSet theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaning
 
Sets functions-sequences-exercises
Sets functions-sequences-exercisesSets functions-sequences-exercises
Sets functions-sequences-exercises
 
Concept of set.
Concept of set.Concept of set.
Concept of set.
 
Set theory
Set theorySet theory
Set theory
 
set.pdf
set.pdfset.pdf
set.pdf
 
sets.ppt
sets.pptsets.ppt
sets.ppt
 
Grade 7 Sets.ppt
Grade 7 Sets.pptGrade 7 Sets.ppt
Grade 7 Sets.ppt
 
Class7 converted
Class7 convertedClass7 converted
Class7 converted
 
Discrete mathematic
Discrete mathematicDiscrete mathematic
Discrete mathematic
 
Set theory-ppt
Set theory-pptSet theory-ppt
Set theory-ppt
 
Mtk3013 chapter 2-3
Mtk3013   chapter 2-3Mtk3013   chapter 2-3
Mtk3013 chapter 2-3
 
Set theory
Set theorySet theory
Set theory
 
Ch1 sets and_logic(1)
Ch1 sets and_logic(1)Ch1 sets and_logic(1)
Ch1 sets and_logic(1)
 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 

file_5.pptx

  • 1. 1 CSE 173: Discrete Mathematics Dr. Saifuddin Md.Tareeq Professor, Dept of CSE, DU smtareeq@cse.du.ac.bd
  • 2. 2 Course Contents Topic Chapters and sections Lecture Sequence Logic 1.1,1.3-1.6 6 Set, Function 2.1-2.3 1 Algorithm 3.1-3.3 4 Number Theory 4.1-4.3 8 Induction Recursion 5.1-5.2 3 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.
  • 3. 3 Course Lecture Sequence Topic Chapters and sections Lecture Sequence Set, Function 2.1-2.3 1 Relation 9.1,9.3,9.5 2 Induction Recursion 5.1-5.2 3 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 Number Theory 4.1-4.3 8 Probability 7.1-7.3 9 Book Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition, McGraw Hill.
  • 4. 4 Course evaluation Topic Marks Comment Homework (3/3) 10 Subject to NSU evaluation policy Quizzes (2/3) 20 Mid term (2) 30 Final 40
  • 5. 5 Discrete mathematics Discrete mathematics – study of mathematical structures and objects that are fundamentally discrete rather than continuous. • Examples of objects with discrete values are – integers, graphs, or statements in logic. • Discrete mathematics and computer science. – Concepts from discrete mathematics are useful for describing objects and problems in computer algorithms and programming languages. These have applications in cryptography, automated theorem proving, and software development.
  • 6. Set : Basic Discrete Structure 6 Discrete math = – study of the discrete structures used to represent discrete objects Many discrete structures are built usingsets – Sets = collection of objects Examples of discrete structures built with the help ofsets: • Relations • Graphs • Combinations
  • 7. Set 7 Definition: A set is a (unordered) collection ofobjects. These objects are sometimes called elements or members of the set. • Examples: – Vowels in the English alphabet V = { a, e, i, o, u } – First seven prime numbers. X = { 2, 3, 5, 7, 11, 13, 17 }
  • 8. Representing Set • A= {1,2,3 …,100} 8 Representing a set by: 1) Listing (enumerating) the members of the set. 2) Definition by property, using the set builder notation {x| x has property P}. 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} If enumeration of the members is hard we often use ellipses. Example: a set of integers between 1 and 100
  • 9. 9 Important set in discrete math • Natural numbers: – N = {0,1,2,3, …} • Integers – Z = {…, -2,-1,0,1,2, …} • Positive integers – Z+ = {1,2, 3.…} • Rational numbers p is in Z | p is a member ofZ – Q {p / q | p Z,q Z,q  0} • Real numbers – R
  • 10. 10 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} Note: Duplicates don't contribute anything new to a set, so remove them. The order of the elements in a set doesn't contribute anything new. Example: Are {1,2,3,4} and {1,2,2,4}equal?
  • 11. 11 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} Note: Duplicates don't contribute anything new to a set, so remove them. The order of the elements in a set doesn't contribute anything new. Example: Are {1,2,3,4} and {1,2,2,4}equal? No!
  • 12. Universal set 12 Special sets: –The universal set is denoted by U: the set of all objects under consideration. – The empty set is denoted as Ø or { }. U={1,2,3,4,5} A={1,2,3,4,5} B={1,2,3,4,5,6} C={}
  • 13. Venn Diagram A set can be visualized using VennDiagrams: – V={ A, B, C } 13
  • 14. Subset 14 P Q PVQ P^Q P→Q T→F Q→P T→F ~PV Q ~QV P F F F F T T T T F T T F T F T F T F T F F T F T T T T T T T T T Statement: Arifis smart (T/F) How are you? Proposition: T Symbolic representation: p = Arif is smart(T/F) OR P= 4 is prime Q= Today is Thursday If p then q P only if q q whenever p
  • 15. A subset et of B: 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. Alternate way to define A is asubs U={1,2,3,4,5,6,7,8} A={} B={1,2,3} A  B x(x  A)  (x  B) 15
  • 16. Problem Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6}, and D = {4, 6, 8}. Determine which of these sets are subsets of which other of these sets. 16
  • 17. Problem Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6}, and D = {4, 6, 8}. Determine which of these sets are subsets of which other of these sets. B  A 17
  • 18. Problem Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6}, and D = {4, 6, 8}. Determine which of these sets are subsets of which other of these sets. C  A 18
  • 19. Problem Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6}, and D = {4, 6, 8}. Determine which of these sets are subsets of which other of these sets. C  D 19
  • 20. 20 Empty set/subset property End of proof • Recall the definition of a subset: all elements of a setA must be also elements of B: x(x  A  x B) • We must show the following implication holds forany • F -> (T/F) T x(x   x S) • Since the empty set does not contain any element, is x always False • Then the implication is always True. (F → T/F =T) Theorem :  S •Empty set is a subset of anyset. Proof: T → F F
  • 21. Venn diagram of Empty set Theorem :   S • Empty set is a subset of any set. A={1,2,3} U Ø A 21
  • 22. Subset property Theorem: • 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: • End of proof A={1,2,3} B={1,2,3} Note on equivalence: • Two sets are equal if each is a subset of the other set. x(x  A  x B) • Applying this to S we get: • x(x  S  x S) which is trivially True S  S T → T T F → F T 22
  • 23. 23 A proper Subset Definition: A set A is said to be a proper subset of B if and only if . We denote that Ais a proper A  B and A  B subset of B with the notation Α  Β . Example: A={1,2,3} B ={1,2} Is: Α  Β ?
  • 24. 24 A proper Subset Definition: A set A is said to be a proper subset of B if and only if . We denote that Ais a proper A  B and A  B subset of B with the notation Α  Β . Example: A={1,2,3} B ={1,2,3,4,5,6} Is: Α  Β ? Yes.
  • 25. Cardinality 25 Definition: Let S be a set. If there are exactly n distinct elements in S, where n is a nonnegative integer, we say S is a finite set and that n is the cardinality of S. The cardinalityof S is denoted by | S |. Examples: • V={1, 2, {3, 4}, 5} | V | = 4 • A={a,b,c,d,e,f,g} |A| =7 • | Ø | = 0
  • 26. What is the cardinality of each of these sets? a){a} b){{a}} c) {a, {a}} d) {a, {a}, {a, {a}}} 26 Problem
  • 27. What is the cardinality of each of these sets? a){a} b){{a}} c) {a, {a}} d) {a, {a}, {a, {a}}} a) 1 27 Problem
  • 28. What is the cardinality of each of these sets? a){a} b){{a}} c) {a, {a}} d) {a, {a}, {a, {a}}} a) 1 b) 1 28 Problem
  • 29. What is the cardinality of each of these sets? a){a} b){{a}} c) {a, {a}} d) {a, {a}, {a, {a}}} a) 1 b) 1 c) 2 29 Problem
  • 30. What is the cardinality of each of these sets? a){a} b){{a}} c) {a, {a}} d) {a, {a}, {a, {a}}} a) 1 b) 1 c) 2 d) 3 30 Problem
  • 31. Infinite set 31 Definition: Aset is infinite if it is not finite. Examples: • The set of natural numbers is an infinite set. • N = {1, 2, 3, ... } • The set of real numbers is an infinite set.
  • 32. 32 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 • What is the power set of Ø ? P(Ø ) = {Ø} • What is the cardinality of P(Ø) ? | P(Ø) | =1. Assume B={1,2} • P(B) = {Ø, {1}, {2}, {1,2}} •|P(B) | = 4 AssumeA={1,2,3} • P(A) = {Ø, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} } • |P(A) | = 8 If S is a set with |S| = n then | P(S) | = ?
  • 33. 33 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 • What is the power set of Ø ? P(Ø ) ={Ø} • What is the cardinality of P(Ø) ? | P(Ø) | =1. 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 If S is a set with |S| = n then | P(S) | = ? 2n
  • 34. 34 N-tuple Example: Coordinates of a point in the 2-D plane (12, 16) Sets are used to represent unordered collections. •Ordered-n tuples are used to represent an ordered collection. Definition: An ordered n-tuple (x1, x2, ..., xN) is the ordered collection that has x1 as its first element, x2 as its second element, ..., and xN as its N-th element, N ˃=2. (5,10) (10,5)
  • 35. 35 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}.T x S = { (t,s) | t ϵT ˄sϵS}. Examples: • S = {1,2} and T = {a,b,c} • S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c)} • T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) } • Is S x T and T x S equal?
  • 36. Cartesian Product 36 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} • S x T = { (1,a), (1,b), (1,c), (2,a), (2,b), (2,c)} • T x S = { (a,1), (a, 2), (b,1), (b,2), (c,1), (c,2) } • Is S x T ≠ T x S!!!!
  • 37. Cardinality of a Cartesian Product 37 • |S x T| = |S| * |T|. |A|=2 |P(A)|=4 Example: • A= {roll, name} • B ={m1, m2} • A x B= {(roll, m1),(roll, m2) (name, m1),(name, m2)} • |A x B| = 4 • |A|=2, |B|=2 → |A| |B|= 4
  • 38. Relation as a subset of a Cartesian Product 38 A= {roll, name} • B ={m1, m2} • A x B= {(roll, m1),(roll, m2) (name, m1),(name, m2)} R1={(roll,m1)} Definition:A subset of the Cartesian productA x B is called a relation from the set A to the set B. roll m1 123 34 124 56 125 67
  • 39. 39 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 AandB. • 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 = ?
  • 40. 40 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 AandB. • 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 }
  • 41. 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 AandB. • Alternate: A ∩ B = { x |x ϵ A ˄ x ϵ B }. Example: • A = {1,2,3} and B = { 2,4,6,9} • A∩ B = ? 41
  • 42. 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 AandB. • Alternate: A ∩ B = { x |x ϵ A ˄ x ϵ B }. Example: • A = {1,3,7} and B = { 2,4,6,9} • A∩ B = ? 42
  • 43. 43 Disjoin Set Definition: Two sets are called disjoint if their intersection is empty. • Alternate:A and B are disjoint if and only if A ∩ B = Ø. Example: • A={1,2,3,6} B={4,7,8} Are these disjoint?
  • 44. 44 Disjoin Set Definition: Two sets are called disjoint if their intersection is empty. • Alternate:A and B are disjoint if and only if A ∩ B = Ø. Example: • A={1,2,3,6} B={4,7,8} Are these disjoint? • Yes. • A ∩ B = Ø
  • 45. 45 Cardinality of set union Cardinality of the set union. • |AU B| = |A| + |B| - |A ∩ B| Why this formula? A={1,2,3,4} B={5,6} A={1,2,3,4} B={3,4, 5,6} |AU B| = = |A| + |B| - |A ∩ B| = 4 + 4 - 2 |AU B| = |A|+|B| - |A ∩ B| = 4+2-0
  • 46. 46 Cardinality of set union Cardinality of the set union. • |AU B| = |A| + |B| - |A ∩ B| Why this formula? Correct for an over-count. A = {1,2,3,6} and B = { 2,4,6,9} • A U B = { 1,2,3,4,6,9 } |AU B| = |A| + |B| - |A∩ B| = 4+4-2 =6
  • 47. 47 Set Difference Example: A= {1,2,3,5,7} B ={1,5,6,8} • A - B = ? 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 toA. •Alternate: A B {x | x A x B}
  • 48. 48 Set Difference Example: A= {1,2,3,5,7} B ={1,5,6,8} • A - B ={2,3,7} 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 toA. •Alternate: A B {x | x A x B}
  • 49. Let A = {a, b, c, d, e} and B = {a, b, c, d, e, f, g, h}. Find a) A ∪B. b) B − A. 49 Problem
  • 50. Let A = {a, b, c, d, e} and B = {a, b, c, d, e, f, g, h}. Find a) A ∪B. b) B − A. a) A ∪ B = {a, b, c, d, e, f, g, h} 50 Problem
  • 51. Let A = {a, b, c, d, e} and B = {a, b, c, d, e, f, g, h}. Find a) A ∪B. b) B − A. a) A ∪ B = {a, b, c, d, e, f, g, h} = B b) B – A = {f, g,h} A – B = {} 51 Problem
  • 52. 52 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 toU. • Alternate:Alternate: Example: U={1,2,3,4,5,6,7,8} A={1,3,5} • Ã=? A {x | x A}
  • 53. 53 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 toU. • Alternate:Alternate: Example: U={1,2,3,4,5} A={1,3,5} • Ã={2,4} A {x | x A}
  • 54. 54 Generalized union Example: i • Let A= {1,2,...,i} i =1,2,...,n Definition: The union of a collection of sets is the set that contains those elements that are members of at least oneset in the collection. n Ai  {A1  A2  . . .  An } i  1 n i  1 A i  { 1 , 2 , . . . , n } A1 = {1} A2= {1,2} A3= {1,2,3} ………….. ………….. An ={1,2,3,4,...,n}
  • 55. 55 Generalized intersection • Let Ai= {1,2,...,i} i =1,2,...,n Definition: The intersection of a collection of sets is the set that contains those elements that are members of all setsin the collection. n Ai  {A1  A2  . . .  An } i  1 Example: n i  1 A i  { 1 } A1 = {1} A2= {1,2} A3= {1,2,3} ………….. ………….. An ={1,2,3,4,...,n}
  • 56. 56 Computer representation of set How to represent sets in the computer? • One solution: Data structures like a list •A better solution: Assign a bit in a bit string to each element in the universal set and set the bit to 1 if the element is present otherwise use 0 Example: All possible elements: U={1 2 3 4 5} = {00000} • AssumeA={2,5} – Computer representation: A =01001 • Assume B={1,5} – Computer representation: B = 10001
  • 57. 57 Computer representation of set Example: • A = 01001 • B = 10001 • The union is modeled with a bitwise or •A U B = 11001 A-B ={01000} B-A = {10000} • The intersection is modeled with a bitwise and • A ∩ B = 00001 • The complement is modeled with a bitwisenegation • Ã =10110