Lê Đ C Huy - ITITIU20212

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Name : Lê Đức Huy

ID : ITITIU20212

HW4

Part a
8.
Base step : n = 0, then we have
LHS = RHS so P(0) is true
Inductive step
Inductive hypothesis : for k ≥ 0

1−(−7)(𝑘+1)+1
2-2.7+2.72-…+2.(-7)k+2.(-7)k+1=
4

1−(−7)(𝑘+1)
We have + 2(-7)k+1
4

1−(−7)(𝑘+1) +8(−7)𝑘+1
=
4

1+7.(−7)(𝑘+1)
=
4
1−(−7)(−7)(𝑘+1)
=
4
1−(−7)(𝑘+1)+1
=
4
10.

𝑛 1 𝑛
a) ∑𝑖=1 = (1)
𝑛(𝑛+1) 𝑛+1

b) Base step : ∑1𝑖=1 1 = 1

Inductive step : we have for k ≥ 0


𝑛 𝑘+1
Replace P(k+1) in to , we get (*)
𝑛+1 𝑘+2

𝑘 1
We have +
𝑘+1 (𝑘+1)(𝑘+2)

𝑘(𝑘+2)+1
=
(𝑘+1)(𝑘+2)

𝑘 2 +2𝑘+1
= (𝑘+1)(𝑘+2)
(𝑘+1)2
=
(𝑘+1)(𝑘+2)
𝑘+1
= , this is equal to (*) , we can say that P(k+1) is true
𝑘+2

12.
Base case : n=0

20+1 +(−1)0
We get : =1
3.20

2(𝑘+1)+1 +(−1)𝑘+1
Inductive hypothesis: (*)
3.2𝑘+1
2(𝑘+1) +(−1)𝑘 −1
∑𝑘+1
−1 𝑗
𝑖=0 ( 2 ) = + ( 2 )𝑘+1
3.2𝑘
2(2𝑘+1 )+(−1𝑘 )+3(−1𝑘+1 )
=
3.2𝑘+1
2𝑘+2 −1(−1𝑘 )
= 3.2𝑘+1
2(𝑘+1)+1 +(−1)𝑘+1
= , equal to (*) , so P(k+1) true.
3.2𝑘+1
14.
Base case : (1-1)21+1 +2 = 2
Inductive case : prove the left hand side equal to k. 2𝑘+2 + 2 (*)
We have (k-1)2𝑘+1 +2 + (k+1).2𝑘+1

= k.2𝑘+1 - 2𝑘+1 + 2 + k. 2𝑘+1 + 2𝑘+1

= k. 2𝑘+1 + 2 + k.2𝑘+1
= 2k. 2𝑘+1 + 2
= k. 2𝑘+2 + 2 , equal to (*) , this is what we need to prove

16.
Base step: n=1
1.2.3.4
We get: =6
4
Inductive step: let n=k
𝑘(𝑘+1)(𝑘+2)(𝑘+3)
1.2.3+2.3.4+…+k(k+1) (k+2) =
4
For n=k+1, we have :
𝑘(𝑘+1)(𝑘+2)(𝑘+3)
+ (k+1)(k+2)(k+3)
4
𝑘(𝑘+1)(𝑘+2)(𝑘+3)+4(𝑘+1)(𝑘+2)(𝑘+3)
=
4
(𝑘+1)(𝑘+2)(𝑘+3)(𝑘+4)
=
4
So, for n= k+1 , the equation holds true for every positive integer n.
18.

a) P(2) = 2! < 22
b) Base step : n=2
2! < 22
-> 2 < 4 ( True)
c) Inductive hypothesis : n=k

k! < kk

d) We need to prove that the equation is true when n=k+1 , means (𝑘 + 1)𝑘+1
e) We have (k+1)! < (𝑘 + 1)𝑘 < (k+1)(𝑘 + 1)𝑘
and (k+1)! = k!(k+1)
Because k < k+1 , we get :

(𝑘 + 1)(𝑘+1)
f) Finally, after completing the base and inductive phases, the inequality holds for any
integer for any n ≥ 1, this is also true when prove n≥4.

22.
Base step : n = 1
12 ≤ 1! , we see in this case 1 = 1
Inductive hypothesis : n=k
For n=k + 1
We have the left hand side n2
(k+1)2 = k2+2k+1 ≤ k! +2k+1 ≤ k! +k!+k! ≤ 3(k!) ≤ (k+1) k! = (k+1)!
Part B
6.
a) We see that: two 3-cent and one 10-cent = 16c
three 3-cent = 9c
one 3-cent and one 10-cent = 13c
etc, …..
So any postage of 18 or more cents can be form using 3-cent and 10-cent stamps.
P(n) (n ≥ 18)
b) Basis step : P(18) = 6.3 = 18
P(19) = three 3-cent and one 10-cent
P(20)= two 10-cent
Inductive step : Assume P(k) is true (k ≥ 20)
- If P(k) uses three 3-cents, we can replace that stamp with a 10-cent one to obtain
P(k+1)
- If P(k) does not use three 3-cent, we must use only 10-cent stamps
Since k ≥ 20 , we must use at least two 10-cent stamps , if we use one 10-cent stamp
and three 3-cent stamps , we must replace three 3-cent with one 10-cent.

c) Basis step : P(18) = 6.3 = 18


P(19) = three 3-cent and one 10-cent
P(20)= two 10-cent
Inductive hypothesis : Assume P(k-3), P(k-2), P(k-1), P(k) are true for (k ≥ 20)
Inductive step :
Add one 3-cent . we get P(k+1-3)
And P(k-2) is true like we assumed , so its proven.
8.
P(65) = 25 + 40
P(75) = 25 + 25 +25
P(80) = 40 + 40
P(90) = 25 + 25 + 40
We see that each value is divisible by 5
Assume we have P(k - 5) , P(0), P(1) , P(2) , P(3) and is true (k ≥ 5)
By that way , we can add 25$ certificate and the value will still be divisible with 5

10.
We call P(1) , P(2) in order choco bar 1 and 2
P(1) = 1-1 = 0
P(2) = 2-1 = 1
Induction hypothesis
Assume that P(k) = k – 1 for all k ≤ x
We need to prove P(x+1) = x
We can get more piece of choco if we break choco bar size P(x) square
Means P(x+1) = 1 + P(x) = x
So if we can break choco bar size x+1 with k breaks , we can get an amount of choco pieces
12.
Base case : for n = 1 ,
20=1
Inductive hypothesis
𝑛+1 𝑛+1 𝑛+1
When n+1 is even , is an integer ( 1 ≤ ≤ n) , so =2a1+2a2+2a3+…+2an (
2 2 2
a1,a2,… an are distinct
When n+1 is odd , we can assume that n = 2a1+ 2a2+…+2an, and a1,a2,… are distinct
powers. Taking both sides mod 2 , Right Hand Side appears powers with positive integer
and the Left Hand Side = 0 . So n+1 =20+ 2a1+ 2a2+…+2an

14.
We assume n ≤ k.
Suppose we have k+1 stones and divide them into two groups x and k+1 – x . We get the
product xk + x – x2
Induction hypothesis :
(𝑘+1−𝑥)(𝑘+2−𝑥) 𝑥(𝑥+1)
+ + xk + x – x2
2 2
𝑘 2 +2𝑘−𝑥𝑘+𝑘+2−𝑥−𝑥𝑘−2𝑥+𝑥 2 +𝑥
= + xk + x – x2
2
𝑘 2 +3𝑘+2
=
2
(𝑘+1)(𝑘+2)
=
2

26
a) P(0) is true , then its also true for P(n+2) , 0+2=2 → true for even numbers
b) P(0) is true , then its also true for P(n+3) , 0+3=3 , its true for 3 , so its also true for
numbers that is divisible for 3
c) Base case : P(0) and P(1) is true
If P(n) and P(n+1) is true , then P(n+2) also true . So P(n) is true for all nonnegative
integer n.
d) Base case : P(0) is true
We can also show that it must hold for 2 = 0+2 and 3 = 0+3. For the value n=1, it is not
necessary to be true. It should, however, be true for every n > 1 number; we can
demonstrate this using inclusion.
P(2) and P(3) are already known to be true. If both P(n) and P(n+1) are true, we want to
know if P(n+2) and P(n+3) are true as well. However, these numbers are produced by
subtracting 2 and 3 from n, therefore the proposition must be true for those values
according to the hypothesis. As long as n 1, P(n) holds for any nonnegative integer.

Writing a program in C/C++ to compute and show a list of n Fibonacci (from 0 to n; n is entered from
keyboard). After running the program, there are two options: if user click to (1), it will run based on the
recursive algorithm. Else, it will run (2) based on the non-recursive algorithm.

Recursion :
Non-recursion :

You might also like