Discrete Mathematics and Its Application - Chapter 1
Discrete Mathematics and Its Application - Chapter 1
Discrete Mathematics and Its Application - Chapter 1
1 (Part 1):
The Foundations: Logic and Proofs
• Introduction
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2011
Introduction: Areas in which discrete
mathematics concepts are present
Important in
• circuit design
• many other CS problems
______________________
Given:
• n cities c1, c2, . . . , cn
• distance between city i and j, dij
HOWEVER . . . . . . . . . . . . .
There are some problems for which we do not know if efficient algorithms
exist to solve them!
Ch.1 (part© 1): 5
by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
Section 1.1: Propositional Logic
propositional variables: P, Q, R, S, . . .
• Unary:
– Negation
• Binary
– Conjunction
– Disjunction
– Exclusive OR
– Implication
– Biconditional
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
Ch.1 (part 1): 7
• Unary
Truth Table
– Negation
P P
‘not’ F(0) T(1)
Symbol: T(1) F(0)
Note: Only
© by Kenneth one of P and Q must be true.
Ch.1 (part 1): 11
H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
• Binary
– Implication: ‘If...then...’
Truth Table
Symbol:
P Q PQ
Example: 0 0 1
P - ‘I am going to town’ 0 1 1
1 0 0
Q - ‘It is going to rain’
1 1 1
Equivalent forms:
If P, then Q
P implies Q
If P, Q
P only if Q
P is a sufficient condition for Q
Q if P
Q whenever P
Q is a necessary condition for P
More terminology:
Q P is the CONVERSE of P Q
Q P is the CONTRAPOSITIVE of P
Q
Ch.1 (part© 1): 15
by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
Example:
• Binary 0 0 1
0 1 0
– Biconditional: ‘if and only if’, ‘iff’ 1 0 0
Symbol: 1 1 1
Example: P - ‘I am going to town’, Q - ‘It is going to rain’
P: I go to Harry’s
Q: I go to the country
R: I will go shopping
If......P......or.....Q.....then....not..…R
(P V Q)R
Ch.1 (part© 1): 19
by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
Constructing a truth table:
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
Ch.1 (part© 1): 21
by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
Chapter 1: (Part 2):
The Foundations: Logic and Proofs
• Propositional
Equivalence
(Section 1.2)
• Predicates &
Quantifiers
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2011
© by Kenneth H. Rosen, Discrete Mathematics & its
Propositional Equivalences (1.2)
PQ
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 24
Propositional Equivalences (1.2) (cont.)
• Example:
(P Q) (Q P) (P Q)
• Proof:
– The left side and the right side must have the
same truth values independent of the truth
value of the component propositions.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 28
Equivalence Name
(P V Q) V R Associative Law
P V (Q V R)
P V (Q R) Distributive Law
(P V Q) (P V R)
(P Q) P V Q De Morgan’s Laws
(P V Q) P Q
P Q P V Q Implication
Equivalence
P Q Q P Contrapositive Law
Note: equivalent expressions can always be substituted for each other in a more
complex expression - useful for simplification.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 29
Propositional Equivalences (1.2) (cont.)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 30
Propositional Equivalences (1.2) (cont.)
(P V Q) R
(P Q R) V (P Q R) V (P Q
R)
V (P Q R) V (P Q R)
• A generalization of propositions -
propositional functions or predicates:
propositions which contain variables
or
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 35
Predicates & Quantifiers (1.3) (cont.)
• Examples:
• Quantifiers
– Universal
– Example: U = {1, 2, 3}
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 39
Predicates & Quantifiers (1.3) (cont.)
• Quantifiers (cont.)
– Existential
Example: U={1,2,3}
x P(x) P(1) V P(2) V P(3)
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 40
Predicates & Quantifiers (1.3) (cont.)
• Quantifiers (cont.)
– Unique Existential
– Example: U = {1, 2, 3, 4}
P(1) P(2) P(3) !xP(x)
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1 How many
1 0 1 0 minterms are
1 1 0 0 in the DNF?
1 1 1 0
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 42
Predicates & Quantifiers (1.3) (cont.)
REMEMBER!
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 43
Predicates & Quantifiers (1.3) (cont.)
Outside in:
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 47
Predicates & Quantifiers (1.3) (cont.)
– Example:
F(x): x is a fleegle
S(x): x is a snurd
T(x): x is a thingamabob
– Everything is a fleegle
x F( x)
(x F(x))
– Nothing is a snurd.
x S(x)
(x S( x))
– No snurd is a thingamabob.
x [S(x) T(x)]
(x [S(x ) T(x)])
• Extra Definitions:
– Examples:
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 52
Predicates & Quantifiers (1.3) (cont.)
• Dangerous situations:
– Commutativity of quantifiers
x y P(x, y) y x P( x, y)?
YES!
x y P(x, y) y x P(x, y)?
NO!
DIFFERENT MEANING!
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 54
Sets (1.6) (cont.)
– Notation:
• specification by predicates:
S= {x| P(x)},
S contains all the elements from U which make
the predicate P true.
• Notation:
x is a member of S or x is an element of S:
x S.
xCS
is 210,
not Ch.1
an element
© by Kenneth of Mathematics
H. Rosen, Discrete S: & its Applications,
56 Seventh Edition, Mc Graw-Hill, 2011
Sets (1.6) (cont.)
• Subsets
– Definition: The set A is a subset of the set B,
denoted
A B, iff
x [x A x B]
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 58
Sets (1.6) (cont.)
– Example:
A = {,{}}.
A has two elements and hence four subsets:
, {}, {{}}. {,{}}
Note that is both a member of A and a subset of A!
– Russell's paradox: Let S be the set of all sets which are not
members of themselves. Is S a member of itself?
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
CS 210, Ch.1 60
Sets (1.6) (cont.)
– Example:
A = {a,b}, B = {1, 2, 3}
AxB = {<a, 1>, <a, 2>, <a, 3>, <b, 1>, <b, 2>, <b,
3>}
What is BxA? AxBxA?
CS–210, © by Kenneth H. Rosen, Discrete Mathematics & its Applications, Seventh Edition, Mc Graw-Hill, 2011
If |A|
Ch.1= m and |B| = n, what61 is |AxB|?