0% found this document useful (0 votes)
2 views22 pages

Unit 2 DMS

The document discusses linear recurrence relations of various orders, including first, second, and higher orders, with constant coefficients. It explains how to solve these relations using characteristic equations and provides examples for finding general and particular solutions based on initial conditions. Additionally, it introduces the inclusion-exclusion principle for counting elements in finite sets with examples illustrating its application.

Uploaded by

Preetham Poojya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views22 pages

Unit 2 DMS

The document discusses linear recurrence relations of various orders, including first, second, and higher orders, with constant coefficients. It explains how to solve these relations using characteristic equations and provides examples for finding general and particular solutions based on initial conditions. Additionally, it introduces the inclusion-exclusion principle for counting elements in finite sets with examples illustrating its application.

Uploaded by

Preetham Poojya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

LINEAR RECURRENCE RELATION -e1atioJ1 of

. . . f fi . .
A hnear recurrenc e relation of degree k with constant coc 1c1ents ts a recurre
nee t

the form
0
an= C 1an-l + C2an-2 + CJan-3 + ... ... + Ckan-k. Where C1, C2,.... Ck are real numbers and o~.-!

First Order recurrence relation is in the form


an= can-t + f(n) for n>=l
where c is a constant and f(n) is a known function .
If f(n) = O, the relation is homogeneous otherwise non-homogeneous.

Second Order Recurrence Relation.


A recurrence relation of the form
an = Cl an-1 + C2 an-2

is called linear, homogeneous, second order recurrence relation with constant coefficient
where Cl and C2 are not equal to zero.

Linear - All exponents of the an' s are I


Homogeneous - All the terms have the same exponent
Second order - an depends on an-I and an-2

Higher Order Recurrence Relation

Third order: an = Cl an-I + C2 an-2 + C3 an-3


Fourth order: an= Cl an-1 + C2 an-2 + C3 an-3 + C4 a 0 -4

nth order: an= Cl 3n-1 + C2 3n-2 + C3 an-3 + C4 3n-4 ••••••••• +Ck 3n-k

Where CI , C2, C3, .. ., Ck be constants which are not equal to O

*) Solving Second Order Linear Recurrence Relation


an = Cl an-t + C2 an-2
Definition:
Given an= Cl an-I + C2 3n-2,
The characte1istic equation of the recurrence relation is r2- Cir_ C2
'
C as e 1: If the roo ts are real and disti nct
·
G 1vcn , - C I a 1 + C2 an-2,
an - n- .
_, _ 1 d di stinc t and satis fy th e char actcn. stic
. uatio n of the relat ion ,
r1 and r 2 are r ca an cq ... n
. . === C(n n ) + D(n " ) whe re n = 0
d C and D are cot1 st~ ·tS -
G ener aI S o IutJon 1s an 2 11
, I, , · · · an

Case 2: If the roots arc real au d equa l


Given aa = C 1 aa - 1 + C2 a n-l, . .
uaJ roots and ro satis fy the char acter istic equa tion
It prod uces eq of the relat ton,
· · an = C( ") + D(nr o") whe re n = 0, 1, 2,. · .. n and C and D are cons tants .
Gene ral Solut10n 1s ro

Case 3: If the roots are com plex and disti nct

Given an = CI au- I + C2 8n-2,


It prod uces com plex and disti nct root s

General Solu tion is an = r" ~C:. cos (n6) + Dsm


• ~ TFh
(n6.2Jw ere n -- o, 1, 2 , · · · ·n and C and D are
constants.

Example 1: Let an= San-I - 6an-2- Find the general


solution.

Solu tion: Equation can be written as an - San-I+ 6an-2 = 0


Characteristic equation: r2 - 5r + 6 = 0
Hen ce (r - 2) (r - 3) = 0 imp lyin g either (r - 2) = 0
or (r - 3) = 0
The roots are real and distinct; n = 2, r2 = 3,
Substitute in the General solution
General Solution is an = C(2°) + 0(3° ).

Once we have found the general solution to a recurren


ce rela tion , if we hav e a suff icie nt num ber
of initial conditions, we can find the particular solution
.
This means we find the values for the arbitrary cons
tants C and D, so that the solu tion for the
recurrence relation takes on those initial conditions.

Example 2: For the last example, we found the recu nen


ce rela tion a 0 = 5a0 _, - 6a _ bas gen eral
0 2
solution an = C(2 ") + D(3 11) . Find the particular solu tion whe
n ao = 9 and a 1 = 20.
ao = C (2°) + D (3°) = C + D = 9
a,= C (2 1) + D (3 1) = 2C + 30 = 20
so 2C + 2D = l8
2C + 30 = 20
so 0 = 2 and C = 7. Therefore, the particular solution is: an = 7(2n) + 2(3n) .

Example 3: Wbat is tbe solution for tbe recu1Tence relation an = an-I + 2an-2 with ao = 2 and a t
= 7?
Recurrence relation an = an- I + 2an-2
Characteristic equation: r2 - r- 2 =O
(r- 2) and (r + 1), Therefore r1 = 2 and r2 = -1
General Solution: an= C(2n) + D(-1").
Particular Solution:
ao=2
ao = C(2°) + D(-1 °) =2
C+D=2 (Equation 1)

a1 = 2C -D = 7 (Equation 2)
From Equation 1 and 2
C+D=2
2C-D= 7

3C = 9; C = 9/3 = 3
Apply C in Equation 1; 3 + D = 2; D = -1
Therefore Particular Solution is: an= 3(2°) - (-1 °).

Assignment I: Solve the recurrence relation Fn = 5Fn-1-6Fn-2 where Fo= 1 and F1 = 4


: ;-; l aJJd a,
Example 4: What is the solution for tbe recurrence relation an= 6an-l - 9an.2 v.ritb ao
= 6?
Recurrence relation an= 6an-1- 9a 11 • 2
Characteristic equation: .. ~ - 6r + 9 = O
(r - 3) and (r - 3), Therefore r = 3

General Solution: an= C(3") + D(n3").


Particular Solution:
ao= l
ao= C(3°) + D(O x 3°) = 1
C=1 (Equation 1)
a1 = 6
a1 = C(3 1) + D( 1 x 31) = 6
a1 = 3C + 3D = 6 (Equation 2)
From Equation 1 and 2
C=1
3C +3D = 6

3 + 3D = 6; 3D = 6 - 3 = 3
D = 3/3 = 1

C = I andD = 1

Therefore Particular Solution is: an = (3°) + (n3°).

Example 5: Find the explicit fom,ula for the Fibonacci numbers (fn = fn.1 + f11.2) with the initial
conditions fo = 0 and f1 = 1)

Recurrence Relation fn = fn-1 + fn-2


fn - fn-l - fn-2= 0
Characteristic equation: r2 - r - 1 = 0
Characteristics roots are r1 = (1 + ✓s) / 2, r2 = (1 - ✓5) / 2
General Solution is a0 = C [(l + ✓s) / 2] '4 D [(l - ✓5) / 2] 0
Par ticu lar Solution:
Equation I
ao = O; C+ D= O
C [(I + ✓5) / 2] +0[(1- ✓5) / 2] = J
Equ atio n2
a, = I;
we get C = 1/✓5, D = -1/✓5
When we solv e these thre e equ atio ns,
The refo re Par ticu lar Solu tion is an=
1/✓5 [(I + ✓5) / 2] "+ -J/✓ 5 [(1 - ✓s) / 2]"

( The orem : If the recurrence relation a11


== C I a11 _ 1 + C2a11 _2 + C3an -J + ...... + Ckan
-k, has a
+
= o, then the General solution is an= C (ri")
characte1istic equation t' -c1,-k - • • • • • -Ck
1

D (r:i") ... .. + N(n ").

rrence relation aa = 6an-J - l lan-2 + 6an-3 with ao=


Example 6: What is the solution for the recu
2, a1 = 5 and a2 = 15?
Recurrence relation: an - 6an-l + 1lan-2 - 6an-3
Characteristic equation: r3 - 6r2 + 11 r - 6 =
O
3; because r - 6r2 + 1 lr - 6
3 = (r - 1) (r- 2) (r-
Characteristics roots are r = 1, r = 2 and r =
3)

General Solution is an = C (1 °) + D (2°)


+ E(3°).

Particular Solu tion :


ao= 2; C+ D+ E= 2 Equation 1

C+ 2D+ 3E= 5 Equation 2

C+ 4D + 9E= 15 Equation 3
C = 1, D = -1 and E = 2
When we solve these three equations, we get
(2°) + 2(38 ) .
Therefore Par ticu lar Solution is an = (1 °) -

m2, m3 .... mn ...


Theorem: If the roots are multiplicities ml,
3 4 + C6n 5 ••••• )rt 0 + (Ct +C m+ C3n 2 + C4n3 + Csn 4
2
Then an= (C1 + Cm + C3n + C4n + Csn
2 3 4 C6n 5 ..... ) n°
+ C6n
5
••••• ) n° ..............+( C1 + C2n + C3n + C4n + Csn +
?W
Example 1: Suppose that the roots of the
Characteristic equation are 2, 2, 2, 9 hat
5, 5 and ·
is the form of general solution?

General Solution is= (Ct + C2.n + C3n 2) 211


+ (Ct + C2n) 511 + (C) 911

Example 1: Find out the solution to the


recurrence relation an= -3an-l - 3an-2 - an-3 with the
initial conditions ao = l , a1 = -2 and a2 = -1
(roots are -1 , -1, -1)

Assignment:
1) an = San-I - 6an-2 with the initial condition
s ao = 1, a1 = 0
2) an= 4an-t - 4an-2 with the initial condition
s a0 = 6, a1 = 8
3) an= -4ao-J - 4ao-2with the initial condition
s ao = 0, a1 = 1
4) an= 4an-2 with the initial conditions ao =
0, a1= 4
INCLUSION AND EXCLUSION PRJNClPLE:
Ler A , B be any two fi nite sets.

Then IA u B/ = IAI + IBI - IA n Bl


Herc wc "incl ude" JAi and IBI and we "excl ud e" JAn Bl
Suppose A , B, C arc fi nite sets. Then A U B u C is fini te
IA u B u q = IAI + /Bl + /Cl - /A n Bl - IA n q _/B n q + l(A n B n C)I

Example I:
How many bit strings of length eight either start with a l bit or end with the two bits 00?
7
Number of bits start with 1 = 2 = 128
6
Number of bits end with 00 = 2 = 64
Number of bits start with 1 and end with 00 = 25 = 32
According to the inclusion and exclusion principle bit strings of length eight either start with a
1 bit or end with the two bits 00 = 128 + 64 - 32 = 160

Example2:
A computer company receives 3S0 applications from computer graduates for a job
planning a line of new Web servers. Suppose that 220 of these people majored in
computer science, 147 majored in business, and Sl majored both in computer science and
business. How many of these applicants majored neither in computer science nor in
business.
Number of people majored in computer science= 220
Number of people majored in business = 147
Number of people majored in both = 51
Therefore Number of people majored either in computer science or business= 220 + 147 -51
= 316
Number of People majored neither in computer science nor business= 350 - 316 = 34

Example 3:
In a discrete mathematics class every student is major in computer science or
mathematics or both. The number of students having computer science as a major is 25;
the number of students having mathematics as a major is 13; and the number of students
-
· · in both computer science
maJonng
nd
are ill tbiS
cIass.? a mathematics isl8. How many ·students

/AU B/ =/A/+ /8/- /An B/


Tbe number of students having compute 1. . .
• sc ience as a rna.1or /Al = 25
Tbe number of students having mathemati .
~ cs as a rnaJor /Bl = .13
TI1e number of students majming in b I .
OtJ computer science and mathematics /An Bi =18
Therefore Total uumber of students in th I
• c c ass /A U Bl = IAI + IBI - IA n Bl
= 25 + 13 -8
= 30
Example 4:

How many positive integers are not exceeding 1000 are divisible by 7 or 11?
The number of positive integers not exceeding 1000 that are divisible by 7 IAI = 11000171
The number of positive integers not exceeding 1000 that are divisible by 1 I IBI = II 000/1 I I
The number of positive integers not exceeding 1000 that are divisible by 7 and 11 jAnBI =
/100017 x 11 /

TI1e number of positive integers not exceeding 1000 that are divisible by 7 or 11 jAUBI = IAI +
/B/-/AnB/

/AUB/ = 142 + 90 +-12


=220
Example S:
Suppose that there are 1807 freshmen at your school. Of these, 453 are taking a course in
computer science, 567 are taking a course in mathematics, and 299 are taking courses in
both computer science and mathematics. How many are not taking a course either in
computer science or in mathematics?
Number of students taking a course in Computer Science IAI = 453
Number of students taking a course in Mathematics IBI = 567
Number of students taking a course in both computer science and mathematics jAnBI = 299
Therefore, The number of students taking course in either computer science or mathematics
/AuB/ = /Al+ /Bl -IAnB/
= 453 +567 -299 = 721
The number of students not taking course in either computer science or mathematics =
1807 - 721 = 1086
Example 6: b
A total of 1232 students have taken a course in Spanish. 879 have taken a course ill freflC
nisb
and 114 have taken a course in Russian. Further, 103 have taken courses in both Spa
and French. 23 have taken courses in both Spanish and Russian and 14 have ta1'e1l
courses in both French and Russian. If 2092 students have taken at least one of Spanisll,
French and Russian, how many students have taken a course in all three languages?
The number of students taken a course in Spanish IAI = 1232
The nwnber of students taken a course in French IBI = 879
The number of students taken a course in Russian ICI = 114
The nwnber of students taken a course in Spanish and French jAnBj = 103
The number of students taken a course in Spanish and Russian jAnq = 23
T11e nwnber of students taken a course in French and Russian jBnq = 14
The number of students taken at least one course in Spanish, French and Russian \AUBUC\ =
2092
Therefore, the number of students taken a course in all three languages \AnBnq =?
IAuBuq = IAI + IBI + ICI - IAnBI - IAnq -IBnq + IAnBnq
2092 = 1232 + 879 + 114-103 -23 - 14 + IAnBnq

IAnBnq= 7
Therefore, there are seven students who have taken courses in Spanish, French, and
Russian

Example 7: Give a formula for the number of' elements in the union of' four sets.
IAUBUCUDI = IAI + IBI + ICI + !DI
-IAnBI - IAnq - IAnoI - IBnq -1Bno1 -1cno1
+ jAnBnq + jAnBnoI + 1Ancno1 + jBncno1
-IAnBncno1
Generating Functions

Consider a sequence of real numbers au, a,. a2, a3.... \el us denote the sequence by ar, where r =

0, 1, 2, 3, ...
Therefore ar == ao, a ,, a2. a3, a4. ...

Suppose there exists a function f{x) whose expansion in a series of powers of x is shown below
1
f(x) == ao.X0 + a1.XI + a2.x-+ · · · r '\
- - - - - - - -11., J
f(x) can also be written as ftx) ~) 0 to 1t ar_,,,f· .Jf t-i. ) -=- ~ tl.11 ,c.
Here f(x) is called as function for the sequence of ao, a 1, a2, a3 ....

1/(1 + x) = (1 + xY1 = lx0 -x 1 + x2 - x3 + x4 .... = 1 - x + x2 - x3 + x4 ....

1/(1- x) = (l - xY1 = lx0 + x1 + x 2 + x 3 + x4 .... = 1 + x + x2 + x3 + x4....


1/(1 + x) 2 = (1 + x)-2 = lx0 - 2x1 + 3x2 - 4 x3 +... = 1 - 2x + 3x2 - 4 x 3+....
1/(1- x) 2 = (1- x)-2 = lx0 + 2x 1 + 3x2 + 4x3 + ... = 1 + 2x + 3x2 + 4x3 + ....
1/(1 - xt) 1 = (1 - xtY1 = x0t 0+x 1t 1+x 2 t 2+x3 t3+ .. ·+xr tr = 1 + Xt + X2 t2+ X3 t3 + •"+Xr tr
1/(1-txt) l = (1 + xt)-1 = xoto+xitI+xz t2+x3 t3+.. ·+xr tr = 1 - xt + x2 t2- x 3 t3+ .. ,_xr tr

Example 1: Find out the generating function of the given sequence 1, 1, 0, 1, 1, 1 ....
Given Sequence= 1, 1, 0, 1, 1, 1. ...

ao = 1, a 1= 1, a2 = 0, a3 = 1, 34 = 1, as = 1....
Generating function f(x) = aox0 + a1 x 1+ a2x 2 + a3 x3 + 34x4 + as x5 ...
Substitue the valuees ao = 1, a1 = 1, a2 = 0, a3= 1, 34 = 1, as= 1
f(x) = 1 x0 + 1 x 1+ 0x2 + 1 x3 + 1 x4 + 1 x5 . .•
= 1 + x + 0 + x 3 + x4 + x5 + x 2 - x 2 (Add and Subtract x 2)
= 1 + x + x2 + x3 + x4 + x5 -x2
f(x) = {l-xf 1 -x2
f(x) = 1/(1 -x) - x 2
1'"'' tnf ·K11 rn•o•finJ ton,C,n 'l jJ,, t1Wfl
f , - 1I 0 I - I I
1I - I - -

0 c1'. > - ctb x t


t
a, r +a, 1.I J
i Q1i
J
-f ~ ;1
lf
1- --

1~u~fktu.t -fu v~Cu.A


1
tl 1 J === 11
'
+ c- 1) x. ' + 0 c1. i J + c-,J J.. 3 + '-' ).X..1 -I t - q r,
0
- I -j.f'/,l-_x3+j.~- 'J..5 __

- t - 1 t ~ x 3 +~ Lf - ~ r:; -f-x.,. -1 l ( acfcf or,J ~Jt-tru.l i

- I-Xtl2.-.x.. 3 +:t.~-i'j -X. 2


_,
ll 1 ) ::: ( H- 1) - 'J.
2

fCt.) ::; ~ - j.. 2.

(1+1)

&ii'ven ~o ~ ,' a' ~ zi 42. = 3 I a, =- ~ , t.\ 4 = ~- - -

bct. ) :::. Qo t
0 L
, Cl, j. I f Qz l
l
f Q3,!. J f ~ ;t. "f __ _

~ ~v~
bc.1) ::::. , i of 2 '1- '+ , 'j., + .,_ 3 +; 1. 4_ _ _
1 ~

-:::: I I t'l'J. + 31 2 tlft 3+6:x.'ft · --- . . .


-i
- (f-:C)

- -
(f-X)
(
2..
IP'\ ~ Tl'ld(J l,f ~ II -1. ; - ,, -
..., c,- - T ' I I -· -

tel) : :- llt1
Cl I
·t Q,.1 f-ct,. l
'2
+Of ;t.
J
t q,, i Lf- - -
~l~&ti f;. ,fu VO.U~

yx) =- I -l f (- 2) l I t ', (l 1
) 1 c-,o j ~ f- - - -

::: 11-2,i t'3i).-tft


3
+- --
-i
:: (If '.l)
I
- 2.
cH-:O

{1.o.m("- ,; : l1 I " I Lf I ~ I LI

(SWJ'117 ~ '1• == 4, ct,:: 4, ai:::: 4, t11 = LI, al.I ==- Lt - - -


~
be;() == aot-·

+Q, 1 I
t Q,J.
}
t Cl3 X, f- - --
~j.bl;...ti,J · ~ v~
3
bu.' : : ; ui + 'it + /,ft.-2. t
0 f
t-ti +-- ..
== ~ +t.tx +'1t1. +t<:t. 1+- - -
::::. ii ( l+:t +'X ti ~ f
l,
- --

- Ci( l-1.)-•

- tJ
tCV
- '
--
0 - l)
de
11 , - ,, , o1 c: 6, a1 ·~ a,, 1C 1

I( l l

Vo&,tB
4
61 -f ~
t I 2
?1 +- "f 1 1 J. J --I IO l .
b(l ) :::=

== :l ➔ 4:£ t 6x i. +f l :w:-9 + 101 ~- - -

7.J( 1+2x.+ 3.1 2. + ,,,t 3 t - - ~

t ( I -X )-' lv
~

~ / ,J .
IJt. ~T ,' ·O I O I 0 I 2 I t.f J ' J q I IOJ - - - -
\.. 1 - - .

Qi ,: O, QJ =:; 2./ Q"f .:::6 / Qf :.f t>/ -· - ~


{;tj ,JU): ao:::. 0 I Q1:::: 0 I

be t): ::. Oo'X


o
+- Q, t
I
+ Q2'i l +lJ3i ' f -- -
' ~
::= 01..

+ 01.. ·r t
O' l
,z.
f Zl +~,x~+6fX t- -- -

o+ o+ o + 2t +~ ;;' f +btx."t - -·
3
===

2:t.
1
ft t j &f X 'f -- -

:::. 21
3
(If it +3lX t~Sl t- --) 2 3

- 2:x:3 C1t2x.+~x +~i


2 3
+- - -J
Jil 3 ( f-.1 )
-z

- 2-
( 1- X)
') q . ·1 1 (,,
• I 1 1

~ I
;:- I 1.. ~ ( -
C
3 ),
f
f q (1 1
) + (. '? f ) '). /
4 0I( I )

~ I - 3-X +q X 1 _ 2 J. t:
1 +'o I 'J. 'f 1
_,
::: ( I t 5X)

b<X) - -
( I f-- 3.I)

: : . / +IfX i ~ 2 6" X ~ t l 2-6' 7.. ~ f - --

f FjX.'Z X +- r;1.? ,.,_, t- - - -


2
:::: f + fit' 1.
_,
- (' +&"~ ,:x.)
_,
- c t+ 6x J 2

( lr' Ff:J..'J.)
lt\!1'('U ft, I
', 1 1, w ,11.,~ ,

1 ~
l l \ (kl
(
f ll, "/. f
'
Q) '( f fl,J 1 I- --

f 2 ~ 1 ~ -I - -
I 1
,:., l r I 11 J f IV X

3
~ ( 1t I ) t (If 3) l. t ( It 9 ) X. 2 f- (f t ? t) t ·f - -

-
1
(r+- 1l+ 1+3 .r +-x tq x
2 +-x 3+ i l-x. 3
3
- '+- 1. t- 'X J +-x' +- -- + 1+ 31 r qx i t- ?. t:x
-I _,
to; - (f- XJ + U- 3:x )
{C t ) - -I +- - I

(1- i) ( f - '3:t)

(> i ·iwnU ti itt {<,.etv'w.m5 fvS5otiCL1;_! wi'fe, ift2 ~~wd.l~(

-e1trunt{
2. j
&
I).. f fj :t f lo J.-
I
t tr; 1, - - -


t6

nl I

'f\,I ( n _qv)~
(1N111lt 1 : ,' ,, I "II I {f., 11
' ur, f, rt lr,1

1/ \
' \j

l ' •I i :· 1r,M11al thrc~1M


lJ
'l 'l n-7\. ~:
(I1~ ) - i:
( nr I X {hd n (n tU(J ofi ,{M,1f /r/W;
I
1,'1 :: 0 9t

n n-1 () -) (I -',
·1
n r
I z' 1 nc
'2
C I '.X,
0
-t nc
I 7.
I l + nr3 1 J.

+ ncI 1. + nc2 1.1 f- nl3 j. ~


t I
nl X
0

n< nc
(J I I I

3
- :; (1+1)
1 ~1 , ~ ::;; t.. , n~3
3 nf n-'1- 3-o o 3~1 1 3 - 2. -i ~- · 3
(3t :t.J :::: t 3 1.~5l 3 1. t 3c 3 ,., +- 3c 3 1- r 'r 'l
1

rn~o c 1 2 ~
2. j
= fii'f -t -~t1xt3X3.'.l tl 1
::: t'}f- 2.};( f.q .X
1
.f<t 3
I ~, '. / (. ) '
'( t z.
I 3
. .. ~
(' I
f 1
-- ---
II
+ J
7~
1' 1- ~ ~ -- -
,_-
3I
:l o
+ (?1 )'J., + (_Z-;r.)+'J
I
c =- (7 X) t 0 J. )
-C'/ ---I(- ---zl.- _,__.
9, /.
_ _,

+ LiXt I-- 'b1-J


- I+ ~ 1 :t.
- -- 2' 6
t· ... -

l r- 21 ~ 7 'J.. '2. t Li 'J. 3 1--


---
- 3
.. - -

l j 3
H- 'tX+ - ii +-
-
L1j
3
} 3,:

~ 1+ ix + z:r '2, + x' c~f-3)


3
- It- 2-X t· z,:xz t
--
J3:t3
3
+---
I
. Mathematical Induction
Mathematical Induction is a math . .
a
emat1cal techrnque which is used to prove a statement '
form ula or a theor · tru c-
em is e •0 r every natural number.

TI1e techn ique involv es tw o steps to prove a statement, as stated below:

initial value.
Step l(Ba se step): It proves that a statement is true for the
i.e, P(I) = True

true for the nth iteration (or number


Step 2(Inductive step): It proves that if the statement is
1).
n), then it is also true for (n+ 1) iteration ( or number n+
111

I+ 2+ 3+ ... n = n (n+ l )/2 using


Exam ple 1: Show that if n is a positive integer, then
Math emat ical Induction.

Basic Step: P (l) is true because l=l (l+ l)/2


1=1

Inductive Step: Assu me P (n) is true


1 + 2 + 3 + .....n = n (n+ I)/2
Unde r this assum ption it must be show n that P (n + 1)
is true
(1)
P (n): 1 + 2 + 3 + ... ..n = n (n+l) /2 -----------------------------------
P (n + J ) I + 2 + 3 + ... .. n + (n + 1) = (n + 1)((n+ 1) + 1)/2
I+ 2 + 3 + ..... n + (n + l) = (n + 1) (n + 2)/2 ---------------- (2)
Now Show that LHS = RHS in equa tion 2
Appl y Equation 1 in Equation 2
n(n+ l)/2 + (n +I)= (n + 1) (n + 2)/2

LHS: = (n 2 + n) / 2 + (n + 1)
= (n 2 + n + 2n + 2) /2
= (n 2 + 3n + 2)/2
= (n + I ) (n + 2) /2

LH S = RHS; Thus Prov ed


Example 2: Show that 'f .
I n is a positive inte
(□+2))/3 using Math . ger, then 1.2+ 2.3+ 3.4+ ... n (n+ l) = (n (n+I)
ematical Induction.

Basic Step: p (J ) is tme because


l(l+l) = I (I+ 1)(1 +2)/3
2 == 6/3
2=2
Inductive Step: Asswne p (n) is true

1. 2+ 2 -3 + 3.4+ •.. n (n+ I)= (n (n+ 1) (n+2))/3


Under th.is a · ·
ssumption It must be shown that P (n + I) is true
p (n): 1.2+ 2.3+ 3.4+ ... n (n+ 1) = (n (n+ 1) (n+2))/3 ----------------------------------- (I)
p (n + I) 1.2+ 2.3+ 3.4+ ... n (n+l) + (n+I) (n+l+l) = ((n+l) (n+l+l) (n+1+2))/3 ---- (2)
Now Show that LHS = RHS in equation 2
Apply Equation 1 in Equation 2
(n (n+l) (n+2))/3 + (n+l) (n+l+l) = ((n+l) (n+l+l) (n+1+2))/3
2
((n +n) (n+2))/3 + (n+l) (n+2) = ((n+l) (n+2) (n+3)) /3
LHS: = ((n2+n) (n+2))/3 + (n+l) (n+2)
= (n 3+n 2+2n 2+2n)/3 + (n+l) (n+2)
= (n 3+n 2+2n 2+2n) + 3((n+ 1) (n+2))/3
= ((n 3+n 2+2n 2+2n) + 3(n2+2n+n+2))/3
= (n 3+n2+2n 2+2n + 3n2+6n+3n+6))/3
= (n 3+6n 2+11n +6))/3
= (n+l) (n+2) (n+3)/3
LHS = RHS; Tims Proved

Example 3: Show that if n is a positive integer, then ]+ 3+ Y+ ___ 3(n-J) = (3" -1)/2 using
Mathematical Induction.

Basic Step: P (I) is true because 3(1-l) = (3 1 -1)/2


3 (0) = (2)/2
1 =1

Inductive Step: Assume P (n) is true


1+ 3+ 32+ ... }(a -I)= (3° -1)/2
Under this assumption it must be shown that P (n + 1) is true
p (n) : I+ 3+ 32+ . · ·3 (, -I J == (3° - I )/2 ___ _
-------- ---- ---- ---- ---- ---- -- ( I )
p (n + I) I+ 3+ 32 .. .3 1D- I J+ 3 (n + l - J\
+ == (3 11 11 - 1)/ 2-- ---- ----------------- ( 2)
N Sl ..
ow tha t LHs == RH s in
lOW
atio n 2
. equ
• E
Ap p ly Eq uation 1 tn quat, on 2
(J" -J )/2 + 3(11" 1-J) == ( -3011 - I )/2
LHS : == (3 - 1)/2 + 3111➔ ) . J )
11

= (3" -1)/2 + 3(11)


= ((J o - I ) + 2. J(nJ) /2
== 3" ( I- 1+2)/2

== (3" . 3-1 )/2

= (3"+1-1) /2
LH S == RH S ; Th us Proved

... ?+ ,n - 2n+1 -1 usi ng


ple 4· Sh th •f . non -ne gat ive inte ger , the n l + ..::+ 2 - · · ·- -
Exam · ow at I n 1s a

Ma the ma tica l Ind uct ion .

e 2" = 2n+I -1
Basic Step: P ( 1) is true bec aus

1= 1
is tru e
Inductive Step: As sum e P (n)
l+ 2+ 22+ .. .2" = 2n+I -1
e
be sho wn tha t P (n + 1) is tru
Un der this ass um pti on it mu st
------------ -------------- (l)
P (n): l+ 2+ 22+ ... 2n = 2n+I -1---------
l + 2+ 22+ ... 2" + 2° = 2°
11 1111
-1----------------------- (2)
P (n + 1)
equation 2
Now Show that LHS = RHS in

Apply Equation 1 in Equation 2


2n+J -1 + 2n+l = 2n+1+J -1
2n+ l _j +z n+I =z n+2_1

LHS: = 2. zn+i -1
= 211+ 1+ 1 -1
= 2n+2 -1
LHS = RHS; Thus Proved
your conjecture using mathematical induction.

J11e sum of the n positi ve odd inteoers


b for n = 1, 2 , 3 , 4 , •• • .arc

I =l
1+3 = 4
]+3+5 = 9
1+3+5+7= 16
1+3+5+7=25
2
TI1erefore the conjecture is 1+3+5+7 .......+ (2n-1) == n

Basic Step: P (I) is true because (2n-1) = n2


l == 1

Inductive Step: Assume P (n) is true


2
1+3+5+7 .......+ (2n-1) = n
Under this asswnption it must be shown that P (n + 1) is true
P (n): 1+3+5+7 ....... + (2n-1) == n2------------------------------- (l)
P (n + I) !+3+5+7 ....... + (2n-1) + (2(n+J)-l) ~ (n+l)'----------------------- (l)
Now Show that LHS == RHS in equation 2

Apply Equation 1 in Equation 2


2
n2 +(2(n+l) -1) = (n+l)
LHS: == n2 +(2n+2-l)
== n2 + (2n+ I)

== (n+l)2

LHS = RHS; Thus Proved


Divide and Conquer Algorithm

' Divide and C · . bl


onquer is a strategy in whi ch a given probl em is split into a set of sub pro ems.
Each sub-probl . . I handled/sol ved individu all y.
em 1s I 1cn
Once all e sub-problems are solved, we combine the sub-solutions of these sub problems and
th
find the fi nal solution.

n·IVI"d e and Conquer is broadly a 3-step strategy:


1) Divide the actual problem into sub-problems (A sub-problem is just a smaller instance of

the same problem).


2) Conquer i.e. recursively solve each sub-problem.
3) Combine the solutions of the sub-problems to get the solution to tbe actual problem.
For example, Let there be a problem of size N and let us divide this problem into 4 SUb-

problems say nl , n2, n3, and n4.

Let the time taken to complete the whole problem be T(N), time taken to complete nl, n2, n3,
n4 respectively be T(nl ), T(n2), T(n3) and T(n4), time taken in dividing the problem into sub-
problems be D(N), time taken to combine the solutions of sub-problems into one final solution
be C(N).
Then,
T(N) = T(nl) + T(n2) + T(n3) + T(n4) + D(N) + C(N)

The General format of Recurrence Relation for Divide and Conquer algorithm
The Problem P is divided into P1 and P2
T (n) = T (n/2) + T (n/2) + f(n)
T (n) = 2T (n/2) + f (n)
Replace 2 by a and b = T (n) = aT (n/b) + f (n)

You might also like