PLG 3 Presentation

You might also like

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

ICS 2304

Programming Paradigms
Assignment

Explain Divisibility using mathematical


induction
Steps to Prove by Mathematical
Induction

Step 1

Show the basis step is true. That is, the


statement is true for n=0
Steps to Prove by Mathematical
Induction

Step 2

Assume the statement is true for n=k.

This step is called the induction


hypothesis.
Steps to Prove by Mathematical
Induction

Step 3

Prove the statement is true for n=k+1.

This step is called the induction step


What does it mean by a divides b ?

Since we are going to prove divisibility statements, we
need to know when a number is divisible by another.
So how do we know for sure if one divides the other?

a
Suppose and b are integers. If a divides b , then
we can write it as an equation
b=ac

where c is some integer.
Example

2 divides 10 because 10=2 (5) where 5 is an
integer

8 divides 136 because 136=8 (17) where 17 is
an integer
Examples of Proving Divisibility
Statements by Mathematical
Induction

Example 1: Use mathematical induction to
prove that n2 + n is divisible by 2 for all positive
integers n.

Solution

Solution

a) Basis step: show true for n=0.
n2 + n = (0)2 + 0
=0+0=0
Yes , 0 is divisible by 2

b) Assume that the statement is true for n=k.

. Thus, n2 + n becomes k2 + k

where k is a positive integer.


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

You might also like