Upload
puspa-novita-sari
View
219
Download
0
Embed Size (px)
Citation preview
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 1/13
MATHEMATICAL INDUCTION
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 2/13
An illustration
Penjumlahan n buah bilangan ganjil pertama
1 = 1 (2.1-1) = 12
1 + 3 = 4 1 + (2.2-1) = 22
1 + 3 + 5 = 9 1 + 3 + (2.3-1) = 32
1 + 3 + 5 + 7 = 16 1 + 3 + 5 + (2.4-1) = 42
……………. ………………
……………. ………………
Hypothesis: 1 + 3 + 5 + 7 + 9 + ... + (2n-1) = n2 ??
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 3/13
A proof by Mathematical Induction
P(n) is true for every positive integer n:
1. Basic step.P(1) is shown to be true.
2. Induction step.
P(k) P(k+1) is shown to be true
for every positive integer k.
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 4/13
Hypothesis: 1 + 3 + 5 + 7 + 9 + ... + (2n-1) = n2 ??
Proof:
Basic Step. (2.1-1) = 12
1=1.1= 12 1 = 12 (2-1) = 12 (2.1-1) = 12
Induction step. 1 + 3 + 5 + 7 + 9 + ... + (2k-1) = k2 .
↓ 1 + 3 + 5 + 7 + 9 + ... + (2(k+1) -1) = (k+1) 2
Misalkan 1 + 3 + 5 + 7 + 9 + ... + (2k-1) = k2, maka:
1 + 3 + 5 + 7 + 9 + …………. + (2(k+1) -1)
= 1 + 3 + 5 + 7 + 9 + ... + (2k-1) + (2(k+1) -1)
= k2 + (2(k+1) -1)
= k2 + 2k+2 -1
= k2 + 2k+1
= (k+1) 2
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 5/13
Examples, show that :
1 + 21 + 22 + … + 2n = 2n+1 – 1 for all
nonnegative integers n.
n < 2n for all positive integers n.
Every amount of postage of 12 cents or
more can be formed using just 4 cent and5 cent stamps.
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 6/13
The second principle
of mathematical induction
1. Basic step. P(1) is shown to be true.
2. Inductive step. It is shown that
[P(1) and P(2) and … and P(k)] P(k+1)
is true for every positive integer k.
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 7/13
RECURSIVE DEFINITIONS
Recursively defined functions
To define a function with the set of
nonnegative integers as its domain,
1. Specify the value of the function at zero.
2. Give a rule for finding its value as an
integer from its values at smaller integer.
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 8/13
Examples:
1 Suppose f(0) = 3 and f(n+1) = 2.f(n)+3.
Find f(1), f(2), f(3), and f(4).
2 If f(0)=0, f(1)=1 and f(n)=f(n-1)+f(n-2).Then f(6)?
3 Give a recursive definition of an where a is
a nonzero real number and n is anonnegative integer.
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 9/13
Recursively Defined Sets
1.Let S be defined by:
3 S
if x
S and y
S, then x + y
S
2.Give a recursive definition of l(w), the
length of the string w.(Note that denotes for empty string)
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 10/13
Recursive Algorithms
Definition. An algorithm is called
recursive if it solves a problem by reducing
it to an instance of the same problem with
smaller input.
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 11/13
Examples:
1.Algorithm for computing an where a is a
nonzero real number and n is a
nonnegative integer.
Procedure power(a:nonzero real number,
n:nonnegative integer)
if n=0 then power(a,n):=1else power(a,n):=a*power(a,n-1)
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 12/13
2.Linier search algorithm as a recursive
procedure
Procedure search(i,j,x)if ai=x then location:=i
else if i = j then location:=0
else search(i+1,j,x)
7/27/2019 Indksi Mat 2
http://slidepdf.com/reader/full/indksi-mat-2 13/13
Recursion and Iteration
A Recursive Procedure for Factorials
Procedure recursive factorial(n: positive integer)
if n=1 then factorial(n):= 1
else factorial(n):= n*factorial(n-1)
An Iterative Procedure for Factorial
Procedure iterative factorial(n: positive integer)x:= 1
for i:= 1 to n x:= i*x
{x is n!}