Discrete Mathematics and Its Application
Discrete Mathematics and Its Application
(Introduction)
‘‘The universe cannot be read until we have learnt the language and
become familiar with the characters in which it is written. It is written in
mathematical language... without which means it is humanly
impossible to comprehend a single word"
Logic is the bridge netween the language the universe is written in and
mathematics.
In this lecture we shall learn the basic entities of logic:
(Introduction)
‘‘The universe cannot be read until we have learnt the language and
become familiar with the characters in which it is written. It is written in
mathematical language... without which means it is humanly
impossible to comprehend a single word"
Logic is the bridge netween the language the universe is written in and
mathematics.
In this lecture we shall learn the basic entities of logic:
1 Propositions
(Introduction)
‘‘The universe cannot be read until we have learnt the language and
become familiar with the characters in which it is written. It is written in
mathematical language... without which means it is humanly
impossible to comprehend a single word"
Logic is the bridge netween the language the universe is written in and
mathematics.
In this lecture we shall learn the basic entities of logic:
1 Propositions
2 Boolean Variables
(Introduction)
‘‘The universe cannot be read until we have learnt the language and
become familiar with the characters in which it is written. It is written in
mathematical language... without which means it is humanly
impossible to comprehend a single word"
Logic is the bridge netween the language the universe is written in and
mathematics.
In this lecture we shall learn the basic entities of logic:
1 Propositions
2 Boolean Variables
3 Logical (boolean) opertaors.
(Introduction)
‘‘The universe cannot be read until we have learnt the language and
become familiar with the characters in which it is written. It is written in
mathematical language... without which means it is humanly
impossible to comprehend a single word"
Logic is the bridge netween the language the universe is written in and
mathematics.
In this lecture we shall learn the basic entities of logic:
1 Propositions
2 Boolean Variables
3 Logical (boolean) opertaors.
4 Truth tables.
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
1 Today is Saturday
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
1 Today is Saturday
2 It is raining today.
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
1 Today is Saturday
2 It is raining today.
3 if n is an integer then (2n + 1)2 mod 8 = 1.
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
1 Today is Saturday
2 It is raining today.
3 if n is an integer then (2n + 1)2 mod 8 = 1.
4 if n is an odd prime number then 2n−1 mod n = 1
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
1 Today is Saturday
2 It is raining today.
3 if n is an integer then (2n + 1)2 mod 8 = 1.
4 if n is an odd prime number then 2n−1 mod n = 1
5 There are no positive integers x, y, z satisfying the equality
x 5 + y 5 = z5
Definition
A Proposition is a statement of a fact which is either true or false but
not both.
Example
1 Today is Saturday
2 It is raining today.
3 if n is an integer then (2n + 1)2 mod 8 = 1.
4 if n is an odd prime number then 2n−1 mod n = 1
5 There are no positive integers x, y, z satisfying the equality
x 5 + y 5 = z5
6 There are infinitely many prime numbers q such that q = 4p + 1
where p is prime.
Comment
Almost all programming languages include boolean variables.
Question
What can be done with a single boolean variable that has only two
values?
Question
What can be done with a single boolean variable that has only two
values?
Answer
Not much more than a light switch, it can be off or on. But combining
an array of boolean variables, like 32 in common processors yields 232
different patterns, That is more than 4, 000, 000, 000 patterns!
Question
What can be done with a single boolean variable that has only two
values?
Answer
Not much more than a light switch, it can be off or on. But combining
an array of boolean variables, like 32 in common processors yields 232
different patterns, That is more than 4, 000, 000, 000 patterns!
Discussion
Each proposition is composed of one or more propositions connected
by key words:
Discussion
Each proposition is composed of one or more propositions connected
by key words:
1 not: number 1 has one proposition.
Discussion
Each proposition is composed of one or more propositions connected
by key words:
1 not: number 1 has one proposition.
2 and: number 2 has two propositions
Discussion
Each proposition is composed of one or more propositions connected
by key words:
1 not: number 1 has one proposition.
2 and: number 2 has two propositions
3 or: number 4 has 3 propositions
Discussion
Each proposition is composed of one or more propositions connected
by key words:
1 not: number 1 has one proposition.
2 and: number 2 has two propositions
3 or: number 4 has 3 propositions
4 if then number 3 has 3 propositions.
Truth tables are used to describe these and also the truth values of
compound propositions.
Truth tables are used to describe these and also the truth values of
compound propositions.
Truth tables are used to describe these and also the truth values of
compound propositions.
Truth tables are used to describe these and also the truth values of
compound propositions.
Truth tables are used to describe these and also the truth values of
compound propositions.
p ¬p
T F
F T
p ¬p
T F
F T
Example
We wish to build the truth table for the compound proposition:
(p → q) ∧ (¬p → q)
p q p→q ¬p → q (p → q) ∧ (¬p → q)
T T T T T
F T T T T
T F F T F
F F T F F
Comment
Here is a list of commonly used binary operators, their names and
description:
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
2 nand, the reverse of and. p | q is false only when both p and q are
true.
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
2 nand, the reverse of and. p | q is false only when both p and q are
true.
3 xor (exclusive or) p ⊕ q is true only when they are different (one is
true and the other is false).
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
2 nand, the reverse of and. p | q is false only when both p and q are
true.
3 xor (exclusive or) p ⊕ q is true only when they are different (one is
true and the other is false).
4 implies p → q is false only when p = true and q = false.
() Discrete Mathematicsand its Applications Ngày 12 tháng 9 năm 2011 10 / 16
Question
1 How many possible binary operators are there?
2 How many non-trivial binary operators are there?
3 How many rows will be needed in the truth table of a compound
proposition with 5 different boolean variables?
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
2 nand, the reverse of and. p | q is false only when both p and q are
true.
3 xor (exclusive or) p ⊕ q is true only when they are different (one is
true and the other is false).
4 implies p → q is false only when p = true and q = false.
5 Biconditional
() p ↔ Discrete
q is true only ifitsboth
Mathematicsand are equal.
Applications Ngày 12 tháng 9 năm 2011 10 / 16
Question
1 How many possible binary operators are there?
2 How many non-trivial binary operators are there?
3 How many rows will be needed in the truth table of a compound
proposition with 5 different boolean variables?
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
2 nand, the reverse of and. p | q is false only when both p and q are
true.
3 xor (exclusive or) p ⊕ q is true only when they are different (one is
true and the other is false).
4 implies p → q is false only when p = true and q = false.
5 Biconditional
() p ↔ Discrete
q is true only ifitsboth
Mathematicsand are equal.
Applications Ngày 12 tháng 9 năm 2011 10 / 16
Question
1 How many possible binary operators are there?
2 How many non-trivial binary operators are there?
3 How many rows will be needed in the truth table of a compound
proposition with 5 different boolean variables?
Comment
Here is a list of commonly used binary operators, their names and
description:
1 nor, the reverse of or, p ↓ q is true only when both p and q are
false.
2 nand, the reverse of and. p | q is false only when both p and q are
true.
3 xor (exclusive or) p ⊕ q is true only when they are different (one is
true and the other is false).
4 implies p → q is false only when p = true and q = false.
5 Biconditional
() p ↔ Discrete
q is true only ifitsboth
Mathematicsand are equal.
Applications Ngày 12 tháng 9 năm 2011 10 / 16
Logic calculations
Operator Precedence
¬ 1
∧ 2
∨ 3
→ 4
Equivalence Name
p ∨ F ≡ p; p ∧ T ≡ p Identity
p ∨ T ≡ T; p ∧ F ≡ F Domination
p ∨ p ≡ p; p ∧ p ≡ p Idempotent
p ∨ q ≡ q ∨ p; p ∧ q ≡ q ∧ p commutative
p ∨ (q ∨ r ) ≡ (p ∨ q) ∨ r
p ∧ (q ∧ r ) ≡ (p ∧ (q ∧ r ) Associative
p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r )
p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r Distributive
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q De Morgan
Bảng: Basic computation laws
Trung, Hóa and Tuán had the same Pho for lunch at the same
restaurant. They asked Hà to guess what they ate and where. To
challenge Há they decided that each will tell Há two facts and at least
one of the fcat will be true..
Trung, Hóa and Tuán had the same Pho for lunch at the same
restaurant. They asked Hà to guess what they ate and where. To
challenge Há they decided that each will tell Há two facts and at least
one of the fcat will be true..
Trung, Hóa and Tuán had the same Pho for lunch at the same
restaurant. They asked Hà to guess what they ate and where. To
challenge Há they decided that each will tell Há two facts and at least
one of the fcat will be true..
Trung, Hóa and Tuán had the same Pho for lunch at the same
restaurant. They asked Hà to guess what they ate and where. To
challenge Há they decided that each will tell Há two facts and at least
one of the fcat will be true..
Trung, Hóa and Tuán had the same Pho for lunch at the same
restaurant. They asked Hà to guess what they ate and where. To
challenge Há they decided that each will tell Há two facts and at least
one of the fcat will be true..
The logician meets a cannibal in the jungle. The cannibal grants our
logician his final wish: to ask him one question. If as a result of the
answer the logician can determine to which tribe the cannibal belongs
his life will be spared.
The logician meets a cannibal in the jungle. The cannibal grants our
logician his final wish: to ask him one question. If as a result of the
answer the logician can determine to which tribe the cannibal belongs
his life will be spared.