Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 13

MATHEMATICAL INDUCTION

An illustration
Penjumlahan n buah bilangan ganjil pertama 1=1 1+3=4 1+3+5=9 1 + 3 + 5 + 7 = 16 . . (2.1-1) = 12 1 + (2.2-1) = 22 1 + 3 + (2.3-1) = 32 1 + 3 + 5 + (2.4-1) = 42

Hypothesis: 1 + 3 + 5 + 7 + 9 + ... + (2n-1) = n2 ??

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.

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

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 and 5 cent stamps.

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.

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.

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 a nonnegative integer.

Recursively Defined Sets


1.Let S be defined by: 3S 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)

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.

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):=1 else power(a,n):=a*power(a,n-1)

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)

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!}

You might also like