You are on page 1of 103

Prepared By

Ramesh Rimal

5/12/2015 3:15 PM 1
 This module provides students with
an understanding of the fundamental
mathematical knowledge in the areas
of discrete mathematics to problems
in computing.

5/12/2015 3:15 PM 2
 This module aims to introduce basic ideas of
discrete mathematics such as formal
mathematical reasoning techniques, basic
counting techniques and their applications
for computing students.
 The objective is intended for students to
understand the basic theory and some
applications of discrete mathematics.
 The course gives students training in the
ability to think quantitatively and analyse
problems critically.

5/12/2015 3:15 PM 3
1. Explain at high levels concepts from discrete
mathematics.
2. Implement basic operations in discrete
mathematics.
3. Use formal mathematical reasoning
techniques and basic counting techniques.
4. Develop mathematical models through
relations, combinatorics, and functions, and
apply mathematical methods to a range of
problems in computing.
5. The combination of LOs 1-4

5/12/2015 3:15 PM 4
 Mathematical Logic
 Methods of Mathematical Proof
 Predicate Calculus
 Sets and Relations
 Cartesian Product
 Functions
 Permutations and Combinations
 Inclusion-Exclusion Principle
 Recurrence Relations
 Graph Theory.

5/12/2015 3:15 PM 5
 Learning through teaching is primarily based on
lectures.
 Learning through tutorials is primarily based on
interactive problem solving instant feedback.
 Learning through take-home assignments helps
students understand basic mathematical
concepts and techniques of discrete
mathematics, and apply mathematical methods
to some problems in computing.
 Learning through examples for applications
helps students apply discrete mathematics to
some problems in computing.
5/12/2015 3:15 PM 6
 P. Grossman, ―Discrete Mathematics for
Computing”, 2nd Edition, 2002, Macmillan

 A. Simpson, ―Discrete Mathematics by


Examples”, 2002, McGraw Hill

 Rosen KH, ―Discrete Mathematics and Its


Applications‖, 7th Edition, 2012, McGraw-Hill

5/12/2015 3:15 PM 7
 Attendance 15%
 Assignment 20%
 Class Room Participation 5%
 Presentation 10%
 Mid-Term Assessment 20%
 Final Assessment 30%
100%

5/12/2015 3:15 PM 8
 Discrete Mathematics deals with discrete
objects. Discrete objects are those objects
that can be counted and are not connected
for e.g. houses, trees, desks, integers, etc.
 So dealing with these discrete objects
requires different concepts like counting
techniques, knowledge of different discrete
structures that are needed to understand
what exactly discrete structure is like sets,
relations, graphs, etc.

5/12/2015 3:15 PM 9
 Discrete mathematics, also called finite
mathematics, is the study of mathematical
structures that are fundamentally discrete in
the sense that its objects can assume only
distinct, separate values, rather than in a
range of values.
 It is the mathematics of integers and of
collections of objects that triggers the
operation of digital computer, and is used
widely in all fields of computer science for
programming and reasoning about data
structures algorithms and complexity.

5/12/2015 3:15 PM 10
Continuous Mathematics
 It considers objects that vary continuously;
Example: analog wristwatch (separate hour,
minute, and second hands).
 From an analog watch perspective, between 1
:25 p.m. and 1 :26 p.m. there are infinitely
many possible different times as the second
hand moves around the watch face.
 Real-Number System - core of continuous
mathematics;
 Continuous mathematics --- models and tools
for analyzing real-world phenomena that
change smoothly over time. (Differential
equations etc.)

5/12/2015 3:15 PM 11
Discrete Mathematics
 It considers objects that vary in a discrete way.
Example: digital wristwatch.
 On a digital watch, there are only finitely many
possible different times between 1 :25 P.M. and
1:27 P.M. A digital watch does not show split
seconds: - no time between 1 :25:03 and 1 :25:04.
The watch moves from one time to the next.
 Integers --- core of discrete mathematics
 Discrete mathematics --- models and tools for
analyzing real-world phenomena that change
discretely over time and therefore ideal for
studying
 computer science – computers are digital! (numbers
as finite bit strings; data structures, all discrete!
Historical aside: earliest computers were
analogue.)
5/12/2015 3:15 PM 12
 Discrete mathematics deals with objects that
come in discrete bundles, e.g.,1 or 2 babies.
 In contrast, continuous mathematics deals
with objects that vary continuously, e.g.,
3.42 inches from a wall.
 Think of digital watches versus analog
watches (ones where the second hand loops
around continuously without stopping).

5/12/2015 3:15 PM 13
 It does not directly help us write programs. At
the same time, it is the mathematics underlying
almost all of computer science.
 Examples:
 Designing high-speed networks and message
routing paths.
 Finding good algorithms for sorting.
 Performing web searches.
 Analyzing algorithms for correctness and
efficiency.
 Formalizing security requirements.
 Designing cryptographic protocols.

5/12/2015 3:15 PM 14
 Logic is a basis or language for reasoning
(mathematical and automated).
 Since logic can helps us to reason the
mathematical models it needs some rules
associated with logic so that we can apply those
rules for mathematical reasoning.
 The rules of logic give precise meaning to
mathematical statements and are used to
distinguish between valid and invalid
mathematical arguments.
 There are lots of applications of logic in the field
of computer science for e.g. designing circuits,
programming, program verifications, etc.

5/12/2015 3:15 PM 15
A proposition is a declarative statement that
is either true or false but not both at a time.
 It is also known as basic building block of
logic.
 Examples:
1. 5 -3 = 2. (True), 7 + 1 = 6. (False)
2. It is hot today. (If it is hot then true)
3. Kathmandu is the capital of Nepal. (True)
All the above examples are either true or
false so they are proposition.

5/12/2015 3:15 PM 16
 Some statements that are not propositions are
What time is it?, x > 5, Come here, Who are you?, 3+ 4
The above sentences are not propositions since we
cannot say whether they are true or false.
 Propositions are denoted conventionally by using small
letters like p, q, r, s ….
 The truth value of proposition is true, denoted by T, if
it is a true proposition and false, denoted by F, if it is
a false proposition.
 Reminder: p, q ,r ,s … are not actual propositions but
they are propositional variables i.e. place holders for
propositions.
 The logic that deals with propositions is called
propositional logic or propositional calculus.

5/12/2015 3:15 PM 17
 New proposition formed by combining
existing propositions is called compound
proposition.
 Logical operators are used to construct
mathematical statements having one or more
propositions by combining the propositions.
 The truth table is used to get the
relationship between truth values of
propositions.
 Here we present the logical operators along
with their behavior in truth table:
5/12/2015 3:15 PM 18
 Let p be a proposition. The negation of p,
denoted by ¬p, is the statement
―It is not the case that p.‖
The proposition ¬p is read as ―not p‖
 Truth table

p ¬p
F T
T F

5/12/2015 3:15 PM 19
 Find the negation of the proposition ―Today
is Tuesday.‖ and express this in simple
English.
Sol.:
The negation is ―It is not the case that today
is Tuesday.‖
This negation can be more simply expressed
as ―Today is not Tuesday‖ or ―It is not
Tuesday today‖

5/12/2015 3:15 PM 20
 Find the negation of the proposition ―At least 10
inches of rain fell today in Kathmandu.‖ and
express this in simple English.
 Negation: ―It is not the case that at least 10
inches of rain fell today in Kathmandu.‖
 This negation can be more simply expressed by
―Less than 10 inches of rain fell today in
Kathmandu.‖
 Negation operator constructs a new proposition
from a single existing proposition

5/12/2015 3:15 PM 21
 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 both p and
q are true and is false otherwise.
 Truth Table

p q pq
F F F
F T F
T F F
T T T

5/12/2015 3:15 PM 22
 Find the conjunction of the propositions
―Today is Wednesday .‖ and ―It is raining
today.‖
Conjunction
Today is Wednesday and it is raining today.

This proposition is true on rainy Wednesday


and is false on any day that is not a
Wednesday and on Tuesday when it does not
rain.

5/12/2015 3:15 PM 23
 Findthe conjunction of two propositions
―Ram is intelligent‖ and ―Ram is diligent‖ .

Conjunction
Ram is intelligent and diligent.

This proposition is true only when Ram is


intelligent and he is diligent too and is
false otherwise

5/12/2015 3:15 PM 24
 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 true when at least one
of the two proposition is true and is false
otherwise.
 Truth Table

p q pq
F F F
F T T
T F T
T T T

5/12/2015 3:15 PM 25
 Find the conjunction of the propositions
―Today is Wednesday .‖ and ―It is raining
today.‖

Conjunction
Today is Wednesday or it is raining today.

This proposition is true on any day that is


either a Wednesday or a rainy day (including
rainy Wednesday ). It is only false on days
that are not Wednesdays when it also does
not rain.
5/12/2015 3:15 PM 26
 Findthe disjunction of two propositions
―Ram is intelligent‖ and ―Ram is diligent‖ .

Disjunction
Ram is intelligent or he is diligent.

This proposition is true only when Ram is


not intelligent and he is not diligent too
and is false otherwise

5/12/2015 3:15 PM 27
 Let p and q be propositions. The exclusive or
of p and q, denoted by pq, is the
proposition ―p or q (but not both)‖.
 The exclusive or pq is true when one of p
and q is true and is false otherwise.
 Truth Table

p q pq
F F F
F T T
T F T
T T F

5/12/2015 3:15 PM 28
 Findthe exclusive or of the propositions
―Ram drinks coffee in the morning‖ and
―Ram drinks tea in the morning‖.

Exclusive-Or
Ram drinks coffee or tea in the morning.

5/12/2015 3:15 PM 29
 Let p and q be propositions. The conditional
statement pq is the proposition ―if p, then
q.‖
 In the conditional statement pq, p is called
the hypothesis or antecedent or premise and
q is called the conclusion or consequence.
 A conditional statement is also called
implication.
 We come across the implication in many
places in mathematical reasoning and we use
different terminologies to express pq like:
5/12/2015 3:15 PM 30
“if p, then q” “a necessary “a sufficient
condition for p is condition for p is
q” q”
―if p, q‖ ―q unless p‖ ―q is necessary for p‖
―p is sufficient for q‖ ―p implies q‖ q follows from p
―q if p‖ ―p only if q‖
―q when p‖ ―q whenever p‖

5/12/2015 3:15 PM 31
 Truth Table
p q pq
F F T
F T T
T F F
T T T

 If I am elected, then I will lower taxes.


 Let ―You study Computer Science.‖ and ―You
will find a good job.‖ be proposition. Then
―If you study Computer Science then you will
find a good job.‖
5/12/2015 3:15 PM 32
 We can form some new conditional
statements starting with a conditional
statement pq.
 The proposition qp is called the converse
of pq.
 The proposition q  p is called the
contrapositive of pq.
 The proposition p  q is called the
inverse of pq.
 When two compound propositions always
have the same truth value we call them
equivalent.
5/12/2015 3:15 PM 33
A conditional statement and its contrapositive
are equivalent.
 The converse and the inverse of a conditional
statement are also equivalent but neither is
equivalent to the original conditional
statement.

5/12/2015 3:15 PM 34
 What are the converse, the contrapositive
and the inverse of the conditional statement
―The home team wins whenever it is
raining.‖
Ans. The given conditional statement can be
rewritten as ―If it is raining, then the home
team wins.‖
Converse: If the home team wins then it is raining.

Contrapositive: ―If the home team does not win,


then it is not raining.‖
Inverse: ―If it is not raining, then the home team
does not win.‖
5/12/2015 3:15 PM 35
 Let p and q be propositions. The
biconditional statement pq is the
proposition ―p if and only if q.‖It is also
known as bi-implications.
 The biconditional statement pq is true
when p and q have the same truth values,
and is false otherwise.
p q pq
F F T
F T F
T F F
T T T

5/12/2015 3:15 PM 36
 In other words the statement pq is true
when both the conditional statements pq
and qp are true and is false otherwise.
 There are some other common ways to
express pq:
―p is necessary and sufficient for q‖
―if p then q, and conversly‖
―p iff q‖
 pq has exactly the same truth value as
(pq)(qp). (verify)

5/12/2015 3:15 PM 37
 Find the biconditional statement of the
propositions p and q where p is the proposition
―You can take the flight.‖ and q is the
proposition ―You buy a ticket.‖
Biconditional statement(pq): You can take the
flight if and only if you buy a ticket.
Explanation: This statement is true if p and q are
either both true or both false, that is, if you buy
a ticket and can take the flight or if you do not
buy a ticket and you cannot take the flight. It is
false when p and q have opposite truth values,
that is, when you do not buy a ticket, but you
can take the flight (such as when you get a free
trip) and when you buy a ticket and cannot take
the flight (such as when the airline bumps you).
5/12/2015 3:15 PM 38
 Constructthe truth table of the compound
proposition (p¬q)(pq).

p q ¬q p¬q pq (p¬q)(pq)


F F T T F F
F T F F F T
T F T T F F
T T F T T T

5/12/2015 3:15 PM 39
 We generally use parentheses to specify the
order in which logical operators in a
compound proposition are to be applied.
 For example (pq)(r) is the conjunction of
pq and r. However, to reduce the number
of parentheses, we specify that the negation
operator is applied before all other logical
operators. This means that pq is the
conjunction of p and q, namely p  q, not
the negation of the conjunction of p and q,
namely (p  q).
 The conjunction operator takes precedence
over the disjunction operator, so that pqr
means (pq)r rather than p(qr).
5/12/2015 3:15 PM 40
 Theconditional and biconditional operators
have lower precedence than the conjunction
and disjunction operators.

Operators Precedence
 1
 2
 3
 4
 5

5/12/2015 3:15 PM 41
 Why should English sentences be translated
into expressions involving propositional
variables and logical connectives?
 English and any other human language is
often ambiguous. Translating sentences
into compound statements removes
ambiguity.
 translated sentences i.e. logical
expressions can be analyzed to determine
their truth values, we can manipulate
them and we can use rules of inference to
reason about them.

5/12/2015 3:15 PM 42
 Translatethe following English sentence into
logical expression.
―You can access the Internet from campus
only if you are a computer science major or
you are not a freshman.‖
Ans. Let p, q and r represent ―You can access
the Internet from campus‖, ―You are a
computer science major‖ and ―You are a
freshman.‖ respectively.

p(qr)

5/12/2015 3:15 PM 43
 Translate the following sentence into logical
expression.
―You cannot ride the roller coaster if you are
under 4 feet tall unless you are older than 16
years old.‖
Ans. Let p, q and r represent ―You can ride the
roller coaster‖, ―You are under 4 feet tall‖
and ―you are older than 16 years old‖
respectively.

(qr)p
5/12/2015 3:15 PM 44
 Logical connectives are used extensively in
searches of large collection of information,
such as indexes of web pages.
 Since these searches employ techniques from
propositional logic, they are called Boolean
Searches.
 In Boolean searches, the connective AND is
used to match records that contain both of
two search terms, the connective OR is used
to match one or both of two search terms,
and connective NOT is used to exclude a
particular search term.
5/12/2015 3:15 PM 45
 Two propositions having different syntax may
have same semantics. If two propositions are
semantically identical then we say those two
propositions are ―equivalent‖.
 Such constructs are very useful in
mathematical reasoning where we can
substitute given propositions by equivalent
propositions to construct mathematical
arguments.

5/12/2015 3:15 PM 46
A compound proposition that is always true,
no matter what the truth values of the
atomic propositions that occur in it, is called
a tautology. For e.g. pp is always true
 Verification:

p p pp
F T T
T F T

5/12/2015 3:15 PM 47
A compound proposition that is always false,
no matter what the truth values of the
atomic propositions occur in it, is called
contradiction. For e.g. pp is always false.
 Verification:

p p pp
F T F
T F F

A compound proposition that is neither a


tautology nor a contradiction is called a
contingency.

5/12/2015 3:15 PM 48
 Compound propositions that have the same
truth values for all possible cases are called
logically equivalent.
 It can also be defined as ―The compound
propositions p and q are logically equivalent,
if proposition p  q is a tautology.‖
 The notation pq or pq denotes that p and
q are logically equivalent.

5/12/2015 3:15 PM 49
 Show that pq and ¬pq are logically
equivalent.

p q pq ¬p ¬pq
F F T T T
F T T T T
T F F F F
T T T F T

5/12/2015 3:15 PM 50
S.N. Equivalences Name

1 pFp Identity Laws


pTp

2 p  ¬p  T Negation Laws
p  ¬p  F (Trivial tautology)

3 ppp Idempotent Laws


ppp

4 pTT Domination laws


pFF

5 p  (p  q)  p Absorption Laws
p  (p  q)  p

5/12/2015 3:15 PM 51
S. N. Equivalences Name

6 pqqp Commutative Laws


Pqqp

7 (p  q)  r  p  (q  r) Associative Laws
(p  q)  r  p  (q  r)

8 p  (q  r)  (p  q)  (p  r) Distributive Laws
p  (q  r)  (p  q)  (p  r)

9 ¬(¬p)  p Double Negation Laws

10 ¬ (p  q)  ¬p  ¬q De Morgan‘s Laws
¬ (p  q)  ¬p  ¬q

5/12/2015 3:15 PM 52
Logical equivalences involving Logical equivalences involving
conditional statements biconditionals

p  q  ¬p  q p  q  (p  q)  (q  p)
p  q  ¬q  ¬p p  q  (p  q)  (¬ p  ¬ q)
qp¬p ¬q
pq¬pq pq¬p¬q
p  q  ¬ (q  ¬p) ¬ (p  q)  p  ¬ q
¬(p  q)  p  ¬ q
(p  q)  (p  r)  p  (q  r)
Verify all these
(p  q)  (p  r)  p  (q  r) equivalences using
(p  r)  (q  r)  (p  q) r truth table.

(p  r)  (q  r)  (p  q) r

5/12/2015 3:15 PM 53
 Show that ¬(p (¬ p  q)) and ¬ p  ¬ q are
logically equivalent using logical equivalences.

¬(p (¬ p  q))  ¬p  ¬(¬p  q) [De Morgan Law]


 ¬ p  (¬(¬p)  ¬q) [De Morgan Law]
 ¬ p  (p  ¬q) [Double Negation]
 (¬p  p) (¬p  ¬q) [Distributive Law]
 F (¬p  ¬q) [Negation Law]
 (¬p  ¬q)  F [Commutative Law]
 (¬p  ¬q) [Identity Law]
Hence, ¬(p (¬ p  q)) and ¬ p  ¬ q are logically
equivalent

5/12/2015 3:15 PM 54
 Show that (p  q)  (p  q) is a tautology.
(p  q)  (p  q)
 ¬(p  q)  (p  q) [p  q  ¬p  q]
 (¬ p  ¬ q)  (p  q) [De Morgan law]
 (¬ p  p)  (¬ q  q) [Commutative law]
TT [Negation Law]
T [Domination Law]

5/12/2015 3:15 PM 55
 The dual of a compound proposition that
contains only the propositional variables and
logical operators such as negation(),
disjunction(), conjunction(), and the
constants T and F is the compound proposition
obtained by replacing
1. Each T with F and each F with T
2. Each  with  and each  with 
 The dual of s is denoted by s*.
 Ex: The dual of ―(p  q)  (q  p)‖ is ―(p  q) 
(q  p)‖.
The dual of ―p  T‖ is ―p  F‖.

5/12/2015 3:15 PM 56
 The dual is important because of the following
property. If we have two logically equivalent
compound propositions (say p and q) then the duals of
the two propositions are logically equivalent as well.
That is, if p  q then p*  q*.
 Ex: We know that p  T  T. So p  F  F.
 In fact, if we look back at our table of logical
equivalences, we will find that (with the exception of
double negation) they come in pairs. And if we take
one of the equivalences from a pair, we find that it is
the dual of the other equivalence from the pair. The
example above illustrates this for the domination
laws.
 Taking the dual of both sides of a logical equivalence
allows us to generate another logical equivalence.
This is a useful technique.

5/12/2015 3:15 PM 57
 A predicate is a statement that may be true or
false depending on the values of its variables.
 Propositional logic cannot adequately express
the meaning of all statements in mathematics
and in natural language.
 The area of logic that deals with predicates and
quantifiers is called the predicate calculus.
 Let us consider a statement ―x > 3‖. Is this
statement a proposition?
 NO
 When a statement has variable(s) in it cannot be
termed as proposition.
 Can we make such statement proposition??
 Yes
5/12/2015 3:15 PM 58
 The statement ―x is greater than 3‖ has two
parts. The first part, the variable x, is the
subject of the statement. The second part—the
predicate, ―is greater than 3‖—refers to a
property that the subject of the statement can
have.
 We can denote the statement ―x is greater than
3‖ by P(x), where P denotes the predicate ―is
greater than 3‖ and x is the variable.
 The statement P(x) is also said to be the value of
the propositional function P at x.
 Once a value has been assigned to the variable
x, the statement P(x) becomes a proposition and
has a truth value.

5/12/2015 3:15 PM 59
 LetP(x) denote the statement ―x > 3.‖ What
are the truth values of P(4) and P(2)?

We obtain the statement P(4) by


setting x = 4 in the statement ―x > 3.‖

Hence, P(4), which is the statement ―4


> 3,‖ is true.

However, P(2), which is the statement


―2 > 3,‖ is false.

5/12/2015 3:15 PM 60
 We can also have statements that involve
more than one variable.
 For example, consider the statement ―x = y +
3.‖ We can denote this statement by Q(x, y),
where x and y are variables and Q is the
predicate.
 When values are assigned to the variables x
and y, the statement Q(x, y) has a truth
value.

5/12/2015 3:15 PM 61
 LetQ(x, y) denote the statement ―x = y + 3.‖
What are the truth values of the propositions
Q(1, 2) and Q(3, 0)?
Solution: To obtain Q(1, 2), set x = 1
and y = 2 in the statement Q(x, y).
Hence, Q(1, 2) is the statement ―1 =
2 + 3,‖ which is false.
The statement Q(3, 0) is the
proposition ―3 = 0 + 3,‖ which is
true.

5/12/2015 3:15 PM 62
 let R(x, y, z) denote the statement ―x + y = z.‖
What are the truth values of the propositions R(1, 2,
3) and R(0, 0, 1)?

The proposition R(1, 2, 3) is obtained by setting x = 1, y = 2, and z = 3


in the statement R(x, y, z).
We see that R(1, 2, 3) is the statement ―1 + 2 = 3,‖ which is true.
Also note that R(0, 0, 1), which is the statement ―0 + 0 = 1,‖ is false.

 In general, a statement involving the n variables x1,


x2, . . . , xn can be denoted by P(x1, x2, . . . , xn).
 A statement of the form P(x1, x2, . . . , xn) is the
value of the propositional function P at the n-tuple
(x1, x2, . . . , xn), and P is also called an n-place
predicate or a n-ary predicate.
5/12/2015 3:15 PM 63
 Quantifier is a tool to create a proposition from
a propositional function.
 The process of creating a proposition from a
proposition using quantifier is called
quantification.
 Quantification expresses the extent to which a
predicate is true over a range of elements.
 In English, the words all, some, many, none, and
few are used in quantifications.
 The variables that appear in the statement can
take different possible values and all the
possible values that the variable can take from a
domain called ―Universe of Discourse‖ or
―Universal set‖.
 We will focus on two types of quantifier:
Universal quantifier and Existential quantifier.
5/12/2015 3:15 PM 64
 Universal quantifier, denoted by , is used
for universal quantification.
 The universal quantification of P(x) for a
particular domain is the proposition that
asserts that P(x) is true for all values of x in
this domain.
 The notation xP(x) denotes the universal
quantification of P(x) where  is called the
universal quantifier. We read xP(x) as ―for
all xP(x)‖ or ―for every xP(x).‖

5/12/2015 3:15 PM 65
 An element for which P(x) is false is called a
counterexample of xP(x).
 When all the elements in the domain can be
listed—say, x1, x2, . . ., xn—it follows that
the universal quantification xP(x) is the
same as the conjunction
P(x1)  P(x2)  · · ·  P(xn),
because this conjunction is true if and only if
P(x1), P(x2), . . . , P(xn) are all true.

5/12/2015 3:15 PM 66
 LetP(x) be the statement ―x + 1 > x.‖ What
is the truth value of the quantification
xP(x),where the domain consists of all real
numbers?

Because P(x) is true for all real


numbers x, the quantification
xP(x) is true.

5/12/2015 3:15 PM 67
 LetQ(x) be the statement ―x < 2.‖ What is
the truth value of the quantification xQ(x),
where the domain consists of all real
numbers?

Q(x) is not true for every real


number x, because, for instance,
Q(3) is false. That is, x = 3 is a
counterexample for the statement
xQ(x). Thus xQ(x) is false.

5/12/2015 3:15 PM 68
 What is the truth value of xP(x), where P(x)
is the statement ―x2 < 10‖ and the domain
consists of the positive integers not
exceeding 4?

The statement xP(x) is the same as


the conjunction P(1)  P(2)  P(3) 
P(4),because the domain consists of
the integers 1, 2, 3, and 4. Because
P(4), which is the statement ―42 < 10,‖
is false, it follows that xP(x) is false.
5/12/2015 3:15 PM 69
 What is the truth value of x(x2  x) if the
domain consists of all real numbers? What is
the truth value of this statement if the
domain consists of all integers?
 Solution:

False for real numbers


and true for integer
domain.

5/12/2015 3:15 PM 70
 Many mathematical statements assert that
there is an element with a certain property.
Such statements are expressed using
existential quantification.
 With existential quantification, we form a
proposition that is true if and only if P(x) is
true for at least one value of x in the
domain.
 A tool used for existential quantification is
called existential quantifier. The symbol  is
used as existential quantifier that represents
existential quantification.
5/12/2015 3:15 PM 71
 The existential quantification of P(x) is the
proposition ―There exists an element x in the
domain such that P(x).‖
 We use the notation xP(x) for the existential
quantification of P(x).
 A domain must always be specified when a
statement xP(x) is used. Furthermore, the
meaning of xP(x) changes when the domain
changes. Without specifying the domain, the
statement xP(x) has no meaning.

5/12/2015 3:15 PM 72
 Besidesthe phrase ―there exists‖ we can also
express existential quantification in many
other ways, such as by using the words ―for
some‖ ―for at least one‖ or ―there is‖ The
existential quantification xP(x) is read as
―There is an x such that P(x),‖ or
―There is at least one x such that P(x),‖ or
―For some xP(x).‖

5/12/2015 3:15 PM 73
 Let P(x) denote the statement ―x > 3.‖ What
is the truth value of the quantification
xP(x), where the domain consists of all real
numbers?
 Solution:

Because ―x > 3‖ is sometimes true—for


instance, when x = 4—the existential
quantification of P(x), which is xP(x), is
true.

5/12/2015 3:15 PM 74
 Let Q(x) denote the statement ―x = x +
1.‖What is the truth value of the
quantification xQ(x),where the domain
consists of all real numbers?
 Solution:

Because Q(x) is false for every real


number x, the existential
quantification of Q(x), which is
xQ(x), is false.

5/12/2015 3:15 PM 75
 Generally, an implicit assumption is made that
all domains of discourse for quantifiers are
nonempty. If the domain is empty, then xQ(x) is
false whenever Q(x) is a propositional function
because when the domain is empty, there can be
no element x in the domain for which Q(x) is
true.
 The existential quantification is the disjunction
of all the propositions that are obtained by
assigning the values of the variable from the
universe of discourse.
 When all elements in the domain can be listed—
say, x1, x2, . . . , xn—the existential
quantification xP(x) is the same as the
disjunction P(x1)  P(x2)  · · ·  P(xn), because
this disjunction is true if and only if at least one
of P(x1), P(x2), . . . , P(xn) is true.
5/12/2015 3:15 PM 76
 What is the truth value of xP(x), where P(x)
is the statement ―x2 > 10‖ and the universe
of discourse consists of the positive integers
not exceeding 4?

Because the domain is {1, 2, 3, 4}, the


proposition 1xP(x) is the same as the
disjunction P(1)  P(2)  P(3)  P(4).
Because P(4), which is the statement ―42
> 10,‖ is true, it follows that xP(x) is
true.

5/12/2015 3:15 PM 77
 The quantifiers  and  have higher
precedence than all logical operators from
propositional calculus.
 For example, xP(x) Q(x) is the disjunction
of xP(x) and Q(x). In other words, it means
(xP(x))  Q(x) rather than x(P (x)  Q(x)).

5/12/2015 3:15 PM 78
 When the variable is assigned a value or it is
quantified it is called bound variable.
 If the variable is not bounded then it is
called free variable.
 A part of a logical expression that is
quantified is given by the scope of the
quantifier.
 All the variables that occur in a propositional
function must be bound or set equal to a
particular value to turn it into a proposition.
 This can be done using a combination of
universal quantifiers, existential quantifiers,
and value assignments.
5/12/2015 3:15 PM 79
 The part of a logical expression to which a
quantifier is applied is called the scope of this
quantifier.
 Consequently, a variable is free if it is outside
the scope of all quantifiers in the formula that
specify this variable.
 In the statement x(x + y = 1), the variable x is
bound by the existential quantification x, but
the variable y is free because it is not bound by
a quantifier and no value is assigned to this
variable. This illustrates that in the statement
x(x + y = 1), x is bound, but y is free.

5/12/2015 3:15 PM 80
 In the statement x(P(x)  Q(x))  xR(x), all
variables are bound.
 The scope of the first quantifier, x, is the
expression P(x)  Q(x) because x is applied only
to P(x)  Q(x), and not to the rest of the
statement.
 Similarly, the scope of the second quantifier, x,
is the expression R(x).
 We can write statement using two different
variables x and y, as x(P(x)  Q(x))  yR(y),
because the scopes of the two quantifiers do not
overlap.
 Expression with no free variable is a proposition.
 Expression with at least one free variable is a
predicate only.

5/12/2015 3:15 PM 81
 Let L(x,y) denotes x loves y where universe
of discourse for x, y is set of all people in the
world. Translate xyL(x,y), yxL(x,y),
xyL(x,y), yxL(x,y), xyL(x,y) and
xyL(x,y) into English.
 Solution:
 xyL(x,y): For all x there is some y such
that x loves y i.e. everybody loves someone.
This is false when there is someone who
doesn‘t love any one.

5/12/2015 3:15 PM 82
 yxL(x,y): For some y all x love y i.e. there
is a people who is loved by everyone. This is
false when there is no person who is loved.
 xyL(x,y): There is some x such that x
loves all y i.e. there is someone who loves all
the people. This is false when all people do
not love some people.
 yxL(x,y): For all y there is x who loves y
i.e. everyone has someone who loves them.
When this is false? (try yourself)

5/12/2015 3:15 PM 83
 xyL(x,y): For all x, x loves all the y i.e.
everybody loves everyone. When this is false?
(try yourself)
 xyL(x,y): There is some x such that he
loves some y i.e. someone loves somebody.
When this is false? (try yourself)

5/12/2015 3:15 PM 84
 ―Every student in your class has taken a course
in calculus.‖
 This statement is a universal quantification,
namely,
xP(x), where P(x) is the statement ―x has taken
a course in calculus‖ and the domain consists of
the students in your class.
 The negation of this statement is ―It is not the
case that every student in your class has taken a
course in calculus.‖
 This is equivalent to ―There is a student in your
class who has not taken a course in calculus.‖
And this is simply the existential quantification
of the negation of the original propositional
function, namely, x ¬P(x).
5/12/2015 3:15 PM 85
 Let P(x) denotes x is lovely, universe of
discourse for x is girls in Kathmandu.
 Then, x P(x) is every girl in Kathmandu is
lovely. If we want to negate it the meaning
would be like there is a girl in Kathmandu
who is not lovely i.e. x¬P(x).
 xP(x) is at least a girl in Kathmandu is
lovely. The opposite for this would be no girls
in Kathmandu are lovely. i.e. x¬P(x).

5/12/2015 3:15 PM 86
 Statements involving predicates and quantifiers are
logically equivalent if and only if they have the same
truth value no matter which predicates are
substituted into these statements and which domain
of discourse is used for the variables in these
propositional functions.
 x(P (x)  Q(x))  xP (x)  xQ(x)
Proof:
 Suppose that x(P (x)  Q(x)) is true. This means that
if ‗a‘ is in the domain, then P(a)  Q(a) is true.
Hence, P(a) is true and Q(a) is true. Because P(a) is
true and Q(a) is true for every element in the domain,
we can conclude that xP(x) and xQ(x) are both
true. This means that xP(x)  xQ(x) is true.

5/12/2015 3:15 PM 87
 Suppose that xP (x)  xQ(x) is true. It
follows that xP(x) is true and xQ(x) is
true. Hence, if ‗a‘ is in the domain, then P(a)
is true and Q(a) is true [because P(x) and
Q(x) are both true for all elements in the
domain, there is no conflict using the same
value of a here].
 It follows that for all a, P(a)  Q(a) is true. It
follows that x(P (x)  Q(x)) is true.
 We can now conclude that
x(P (x)  Q(x))  xP (x)  xQ(x)
5/12/2015 3:15 PM 88
 ¬xQ(x)  x ¬Q(x)
 Proof:
 ¬xQ(x) is true if and only if xQ(x) is false. This is
true if and only if no x exists in the domain for which
Q(x) is true.
 Next, note that no x exists in the domain for which
Q(x) is true if and only if Q(x) is false for every x in
the domain.
 Finally, note that Q(x) is false for every x in the
domain if and only if ¬Q(x) is true for all x in the
domain, which holds if and only if x¬Q(x) is true.
Putting these steps together, we see that ¬xQ(x) is
true if and only if x¬Q(x) is true.
 We conclude that ¬xQ(x) and x ¬Q(x) are logically
equivalent.

5/12/2015 3:15 PM 89
Negation Equivalent When Is When False?
Statement Negation True?

¬xP(x) x¬P(x) For every x, There is an x for


P(x) is false. which
P(x) is true.

¬xP(x) x¬P(x) There is an x P(x) is true for


for which P(x) every x.
is false.

5/12/2015 3:15 PM 90
 What are the negations of the statements ―There is an
honest politician‖ and ―All Americans eat
cheeseburgers‖?
 Let H(x) denote ―x is honest.‖ Then the statement
―There is an honest politician‖ is represented by
xH(x), where the domain consists of all politicians.
 The negation of this statement is ¬xH(x), which is
equivalent to x¬H(x). This negation can be expressed
as ―Every politician is dishonest.‖
 [Note: In English, the statement ―All politicians are not
honest‖ is ambiguous. In common usage, this
statement often means ―Not all politicians are
honest.‖Consequently, we do not use this statement to
express this negation.]
5/12/2015 3:15 PM 91
 Let C(x) denote ―x eats cheeseburgers.‖
Then the statement ―All Americans eat
cheeseburgers‖ is represented by xC(x),
where the domain consists of all Americans.
 The negation of this statement is ¬xC(x),
which is equivalent to x¬C(x).
 This negation can be expressed in several
different ways, including ―Some American
does not eat cheeseburgers‖ and ―There is
an American who does not eat
cheeseburgers.‖

5/12/2015 3:15 PM 92
 Example1:
Translate ―not every integer is even‖ where the
universe of discourse is set of integers.
 Solution:
Let E(x) denotes x is even. ¬xE(x)

 Example2:
Translate ―if a person is female and is a parent, then
this person is someone‘s mother‖ into logical
expression, Universe of discourse is set of all people.
 Solution:
Let F(x) denotes x is female, P(x) denotes x is a
parent and M(x,y) denotes x is a mother of y. then
the logical expression for above sentence is xy
(F(x)  P(x)  M(x,y))
5/12/2015 3:15 PM 93
 LetP(x) denote the statement ―x  4.‖ What
are these truth values?
a) P(0) b) P(4) c) P(6)

a. T b. T c. F

5/12/2015 3:15 PM 94
 LetQ(x, y) denote the statement ―x is the
capital of y.‖ What are these truth values?
a) Q(Kathmandu, Nepal)
b) Q(Delhi, India)
c) Q(New York, America)
d) Q(Thimpu, Bhutan)

a. T b. T c. F d. T

5/12/2015 3:15 PM 95
 Let P(x) be the statement ―x spends more
than five hours every weekday in class,‖
where the domain for x consists of all
students. Express each of these
quantifications in English.
a) xP(x) b) xP(x)
c) x ¬P(x) d) x ¬P(x)
a There is a student who spends more than 5 hours every
weekday in class.
b Every student spends more than 5 hours every weekday in
class.
c There is a student who does not spend more than 5 hours
every weekday in class.
d No student spends more than 5 hours every weekday in
class.
5/12/2015 3:15 PM 96
 Let P(x) be the statement ―x = x2.‖ If the
domain consists of the integers, what are
these truth values?
a) P(0) b) P(1) c) P(2)
d) P(−1) e) xP(x) f) xP(x)

a. T d. F
b. T e. T
c. F f. F

5/12/2015 3:15 PM 97
 Suppose that the domain of the propositional
function P(x) consists of the integers 0, 1, 2, 3,
and 4. Write out each of these propositions using
disjunctions, conjunctions, and negations.
a) xP(x) b) xP(x) c) x¬P(x)
d) x¬P(x) e) ¬xP(x) f) ¬xP(x)

a. P(0)  P(1)  P(2)  P(3)  P(4)


b. P(0)  P(1)  P(2)  P(3)  P(4)
c. ¬P(0)  ¬P(1)  ¬P(2)  ¬P(3)  ¬P(4)
d. ¬P(0)  ¬P(1)  ¬P(2)  ¬P(3)  ¬P(4)
e. ¬(P(0)  P(1)  P(2)  P(3)  P(4))
f. ¬(P(0)  P(1)  P(2)  P(3)  P(4))

5/12/2015 3:15 PM 98
 Two quantifiers are nested if one is within
the scope of the other.
 Example: xy(x+y=0)
 Everything within the scope of a quantifier
can be thought of as a propositional
function.
 For example, xy(x+y=0) is the same thing
as xQ(x), where Q(x) is yP(x,y), where
P(x,y) is x+y=0.

5/12/2015 3:15 PM 99
 Translate the following statement into English.
x y (x + y = y + x)
Domain: real numbers
 Solution:
For all real numbers x and y, x + y = y + x

 Translate the following statement into English.


x y (x = - y) Domain: real numbers
 Solution:
For every real number x, there is a real number
y such that x = -y.
5/12/2015 3:15 PM 100
 Translate the following statement into
English.
x y ((x > 0)  (y < 0)  (xy < 0))
Domain: real numbers
Solution:
 For every real number x and for every real
number y, if x > 0 and y < 0, then xy < 0.
 For real numbers x and y, if x is positive and
y is negative, then xy is negative.
 ―The product of a positive real number and a
negative real number is always a negative
real number.‖
5/12/2015 3:15 PM 101
 The order of nested universal quantifiers in a
statement without other quantifiers can be
changed without changing the meaning of
the quantified statement.
 The order of nested Existential quantifiers in
a statement without other quantifiers can be
changed without changing the meaning of
the quantified statement.

5/12/2015 3:15 PM 102


 Let P(x, y) be the statement ―x + y = y + x.‖
What are the truth values of the
quantifications xyP(x, y) and yxP(x, y)
where the domain for all variables consists of
all real numbers?

5/12/2015 3:15 PM 103

You might also like