q - Tennessee State University

advertisement
Discrete Mathematics
• Goals of a Discrete Mathematics
Learn how to think mathematically
• What will we learn from Discrete Mathematics
1. Mathematical Reasoning
Foundation for discussions of methods of proof
2. Combinatorial Analysis
The method for counting or enumerating objects
3. Discrete Structure
Abstract mathematical structures used to represent
discrete objects and relationship between them
4. Algorithms Thinking
Algorithm is the specification for solving problems.
It’s design and analysis is a mathematical activity.
5. Application and Modeling
Discrete Math has applications to most area of study.
Modeling with it is an extremely important
problem-solving skill .
• How to learn Discrete Mathematics?
Do as many exercises as you possibly can !
Chapter 1 The Foundations: Logic, Sets, and Functions
• Rules of logic specify the precise meaning of
mathematics statements.
• Sets are collections of objects.
• A function sets up a special relation between two sets.
1.1 Logic
Propositions
A proposition is a statement that is either true or false,
but not both.
Examples
Propositions
Not propositions
1. This class has 25 students.
1. What time is it?
2. 4+8=12
2. Read this carefully.
3. 5+3=7
3. x+1= 2.
• We let propositions be represented as p,q,r,s,….
The value of a proposition is either T(true) or F(false).
Definition 1. Let p be a proposition. The statement
“It is not the case of p” is a proposition, called the
negation of p and denoted by  p.
called connectives
Examples
p: Toronto is the capital of Canada.
p : Toronto is not the capital of Canada.
Table 1. The Truth Table
for the negation of a proposition
p
p
T
F
F
T
Definition 2. Let p and q be propositions.The proposition
“p and q”, denoted by p  q, is the proposition that is true
when both p and q are true and is false otherwise. The
proposition p  q is called the conjunction of p and q.
Examples p : Today is Friday.
q : It is raining today.
p  q : Today is Friday and it is raining today.
Table 2. The Truth Table
for the conjunction of two propositions
pq
p q
T T
T
T F
F
F T
F
F F
F
Definition 3. Let p and q be propositions.The proposition
“p or q”, denoted by p  q, is the proposition that is false
when both p and q are false and is true otherwise. The
proposition p  q is called the disjunction of p and q.
Examples p : Today is Friday.
q : It is raining today.
p  q : Today is Friday or it is raining today.
Table 3. The Truth Table
for the disjunction of two propositions
pq
p q
T T
T
T F
T
F T
T
F F
F
Definition 4. Let p and q be propositions.The exclusive of
p and q, denoted by p  q , is the proposition that is true
when exactly one of p and q is true and it is false otherwise.
Examples p : They are parents.
q : They are children.
p  q : They are parents or children but not both.
Table 4. The Truth Table
for the exclusive or of two propositions
p q
pq
T T
F
T F
T
F T
T
F F
F
Definition 5. Let p and q be propositions.The implication
p  q is the proposition that is false when p is true and q is
false and true otherwise,where p is called hypothesis and q
is called the conclusion.
“If p, then q” or “ p implies q”.
Examples
p : It is sunday .
q : we will go to the beach.
p  q : if it is sunday tod ay, then we will go to the beach.
Table 5. The Truth Table
for the implication
pq
p q
T T
T
T F
F
F T
T
F F
T
Another example: If today is Friday, then 2+3=6.
Definition 6. Let p and q be propositions.The biconditional
p  q is the proposition that is true when p and q have the
same truth values and is false otherwise.
“p if and only if q”.
Examples
p : we will go to the beach.
q : it is sunday tod ay.
p  q : we will go to the beach if and only if it is sunday tod ay.
Table 6. The Truth Table
for the biconditional
pq
p q
T T
T
T F
F
F T
F
F F
T
Translating English Sentences into Logical Expressions
Example 1
You can access the Internet from campus only if you are a
computer science major or you are not a freshman.
a . You can access the Internet from campus.
c. You are a computer science major.
f. You are freshman.
The sentence can be represented as a  (c  f )
Example 2
You cannot ride the roller coaster if you are under
4 feet tall unless you are older than 16 years old.
q. You can ride the roller coaster.
r. You are under 4 feet tall.
s. You are older than 16 years old.
The sentence can be represented as (r  s )  q
Logic and Bit Operations
• A bit has two values: 1(true) and 0(false).
• A variable is called a Boolean variable if its value is
either true or false.
• Bit operations ,, are written to be AND, OR and
XOR in programming languages.
Table 7. Table for the bit
operations OR,AND and XOR
x
y x y x y x y
0
0
0
0
0
0
1
1
0
1
1
0
1
0
1
1
1
1
1
0
Example
Extend bit operations
to bit strings.
01 1011 0110
11 0001 1101
11 1011 1111 bitwise OR
01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR
1.2 Propositional Equivalences
Definition 1. A tautology is a compound proposition
that is always true no matter what the values of the
propositions that occur in it. A contradiction is a
compound proposition that is always false.A
contingency is a proposition that is neither a tautology
nor a contradiction.
Example 1.
a tautology
Table 1. Examples of a Tautology
and a Contradiction.
p
p
p  p
p  p
T
F
F
T
T
T
F
F
a contradiction
Logic Equivalences
Definition 2. The proposition p and q are called logically
equivalent if p  q is a tautology. The notation p  q
denotes that p and q are logically equivalent.
• Using a truth table to determine whether two propositions
are equivalent
equivalent
equivalent
Example 3
Example 2
Table 2. Truth tabl es for (p  q) and
p  q
p q p  q (p  q) p q p  q
T T T
F
F F F
T F T
F
F T F
Table 3. Truth tabl es for p  q
and p  q
p q p p  q p  q
T T F
T
T
T F F
F
F
F T T
F F F
F T T
F F T
F
T
T
T
F
T
F
T
T
T
T
T
• Some important
equivalences.
Table 5 Logica l Equivale
Equivalenc e
pT  p
pF  p
pT  T
pF F
pp  p
pp  p
(p)  p
pq  qp
pq  q p
(p  q)  r  p  ( q  r )
(p  q)  r  p  (q  r)
p  (q  r)  ( p  q)  ( p  r)
p  (q  r)  ( p  q)  ( p  r)
(p  q)  p  q
(p  q)  p  q
nces.
Name
Identity law
Dominat ion Laws
Idempotent Laws
Double negtion law
Commutativ e laws
Associativ e laws
Distribu tive laws
DeM organ' s laws
Table 6 Some Useful Logical
Equiv anlences.
p  p  T
p  p  F
(p  q)  (p  q)
Example 4
Show that (p  (p  q))
and p  q are logically
equivalent .
Example 5
Show that (p  q)  (p  q)
is a tautology .
Solution :
( p  q)  ( p  q)  ( p  q)  ( p  q)
Solution :
 (p  q)  ( p  q)
(p  (p  q))  p  (p  q)  (p  p )  (q  q)
 p  (p  q)  TT
 (p  p)  (p  q)
T
 F  (p  q)
 p  q
1.3 Predicates and Quantifiers
Propositional function
A statement involving a variable x is P(x) is said to be a
propositional function if x is a variable and P(x) becomes
a proposition when a value has been assigned to x.
Example 1
Let P(x) denote the statement “x>3”. What are the truth
values of P(4) and P(2)?
In general, a statement involving the n variables
x1 , x2 ,..., xn is denoted as p(x1 , x2 ,..., xn ).
Example 2
Let Q(x,y) denote the statement “x=y+3”. What are the
truth values of the propositions Q(1,2) and Q(3,0)?
Quantifiers
The universal quantification of P(x),denoted as xP(x) is the
proposition “P(x) is true for all values of x
in the universe of discourse.”
universal quantifier
Example 3
Express the statement “Every student in this class has studied calculus.
Solution P(x): x has studied calculus.
S(x): x is in this class.
The statement can be expressed as x( S ( x)  p( x))
Example 4
Let p(x) be the number " x  1  x". What is the truth val ue of
the quantifica tion xP(x), where the universe of discourse is
the set of real numbers?
Solustion : xP(x)is true.
Example 5 What is the truth val ue of xP(x), where P(x) is the statement " x 2  10"
and the universe of discourse consists of the positive integers not exceeding 4?"
Solution : xP(x) is the same as the conjunctio n P( 1 )  P( 2 )  P( 3 )  P( 4 ).
xP(x)is false since P( 4 ) is false.
The existential quantification of P(x),denoted as xP(x ) is
the proposition “There exists an element x in the universe of
discourse such that P(x) is true.”
Example 6
existence quantifier
Let P(x) denote the statement " x  3". What is the truth val ue of
the quantifica tion xP(x), where the universe of discourse is
the set of real numbers?
Solution : xP( x) is true since " x  3" is true - for instance, when " x  4".
Example 7 What is the truth val ue of xP(x), where P(x) is the statement
" x 2  10" and the universe of discourse consists of the positive
integers not exceeding 4?"
Solution : xP(x) is the same as the conjunctio n P( 1 )  P( 2 )  P( 3 )  P( 4 ).
xP(x)is true since P( 4 ) is true.
Example 8
Translate the statement x(C(x) y(C(y)  F(x,y))) into English,
where C(x) is " x has a computer" , F(x,y) is " x and y are friends, " and
the universe of discouse for both x and y is the set of all students
in your school.
Solution: Every student in your school has a computer or has a friend
who has a computer.
Example 9
Translate the statement xyz(((F(x,y)  F(x,z)  (y  z))  F(y,z)))
into English, where F(a,b) means a and b are friends and the universe of discourse
for x, y and z is the set of all students in your school.
Solution: There is a student none of whose friends are also friends with
each other.
Translating Sentences into Logical Expressions
Example 10
Express the statements “Some student in this class has visited
Mexico” and “every student in this class has visited either Canada or
Mexico using quantifiers.
Solution : Let M(x) be the statement " x has visited Mexico"
and C(x) the statement " x has visited Canada." The solution is
(C(x)  M(x)).
Example 11
Express the statement “Everyone has exactly one best friend” as a
logical expression.
Solution : Let B(x,y) be the statement " y is the best friend of x."
The solution is xyz(B(x,y)  ((z  y)  B(x,z)).
Example 12
Express the statement “There is a woman who has taken a flight on
every airline in the world.
Solution :
Let P(w,f) be " w has taken f " and Q(f,a) be " f is flght on a."
The solutition is waf(P(w,f)  Q(f,a), where
the universes of discourse for w, f , and a consisits of all the woman
in the world, all airplanes, and all airlines, respective ly.
Negations: the negation of quantified expressions.
(1) xP(x)  xP(x).
(2)xP(x)  xP(x).
Example 13
Every student in the class has taken a course in calculus.
Example 14
There is a student in the class who has taken a course in calculus.
Download