3 Algorithms-Section3
3 Algorithms-Section3
Section Content:
Mathematic induction
Mathematical Induction
Is a mathematical technique which is used to prove a statement, a formula or a
theorem is true for every natural number. The technique involves two steps to prove
a statement, as stated below –
Step 1(Base step) − It proves that a statement is true for the initial value.
Step 2(Inductive step) − It proves that if the statement is true for the n th
iteration (or number n), then it is also true for (n+1)th iteration (or number
n+1).
Example 1:
𝑛
𝑛(𝑛 + 1)
∑𝑖 = 1 + 2 + 3 + 4 + ⋯+ 𝑛 =
2
𝑖=1
Answer:
Base case: Show it is true for n=1
1(1+1) 2
1= = √
2 2
Inductive hypothesis:
1. Assume it is true for n=k
𝐾(𝐾+1)
1+2+3+4+…+K= form 1
2
2. prove it is true for "k+1"
(𝐾+1)((𝐾+1)+1)
1+2+3+4+…+K+(K+1)=
2
𝐾(𝐾 + 1) (𝐾 + 1)((𝐾 + 1) + 1)
+ (𝐾 + 1) = (∗ 2)
2 2
𝐾(𝐾 + 1) + 2(𝐾 + 1) = (𝐾 + 1)((𝐾 + 1) + 1)
𝐾(𝐾 + 1) + 2(𝐾 + 1) = (𝐾 + 1)(𝐾 + 2)
𝑡𝑎𝑘𝑒 (𝑘 + 1)𝑐𝑜𝑚𝑚𝑜𝑛𝑒 𝑓𝑎𝑐𝑡𝑜𝑟 𝑓𝑟𝑜𝑚 𝐿𝐻𝑆
(𝐾 + 1)(𝐾 + 2) = (𝐾 + 1)(𝐾 + 2) √
Eng. Rania Ahmed Eng. Sohaila Ahmed Eng. Nadeen Qadry Eng. Mostafa Sayed
Example 2:
𝑛
1 1
12 + 22 + 32 + ⋯ + 𝑛2 = 𝑛(2𝑛 + 1)(𝑛 + 1) , ∑ 𝑖 2 = 𝑛(2𝑛 + 1)(𝑛 + 1)
6 6
𝑖=1
Answer:
Base case: Show it is true for n=1
1 6
12 = (1)((2 ∗ 1) + 1)(1 + 1)) = √
6 6
Inductive hypothesis:
1. Assume it is true for n=k
1
12 + 22 + 32 + ⋯ + 𝐾 2 = 𝐾(2𝐾 + 1)(𝐾 + 1) form 1
6
2. prove it is true for "k+1"
1
12 + 22 + 32 + ⋯ + 𝐾 2 + (𝐾 + 1)2 = (𝐾 + 1)(2(𝐾 + 1) + 1)((𝐾 + 1) + 1)
6
1 2 1
𝐾(2𝐾 + 1)(𝐾 + 1) + (𝐾 + 1) = (𝐾 + 1)(2(𝐾 + 1) + 1)((𝐾 + 1) + 1) (*6)
6 6
)( ) ( ) 2
𝐾 2𝐾 + 1 𝐾 + 1 + 6 𝐾 + 1 = (𝐾 + 1)(2(𝐾 + 1) + 1)((𝐾 + 1) + 1)
(
(2𝐾 2 + 𝐾)(𝐾 + 1) + 6(𝐾 + 1)2 = (𝐾 + 1)((2𝐾 + 2) + 1)(𝐾 + 2)
(2𝐾 2 + 𝐾)(𝐾 + 1) + 6(𝐾 + 1)2 = (𝐾 + 1)(2𝐾 + 3)(𝐾 + 2)
𝑡𝑎𝑘𝑒 (𝑘 + 1)𝑐𝑜𝑚𝑚𝑜𝑛𝑒 𝑓𝑎𝑐𝑡𝑜𝑟 𝑓𝑟𝑜𝑚 𝐿𝐻𝑆
(𝐾 + 1)[ (2𝐾 2 + 𝐾) + 6(𝐾 + 1)] = (𝐾 + 1)((2𝐾 + 2) + 1)(𝐾 + 2)
(𝐾 + 1)[ 2𝐾 2 + 𝐾 + 6𝐾 + 6] = (𝐾 + 1)(2𝐾 + 3)(𝐾 + 2)
(𝐾 + 1)[ 2𝐾 2 + 𝐾 + 6𝐾 + 6] = (𝐾 + 1)(2𝐾 2 + 4𝐾 + 3𝐾 + 6)
(𝐾 + 1)( 2𝐾 2 + 7𝐾 + 6) = (𝐾 + 1)(2𝐾 2 + 7𝐾 + 6) √
Eng. Rania Ahmed Eng. Sohaila Ahmed Eng. Nadeen Qadry Eng. Mostafa Sayed
Example 3:
𝑛
3𝑛2 + 17𝑛
∑(3𝑖 + 7) =
2
𝑖=1
Answer:
3𝑛2 +17𝑛
10 + 13 + 16 + ⋯ + (3𝑛 + 7) =
2
Base case: Show it is true for n=1
3(1)2 +(17∗1)
((3*1)+7) =
2
20
10 =
2
10 = 10 √
Inductive hypothesis:
1. Assume it is true for n=k
3𝑘 2 +17𝑘
10 + 13 + 16 + ⋯ + (3𝑘 + 7) =
2
form 1
2. prove it is true for "k+1"
3(𝑘+1)2 +17(𝑘+1)
10+13+16+⋯+(3k+7)+(3(K+1)+7)=
2
3𝑘 2 +17𝑘 3(𝑘+1)2 +17(𝑘+1)
+(3(K+1)+7)= (*2)
2 2
2
3𝑘 + 17𝑘+2(3(K+1)+7)= 3(𝑘 + 1)2 + 17(𝑘 + 1)
2
3𝑘 + 17𝑘+6(K+1)+14= 3(𝑘 + 1)2 + 17𝑘 + 17
𝑢𝑠𝑒 square brackets 𝑓𝑜𝑟𝑚𝑢𝑙𝑎𝑠 𝑡𝑜 𝑠𝑜𝑙𝑣𝑒 (𝑘 + 1)2
3𝑘 2 + 17𝑘+6K+6+14= 3(𝑘 2 + 2𝐾 + 1) + 17𝑘 + 17
3𝑘 2 + 23𝐾+20= 3𝑘 2 + 6𝐾 + 3 + 17𝑘 + 17
3𝑘 2 + 23𝐾+20= 3𝑘 2 + 23𝐾 + 20 √
Eng. Rania Ahmed Eng. Sohaila Ahmed Eng. Nadeen Qadry Eng. Mostafa Sayed
Example 4:
𝑛
1
∑(2𝑖 − 1)2 = 𝑛(2𝑛 − 1)(2𝑛 + 1)
3
=1
Answer:
1
1 + 9 + 25 + ⋯ + (2𝑛 − 1)2 = 𝑛(2𝑛 − 1)(2𝑛 + 1)
3
Base case: Show it is true for n=1
1 3
(2(1) − 1)2 = (1)((2 ∗ 1) − 1)((2 ∗ 1) + 1)) = = 1 √
3 3
Inductive hypothesis:
1. Assume it is true for n=k
1
1 + 9 + 25 + ⋯ + (2𝐾 − 1)2 = 𝐾(2𝐾 − 1)(2𝐾 + 1) form 1
3
2. prove it is true for "k+1"
1
1 + 9 + 25 + ⋯ + (2𝐾 − 1)2 + (2(𝐾 + 1) − 1)2 = 3 (𝐾 + 1)(2(𝐾 + 1) − 1)(2(𝐾 + 1) + 1)
1 1
𝐾(2𝐾 − 1)(2𝐾 + 1) + (2(𝐾 + 1) − 1)2 = 3 (𝐾 + 1)(2(𝐾 + 1) − 1)(2(𝐾 + 1) + 1) (*3)
3
𝐾(2𝐾 − 1)(2𝐾 + 1) + 3(2(𝐾 + 1) − 1)2 = (𝐾 + 1)(2(𝐾 + 1) − 1)(2(𝐾 + 1) + 1)
𝐾(2𝐾 − 1)(2𝐾 + 1) + 3(2𝐾 + 2 − 1)2 = (𝐾 + 1)(2𝐾 + 2 − 1)(2𝐾 + 2 + 1)
𝐾(2𝐾 − 1)(2𝐾 + 1) + 3(2𝐾 + 1)2 = (𝐾 + 1)(2𝐾 + 1)(2𝐾 + 3)
𝑡𝑎𝑘𝑒 (2𝑘 + 1)𝑐𝑜𝑚𝑚𝑜𝑛𝑒 𝑓𝑎𝑐𝑡𝑜𝑟 𝑓𝑟𝑜𝑚 𝐿𝐻𝑆
(2𝐾 + 1)[ 𝐾(2𝐾 − 1) + 3(2𝐾 + 1)] = (𝐾 + 1)(2𝐾 + 1)(2𝐾 + 3)
(2𝐾 + 1)[ (2𝐾 2 − 𝐾) + (6𝐾 + 3)] = (2𝐾 + 1)(𝐾 + 1)(2𝐾 + 3)
(2𝐾 + 1)[ 2𝐾 2 − 𝐾 + 6𝐾 + 3] = (2𝐾 + 1)(2𝐾2 + 3𝐾 + 2𝐾 + 3)
(2𝐾 + 1)(2𝐾 2 + 5𝐾 + 3) = (2𝐾 + 1)(2𝐾2 + 5𝐾 + 3) √
Eng. Rania Ahmed Eng. Sohaila Ahmed Eng. Nadeen Qadry Eng. Mostafa Sayed
Example 5:
𝑛
1 1
13 + 23 + 33 + ⋯ + 𝑛3 = 𝑛2 (𝑛 + 1)2 , ∑ 𝑖 3 = 𝑛2 (𝑛 + 1)2
4 4
𝑖=1
Answer:
Base case: Show it is true for n=1
1 4
13 = (1)2 (1 + 1)2 = √
4 4
Inductive hypothesis:
1. Assume it is true for n=k
1
13 + 23 + 33 + ⋯ + 𝐾 3 = 𝐾 2 (𝐾 + 1)2 form 1
4
2. prove it is true for "k+1"
1
13 + 23 + 33 + ⋯ + 𝐾 3 + (𝐾 + 1)3 = (𝐾 + 1)2 ((𝐾 + 1) + 1)2
4
1 2 (𝐾 2 3 1 2 ((𝐾
𝐾 + 1) + (𝐾 + 1) = (𝐾 + 1) + 1) + 1)2 (*4)
4 4
𝐾 2 (𝐾 + 1)2 + 4(𝐾 + 1)3 = (𝐾 + 1)2 ((𝐾 + 1) + 1)2
𝐾 2 (𝐾 + 1)2 + 4(𝐾 + 1)3 = (𝐾 + 1)2 (𝐾 + 2)2
𝑡𝑎𝑘𝑒 (𝑘 + 1)2 𝑐𝑜𝑚𝑚𝑜𝑛𝑒 𝑓𝑎𝑐𝑡𝑜𝑟 𝑓𝑟𝑜𝑚 𝐿𝐻𝑆
(𝐾 + 1)2 [𝐾 2 + 4(𝐾 + 1)] = (𝐾 + 1)2 (𝐾 + 2)2
𝑢𝑠𝑒 square brackets 𝑓𝑜𝑟𝑚𝑢𝑙𝑎𝑠 𝑡𝑜 𝑠𝑜𝑙𝑣𝑒 (𝑘 + 2)2
(𝐾 + 1)2 [𝐾 2 + 4(𝐾 + 1)] = (𝐾 + 1)2 (𝐾 2 + 4𝐾 + 4)
(𝐾 + 1)2 (𝐾 2 + 4𝐾 + 4) = (𝐾 + 1)2 (𝐾 2 + 4𝐾 + 4) √
Eng. Rania Ahmed Eng. Sohaila Ahmed Eng. Nadeen Qadry Eng. Mostafa Sayed
Assignment
Example 1: prove by mathematical induction.
1
1 + 5 + 52 + 53 + ⋯ + 5𝑛−1 = (5𝑛 − 1)
4
𝑛(3𝑛−1)
1 + 4 + 7 + ⋯ + (3𝑛 − 2) = 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑣𝑎𝑙𝑢𝑒𝑠 𝑜𝑓 𝑛 ≥ 1
2
Eng. Rania Ahmed Eng. Sohaila Ahmed Eng. Nadeen Qadry Eng. Mostafa Sayed