Lecture 4
Lecture 4
Discrete Mathematics
(MA102)
Lecture 4 (For AI and IS programs)
Prepared By:
Dr. Heba Askr
Information Systems Department
2020-2021
1
Chapter 1: Logic and Proofs
Topics
▪ Propositional logic
▪ Predicates and Quantifiers
▪ Rules of Inference and Proofs
2
Outline
• What is a Proof ?
• Methods of Proving
• Common Mistakes in Proofs
• Strategies : How to Find a Proof ?
3
Introduction to Proofs
A proof is a valid argument that establishes the truth of
a statement (as the conclusion).
4
Introduction to Proofs
Related Terminology
Theorem
Lemma
corollary
conjecture
5
Introduction to Proofs
Related Terminology
• A theorem (major result) is a statement that can be shown to be
true using:
– definitions
– other theorems
– axioms (statements which are given as true)
– rules of inference
• A lemma
• is a ‘helping theorem’ or a result which is needed to prove a
theorem.
• is a theorem that is not very important. we sometimes prove a
theorem by a series of lemmas
6
Introduction to Proofs
Related Terminology cont.
• A corollary is a result which follows directly from a theorem.
7
Introduction to Proofs
Proving Theorems
• Many theorems have the form:
8
Introduction to Proofs
Methods of Proofs
1. Direct Proofs
2. Indirect Proofs
• proof by contraposition.
• Proof by Contradiction.
9
Introduction to Proofs
Methods of Proof (Direct Proofs)
• A direct proof of a conditional statement p → q
10
Introduction to Proofs
Methods of Proof (Direct Proofs cont.)
Even and Odd Integers
Definition:
The integer n is even if there exists an integer k such that n = 2k, and
n is odd if there exists an integer k, such that n = 2k + 1.
• Note that every integer is either even or odd and no integer is both
even and odd.
• We will need this basic fact about integers in some of the example
proofs to follow.
11
Introduction to Proofs
Methods of Proof (Direct Proofs cont.)
Direct Proof (Example 1)
Give a direct proof of the theorem “If n is an odd
integer, then n2 is odd.”
Proof
Assume that n is an odd integer. This implies
that there is some integer k such that
n = 2k + 1. r
Then n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1
= 2 r +1, (where r is an integer) Thus, n2 is odd.
12
Introduction to Proofs
Methods of Proof (Direct Proofs cont.)
Direct Proof (Example 2)
Give a direct proof of “if m and n are both square
numbers, then mn is also a square number.”
Proof
Assume that m and n are both squares. This implies
that there are integers u and v such that
m = u2 and n = v2.
Then mn = u2 v2 = (uv)2. Thus, mn is a square.
13
Introduction to Proofs
Methods of Proof (Direct Proofs cont.)
14
Introduction to Proofs
Methods of Proof (Direct Proofs cont.)
Direct Proof (Example 3)
Prove that the sum of two rational numbers
is rational.
Proof
Where =
= ≠0
15
Introduction to Proofs
Methods of Proof (Indirect Proofs)
• Indirect Proofs : Proofs that are not direct proofs,
that do not start with the premises and end with
the conclusion.
• Examples of Indirect Proofs :
1. Proof by Contraposition
2. Proof by Contradiction
16
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proving Conditional Statements: p → q using
indirect proofs
• The proof by contraposition method makes
use of the equivalence
p→q q→ p
18
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proof by Contraposition (Example 1)
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Remember p → q q → p
Proof Assume q is true to prove that p is true
q
Assume that n is even. This implies that n = 2k for some integer k.
Then, 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1),
Therefore 3n + 2 is even. p
Since we have shown ¬q → ¬p , p → q must hold as well. If n is
an integer and 3n + 2 is odd (not even) , then n is odd (not even).
19
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proof by Contraposition (Example 2)
Prove by contraposition that for an integer n,
if n2 is odd, then n is odd.
Proof
Assume n is even (i.e., not odd). Therefore, there exists an integer
k such that n = 2k. Hence,
n2 = 4k2 = 2 (2k2)
and n2 is even(i.e., not odd).
We have shown that if n is an even integer, then n2 is even.
Therefore by contraposition, for an integer n, if n2 is odd, then n is
odd.
20
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
• The proof by contradiction method makes use
of the equivalence
p p→q
where q is any contradiction.
21
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Explanation of the previous slide
p p→q
where q is any contradiction.
• Because a contradiction q is false, but ¬p → q is
true, we can conclude that ¬p is false, which
means that p is true. p q p→q
T T T
T F F
F T T
F F T
22
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
p p→q
One way to show that as follows:
• To construct a proof by contradiction, we assume
that both p and ¬q are true.
• If both p and ¬p or q and ¬q are true, then we
have a contradiction and the proof by
contradiction is complete.
23
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proof by contradiction (Example)
Give a proof by contradiction of the theorem
“If 3n +2 is odd, then n is odd.”
Proof Remember
Let p be “3n + 2 is odd” and q be “n is odd.” P p →q
Assume that p and ¬q is true. This implies that n is even and n = 2k
for some integer k, so that 3n + 2 = 3(2k) + 2 = 2(3k + 1).
Thus, 3n + 2 is even.
A contradiction occurs (where ?)
Because both p and ¬p are true and q and ¬q are also true , we
have a contradiction.
so the original statement is true by proving by contradiction
24
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proofs of Equivalence (Theorems that are
Biconditional Statements)
• When proving bi-conditional statement, we may make use of the
equivalence pq(p→q)(q→p)
25
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proofs of Equivalence (Theorems that are
Biconditional Statements)
Proofs of Equivalence (Example)
• Show that the following statements about the integer n are
equivalent :
p := “n is even”
q := “n –1 is odd”
r := “n2 is even”
27
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proofs of Equivalence (Theorems that are
Biconditional Statements)
Proofs of Equivalence (Example) p := “n is even”
q := “n – 1 is odd”
r := “n 2 is even”
28
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proofs of Equivalence (Theorems that are
Biconditional Statements)
Proofs of Equivalence (Example) p := “n is even”
q := “n – 1 is odd”
r := “n 2 is even”
29
Introduction to Proofs
Methods of Proof (Indirect Proofs cont.)
Proofs of Equivalence (Theorems that are
Biconditional Statements)
Proofs of Equivalence (Example) p := “n is even”
q := “n – 1 is odd”
r := “n 2 is even”
30
Introduction to Proofs
Mistakes in Proofs
Example:
What is wrong with this famous supposed “proof” that 1 = 2?
“Proof”: We use these steps, where a and b are two equal positive integers.
32
Proof Methods and Strategy
Proof by Cases:
A proof by cases must cover all possible cases that arise in a theorem.
33
Proof Methods and Strategy
Proof by Cases: Example:
Use a proof by cases to show that n 2 + 1 ≥ 2 n when n is a positive
integer with 1 ≤ n ≤ 4.
Solution:
Case (1): When n = 1, we have 1 2 + 1 >= 21 . It follows that n 2 +1≥ 2n is
true in this case.
Case (2): When n = 2, we have 2 2 + 1 >= 22 . It follows that n 2 +1≥ 2n is
true in this case..
Case (3): When n = 3, we have 3 2 + 1 >= 23 . It follows that n 2 +1≥ 2n is
true in this case.
Case (4): When n = 4, we have 4 2 + 1 >= 24 . It follows that n 2 +1≥ 2n is
true in this case.
So the inequality n 2 + 1 ≥ 2 n holds for all the above cases and the
proof is complete.
34
Proof Methods and Strategy
Existence Proofs :
• Proof of theorems of the form is called an existence proof.
Example: Show that there is a positive integer that can be written as the sum of cubes of
positive integers in two different ways:
35
Proof Methods and Strategy
Nonconstructive Existence Proofs :
In a nonconstructive existence proof, we assume no c
exists which makes P(c) true.
36
Proof Methods and Strategy
Nonconstructive Existence Proofs cont.:
Example: Show that there exist irrational numbers x and y
such that x y is rational.
37
Proof Methods and Strategy
Proof Strategies for proving p → q
• Choose a method.
1. First try a direct method of proof.
2. If this does not work, try an indirect method (e.g., try to
prove by contraposition or by contradiction).
• For whichever method you are trying, choose a strategy.
1. First try forward reasoning. Start with the axioms and known
theorems and construct a sequence of steps that end in the
conclusion. Start with p and prove q, or start with ¬q and
prove ¬p.
2. If this doesn’t work, try backward reasoning. When trying to
prove q, find a statement p that we can prove with the
property p → q.
38
Proof Methods and Strategy
Backward Reasoning:
Example:
39
Proof Methods and Strategy
Backward Reasoning:
Solution:
40