80 likes | 285 Views
Discrete Mathematics Lecture 8. Alexander Bukharovich New York University. Recursive Sequences.
E N D
Discrete MathematicsLecture 8 Alexander Bukharovich New York University
Recursive Sequences • A recurrence relation for a sequence a0, a1, a2, … is a formula that relates each term ak to certain collection of its predecessors. Each recurrence sequence needs initial conditions that make it well-defined • Famous recurrences: algebraic and geometric sequences, factorial, Fibonacci numbers • Tower of Hanoi problem • Compound interest
Exercises • A row in a classroom has n seats. Let sn be the number of ways nonempty sets of students can sit in a row so that no two students occupy adjacent seats. Find recurrence for sn. • In how many ways can one climb n stairs if one is allowed to move to the next stair or jump through one stair? • Show that Fn < 2n • Prove that gcd(Fn+1, Fn) = 1
Solving Recurrences • Iteration method • Telescoping • Range transformation • Domain transformation • Recurrences involving sum
Exercises • Find an explicit formula for: xk = 3xk-1 + k with x1 = 1 wk = wk-2 + k with w1 = 1, w2 = 2 uk = uk-2 * uk-1with u0 = u1 = 2
Second-Order Homogenous Recurrences • Second-order homogeneous relation with constant coefficients is a relation of the form: ak = A * ak-1 + B * ak-2, where A and B are constants • Characteristics equation • Distinct roots case: Fibonacci numbers • Single root case: gambler’s ruin
Classes of Functions • Constants • Polynoms: linear, quadratic • Exponents • Logarithms • Functions in between • Relationship between different classes
O-notation • Function f(n) is of order g(n), written f = O(g), when there exists number M such that there exists number n0 so that for all n > n0 we have f(n) <= M * g(n) • If f is O(g), then g is (f), or in other words, when for all numbers M and for all numbers no, there exists n > n0 such that f(n) > M * g(n) • If f is O(g) and g is O(f), then we say that f is (g) or that f and g are of the same order