Discrete Mathematics Lecture 8 Alexander Bukharovich New York University
Recursive Sequences A recurrence relation for a sequence a 0, a 1, a 2, … is a formula that relates each term a k 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 s n 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 s n. 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 F n < 2 n Prove that gcd(F n+1, F n ) = 1
Solving Recurrences Iteration method Telescoping Range transformation Domain transformation Recurrences involving sum
Exercises Find an explicit formula for: x k = 3x k-1 + k with x 1 = 1 w k = w k-2 + k with w 1 = 1, w 2 = 2 u k = u k-2 * u k-1 with u 0 = u 1 = 2
Second-Order Homogenous Recurrences Second-order homogeneous relation with constant coefficients is a relation of the form: a k = A * a k-1 + B * a k-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 n 0 so that for all n > n 0 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 > n 0 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