Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 24

DISCRETE MATHEMATICS AND ITS APPLIACTIONS

By the end of the lecture (i) you should be familiar with the following terms:
• Proposition
• Truth value
• Propositional calculus/propositional logic
• Negation, conjunction, disjunction
• Compound proposition
• Exclusive or, inclusive or
• Implications
• Converse, contrapositive, inverse

(ii) be able to
• Translate English sentences into expressions involving propositional variables and
logical connectives

Section 1.1 Text

Text: Discrete Mathematics and its Applications, Kenneth Rosen, Mc Graw Hill,
fifth ed., 2003
Lecture 1

Formal logic

The rules of logic give precise meaning to mathematical statements. The rules are used to
distinguish between valid and invalid mathematical statements.

Logic is the basis of all mathematical reasoning. It has practical application in the design
of computing macnines, artificial intelligence, programming languages and many other
areas in computer science.

Propositions

Let us begin with the building blocks of logic – propositions. A proposition is a statement
that is either true or false, but not both.

Example: The following are propositions:


5 + 5 = 10 true
1+6=2 false
Owen Arthur is the Prime Minister of Barbados true

The following are NOT propositions since their truth value cannot be established:
r+s=t
x+5=7
Letters are used to denote propositions. (eg. p or q). For example the propositions above
could have been written as
p: 5 + 5 = 10
q: 1 + 6 = 2
r: Owen Arthur is the Prime Minister of Barbados

The truth value of a proposition is true, denoted by T, if it is a true proposition, and false
F, if it is a false proposition.

The area of logic which deals with propositions is called propositional calculus or
propositional logic.

Def: Let p be a proposition. The negation of p, denoted by ~p, is the proposition “it is
not the case that p”

Compound propositions are formed from existing propositions using logical operators
called connectives. Some of these connective are the conjunction (AND denoted ∧),
the disjunction (OR denoted ∨), implication (denoted →),the equivalence ( ↔ ) and
the exclusive-or (denoted ¿).
Def: 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.

Def: 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. This is often referred to a the
inclusive or.

Example: Let p be the proposition “Today is Monday” and q the proposition “It is
the first Discrete Math class”.
Find the negation of p, the conjunction of p and q and the disjunction of p and q
as expressed in English?

Solution: 5p : Today is not Monday


p ∧q : Today is Monday and it is the Discrete Math class
p ∨q : Today is Monday or it is the Discrete Math class

Def: Let p and q be propositions. The exclusive or of p and q, denoted by p¿q is the
proposition that is true when exactly one of p and q is true and is false
otherwise.

Eg Martha was born in Barbados or Antigua.


Lecture 2
By the end of the lecture
(i) you should be familiar with the following terms:
• Implications
• Converse, contrapositive, inverse
• Tautology, contradiction, contingency
• Logical equivalence

(ii) be able to
• Translate English sentences into expressions involving propositional variables and
logical connectives
• Show that two propositions are logically equivalent using truth tables or a series
of logically equivalent statements

Section 1.1 & 1.2


Def: 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 is true otherwise. p is called the
hypothesis and q is called the conclusion.

The implications p → q can be expressed in a variety of ways. Some of these are:

“if p, then q” “p is sufficient for q”


“p implies q” “q whenever p”
“p only if q” “q is necessary for p”

eg. Let p: I am elected to office and q: I will lower the amenities fees. The implication p
→ q reads: If I am elected to office then I will lower the amenities fees.

The only case when I would have broken my promise is the case when I am elected to
office and did not lower the amenities fees.
If I am not elected to office (~p) you cannot expect me to lower the amenities fees. I
would not have broken my pledge in such a case.

Note that p → q is false only in the case where p is true and q is false.

A truth table displays the relationships between the truth values of propositions.
conjunction

Disjunction

Implication

Equivalence

Negation

Exclusive OR

p q p ∧q p ∨q p →q p↔q 5p P¿q

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

NB
p ↔ q True when p and q have the same truth values
p¿q True when p or q is true, but not both.
We can form or build new compound propositions using the connectives we have just
seen.

Example: (p ∧q) ∧(5r) where p, q and r are all propositions

Converse contrapositive and inverse

We can form additional propositions from this implication:


• The proposition q→ p is called the converse of p → q.
• The proposition 5q→ 5p is called the contrapositive of p → q.
• The proposition 5p→ 5q is called the inverse of p → q

Example: Find the converse, contrapositive and inverse of the implication:


“If it is raining, then there are dark clouds in the sky”

Solution:
Converse: “If there are dark clouds in the sky, then it is raining”

Contrapositive: “If there are no dark clouds in the sky, then it is not raining”

Inverse: If it is not raining then there are no dark clouds in the sky.

Def: 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.

Some terminology used :


p if and only if q
p I necessary and sufficient for q
if p then q and conversely
p if q

Precedence of logical Operators


Read text

Translating English sentences


Translating sentences into logical expressions removes the ambiguities of the English
language and facilitates their analysis and the application of the rules of inference.
Example: Translate the following English sentence into a logical expressions.
You can access the internet from campus only if you are a Computer
Science major or you are not a freshman.

Sol: Let a: You can access the internet from campus


c: You are a Computer Science major
f: you are a freshman.

Noting that “only if” is one way an implication can be expressed the sentence can be
expressed as
if you can access the internet from campus then you are a Computer
Science major or you are not a freshman

which gives a → (c ∨ 5f).

Propositional Equivalence
Sometime it is necessary, in a mathematical argument to replace one statement with a
statement with the same truth value

Def
A compound proposition that is always true, no matter what the truth values of the
propositions that occur in it, is called a tautology. A compound proposition that is always
false is called a contradiction. Finally, a proposition that is neither a tautology nor a
contradiction is called a contingency.

Example:

p p p ∨p p ∧5p

T F T F
F T T F

From the above table we see that


p ∨p is a tautology
p ∧5p is a contradiction

Logical Equivalence
Compound propositions that have the same truth values in all possible cases are called
logically equivalent.
Definition

The propositions 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.

Example: Show that  (p ∨ q) and


p ∧q are logically equivalent.

Solution: The solution given using a truth table below. Since the truth values of the
propositions  (p ∨ q) and p ∧q are the same in all possible combination of truth
values of p and q, it follows that these propositions are logically equivalent.

p q p∨q  (p ∨ q) p q p

q

T T T F F F F

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

Note: It can easily be shown that that  (p ∨ q) ↔ (p ∧q) is a tautology.


Equivalence Name

p ∧T ⇔ p
p ∨F ⇔ p Identity laws

p ∨T ⇔ T
p ∧F ⇔ F Domination laws

p ∨p ⇔ p
p ∧p ⇔ p Idempotent laws

¬ (¬ p ) ⇔ p Double negation law

p ∨q ⇔ q ∨ p
p ∧q ⇔ q ∧p Commutative laws

1. (p ∨q) ∨r ⇔ p ∨(q ∨r ) Associative laws


2. (p ∧q) ∧r ⇔ p ∧(q ∧r )

1. p ∨ (q ∧r) ⇔ ( p ∨ q) ∧( p ∨r )
Distributive laws
p ∧ (q ∨r) ⇔ ( p ∧q) ∨( p ∧r )

1. ¬ (p ∧q) ⇔ ¬ p ∨¬ q De Morgan’s laws

2. ¬ (p ∨q) ⇔ ¬ p ∧¬ q

p ∨¬ p ⇔ T Complement property
p ∧¬ p ⇔ F

(p → q) ⇔ (¬ p ∨q) Implication

(p → q) ⇔ (¬ q → ¬ p) Contraposition
We can use a truth table to show that compound propositions are logically equivalent OR
we can use a series of logical equivalences.

Example: Show that  (p ∨ (p ∧q)) and p ∧q are logically equivalent.

Solution
 (p ∨ (p ∧q))
⇔ p ∧(p ∧q) Demogans 2nd law
⇔ p ∧[(p) ∨q)] Demorgan’s 1st Law
⇔ p ∧( p ∨q) Double
negation
⇔ (p ∧p) ∨(p ∧q) Distributive laws
⇔ F ∨(p ∧q) since ¬p ∧ p
⇔F
⇔ (p ∧q) ∨F commutative
Law
⇔ (p ∧q)
Identity Laws

Consequently  (p ∨ (p ∧q)) and p ∧q are logically equivalent.

Predicates and Quantifiers

Consider the statement: “x < 5” which is found in computer programs.

“x < 5” has two parts: The variable “x” is the subject of the statement, while “is
less than 5” is the predicate and refers to the property that
the subject of the statement can have.

The statement “x < 5” can be denoted by P(x) where P denotes “is less than 5” and x is
the variable.

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.

To create a proposition from a propositional function we use quantifiers. Many


mathematical statements assert that a property is true for all values of a variable in a
particular domain called the universe of discourse. Such a statement is expressed using a
universal quantification.
Definition

The universal quantification of P(x) is the proposition “ P(x) is true for all values of x in
the universe of discourse”. The notation:
x P(x): denotes the universal quantification of P(x)
Here  denotes the universal quantifier

Example 1: Let P(x) be the statement “x * 0 = 0”. What is the truth value of the
quantification x P(x), where the universe of discourse is the set of real
numbers.

Solution: Since P(x) is true for all real numbers x, (any number multiplied by zero is
zero) then x P(x) is true.

Def: The universal quantification of P(x) is the proposition “ P(x) is true for all values of
x in the universe of discourse”. The notation:
x P(x): denotes the universal quantification of P(x. Here 
denotes the universal quantifier

Example 1: Express the statement “ All Mathematicians are analytical” as a universal


quantification.

Solution: Let M(x) denote “ x is a mathematician”


Let A(x) denote “ x is analytical”

This statement can now be expressed as x [M(x) → A(x)]


where the universe of discourse is the set of mathematicians at UWI.

Example 2
What is the truth value of the function x Q(x) where Q(x) is the statement
“x2 < 10” and the universe of discourse consist of (i) positive integers not exceeding 4 (ii)
integers not exceeding 3?

Solution (i) The statement x Q(x) is the same as Q(1) ∧Q(2) ∧Q(3) ∧Q(4) since the
universe consist of the integers 1, 2, 3, 4. Since Q(4) is false, x Q(x) is false.
(ii) false. Why???

Again many mathematical statements assert that there is an element with a certain
property. Such statements are expressed using existential quantification.

Definition
The existential quantification of P(x) is the proposition “ There exist an element in the
universe of discourse such that P(x) is true”. The notation:
x P(x): denotes the existential quantification of P(x)
Here  denotes the existential quantifier

Example: Let P(x) be the statement


“x > 10 ”. What is the truth value of quantification x P(x) where the universe of
2

discourse consists of the positive integers not exceeding 4?

Solution: The universe of discourse is {1, 2, 3, 4}, the proposition x P(x) is the
same as P(1) ∨P(2) ∨P(3) ∨P(4).

Since P(4) , which is the statement “42 > 10” is true, it follows that x P(x) is true.

Translating sentences into logical expressions

We can now use logical operators and quantifiers to express English sentences.

Example1. Express the statement “Everyone has exactly one best friend” using
quantifiers and logical connectives.

Sol. Let B(x, y) : y is the best friend of x. The statement given may be rephrased as
follows.
For every person x there is another person y, such that y is the best friend
of x and if z is another person other than y, then z is not the best friend of
x.
Hence the require expression is:
x y z[B( x, y) ∧(( z != y) → B(x, z))]

Example 2. Consider the following statements the first three of which are premises and
the fourth a valid conclusion.
All humming birds are richly coloured.
No large bird live on honey.
Birds that do not live on honey are dull coloured.
Humming birds are small.

Let P(x) : x is a humming bird,


Q(x) : x is large,
R(x): x lives on honey and
S(x): x is richly coloured
be propositional functions.

Assume that the universe of discourse is the set of all birds. Express the statements in the
arguments using quantifiers, P(x), Q(x), R(x), S(x) and logical connectives.
Soln
x (P(x) → S(x))
x (Q(x) ∧R(x))
x (R(x)→ S(x))
x (P(x) →Q(x))
Here small means not big and dull means not brightly coloured.

Example 3: Consider the following statements. The first two are premises while the
third is called the conclusion. The entire set is called an argument.

“ All lions are fierce”


“Some lions do not drink coffee”
“Some fierce creatures do not drink coffee”

Solution: Let P(x) be the statement “ x is a lion”


Let Q(x) be the statement “ x is fierce”
Let R(x) be the statement “ x drinks coffee”

We can express these statements as:

x (P(x) → Q(x))
x (P(x) ∧R(x))
x (Q(x) ∧R(x))

Note that the second statement cannot be written as x (P(x) → R(x)). The reason is
that P(x) → R(x) is true whenever x is not a lion, so x (P(x) → R(x)) is true as long
as there is at least one creature that is not a lion. NEVER USE THE IMPLICATION “→”
WITH .

Multiple Quantification of Propositional functions

Let Q(x, y) denote “x + y = 0”. What is the truth value of the following quantifications,
for x, y real numbers.
(i) xy Q(x, y)
(ii) y x Q(x, y)
(iii) xy Q(x, y)

Solution
(i) xy Q(x, y) : For every real number x there is a real number y such that
Q(x, y) is true. This statement is true since y = -x.

(ii) y x Q(x, y): there is a real number y such that for every real x Q(x, y) is
true. This statement is false since when y is chosen it will only apply to only
one value of x.
(iii) xy Q(x, y) : false , a consequence of (ii) above.

NB. The order in which quantifiers appear makes a difference:

Example: Let Q(x,y) denote “x + y = 0”. What are the truth values of the
quantifications y x Q(x,y) and x y Q(x,y)? The universe of
discourse is the set of real numbers.

Solution:
(i)y x Q(x,y) denotes the proposition “ There is a real number y such that
for every real number x, Q(x,y) is true.”
Since there is no value y such that for every real value of x, x + y = 0 then
y x Q(x,y) is false.

(ii)x y Q(x,y) denotes the proposition “ For every real number x, there is a real
number such that Q(x,y) is true.” This is the case when we let y = -x.
Therefore x y Q(x,y) is true.

Note, if y x Q(x,y) is true then x y Q(x,y) is also true. However if x y Q(x,y)


is true, it is not necessarily that y x Q(x,y) is true.
Negation

x P(x) ⇔ x P(x) important


x Q(x) ⇔ x Q(x) important

Methods of Proofs

How do we know that a mathematical argument is correct? What methods can we use to
ensure that it is correct? Here we introduce the rules of inference for propositional logic.
These rules provide the justification of the steps used to show that a conclusion follows
logically from a set of hypotheses. ( See table below)

Rules of Inference

Rule of Inference Tautology Name

p
————— p → (p ∨q) Addition
∴ p ∨q

p ∧q
————— (p ∧q) → p Simplification
∴p

p
q ((p) ∧(q)) → (p ∧q) Conjunction
—————
∴ p ∧q

p
p →q [p ∧(p → q)] → q Modus ponens
—————
∴ q

¬q
p →q [¬q ∧(p → q)] → ¬ p Modus tollens
—————
∴ ¬p
p →q
q →r [(p → q) ∧(q → r)] → (p → r) Hypothetical syllogism
—————
∴ p →r

p∨q
¬p [(p ∨q) ∧¬ p)] → q Disjunctive syllogism
—————
∴ q

Addition:

1. p
2. Therefore, p or q.

1. It is raining
2. Therefore, either it is raining or the sun is shining.

Conjunction:

1. p
2. q
3. Therefore, p and q.

1. It is raining in Barbados.
2. It is raining in St. Lucia
3. Therefore, it is raining in both Barbados and St. Lucia

Simplification:

1. p and q.
2. Therefore, p.

1. It is raining in both Barbados and St. Lucia.


2. Therefore, it is raining in Barbados.

Modus Ponens:

1. If p then q.
2. p.
3. Therefore, q.

1. If it is raining, then I will get wet.


2. It is raining.
3. Therefore, I will get wet.

Modus Tollens:

1. If p then q.
2. Not q. (¬q).
3. Therefore, not p (¬p).

1. If it had rained this morning, I would have gotten wet.


2. I did not get wet.
3. Therefore, it did not rain this morning.

Hypothetical Syllogism:

1. If p then q.
2. If q then r.
3. Therefore, if p then r.

1. If it rains, then I will get wet.


2. If I get wet, then my shirt will be ruined.
3. If it rains, then my shirt will be ruined.

Disjunctive Syllogism:

1. Either p or q.
2. Not p (¬p).
3. Therefore, q.

1. Either it rained or I took a ride to the park.


2. It did not rain.
3. Therefore, I took a ride to the park.

Lets look at some examples of how these rules are used:

Example 1: Given the hypotheses r → s and ¬s, show that ¬r is a valid conclusion.

Solution:
1. r →s hypothesis (premise)
2. ¬s → ¬r 1, contrapositive
3. ¬s hypothesis (premise)
4. ¬r 2, 3 modus ponens

Note that we could have simply invoked modus tollens


Example 2: Given the hypotheses p → (r → s), p and ¬ r → ¬p show that s is a valid
conclusion.

Solution:
1. p → (r → s) hypothesis (premise)
2. p hypothesis
3. r →s 1, 2 modus ponens
4. ¬ r → ¬p hypothesis
5. p →r 4, contrapositive
6. p →s 3, 5 hypothetical syllogism
7. s 2, 6 modus ponens

Example 3: Show that the hypotheses “It is not sunny this afternoon and it is
colder than yesterday”, “ We will go swimming only if it is sunny”, “If we
do not go swimming, then we will take a canoe trip”, “If we take a canoe
trip, then we will be home by sunset” lead to the conclusion “We will be
home by sunset”.

Solution: Let p be the proposition “It is sunny this afternoon”


Let q be the proposition “It is colder than yesterday”
Let r be the proposition “We will go swimming”
Let s be the proposition “We will take a canoe trip”
Let t be the proposition “We will be home by sunset”

Then the hypotheses become ¬ p ∧ q, r → p, ¬ r → s and s → t. The


conclusion is t. We construct the argument as follows:

1. ¬p ∧ q hypothesis
2. ¬p 1, simplification
3. r →p hypothesis
4. ¬r 2, 3 modus tollens
5. ¬r → s hypothesis
6. s 4, 5 modus ponens
7. s →t hypothesis
8. t 6, 7 modus ponens

Rules of Inference for Quantified Statements

Rule of Inference Name

∀x P(x)
 Universal instantiation
∴ P(c) if c ∈ U

P(c) for an arbitrary c ∈ U


 Universal generalisation
∴ ∀x P(x)

∃ x P(x)
 Existential instantiation
∴ P(c) for some element c ∈ U

P(c) for some element c ∈ U


 Existential generalisation
∴ ∃ x P(x)

Note that U is the Universe of Discourse.

Again lets look at an example of these rules are used:

Example: We go back to a previous example:

“ All lions are fierce”


“Some lions do not drink coffee”

“Some fierce creatures do not drink coffee”


where the universe of discourse is the set of all creatures.

Solution: We will show that the conclusion is valid


Let P(x) denote “x is a lion”
Let Q(x) denote “x is a fierce”
Let R(x) denote “x drinks coffee”

Note the conclusion is x (Q(x) ∧R(x))

1. x (P(x) → Q(x)) hypothesis


2. x (P(x) ∧R(x)) hypothesis
3. P(i) → Q(i) 1, Universal instantiation
4. P(i) ∧R(i) 1, Existential instantiation
5. P(i) 4, simplification
6. Q(i) 3, 5 modus ponens
7. R(i) 4, simplification
8. Q(i) ∧R(i) 6, 7 conjunction
9. x (Q(x) ∧R(x)) 8, existential generalization
Predicates and Quantifiers

Consider the statement “x < 5” which is found in computer programs.

“x < 5” has two parts: The variable “x” is the subject of the statement, while “is
less than 5” is the predicate and refers to the property that
the subject of the statement can have.

The statement “x < 5” can be denoted by P(x) where P denotes “is less than 5” and x is
the variable.

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.

To create a proposition from a propositional function we use quantifiers. Many


mathematical statements assert that a property is true for all values of a variable in a
particular domain called the universe of discourse. Such a statement is expressed using a
universal quantification.

Definition

The universal quantification of P(x) is the proposition “ P(x) is true for all values of x in
the universe of discourse”. The notation:
x P(x): denotes the universal quantification of P(x)
Here  denotes the universal quantifier

Example 1: Let P(x) be the statement “x * 0 = 0”. What is the truth value of the
quantification x P(x), where the universe of discourse is the set of real
numbers.

Solution: Since P(x) is true for all real numbers x, (any number multiplied by zero is
zero) then x P(x) is true.

Example 2: Express the statement “ All Mathematicians are analytical” as a universal


quantification.

Solution: Let M(x) denote “ x is a mathematician”


Let A(x) denote “ x is analytical”

This statement can now be expressed as x [M(x) → A(x)]


where the universe of discourse is the set of mathematicians at UWI.
Again many mathematical statements assert that there is an element with a certain
property. Such statements are expressed using existential quantification.

Definition

The existential quantification of P(x) is the proposition “ There exist an element in the
universe of discourse such that P(x) is true”. The notation:
x P(x): denotes the existential quantification of P(x)
Here  denotes the existential quantifier

Example: Let P(x) be the statement “x2 > 10 ”. What is the truth value of
quantification x P(x) where the universe of discourse consists of the
positive integers not exceeding 4?

Solution: The universe of discourse is {1, 2, 3, 4}, the proposition x P(x) is the
same as P(1) ∨P(2) ∨P(3) ∨P(4).

Since P(4) , which is the statement “42 > 10” is true, it follows that x
P(x) is true.

Translating sentences into logical expressions

We can now use logical operators and quantifiers to express English sentences.

Example: Consider the following statements. The first two are premises while the
third is called the conclusion. The entire set is called an argument.

“ All lions are fierce”


“Some lions do not drink coffee”
“Some fierce creatures do not drink coffee”

Solution: Let P(x) be the statement “ x is a lion”


Let Q(x) be the statement “ x is fierce”
Let R(x) be the statement “ x drinks coffee”

We can express these statements as:

x (P(x) → Q(x))
x (P(x) ∧R(x))
x (Q(x) ∧R(x))

Note that the second statement cannot be written as x (P(x) → R(x)). The reason is
that P(x) → R(x) is true whenever x is not a lion, so x (P(x) → R(x)) is true as long
as there is at least one creature that is not a lion. NEVER USE THE IMPLICATION “→”
WITH .
The order in which quantifiers appear makes a difference:

Example: Let Q(x,y) denote “x + y = 0”. What are the truth values of the
quantifications y x Q(x,y) and x y Q(x,y)? The universe of
discourse is the set of real numbers.

Solution: y x Q(x,y) denotes the proposition “ There is a real number y such that
for every real number x, Q(x,y) is true.”
Since there is no value y such that for every real value of x, x + y = 0 then
y x Q(x,y) is false.

x y Q(x,y) denotes the proposition “ For every real number x, there is


a real number such that Q(x,y) is true.” This is the case when we let y = -x.
Therefore x y Q(x,y) is true.

Note, if y x Q(x,y) is true then x y Q(x,y) is also true. However if x y Q(x,y)


is true, it is not necessarily that y x Q(x,y) is true.

Negation

x P(x) ⇔ x P(x) important


x Q(x) ⇔ x Q(x) important

¬  x P(x) ⇔  x ¬ P(x)
¬  x Q(x) ⇔  x ¬ Q(x) Negation

You might also like