# MAT 4 – Kompleks Funktionsteori MATEMATIK 4 INDUKTION OG REKURSION MM 1.4 MM 1.4: Induktion og Rekursion Topics: Mathematical induction Example of Towers.

## Presentation on theme: "MAT 4 – Kompleks Funktionsteori MATEMATIK 4 INDUKTION OG REKURSION MM 1.4 MM 1.4: Induktion og Rekursion Topics: Mathematical induction Example of Towers."— Presentation transcript:

MAT 4 – Kompleks Funktionsteori MATEMATIK 4 INDUKTION OG REKURSION MM 1.4 MM 1.4: Induktion og Rekursion Topics: Mathematical induction Example of Towers of Hanoi Recursively defined functions Example of Fibonacci numbers

MAT 4 – Kompleks Funktionsteori What should we learn today? What is mathematical induction? In which situations is it used? How to define a function recursively?

MAT 4 – Kompleks Funktionsteori Example Several lines are drawn on the plane and they partinion the plane into separate parts. Prove that we can color the separate parts into white and black in such a way that neighbouring parts are of different colors.

MAT 4 – Kompleks Funktionsteori Example (cntd) Step 1: one lineStep 2: two lines Step 3: three lines

MAT 4 – Kompleks Funktionsteori Mathematical induction Mathematical induction is a method of mathematical proof typically used to establish that a given statement is true of all natural numbers. It is done by proving that the first statement in the infinite sequence of statements is true, and then proving that if any one statement in the infinite sequence of statements is true, then so is the next one. Principle of induction: 1.The basis: showing that the statement holds when n = 0. 2.The inductive step: showing that if the statement holds for n = m, then the same statement also holds for n = m + 1. –The proposition following the word "if" in the inductive step is called the inductive hypothesis.

MAT 4 – Kompleks Funktionsteori Mathematical induction - variance Starting at some other number Complete induction (or strong induction): –in the second step we may assume not only that the statement holds for n = m but also that it is true for n less than or equal to m.

MAT 4 – Kompleks Funktionsteori Examples Example 1: prove that Example 2: prove that

MAT 4 – Kompleks Funktionsteori Tower of Hanoi The Tower of Hanoi is a puzzle. It consists of three pegs, and a number of disks of different sizes which can slide onto any peg. The puzzle starts with the disks neatly stacked in order of size on one peg. The objective of the puzzle is to move the entire stack to another peg, obeying the following rules: –Only one disk may be moved at a time. –No disk may be placed on top of a smaller disk. Prove that the puzzle can be solved.

MAT 4 – Kompleks Funktionsteori Tower of Hanoi

MAT 4 – Kompleks Funktionsteori Tower of Hanoi : n=3

MAT 4 – Kompleks Funktionsteori Making the statement stronger Example. Prove that the sum is equal to a square of an integer. Instead we will prove the following statement:

MAT 4 – Kompleks Funktionsteori Recursion n! is an example of recursive function Recursion is a method of defining functions in which the function being defined is applied within its own definition. Example: f is a function that is defined in the following way: A) B) We can prove that

MAT 4 – Kompleks Funktionsteori Tower of Hanoi Find the number of moves required to solve the puzzle Solution:

MAT 4 – Kompleks Funktionsteori Recursive functions Recursive functions are typically appearing in two types of situations: –As a description of a function obtained in the analysis of the problem –For calculations of the values of the function

MAT 4 – Kompleks Funktionsteori Fibonacci numbers Fibonacci numbers are a sequence of numbers where each number is the sum of the two preceding numbers This is a solution to the idealized rabbit population problem: –in the first month there is just one newly-born pair, –new-born pairs become fertile from after their second month –each month every fertile pair begets a new pair, and –the rabbits never die Tree:

MAT 4 – Kompleks Funktionsteori Infinite descent A proof by infinite descent is a particular kind of mathematical induction. It is based on the fact that any nonempty set of integers has a smallest number. Example: Fibonacci numbers 1, 1, 2, 3, 5, 8, 13, 21, 34, 55,… Prove that two numbers from the sequence that can be divided by 7 without a remainder can not be neighbors

MAT 4 – Kompleks Funktionsteori Integer square root Integer square root of n is the smallest integer m: Binary searching algorithm:

MAT 4 – Kompleks Funktionsteori Integer square root Induction principle can be used to show the correctness of recursive programmes/ algorithms

MAT 4 – Kompleks Funktionsteori Where is the error? All stones are of the same color

Download ppt "MAT 4 – Kompleks Funktionsteori MATEMATIK 4 INDUKTION OG REKURSION MM 1.4 MM 1.4: Induktion og Rekursion Topics: Mathematical induction Example of Towers."

Similar presentations