Discrete Mathematics Lecture 17: Induction and Recursion, Slides of Discrete Mathematics

Lecture notes from docsity.com on discrete mathematics, focusing on mathematical induction and recursion. It includes examples of induction proofs and recursive functions, as well as explanations of strong induction and recursive sets.

Typology: Slides

2012/2013

Uploaded on 04/27/2013

aslesha
aslesha 🇮🇳

4.4

(14)

160 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSci 2011
Discrete Mathematics
Lecture 17
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Discrete Mathematics Lecture 17: Induction and Recursion and more Slides Discrete Mathematics in PDF only on Docsity!

CSci 2011

Discrete Mathematics

Lecture 17

Interesting Induction

Someone with zero hairs is bald.

Someone with one more hair than a bald person is bald.

.

. turn the inductive crank……

.

Therefore, someone with

1,000, 000 hairs is bald.

What’s wrong with this induction?

Induction Example

Induction Hypothesis

P(k) = ∑ki=1 2i-1= k^2

Inductive Steps P(k+1) = ∑k+1i=1 2i- = ki=1 2i-1 + (2 (k+1) -1) = k^2 + (2k +1) = (k+1) 2

Second induction example

Show the sum of the first n positive even integers is n^2 + n Rephrased: ∀ n P(n) where P(n) = ∑ni=1 2 i = n 2

  • n

The three parts: Base case Inductive hypothesis Inductive step

More Examples

Prove thatt if h> -1, then 1+nh ≤ (1+h)n^ for all non-negative integer n.

Prove that n^2 ≡ 1 mod 8 for all odd integer n.

Strong induction

Weak mathematical induction assumes P( k ) is true, and uses that (and only that!) to show P( k +1) is true

Strong mathematical induction assumes P(1), P(2), …, P( k ) are all true, and uses that to show that P( k +1) is true. [P(1) ∧ P(2) ∧ p(3) ∧ … ∧ P(k) ] → P(k+1)

Strong induction example 1

Inductive step: Show that P( k +1) is true

There are two cases:  k +1 is prime It can then be written as the product of k +  k +1 is composite It can be written as the product of two composites, a and b, where 2 ≤ ab < k + By the inductive hypothesis, both P( a ) and P( b ) are true

Strong Induction Examples 2

Prove that every amount of 12 cents or more can be formed using just 4-cent and 5-sent stamps. Basis Step  12 = 3 * 4 cent stamp  13 = 2 * 4 + 1 * 5  14 = 1 * 4 + 2 * 5  15 = 3 * 5 Inductive step: Suppose P(j) is true for 12 ≤ j ≤ k (k≥15). It is sufficient to show that P(k+1) is true. We know that P(k-3) is true since k ≥ 15. To form postage of k+1 cents, we just need to add 1 4-cent postage to the stamps we used to form k-3 cents.

Recursive objects

Sometimes it is difficult to define an object explicitly, but it is easier to define it in terms of itself.

Recursive Functions

We can define a function recursively by specifying: Basis: the value of the function at the smallest element of the domain. E.g.: f(0) = 1 Recursive step: A rule for finding the value of the function at an integer from its values at smaller integers E.g: f(n+1) = 2*f(n)

Many common functions can be defined recursively.

F(n) grows infinitely

Let α = (1+√5)/2 = 1.61803…

For n ≥3, F(n) > αn-

Proof by induction.

Hint for the inductive step:

Solve x 2 -x-1=0 for x

Strings can be defined recursively

Σ: Alphabet (set of symbols)

λ: Empty String

Σ*: set of all strings over the alphabet

Basis: λ∈Σ

Recursive Step: If w∈Σ* and x∈Σ, then wx ∈ Σ*

wx: string w followed by symbol x

(Rooted) Trees

  • Basis: a single vertex r is a rooted tree
  • Recursive step: Suppose that T 1 , …, Tn are rooted trees with roots r 1 , …, rn.
  • Then, the graph formed by adding edges (r, ri) for i=1,…,n is a rooted tree

Extended Binary Trees

Basis: The empty set is an extended binary tree

Recursive step: if T 1 and T 2 are extended binary trees, then the tree T 1 T 2 obtained by connecting a root r to the roots of T 1 and T 2 is also an extended binary tree

r