Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Discrete Mathematics
Topics
Orientation (UM VMG,CEE PEO, Grading
System)
Logic, Sets, Proofs, and Functions
Propositions
Conditional Propositions & Logical
Equivalence
Quantifiers
Proofs
Resolution of Proofs
Mathematical Induction
Integers, and Matrices
Sets
Sequences and Strings
Number Systems
Relations and Equivalence
Matrices
Functions
Discrete Mathematics
3
Logic, Sets, Proofs, and Functions
4
Logic
5
Logic
Example
6
Logic
Problems
7
Proposition
- is a collection of declarative
statements that has either a truth
value "true” or a truth value
- "false"
It consists of propositional
variables and connectives
- We denote the propositional
variables by lower case letters (a,
b,
Theetc)connectives connect the
-
propositional variables.
8
Cont’d
Not a proposition
"A is less than 2".
10
Cont’d
1.Negation/Not
2.Or ˅
3.And ˄
4.Exclusive Or (XOR)
5.Implication/If-then
6.Biconditional/If and only if
11
Compound
Propositions
12
Compound Propositions
Negation of a proposition
Let p be a proposition. The
negation of p, denoted by
• Symbol:
p p
true false
false true
14
Example
s
1. Find the negation of the following
proposition
p : Today is Friday.
The negation is
p : It is not the case that today
is Friday.
16
Conjunction
(AND)
Definition
Let p and q be propositions. The
conjunction of p and q, denoted
by p˄q, is the proposition “p and
q”.
The conjunction p˄q is true when p
and q and both true and is false
otherwise.
17
Truth Table (AND)
18
Examples
Definition
Let p and q be propositions. The
disjunction of p and q, denoted
by p˅q, is the proposition “p or
q”.
The disjunction p˅q is false when
both p and q are false and is true
otherwise.
20
Truth Table
(OR)
p q p q
true true true
true false true
false true true
false false false
21
Examples
where
p : Today is Friday.
q : It is raining today.
The disjunction is
p˅q : Today is Friday or it is
raining today.
22
Exclusive OR (XOR)
Definition
Let p and q be propositions. The
exclusive or of p and q, denoted
by pq, is the proposition
“pq”.
The exclusive or, p q, is true
when exactly one of p and q is
true and is false otherwise.
23
Truth Table
(XOR)
24
Examples
In logic form 27
Conditional Statements
Implication
Definition: Let p and q be propositions. The
conditional statement pq, is the
proposition “If p, then q”.
The conditional statement p q is
false when
p is true and q is false and is
true otherwise.
29
Conditional Statements
Biconditional
Statements
Definition: Let p and q be
propositions.
The biconditional statement p q,
is proposition “p if and only if q”.
The biconditional (bi-implication)
statement p q is true
31
Composite Statements
32
Equivalent Statements
36
Example
Solution
p ¬p ¬ (¬p)
T F T
F T F
39
De Morgan’s
laws
De Morgan’s laws state that:
The negation of an and proposition
is logically equivalent to the or
proposition in which each
component is negated.
40
Symbolically (De Morgan’s Laws)
1. ¬(pq) ≡ ¬p¬q
2. ¬(pq) ≡ ¬p¬q
41
Applying De-Morgan’s Law
Question: Negate the following compound
Propositions
42
Solutio
n
43
Laws of Logic Note T = 1 & F = 0
Logical Equivalence
Name Equivalence
p ^ T ≡ p Identity Laws
p v F ≡ p
p v T ≡ T Domination Laws
p ^ F ≡ F
p ^ p ≡ p
p v p ≡ p Idempotent Laws
Logical Equivalence
Name Equivalence
p ^ (q v r) ≡ (p ^ q) v (p Distributive Law
^ r)
p v (q ^ r) ≡ (p v q) ^ (p
v r)
¬(p ^ q) ≡ ¬p v ¬q De Morgan’s Law
¬(p v q) ≡ ¬p ^ ¬q
p ^ (p v q) ≡ p Absorption Law
p v (p ^ q) ≡ p
p v ¬p ≡ T Negation Laws
p ^ ¬p ≡ F
45
Laws of Logic Note T = 1 & F = 0
46
Laws of Logic Note T = 1 & F = 0
47
Exercise
48
contd…
49
Problems
50
Quantifiers
a formula constructor that produces new formulas
from old ones.
51
Quantifiers
Example 1
52
Quantifiers
Example 2
𝑛2 + 2𝑛 𝑖𝑠 𝑎𝑛 𝑜𝑑𝑑 𝑖𝑛𝑡𝑒𝑔𝑒𝑟 (𝐷 = 𝑠𝑒𝑡 𝑜𝑓 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑖𝑛𝑡𝑒𝑔𝑒𝑟)
Example 3
𝑥 2 − 𝑥 − 6 = 0 (𝐷 = 𝑠𝑒𝑡 𝑜𝑓 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑖𝑛𝑡𝑒𝑔𝑒𝑟)
53
Quantifiers
Universally Quantified Statement (∀→ "𝑓𝑜𝑟 𝑒𝑣𝑒𝑟𝑦")
∀→ 𝑢𝑛𝑖𝑣𝑒𝑟𝑠𝑎𝑙 𝑞𝑢𝑎𝑛𝑡𝑖𝑓𝑖𝑒𝑟
𝑓𝑜𝑟 𝑒𝑣𝑒𝑟𝑦 𝑥, 𝑃(𝑥)
∀𝑥𝑃(𝑥)
54
Quantifiers
Existentially Quantified Statement (∃→ "𝑓𝑜𝑟 𝑠𝑜𝑚𝑒")
∃→ 𝑒𝑥𝑖𝑠𝑡𝑒𝑛𝑡𝑖𝑎𝑙 𝑞𝑢𝑎𝑛𝑡𝑖𝑓𝑖𝑒𝑟
𝑓𝑜𝑟 𝑠𝑜𝑚𝑒 𝑥, 𝑃(𝑥)
∃𝑥𝑃(𝑥)
55
Quantifiers
Other terms
56
Quantifiers
Other terms
57
Quantifiers
Example 1
𝑓𝑜𝑟 𝑒𝑣𝑒𝑟𝑦 𝑟𝑒𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑥, 𝑖𝑓 𝑥 > 1, 𝑡ℎ𝑒𝑛 𝑥 + 1 > 1
Example 2
𝑓𝑜𝑟 𝑒𝑣𝑒𝑟𝑦 𝑟𝑒𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑥, 𝑖𝑓 𝑥 > 1, 𝑡ℎ𝑒𝑛 𝑥 + 1 > 1
58
Proofs
− 𝑎𝑛 𝑎𝑟𝑔𝑢𝑚𝑒𝑛𝑡 𝑡ℎ𝑎𝑡 𝑒𝑠𝑡𝑎𝑏𝑙𝑖𝑠ℎ𝑒𝑠
𝑡ℎ𝑒 𝑡𝑟𝑢𝑡ℎ 𝑜𝑓 𝑎 𝑡ℎ𝑒𝑜𝑟𝑒𝑚
Resolution of Proofs
− 𝑡ℎ𝑒 ℎ𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑒𝑠 𝑎𝑛𝑑 𝑡ℎ𝑒 𝑐𝑜𝑛𝑐𝑙𝑢𝑠𝑖𝑜𝑛
𝑎𝑟𝑒 𝑤𝑟𝑖𝑡𝑡𝑒𝑛 𝑎𝑠 𝑐𝑙𝑎𝑢𝑠𝑒
− 𝑎 𝑐𝑙𝑎𝑢𝑠𝑒 𝑐𝑜𝑛𝑠𝑖𝑠𝑡𝑠 𝑜𝑓 𝑡𝑒𝑟𝑚𝑠 𝑠𝑒𝑝𝑎𝑟𝑎𝑡𝑒𝑑 𝑏𝑦
𝑜𝑟 ′ 𝑠, 𝑤ℎ𝑒𝑟𝑒 𝑒𝑎𝑐ℎ 𝑡𝑒𝑟𝑚 𝑖𝑠 𝑎 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝑜𝑟 𝑡ℎ𝑒
𝑛𝑒𝑔𝑎𝑡𝑖𝑜𝑛 𝑜𝑓 𝑎 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒.
59
Resolution of Proofs
𝑆𝑝𝑒𝑐𝑖𝑎𝑙 𝑐𝑎𝑠𝑒𝑠:
𝐼𝑓 𝑝 ∨𝑞 𝑎𝑛𝑑 ¬𝑝 𝑎𝑟𝑒 𝑡𝑟𝑢𝑒, 𝑡ℎ𝑒𝑛 𝑞 𝑖𝑠 𝑡𝑟𝑢𝑒
(1.5.2)
𝐼𝑓 𝑝 and ¬𝑝 ∨r 𝑎𝑟𝑒 𝑡𝑟𝑢𝑒, 𝑡ℎ𝑒𝑛 𝑟 𝑖𝑠 𝑡𝑟𝑢𝑒
60
Mathematical Induction
𝑖𝑠 𝑎 𝑡𝑒𝑐ℎ𝑛𝑖𝑞𝑢𝑒 𝑓𝑜𝑟 𝑝𝑟𝑜𝑣𝑖𝑛𝑔 𝑎 𝑠𝑡𝑎𝑡𝑒𝑚𝑒𝑛𝑡
− −𝑎 𝑡ℎ𝑒𝑜𝑟𝑒𝑚, 𝑜𝑟 𝑎 𝑓𝑜𝑟𝑚𝑢𝑙𝑎
− −𝑡ℎ𝑎𝑡 𝑖𝑠 𝑎𝑠𝑠𝑒𝑟𝑡𝑒𝑑 𝑎𝑏𝑜𝑢𝑡 𝑒𝑣𝑒𝑟𝑦 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟. 𝐵𝑦 "𝑒𝑣𝑒𝑟𝑦", 𝑜𝑟 "𝑎𝑙𝑙,
" 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟𝑠, 𝑤𝑒 𝑚𝑒𝑎𝑛 𝑎𝑛𝑦 𝑜𝑛𝑒 𝑡ℎ𝑎𝑡 𝑤𝑒 𝑛𝑎𝑚𝑒.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒
𝑆𝑛 = 1 + 2 + 3 + ⋯ + 𝑛
𝑎𝑛𝑑 𝑎𝑙𝑠𝑜
𝑛(𝑛+1)
𝑆𝑛 = 𝑓𝑜𝑟 𝑛 = 1,2, …
2
𝑤ℎ𝑒𝑟𝑒
1(1+1) 1 2
𝑆1 = = =1
2 2
2(2 + 1) 2 3
𝑆2 = = =3
2 2
3(3+1) 3 4
𝑆3 = = =6
2 2
61
Mathematical Induction
𝑖𝑠 𝑎 𝑡𝑒𝑐ℎ𝑛𝑖𝑞𝑢𝑒 𝑓𝑜𝑟 𝑝𝑟𝑜𝑣𝑖𝑛𝑔 𝑎 𝑠𝑡𝑎𝑡𝑒𝑚𝑒𝑛𝑡
− −𝑎 𝑡ℎ𝑒𝑜𝑟𝑒𝑚, 𝑜𝑟 𝑎 𝑓𝑜𝑟𝑚𝑢𝑙𝑎
− −𝑡ℎ𝑎𝑡 𝑖𝑠 𝑎𝑠𝑠𝑒𝑟𝑡𝑒𝑑 𝑎𝑏𝑜𝑢𝑡 𝑒𝑣𝑒𝑟𝑦 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟. 𝐵𝑦 "𝑒𝑣𝑒𝑟𝑦", 𝑜𝑟 "𝑎𝑙𝑙,
" 𝑛𝑎𝑡𝑢𝑟𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟𝑠, 𝑤𝑒 𝑚𝑒𝑎𝑛 𝑎𝑛𝑦 𝑜𝑛𝑒 𝑡ℎ𝑎𝑡 𝑤𝑒 𝑛𝑎𝑚𝑒.
𝐸𝑥𝑎𝑚𝑝𝑙𝑒
𝑆𝑛 = 1 + 2 + 3 + ⋯ + 𝑛
𝑎𝑛𝑑 𝑎𝑙𝑠𝑜
𝑛(𝑛+1)
𝑆𝑛 = 𝑓𝑜𝑟 𝑛 = 1,2, …
2
𝑤ℎ𝑒𝑟𝑒
𝑆𝑛 = 𝑑𝑒𝑛𝑜𝑡𝑒𝑑 𝑎𝑠 𝑠𝑢𝑚 𝑜𝑓 𝑡ℎ𝑒 𝑓𝑖𝑟𝑠𝑡 𝑛 𝑝𝑜𝑠𝑡𝑖𝑣𝑒 𝑖𝑛𝑡𝑒𝑔𝑒𝑟
1(1+1) 1 2
𝑆1 = = =1
2 2
2(2 + 1) 2 3
𝑆2 = = =3
2 2
3(3+1) 3 4
𝑆3 = = =6
2 2 62
Integers, and Matrices
63
Sets
𝑖𝑠 𝑠𝑖𝑚𝑝𝑙𝑦 𝑎𝑛𝑦 𝑐𝑜𝑙𝑙𝑒𝑐𝑡𝑖𝑜𝑛 𝑜𝑓 𝑜𝑏𝑗𝑒𝑐𝑡𝑠.
Example: 𝐴 = 1,2,3,4
elements
64
Sets
if a set is a large finite set or an infinite
set, we can describe it by listing property
necessary for membership.
65
Sequence and String
is a list in which order is taken into
account.
𝑆1 , 𝑆2 , 𝑆3 , … , 𝑆𝑛 , …
66
Sequence and String
Example 3: Define a sequence {𝑡𝑛 } by the rule
𝑡𝑛 = 𝑛2 − 1, 𝑛 ≥ 1.
Ans. First five terms are 0, 3, 8, 15, 24.
1
𝑥𝑛 = , −1 ≤ 𝑛 ≤ 4, .
2𝑛
67
Sequence and String
Sum (or Sigma) Notation
𝑎𝑖 = 𝑎𝑚 + 𝑎𝑚+1 + ⋯ + 𝑎𝑛
𝑖=𝑚
n = upper limit
m = lower limit
i = index
68
Sequence and String
Example: Let a be the sequence defined by
𝑎𝑛 = 2𝑛, 𝑛 ≥ 1. 𝑇ℎ𝑒𝑛
𝑎𝑖 = 𝑎1 + 𝑎2 + 𝑎3 = 2 + 4 + 6 = 12
𝑖=𝑖
69
Sequence and String
String – a finite sequence
Example 2: 𝑏𝑏𝑎𝑎𝑎𝑐 = 𝑏 2 𝑎3 𝑐
71
Sequence and String
Length of a String 𝜶 is a number of elements in 𝜶.
The length of 𝜶 is denoted |𝜶|.
|𝜶| =
5
|𝛽| =
39
72
Sequence and String
If 𝛼 and 𝛽 are two strings, the string consisting
of 𝛼 followed by 𝛽, written 𝛼𝛽 is called
concatenation of 𝛼 and 𝛽.
Ans. 𝛼𝛽 = aabcabd
𝛽𝛼 = cabdaab
73
Number System
A bit is a binary digit, that is, a 0 or a 1.
- It is used in a digital computer’s data and
instructed when encoded.
3 8 5 4
Symbol 3 Symbol 0
Symbol 2 Symbol 1
74
Number System
1 0 1 1 0 1
Symbol 5 Symbol 0
Symbol 4 Symbol 1
Symbol 3 Symbol 2
75
Number System
2 4 8
Symbol 2 Symbol 0
Symbol 1
76
Number System
B F 4
Symbol 2 Symbol 0
Symbol 1
77
Relations and
Equivalence
Relation – can be thought of as a table that
lists the relationship of element to other
elements
Student
Course
Bill CPE 122
Mary CPE 112
Bill CPE 122
Beth CPE 112
Beth CPE 122
Dave CPE 112
78
Relations and
Equivalence
Equivalence Relations – is a binary relation that
is reflexive, symmetric and transitive.
• a = a (reflexive property),
• if a = b then b = a (symmetric property), and
• if a = b and b = c then a = c (transitive
property).
79
Matrices of Relation &
Function
Matrix– is a convenient way to represent a
relation R from X to Y.
• a = a (reflexive property),
• if a = b then b = a (symmetric property), and
• if a = b and b = c then a = c (transitive
property).