HOW TO PROVE THAT THESE ALGORITHMS ARE
CORRECT?
No. 1 function fib(n)
comment Return Fn
if n = 0 then return (0) else
a : = 0; b := 1; i :=2
while i < n do
c := a+b; a := b; b ;=c; i := i + 1
return(b)
No. 2 Proof for all n ∈ N, if 1 + x > 0, so (1 + x)n > 1 + nx
ANSWER No. 1
Recall on mathematical induction :
Claim for all n ∈ N,
𝑛(𝑛+1)
1+2+…+n= 2
When using induction to prove that some statement concerning the positive integer is true, the
following terminology is used :
1. The induction base is the proof that the statement is true fot n = 1 (or another initial
value)
2. The induction hypothesis is the assumption that the statement is true for an arbitrary n
> 1 (or another initial value)
3. The induction step is the proof that if the statement is true for n, it must be also true
for n + 1
Then
Induction base : for n = 1
1(1+1)
1= 2
(True)
Induction hypothesis : Assume, for an arbitrary positive integer n, that
𝑛(𝑛+1)
1+2+…+n= 2
Induction step : We need to prove that
(𝑛+1)(𝑛+2)
1 + 2 + … + n + (n + 1) = 2
To that end ,
𝑛(𝑛+1)
= 2
+ (n + 1)
𝑛2 +𝑛
= + (n + 1)
2
𝑛2 +3𝑛+2
= 2
(𝐧+𝟏)(𝒏+𝟐)
= 𝟐
(proved)
ANSWER No. 2
Claim for all n ∈ N,
Induction base : for n = 1
(1 + x)1 > 1 + 1.x (True)
Induction hypothesis : Assume, for an arbitrary positive integer n, that
(1 + x)n+1 > 1 + (n + 1)x
Induction step : We need to prove that
(1 + x)n+1 > 1 + (n + 1)x
(1 + x)n+1 > (1 + x)n (1 + x)1
(1 + x)n+1 > (1 + x) (1 + nx)
(1 + x)n+1 > 1 + (n + 1)x + nx2
nx2 must be > 0, then it can be excluded
(1 + x)n+1 > 1 + (n + 1)x (proved)