Professional Documents
Culture Documents
PLG 3 Presentation
PLG 3 Presentation
PLG 3 Presentation
Programming Paradigms
Assignment
Step 1
Step 2
Step 3
Now , write k2 + k as part of an equation which
denotes that it is divisible by 2.
k2 + k= 2x
For some integer x.
Solve for k2. We will use this for substitution
later.
k2 = 2x - k
c)Prove the statement is true for n = K + 1
(k+1)2 + (k+1) = k2 + 2k + 1+ k+ 1
=k2 + 3k + 2
=k2 + 3k + 2
=(2x - k) + 3k + 2
=2x – k + 3k +2
=2x + 2k +2
=2(x + k + 1)
(k+1)2 + (k+1)= 2y
Where y= x+ k +1 ,and since x and k are
integers, therefore y is also an integer.
This means (k+1)2 + (k+1) is also divisible by 2.
By principle of mathematical induction , the
statement is true for all positive integers.
Example 2:
Use mathematical induction to prove that
n3 - n + 3n is divisible by 3 for all positive
integers n.
Solution
a) Is it true for n= 0 ?
n3 – n + 3 = (0)3 – (0) + 3
=0–0+3
=3
Yes , it is divisible by 3
b) Assume true for n = k
n3 – n + 3 = k3 – k + 3 Where
k = Z+
Next ,express k3 –k +3 as part of an equation
which suggests that it is divisible by 3
k3 – k + 3 = 3x
for some integer x
Solve for k3 . This will be used for substitution
later.
k3 = 3x + k - 3
c) Show that the statement is true for
n =k + 1
(k + 1)3 – (k + 1) + 3 =RHS
RHS =k3 + 3k2 + 3k + 1 - k -1 + 3
= k3 + 3k2 + 2k + 3
=(3x + k - 3) + 3k2 + 2k + 3
=3x + k - 3 + 3k2 + 2k +3
= 3x + 3k2 + k + 2k - 3 + 3
=3x + 3k2 + 3k
=3(x + k2 + k)
RHS = 3y
Notice , y = x + k2 + k. Since x and k are
integers, then y must also be an integer.
We have shown that (k + 1)3 – (k +1) + 3 is
divisible by 3.
By principle of mathematical induction, the
statement is true for all positive integers.
Example 3:
Use mathematical induction to prove that
22n - 1 is divisible by 3 for all positive integers
n.
Solution
a) Basis step: show the statement is true for
n=0.
22n – 1 = 22(0) – 1
=2 -1
0
=1–1
=0
Yes , 0 is divisible by 3
b) Assume the statement is true for n=k .
Substitute k for n to transform
22n – 1 to 22k – 1
Suppose k is a positive integer, if 22k – 1 is
divisible by 3 then there exists an integer x
such that
22k – 1 = 3x
Let’s solve for 22k . This will be used in our
inductive step in part c.
22k = 3x + 1
b)Prove the statement true for n = k + 1
22(k+1) – 1 = 22k+2 – 1
=22k .22 – 1
= 22. 22k – 1
=4 . 22k – 1
=4.(3x + 1) – 1
=12x + 4 – 1
= 12x + 3
=3(4x + 1)
22(k+1) – 1 = 3y
Note, y = 4x + 1. I hope you can see that
y is an integer since x is also an integer.
Clearly, 22(k+1) – 1 is divisible by 3.
By principle of mathematical induction,
the statement is true for all positive
integers.
Group-3 Members
James Lemayian Nakolah
Juma Ali Kiwaka
Perpetual Nduta Kabute
Joseph Mbote Mbogo
Brian Orori Athanas Simba