MATH 302 Lecture 14

From Notes
Jump to navigation Jump to search

« previous | Monday, October 17, 2011 | next »


Recursively Defined Sets

Basis step.

Inductive step. if , then .


Example property:

Proof by structural induction.

(1) Basis step.

Inductive step. Assume for . Then and for some .

Hence . THis proves the inductive step, and followl by structural principle of mathematical induction.

(2) Basis step. by definition of

Inductive step. Assume for , then by recursive step definition of . This proves the inductive step and thus the general result follows by the principle of mathematical induction.

Properties of S

Basis step. 3 has a property

Recursive step. If have the property , then has the property

This is an example of structural induction.

Strong Properties of S

Basis Step. Something has a certain property

Inductive Step. Any element which can be obtained either by the basis step or up to iterations for some of recursive step has property . Show any such element that can be obtained by iterations of recursive steps has property .


Trees

Basis step. A root is a tree

Inductive step. Let be disjoint rooted trees such that with corresponding roots . Draw edges connecting another distinct root with each of the roots . , the resulting graph, is a rooted tree.

Example Structural Proof

This proof is for full binary trees in which each node is a leaf or has exactly two children.

Theorem. , where is the number of vertices and is the height.

Proof by Structural Induction.

Basis step. is a root alone: , . true.

Recursive step. Assume and are full binary trees satisfying the theorem


Thus we have Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 2h(T_i) + 1 \le n(T_i) \le 2^{h(T_i)+1}-1} for Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle i=1,2}

Adding the two formulae together gives

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} 2h(T_1)+2h(T_2) + 2+1 \le n(T_1)+n(T_2) + 1 & \le 2^{h(T_1)+1}-1 + 2^{h(T_2) + 1} - 1 + 1 \\ 2\left( \mathrm{max}(h(T_1),\ h(T_2)) + 1 \right) \le n(T_1 \cdot T_2) & \le 2\cdot 2^{\mathrm{max}(h(T_1),\ h(T_2))+1}-1 \\ 2 h(T_1 \cdot T_2) +1 \le n(T_1 \cdot T_2) & \le 2^{h(T_1 \cdot T_2) + 1}-1 \end{align}}

This proves the inductive step, and the general result follows by the structural principle of mathematical induction.

Q.E.D.


And now for something completely different.

Recursive Algorithms

Solving a problem by reducing it to the same problem with a smaller input.

Simple definition for Factorial

Basis step.

Recursive step. Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n! = n \cdot (n-1)!} for Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n > 0}

def factorial n

 raise Exception.new("must be nonnegative") if n < 0
 return 1 if n == 0
 n * factorial(n-1)

end

Greatest Common Divisor

def gcd a, b

 return b if a == 0
 gcd(b % a, a)

end

Note: if Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathrm{gcd}(a,b) = 1} , then a and b are relatively prime.