You are on page 1of 37

Acknowledgment: All course slides are either referenced to Rosen Book online presentations

(with certain amendments) or are personally developed by the instructor.


• Arguments
Premises or Hypotheses Conclusion We can write
imply If it is raining, then I get wet.
If it is raining, then I get wet.
therefore, I get wet It is raining.
It is raining.
∴ I get wet
Tautology, then it is a valid argument.
( 𝑝1 ∧ 𝑝2 ∧ 𝑝3 ∧ … .∧ 𝑝𝑛 ) → 𝑞
Not Tautology, then it is a fallacy.
• An argument form is an argument that is valid no matter what propositions are
substituted into its propositional variables.
Argument Argument Form
If it is raining, then I get wet. 𝑝 →𝑞
It is raining. 𝑝
∴ I get wet ∴𝑞
2 2 Discrete Structures (1) First Semester - 1444
• Validity of arguments can be proven using:
– Truth tables.

– Logical proofs: is a sequence of steps, each of which consists of a proposition


and a justification.
o There are two types of named elements used in logical proofs.
▪ An arbitrary element of a domain has no special properties.
▪ A particular element of the domain may have properties that are not shared other elements.

3 3 Discrete Structures (1) First Semester - 1444


• Rules of inference

4 4 Discrete Structures (1) First Semester - 1444


• Mathematical Proofs
• Forms of Theorems
• Mathematical Definitions
• Proving theorem 𝑝 → 𝑞:
– Direct Proofs
– Indirect Proofs
o Proof of the Contrapositive
o Proof by Contradiction
• Proving equivalence (𝑝 ↔ 𝑞)
• Counterexamples
• Exhaustive Proofs and Proofs by Cases
• Mistakes in Proofs
5 5 Discrete Structures (1) First Semester - 1444
• A proof is a valid argument that establishes the truth of a statement.
• In math, CS, and other disciplines, informal proofs which are generally
shorter, are generally used.
– More than one rule of inference are often used in a step.
– Steps may be skipped.
– The rules of inference used are not explicitly stated.
– Easier for to understand and to explain to people.
– But it is also easier to introduce errors.
• Proofs have many practical applications:
– verification that computer programs are correct
– establishing that operating systems are secure
– enabling programs to make inferences in artificial intelligence
– showing that system specifications are consistent

6 6 Discrete Structures (1) First Semester - 1444


• A theorem 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.
• A corollary is a result which follows directly from a theorem.
• Less important theorems are sometimes called propositions.
• A conjecture is a statement that is being proposed to be true. Once a proof of a
conjecture is found, it becomes a theorem. It may turn out to be false.

7 7 Discrete Structures (1) First Semester - 1444


Theorem Lemma Conjecture
(proved) (helping theorem) (unproved theorem)

Definition Axiom
(mathematical Mathematical proof (True without proof)
meaning)

Corollary Important? Input or


(needs short proof) Yes No Output

Process

Decision
Inference Theorem Proposition

8 8 Discrete Structures (1) First Semester - 1444


• Many theorems assert that a property holds for all elements in a
domain, such as the integers, the real numbers, or some of the
discrete structures.

• Often the universal quantifier (needed for a precise statement of a


theorem) is omitted by standard mathematical convention.
For example, the statement:
“If x > y, where x and y are positive real numbers, then x2 > y2 ”
really means
“For all positive real numbers x and y, if x > y, then x2 > y2 .”

9 9 Discrete Structures (1) First Semester - 1444


Title Definition Examples
Even and odd An integer 𝑥 is even if there is an integer 𝑘 such that 𝑥 = 2𝑘. 0 is even, k=0
-3 is odd, k=-2
integers. An integer 𝑥 is odd if there is an integer 𝑘 such that 𝑥 = 2𝑘 + 1.
Parity The parity of a number is whether the number is odd or even. If two numbers are 7 and -3 have the same
parity.
both even or both odd, then the two numbers have the same parity. If one 7 and 2 has opposite
number is odd and the other is even, then the two numbers have opposite parity. parity
𝑥 0.6 is rational, x=6, y=10
Rational A number 𝑟 is rational if there exist integers 𝑥 and 𝑦 such that 𝑦 ≠ 0 and 𝑟 = .
𝑦
numbers
Divides An integer 𝑥 divides an integer 𝑦 if and only if 𝑥 ≠ 0 and 𝑦 = 𝑘𝑥, for some integer 3 divides 12, k=4
3 is a factor of 12
𝑘. If 𝑥 divides 𝑦, then 𝑦 is said to be a multiple of 𝑥, and 𝑥 is a factor or divisor of 3 does not divides 10
𝑦.
Prime and An integer 𝑛 is prime if and only if 𝑛 > 1, and the only positive integers that 13 is prime
composite divide 𝑛 are 1 and 𝑛. 12 is composite,
numbers An integer 𝑛 is composite if and only if 𝑛 > 1, and there is an integer 𝑚 such that m∈{6,4,3,2}
1 < 𝑚 < 𝑛 and 𝑚 divides 𝑛.

10 10 Discrete Structures (1) First Semester - 1444


Many theorems have the form:

To prove them:
1. We show that where c is an arbitrary element of the domain,
2. By universal generalization the truth of the original formula follows.

So, we must prove something of the form:

11 11 Discrete Structures (1) First Semester - 1444


𝑝 → 𝑞

• We can use any of the following methods to show that propositions


based on the conditional statement p → q are true:
– Direct proofs: Assume p is true; the last step establishes q is true.
– Proof by Contraposition: Uses a direct proof of the contrapositive ¬𝑞 → ¬𝑝.
That is, assume ¬𝑞 is true; the last step establishes is ¬𝑝 true.
– Proof by Contradiction: To prove that p is true, we assume ¬𝑝 is true and reach
a contradiction, that is (𝑟 ∧ ¬ 𝑟) is true for some proposition r. In particular, to
prove p → q, we assume p → q is false, and get as a consequence a
contradiction. Assuming that p → q is false ≡ 𝑝 ∧ ¬𝑞 is true.

12 12 Discrete Structures (1) First Semester - 1444


Direct Proof: Assume that p is true. Use rules of inference, axioms, and logical
equivalences to show that q must also be true.
𝑝→𝑞≡𝑝→𝑞
Theorem Proof

Example: Give a direct proof of the theorem “If 𝑛 is an odd integer, then 𝑛2 is odd.”
Solution:
Assume that 𝑛 is odd. Then 𝑛 = 2𝑘 + 1 for an integer 𝑘. Squaring both sides of
the equation, we get:= + +
2
𝑛 = (2𝑘 + 1)2 4 𝑘 2 4𝑘 + 1 = 2(2𝑘 2 2𝑘) ++ 1
𝑛2 = 2𝑟 + 1 (Assume 𝑟 = 2𝑘2 2𝑘)
𝑛2 is an odd integer.
Q.E.D.
We have proved that f 𝑛 is an odd integer, then 𝑛2 is odd integer.
13 13 Discrete Structures (1) First Semester - 1444
Practice: Give a direct proof of the theorem “If n is an even integer,
then n2 is even.”

14 14 Discrete Structures (1) First Semester - 1444


Example: Prove that the sum of two rational numbers is rational.

Solution: Assume r and s are two rational numbers. Then there must be
integers p, q and also t, u such that

where v = pu + qt , w = qu ≠ 0

Thus the sum is rational.


Q.E.D.

15 15 Discrete Structures (1) First Semester - 1444


Proof by Contraposition: Assume ¬q and show ¬p is true also. This is sometimes called an indirect
proof method. If we give a direct proof of ¬q → ¬p then we have a proof of p → q.
𝑝 → 𝑞 ≡ ¬𝑞 → ¬𝑝
Theorem Proof

Example: Prove that if n is an integer and 3n + 2 is odd, then n is odd.

Solution: Assume n is even. So, n = 2k for some integer k. Thus


3n + 2 = 3(2k) + 2
=6k +2
= 2(3k + 1) assume j = 3k +1
= 2j
Therefore 3n + 2 is even. 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).
Q.E.D.

16 16 Discrete Structures (1) First Semester - 1444


Example: Prove that for an integer n, if n2 is odd, then n is odd.

Solution: Use proof by contraposition. Assume n is even (i.e., not


odd). Therefore, there exists an integer k such that n = 2k. Hence,
n2 = 4k2 = 2 (2k2) assume j = 2k2
= 2j
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.
Q.E.D.
17 17 Discrete Structures (1) First Semester - 1444
Proof by Contradiction: To prove p, assume ¬p and derive a contradiction
such as p ∧ ¬p. (an indirect form of proof). Since we have shown that ¬p
→F is true , it follows that the contrapositive T→p also holds.
𝑝 → 𝑞 ≡ ¬(𝑝 → 𝑞) → 𝐹
Theorem Proof

Example: Prove that if you pick 22 days from the calendar, at least 4 must
fall on the same day of the week.
Solution: Assume that no more than 3 of the 22 days fall on the same day
of the week. Because there are 7 days of the week, we could only have
picked 21 days. This contradicts the assumption that we have picked 22
days. Remember:
Q.E.D. ¬ 𝑝 → 𝑞 ≡ 𝑝 ∧ ¬𝑞

18 18 Discrete Structures (1) First Semester - 1444


Example: Use a proof by contradiction to give a proof that 2 is irrational.

Solution: Suppose 2 is rational. Then there exists integers a and b with


2 = a/b, where b≠ 0 and a and b have no common factors. Then

Therefore a2 must be even. If a2 is even then a must be even (an exercise). Since a is even, a = 2c
for some integer c. Thus,

Therefore b2 is even. Again then b must be even as well.


But then 2 must divide both a and b. This contradicts our assumption that a and b have no
common factors. We have proved by contradiction that our initial assumption must be false and
therefore √2 is irrational .
Q.E.D.
19 19 Discrete Structures (1) First Semester - 1444
Example: Use a proof by contradiction to give a proof that:
if 𝑥 2 + 𝑥 − 2 = 0 , then 𝑥 ≠ 0

Solution: Assume 𝑥 2 + 𝑥 − 2 = 0 and 𝑥 = 0 . Then substitute every x by its value in the


statement:
𝑥2 + 𝑥 − 2 = 0
02 + 0 − 2 = 0
−2 = 0
And that is a contradiction.
Then, by proof by contradiction, if 𝑥 2 + 𝑥 − 2 = 0 ,
then 𝑥 ≠ 0

Q.E.D.

20 20 Discrete Structures (1) First Semester - 1444


Example: Use a proof by contradiction to give a proof that:
𝐴−𝐵 ∩ 𝐵−𝐴 =∅

Solution: Assume 𝐴 − 𝐵 ∩ 𝐵 − 𝐴 ≠ ∅
Then, ∃𝑥 ∈ [ 𝐴 − 𝐵 ∩ 𝐵 − 𝐴 ]
𝑥 ∈ 𝐴−𝐵 ∧ 𝑥 ∈ 𝐵−𝐴
(𝑥 ∈ 𝐴 ∧ 𝑥 ∉ 𝐵) ∧ (𝑥 ∈ 𝐵 ∧ 𝑥 ∉ 𝐴)
𝑥 ∈𝐴∧𝑥 ∉𝐵∧𝑥 ∈𝐵∧𝑥 ∉𝐴
And there are two contradictions:
𝑥 ∈𝐴∧𝑥 ∉𝐴 and 𝑥 ∉𝐵∧𝑥 ∈𝐵

Then, using proof by contradiction, 𝐴 − 𝐵 ∩ 𝐵 − 𝐴 = ∅


Q.E.D.

21 21 Discrete Structures (1) First Semester - 1444


• Mathematical Proofs
• Forms of Theorems
• Proving theorem 𝑝 → 𝑞:
– Direct Proofs
– Indirect Proofs
o Proof of the Contrapositive
o Proof by Contradiction
• Proving equivalence (𝑝 ↔ 𝑞)
• Counterexamples
• Exhaustive Proofs and Proofs by Cases
• Mistakes in Proofs

22 22 Discrete Structures (1) First Semester - 1444


• To prove an equivalence theorem which is a biconditional statement, that is, a statement of the
form 𝑝 ↔ 𝑞:
we show that 𝑝 → 𝑞 and 𝑞 → 𝑝 are both true.

𝑝 ↔ 𝑞 ≡ (𝑝 → 𝑞) ∧ (𝑞 → 𝑝)
Theorem Proof

• Sometimes a theorem states that several propositions are equivalent. Such a theorem states that
propositions 𝑝1, 𝑝2, 𝑝3, . . . , 𝑝𝑛 are equivalent. This can be written as: 𝑝1 ↔ 𝑝2 ↔ 𝑝3 ↔. . . ↔ 𝑝𝑛 . To
prove it, we use the following:

𝑝1 ↔ 𝑝2 ↔ 𝑝3 ↔ ⋯ ↔ 𝑝𝑛 ≡ 𝑝1 → 𝑝2 ∧ 𝑝2 → 𝑝3 ∧ ⋯ ∧ (𝑝𝑛 → 𝑝1 )
Theorem Proof

23 23 Discrete Structures (1) First Semester - 1444


Example: Prove the theorem: “If n is an integer, then n is odd if and only if n2
is odd.”

Solution:
We have already shown (previous slides) that both
𝑝 → 𝑞 and 𝑞 → 𝑝 are true.
Therefore, we can conclude 𝑝 ↔ 𝑞.

Note: Sometimes iff is used as an abbreviation for “if an only if,” as


in:
“If n is an integer, then n is odd iif n2 is odd.”
24 24 Discrete Structures (1) First Semester - 1444
Example: Show that these statements about the integer n are equivalent:
p1: n is even.
p2: n − 1 is odd.
p3: n2 is even.

Solution:
We will show that these three statements are equivalent by showing that 𝑝1 → 𝑝2, 𝑝2 → 𝑝3, and 𝑝3 → 𝑝1 are true.

• Proof of 𝒑𝟏 → 𝒑𝟐: (If n is even, then n-1 is odd)


By direct proof, assume n is even:
n = 2k (where k is integer)
Then, n-1 = 2k-1 (since odd int is 2i+1)
n-1 = 2(k-1)+1
n-1 = 2i+1 (i=k-1)
therefore, n-1 is odd

25 25 Discrete Structures (1) First Semester - 1444


• Proof of 𝒑𝟐 → 𝒑𝟑 : (if n-1 is odd, then n2 is even)
By direct proof, assume n − 1 is odd:
Then n −1 = 2k + 1 (where is integer)
n = 2k + 2
n2 = (2k + 2)2 = 4k2 + 8k + 4 = 2 (2k2 + 4k + 2)
n2 = 2i (i = 2k2 + 4k + 2)
therefore, n2 is even

• Proof of 𝒑𝟑 → 𝒑𝟏 : (if n2 is even, then n is even)


By contraposition. (practice)

Since 𝑝1 → 𝑝2, 𝑝2 → 𝑝3, and 𝑝3 → 𝑝1 are true, then 𝑝1 ↔ 𝑝2 ↔ 𝑝3 is true


Q.E.D.

26 26 Discrete Structures (1) First Semester - 1444


To prove that ∀x P(x) is false, we need only to find a counterexample, that is,
an example x for which P(x) is false.

Example: Show that the statement “Every positive integer is the sum of the
squares of two integers” is false.

Solution:
3 is not a sum of two squares.
02 + 12 = 1 ≠ 3
12 + 22 = 5 ≠ 3

27 27 Discrete Structures (1) First Semester - 1444


• Mathematical Proofs
• Forms of Theorems
• Proving theorem 𝑝 → 𝑞:
– Direct Proofs
– Indirect Proofs
o Proof of the Contrapositive
o Proof by Contradiction
• Proving equivalence (𝑝 ↔ 𝑞)
• Counterexamples
• Exhaustive Proofs and Proofs by Cases
• Mistakes in Proofs

28 28 Discrete Structures (1) First Semester - 1444


• Sometimes we cannot prove a theorem using a single argument that
holds for all possible cases.
– Solution: considering different cases separately.

• Two strategies can be used:


– Proof by cases: split your proposition into general cases that covers all
possible cases.
o Large range to test
– Exhaustive proof: test all possible examples
o Small range to test

29 29 Discrete Structures (1) First Semester - 1444


• To prove a conditional statement of the form:

• Use the tautology

• Each of the implications is a case.

30 30 Discrete Structures (1) First Semester - 1444


Example: Let a @ b = max{a, b} = a if a ≥ b, otherwise
a @ b = max{a, b} = b.
Show that for all real numbers a, b, c
(a @b) @ c = a @ (b @ c)
(This means the operation @ is associative.)

Proof: Let a, b, and c be arbitrary real numbers.


Then one of the following 6 cases must hold.
1. a ≥ b ≥ c
2. a ≥ c ≥ b
3. b ≥ a ≥c
4. b ≥ c ≥a
5. c ≥ a ≥ b
6. c ≥ b ≥ a
Continued on next slide →
31 31 Discrete Structures (1) First Semester - 1444
Case 1: a ≥ b ≥ c
(a @ b) @ c = a @ c = a
a @ (b @ c) = a @ b = a =(a @ b) @ c
Therefore the equality holds for the first case.

A complete proof requires that the equality be shown to hold for all
6 cases. But the proofs of the remaining cases are similar. Try them.
Q.E.D.

32 32 Discrete Structures (1) First Semester - 1444


Example: Show that if x and y are integers and both x∙y and x+y are even, then both x and y are
even.

Proof: Use a proof by contraposition:


Suppose x and y are not both even. Then, one or both are odd.
Without loss of generality, assume that x is odd.
Then x = 2m + 1 for some integer m.
Case 1: y is even. Then y = 2n for some integer n, so
x + y = (2m + 1) + 2n = 2(m + n) + 1 is odd.
Case 2: y is odd. Then y = 2n + 1 for some integer n, so
x ∙ y = (2m + 1) (2n + 1) = 2(2m ∙ n +m + n) + 1 is odd.
Q.E.D.

Note:
We only cover the case where x is odd because the case where y is odd is similar. The use
phrase without loss of generality (WLOG) indicates this.
33 33 Discrete Structures (1) First Semester - 1444
Example: Prove that (n + 1)3 ≥3n if n is a positive integer with 1 ≤ n ≤ 4.

Solution:
We use a proof by exhaustion, by examining all the possible cases: n = 1, 2, 3,
4.
for n=1 then 23 ≥31 8≥3 true
for n=2 then 33 ≥32 27 ≥ 9 true
for n=2 then 43 ≥33 64 ≥ 27 true
for n=2 then 53 ≥34 125 ≥ 81 true
Therefore, (n + 1)3 ≥3n for 1 ≤ n ≤ 4
Q.E.D.

34 34 Discrete Structures (1) First Semester - 1444


• Mathematical Proofs
• Forms of Theorems
• Proving theorem 𝑝 → 𝑞:
– Direct Proofs
– Indirect Proofs
o Proof of the Contrapositive
o Proof by Contradiction
• Proving equivalence (𝑝 ↔ 𝑞)
• Counterexamples
• Exhaustive Proofs and Proofs by Cases
• Mistakes in Proofs

35 35 Discrete Structures (1) First Semester - 1444


“Proof” that 1 = 2

Solution:
Step 5. a - b = 0 by the premise and division by 0 is undefined.
36 36 Discrete Structures (1) First Semester - 1444
• Read Section 1.7 and 1.8.1 to 1.8.2 of Rosen’s book.

37 37 Discrete Structures (1) First Semester - 1444

You might also like