Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

Department Of Computer Science, CUI

Lahore Campus

CSC102 - Discrete Structures


By
Mahwish Waqas
06/29/2021 CSC102 - Discrete Structures 2

Lecture Outline

• Mathematical Induction
• Proof using Mathematical Induction
• Sequence formulas
• Inequality
• Divisibility
06/29/2021 CSC102 - Discrete Structures 3

Mathematical Induction

• Mathematical induction is an extremely important proof


technique.

• Mathematical induction can be used to prove


• results about complexity of algorithms
• correctness of certain types of computer programs
• theorem about graphs and trees
• …
06/29/2021 CSC102 - Discrete Structures 4

What is Mathematical Induction?

• How to prove “P(n), a mathematical statement, for all


positive integer n”.

• It is a method of proof.

• It does not generate answers: it only can prove them.


06/29/2021 CSC102 - Discrete Structures 5

Mathematical Induction
•• Assume P(n) is a propositional function.
 
• Principle of mathematical induction:
To prove that P(n) is true for all positive integers n, we complete two steps.

• Basis Step: P(1)


• Inductive Step:
• Result: n P(n) domain: positive integers

• How to show P(1) is true?


• P(1): n is replaced by 1 in P(n)
• Then, show P(1) is true.
• How to show k (P(k) P(k+1))?
• Direct proof can be used
• Assume P(k) is true for some arbitrary k.
• Then, show P(k+1) is true.
06/29/2021 CSC102 - Discrete Structures 6

Example
Suppose that we have an infinite ladder
1. We can reach the first step of the
ladder.
2. If we can reach a particular step of
the ladder, then we can reach the
next step.
Then, we can conclude that we are able
to reach every step of this infinite
ladder.
06/29/2021 CSC102 - Discrete Structures 7

Example
• An infinite row of dominoes, labeled 1,
2, 3, ..., n
• P(n): Domino n is knocked over
• P(1): The first domino is knocked over
• P(k): The kth domino is knocked over
• The fact that
• The first domino is knocked over
• And whenever the kth domino is knocked
over, it also knocks the (k+1)st domino over
• Implies that all the dominoes are
knocked over
06/29/2021 CSC102 - Discrete Structures 8

Example
• Show that 1 + 2 + 3 + … + n = n(n+1) / 2, where n is a
positive integer.

• Proof:
• First define P(n)
P(n) is 1 + 2 + 3 + … + n = n(n+1) / 2

• Basis Step: (Show P(1) is true.)


1 = 1(2)/2
So, P(1) is true.
06/29/2021 CSC102 - Discrete Structures 9

Example
•Inductive
  Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true.

1 + 2 + 3 + … + k = k(k+1) / 2
• Show P(k+1) is true.
P(k+1) : 1 + 2 + 3 + … (k+1) = (k+1)(k+2) / 2
L.H.S of P(k+1) = 1 + 2 + … + k + k+1
= (1 + 2 + …+ k) + (k+1)
= k(k+1)/2 + (k+1)
= [k(k+1) + 2(k+1)]/2
= (k+1)(k+2)/2 = R.H.S of P(k+1)
• We showed that P(k+1) is true under assumption that P(k) is
true. So, by mathematical induction 1+2+…+n = n(n+1)/2.
06/29/2021 CSC102 - Discrete Structures 10

What did we show


• Base case: P(1)
• If P(k) was true, then P(k+1) is true
• i.e., P(k) → P(k+1)
• We know it’s true for P(1)
• Because of P(k) → P(k+1), if it’s true for P(1), then it’s true for P(2)
• Because of P(k) → P(k+1), if it’s true for P(2), then it’s true for P(3)
• Because of P(k) → P(k+1), if it’s true for P(3), then it’s true for P(4)
• Because of P(k) → P(k+1), if it’s true for P(4), then it’s true for P(5)
• And onwards to infinity
• Thus, it is true for all possible values of n
• In other words, we showed that:
• [P(1)   k (P(k)  P(k+1))]   n P(n)
06/29/2021 CSC102 - Discrete Structures 11

Example
• 
• Use mathematical induction to show that for all
nonnegative integers n.

• Proof:
• First define P(n)
P(n) is

• Basis step: (Show P(0) is true.)


So, P(0) is true.
06/29/2021 CSC102 - Discrete Structures 12

Example
•Inductive
  Step: (Show k (P(k) P(k+1)) is true
• Assume P(k) is true.

• Show P(k+1) is true.

• We showed that P(k+1) is true under assumption that P(k) is


true. So, by mathematical induction that .
06/29/2021 CSC102 - Discrete Structures 13

Example
•  Prove by mathematical induction
06/29/2021 CSC102 - Discrete Structures 14

Example
•  Use mathematical induction to prove the formula for the
sum of a finite number of terms of a geometric
progression.

• Proof:
• First define P(n)
P(n) is

• Basis step: (Show P(0) is true.)


So, P(0) is true.
06/29/2021 CSC102 - Discrete Structures 15

Example
 
• Inductive
Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true.
• Show P(k+1) is true.
P(k+1) :

• We showed that P(k+1) is true under assumption that


P(k) is true.
So, by mathematical induction
06/29/2021 CSC102 - Discrete Structures 16

Proving Divisibility Results


• 
Proof:
• First define P(n)
P(n) is.

• Basis step: (Show P(1) is true.)

So, P(1) is true.


06/29/2021 CSC102 - Discrete Structures 17

Proving Divisibility Results


• Inductive
  Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true.

• Show P(k+1) is true.


P(k+1) is

• We showed that P(k+1) is true under assumption that P(k) is


true. So given statement is true by mathematical induction.
06/29/2021 CSC102 - Discrete Structures 18

Proving Divisibility Results


• 
Proof:
• First define P(n)
P(n) is.

• Basis step: (Show P(1) is true.)

So, P(1) is true.


06/29/2021 CSC102 - Discrete Structures 19

Proving Divisibility Results


•  Inductive Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true.

• Show P(k+1) is true.


P(k+1) is

• We showed that P(k+1) is true under assumption that P(k)


is true. So given statement is true by mathematical
induction.
06/29/2021 CSC102 - Discrete Structures 20

Proving Inequalities Example


• 

Proof:
• First define P(n)
P(n) is.
• Basis step: (Show P(4) is true.)

So, P(4) is true.


06/29/2021 CSC102 - Discrete Structures 21

Proving Inequalities Example


 
• Inductive Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true for

• Show P(k+1) is true.


P(k+1) is

• We showed that P(k+1) is true under assumption that P(k)


is true. So, by mathematical induction for all positive
integers n and .
06/29/2021 CSC102 - Discrete Structures 22

Proving Inequalities Example


•Show
  that for all .

Proof:

• First define P(n)


P(n) is

• Basis Step: (Show P(2) is true.)

So, P(2) is true.


06/29/2021 CSC102 - Discrete Structures 23

Proving Inequalities Example


•  Inductive Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true .

• Show P(k+1) is true.


P(k+1) is

• We showed that P(k+1) is true under assumption that P(k)


is true.
06/29/2021 CSC102 - Discrete Structures 24

Proving Inequalities Example


• 

Proof:
• First define P(n)
P(n) is
• Basis step: (Show P(1) is true.)
1
So, P(1) is true.
06/29/2021 CSC102 - Discrete Structures 25

Proving Inequalities Example


••  Inductive Step: (Show k (P(k) P(k+1)) is true.)
• Assume P(k) is true .

• Show P(k+1) is true.


P(k+1) is

• We showed that P(k+1) is true under assumption that P(k)


is true. So, by mathematical induction for all positive
integers n.
06/29/2021 CSC102 - Discrete Structures 26

Chapter Exercise

Chapter # 5
Topic # 5.1
Q 3, 4, 5, 7, 8, 18, 20, 21, 31, 32, 33, 34

You might also like