Upload
allan-ellis
View
221
Download
0
Embed Size (px)
Citation preview
Discrete Mathematics
• Goals of a Discrete Mathematics Learn how to think mathematically
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
• What will we learn from Discrete Mathematics
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.
Propositions
1. This class has 25 students.
2. 4+8=12
3. 5+3=7
Not propositions
1. What time is it?
2. Read this carefully.
3. x+1= 2.
Examples
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
• We let propositions be represented as p,q,r,s,….
The value of a proposition is either T(true) or F(false).
p: Toronto is the capital of Canada.
Canada. of capital not the is Toronto:p
Examples
Table 1. The Truth Table for the negation of a proposition
p
TF
FT
p
called connectives
Definition 2. Let p and q be proposition s .The proposition “p and q”, denoted by , is the proposition that is true when both p and q are true and is false otherwise. The proposition is called the conjunction of p and q.
qp
qp
Table 2. The Truth Table for the conjunction of two propositions
p q
T TT FF TF F
TFFF
qp
Examples
today.raining isit andFriday isToday :
today.raining isIt :
Friday. isToday :
qp
q
p
Definition 3. Let p and q be proposition s .The proposition “p or q”, denoted by , is the proposition that is false when both p and q are false and is true otherwise. The proposition is called the disjunction of p and q.
qp
qp
Table 3. The Truth Table for the disjunction of two propositions
p q
T TT FF TF F
TTTF
qp
Examples
today.raining isit or Friday isToday :
today.raining isIt :
Friday. isToday :
qp
q
p
Definition 4. Let p and q be proposition s .The exclusive of p and q, denoted by , is the proposition that is true when exactly one of p and q is true and it is false otherwise.
qp
Table 4. The Truth Table for the exclusive or of two propositions
p q
T TT FF TF F
FTTF
qp
Examples
both.not but children or parents areThey :
children. areThey :
parents. areThey :
qp
q
p
Definition 5. Let p and q be proposition s .The implication 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.
qp
Table 5. The Truth Table for the implication
p q
T TT FF TF F
TFTT
qp
Examples
beach. the togo will then weay,sunday tod isit if :
beach. the togo will we:
.sunday isIt :
qp
q
p
“If p, then q” or “ p implies q”.
Another example: If today is Friday, then 2+3=6.
Definition 6. Let p and q be proposition s .The biconditional is the proposition that is true when p and q have the same truth values and is false otherwise.
qp
Table 6. The Truth Table for the biconditional
p q
T TT FF TF F
TFFT
qp
Examples
ay.sunday tod isit ifonly and ifbeach the togo will we:
ay.sunday tod isit :
beach. the togo willwe:
qp
q
p
“p if and only if q”.
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 )( fca
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 qsr )(
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
x0011
y0101
0111
0001
0110
yx yx yx
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.
Table 1. Examples of a Tautologyand a Contradiction.
pTF
FT
TT
FF
p pp pp
a contradiction
a tautologyExample 1.
Logic Equivalences
Definition 2. The proposition p and q are called logically equivalent if is a tautology. The notation denotes that p and q are logically equivalent.
qp qp
• Using a truth table to determine whether two propositions are equivalent
T T T T F F F
F F T F T T F
F T F F T F T
F F F F T T T
and for esTruth tabl 2. Table
qpq p q) (pq p q p
qp
q)(p
T T T F F
T T T T F
F F F F T
T T F T T
and
for esTruth tabl 3. Table
qpqpp p q
qp
qp
Example 2 Example 3equivalent equivalent
• Some important
equivalences.
qpq)(p
laws sorgan' DeM qpq)(p
r)(q)p(r)(qp
laws tive Distribur)(q)p(r)(qp
r)q(prq)(p
laws eAssociativ )(prq)(p
pqqp
laws eCommutativ pqqp
law negtion Double pp)(
ppp
LawsIdempotent ppp
FFp
Lawsion Dominat TTp
pFp
lawIdentity pTp
Name eEquivalenc
nces. Equivalel Logica5 Table
p
p
rq
q)p(q)(p
Fpp
Tpp
anlences. Equiv
Logical UsefulSome 6 Table
Example 4
.equivalent
logically are and
that Show
qp
q)) p((p
qp
q)p(F
q)p(p)p(
q)(pp
q)p(pq))p((p
Solution
:
Example 5
. tautologya is
that Show q) (pq)(p
T
TT
)()(
)()(
)()()()(
:
qqpp
qpqp
qpqpqpqp
Solution
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.
In general, a statement involving the n variables ).,...,,p(x as denoted is ,...,, 2121 nn xxxxx
Example 1
Let P(x) denote the statement “x>3”. What are the truth values of P(4) and P(2)?
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 is the proposition “P(x) is true for all values of x
in the universe of discourse.”
)(xxP
Solution P(x): x has studied calculus.
S(x): x is in this class.
The statement can be expressed as ))()(( xpxSx
universal quantifier
true.is :Solustion xP(x)
Example 3
Express the statement “Every student in this class has studied calculus.
numbers? real ofset the
is discourse of universe the where,tion quantifica the
of ue truth val theis What ".1"number thebe Let
4 Example
xP(x)
xxp(x)
existence quantifier
The existential quantification of P(x),denoted as is the proposition “There exists an element x in the universe of discourse such that P(x) is true.”
)(xxP
".4" when instance,for - trueis 3"" since trueis )( :Solution x xxxP
false. is 4 since false is
.4321n conjunctio theas same theis :Solution
)P(xP(x)
)P()P()P()P(xP(x)
?"4 exceedingnot integers positive theof consists discourse of universe theand
"10"statement theis where, of ue truth val theis What 5 Example 2 xP(x)xP(x)
numbers? real ofset the
is discourse of universe thewhere,tion quantifica the
of ue truth val theis What ".3"statement thedenote Let
6 Example
xP(x)
xP(x)
true.is 4 since trueis
.4321n conjunctio theas same theis :Solution
)P(xP(x)
)P()P()P()P(xP(x)
Solution: Every student in your school has a computer or has a friend
who has a computer.
Solution: There is a student none of whose friends are also friends with
each other.
?"4 exceedingnot integers
positive theof consists discourse of universe theand "10"
statement theis where, of ue truth val theis What 7 Example2
x
P(x)xP(x)
school.your in
students all ofset theisy andboth x for discouse of universe the
and "friends, are and " is ,computer" a has " is where
English, into statement theTranslate
8 Example
yxF(x,y) xC(x)
F(x,y)))y(C(y)x(C(x)
school.your in students all ofset theis and for
discourse of universe theand friends are and means whereEnglish, into
statement theTranslate
9 Example
zx, y
baF(a,b)
F(y,z)))z))(yF(x,z)z(((F(x,y)yx
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.
issolution The Canada." visitedhas "statement the and
Mexico" visitedhas"statement thebe Let :
M(x)).(C(x)
xC(x)
x M(x)Solution
Example 11
Express the statement “Everyone has exactly one best friend” as a logical expression.
. issolution The
." of friendbest theis "statement thebe Let :
B(x,z))y)((zz(B(x,y)yx
xyB(x,y)Solution
Example 12
Express the statement “There is a woman who has taken a flight on every airline in the world.
ly.respectiveairlines, all and airplanes, all world,in the
woman theall of consisits and ,for discourse of universes the
where, is solutition The
."on flght is " be and " takenhas " be Let
:
aw, f
Q(f,a)f(P(w,f)aw
afQ(f,a) fwP(w,f)
Solution
Negations: the negation of quantified expressions.
.)2(
. (1)
P(x)xxP(x)
P(x)xxP(x)
Example 14
There is a student in the class who has taken a course in calculus.
Example 13
Every student in the class has taken a course in calculus.