Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES

Size: px
Start display at page:

Download "Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES"

Transcription

1 CS131 Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES A recurrence is a rule which defines each term of a sequence using the preceding terms. The Fibonacci Sequence. The Fibonacci sequence F n ) is defined by the following recurrence: together with the initial conditions: F n = F n 1 + F n n ) F 0 = 0, F 1 = 1. Since the first two terms are known, we can use the recurrence to compute later terms of the sequence, giving 0, 1, 1,, 3,, 8, 13, 1, 34,,.... The Towers of Hanoi. This puzzle was invented by the French mathematician Edouard Lucas in It consists of eight disks, initially stacked in decreasing size on one of three pegs. The objective is to move the tower to one of the other pegs by moving one disk at a time and never moving a larger one onto a smaller. This leads to the recurrence T n = T n With T 0 = 0 this gives the sequence 0, 1, 3, 7, 1, 31, 63,.... It is easy to guess that T n = n 1 for each n 0 and this formula can then be proved by induction. This is known as a closed form for T n and allows us to compute terms of the sequence immediately in terms of n. Linear recurrences. In this note we look at methods for solving linear recurrences with constant coefficients. These have the form x n + a 1 x n a k x n k = fn) where a 1,..., a k are constants and f is some given function. If the values of the first k terms are given, then this recurrence defines a unique sequence x n ). We begin by looking at homogeneous recurrences, which are those with fn) = 0 for all n, and we will also assume k = the generalisation to higher order recurrences is fairly straightforward). 16 1

2 We wish to find the general solution of the recurrence x n + ax n 1 + bx n = 0. When b = 0 it is easy to see that the solution is given by x n = a) n x 0. This suggests that in the general case we should look for solutions of the form x n = λ n A, where λ and A are constants. Now x n = λ n is a solution of x n + ax n 1 + bx n = 0 λ n + aλ n 1 + bλ n = 0 λ n λ + aλ + b) = 0 λ = 0 or λ + aλ + b = 0. Auxiliary equation. The equation λ + aλ + b = 0 is called the auxiliary equation of the recurrence x n + ax n 1 + bx n = 0. If the auxiliary equation has two distinct solutions λ 1 and λ, then it is easy to verify that x n = Aλ n 1 + Bλ n is a solution of the recurrence for any constants A and B. If the first two terms of the sequence x n ) are given, then they can be used to find the values of A and B. If the auxiliary equation has only a single solution for λ then a 4b = 0, so b = a /4 and λ = a/. In this case x n = Aλ n is a solution of the recurrence for any A, but is not the general solution. However x n = nλ n is also a solution since this gives, on substitution, x n + ax n 1 + bx n = nλ n + an 1)λ n 1 + bn )λ n = nλ n λ + aλ + b) λ n aλ + b) = nλ n 0 λ n 0 = 0. The second term is 0 since aλ = a / and b = a /.) Hence the general solution is x n = Aλ n + Bnλ n where A and B are constants. Solution of the recurrence x n + ax n 1 + bx n = 0. Let λ 1, λ be the roots of the auxiliary polynomial λ + aλ + b, then if λ 1 λ, x n = Aλ n 1 + Bλ n, if λ 1 = λ, x n = Aλ n 1 + Bnλ n. If the first two terms of the sequence x n ) are known, then they can be used to find the constants A and B. Problem. Find a closed form for the terms of the Fibonacci sequence. 16

3 Solution. Here we have F n F n 1 F n = 0, so the auxiliary equation is λ λ 1 = 0, which has roots Hence we have λ 1 = 1 + F n = A and λ = ) n 1 ) n + B. Finding A and B is easy since we have F 0 = 0 and F 1 = 1. Thence F n = ) n 1 1 ) n. The number 1 + )/ or is called the golden ratio and is often denoted by φ. Note that F n is an integer expression, despite appearances. Since 1 )/ < 1, the second term in the above closed form for F n becomes smaller as n increases. In fact we have 1 1 ) n < 1 for all n, which gives the formula: ) φ n F n = rounded to the nearest integer. We now look at the case of a non- Non-homogeneous recurrences. homogeneous recurrence of the form x n + ax n 1 + bx n = fn) where a and b are constants. Suppose that x n = h n is the general solution of the corresponding homogeneous recurrence so that h n + ah n 1 + bh n = 0, and that x n = p n is any particular solution of the original recurrence so that p n + ap n 1 + bp n = fn). 16 3

4 Then x n = h n +p n is a solution of the recurrence since, on adding the above, h n + p n ) + ah n 1 + p n 1 ) + bh n + p n ) = h n + ah n 1 + bh n ) + p n + ap n 1 + bp n ) = 0 + fn) = fn). It follows that x n = h n +p n is the general solution of the original recurrence. Solution of the recurrence x n + ax n 1 + bx n = fn). 1) Find the general solution x n = h n of the homogeneous recurrence: x n + ax n 1 + bx n = 0 solution will contain two arbitrary constants). ) Find any particular solution x n = p n of the original recurrence: x n + ax n 1 + bx n = fn). 3) The general solution of the original recurrence is then given by x n = h n + p n. In general finding a particular solution of the recurrence will not be easy! x n + ax n 1 + bx n = fn) Some useful techniques are: If f is constant, say fn) = k for all n, then it is easy to find a constant particular solution provided 1 + a + b 0). For if x n = c for all n, then substituting into the recurrence x n +ax n 1 +bx n = k gives c + ac + bc = k or c = k/1 + a + b). For a more complicated polynomial) fn), try to find a particular solution which is also a polynomial in n, e.g., try x n = k or x n = k 1 n + k or x n = k 1 n + k n + k 3,.... Example. Find the general solution of the recurrence x n 10.1x n 1 + x n =.7n. Solution. The homogeneous recurrence x n 10.1x n 1 + x n = 0 has auxiliary equation λ 10.1λ + 1 = 0 or λ 10)λ 1/10) = 0, 16 4

5 and so has general solution x n = A10 n ) + B/10 n. To find a particular solution of we try x n = Cn + D. This gives x n 10.1x n 1 + x n =.7n, Cn+D 10.1Cn 1)+D)+Cn )+D = 8.1Cn+8.1D 8.1C =.7n. Since this holds for all n, we have 8.1C =.7, 8.1D 8.1C = 0 so C = D = 1/3. Hence the general solution of the recurrence is x n = 10 n A + B 10 n + n ABSTRACT Content definition, well-known examples, solution of linear recurrences homogeneous and non-homogeneous) In this Note we study the solution of linear recurrences. Those students familiar with the solution of linear ordinary differential equations will recognise much that is in this Note. Because recurrence relationships are closely related to recursive algorithms, recurrences arise naturally in the analysis of the latter. History The most useful recurrences are non-linear and are generally beyond the scope of this module. These are to be found mostly in the area of mathematical physics. 16

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/ SECTION 5.6 Defining Sequences Recursively Copyright Cengage Learning. All rights reserved.

More information

Advanced Counting Techniques. Chapter 8

Advanced Counting Techniques. Chapter 8 Advanced Counting Techniques Chapter 8 Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence Relations Nonhomogeneous Recurrence Relations Divide-and-Conquer

More information

Advanced Counting Techniques

Advanced Counting Techniques . All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Advanced Counting

More information

Learning Objectives

Learning Objectives Learning Objectives Learn about recurrence relations Learn the relationship between sequences and recurrence relations Explore how to solve recurrence relations by iteration Learn about linear homogeneous

More information

Algorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee

Algorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee Algorithm Analysis Recurrence Relation Chung-Ang University, Jaesung Lee Recursion 2 Recursion 3 Recursion in Real-world Fibonacci sequence = + Initial conditions: = 0 and = 1. = + = + = + 0, 1, 1, 2,

More information

6.042/18.062J Mathematics for Computer Science March 17, 2005 Srini Devadas and Eric Lehman. Recurrences

6.042/18.062J Mathematics for Computer Science March 17, 2005 Srini Devadas and Eric Lehman. Recurrences 6.04/8.06J Mathematics for Computer Science March 7, 00 Srini Devadas and Eric Lehman Lecture Notes Recurrences Recursion breaking an object down into smaller objects of the same type is a major theme

More information

AROUND (1 + 2) n. (1 + x) 5 = 1 + 5x + 10x x 3 + 5x 4 + x 5.

AROUND (1 + 2) n. (1 + x) 5 = 1 + 5x + 10x x 3 + 5x 4 + x 5. AROUND (1 + ) n 1. Calculator tricks. Let us take a simple pocket calculator and compute 1-st, -nd, 3-rd, and so on, powers of the number 1 +. Here are the results: 1 + =.41413... (1 + ) =.8847... (1 +

More information

Chapter 8: Recursion. March 10, 2008

Chapter 8: Recursion. March 10, 2008 Chapter 8: Recursion March 10, 2008 Outline 1 8.1 Recursively Defined Sequences 2 8.2 Solving Recurrence Relations by Iteration 3 8.4 General Recursive Definitions Recursively Defined Sequences As mentioned

More information

5. Sequences & Recursion

5. Sequences & Recursion 5. Sequences & Recursion Terence Sim 1 / 42 A mathematician, like a painter or poet, is a maker of patterns. Reading Sections 5.1 5.4, 5.6 5.8 of Epp. Section 2.10 of Campbell. Godfrey Harold Hardy, 1877

More information

SOLVING LINEAR RECURRENCE RELATIONS

SOLVING LINEAR RECURRENCE RELATIONS SOLVING LINEAR RECURRENCE RELATIONS Schaum's outline Sec. 6.6 6.9 Rosen Sec. 8.1 8. November 9, 017 margarita.spitsakova@ttu.ee ICY0001: Lecture 8 November 9, 017 1 / 47 Contents 1 Motivation examples

More information

Handout 7: Recurrences (Cont d)

Handout 7: Recurrences (Cont d) ENGG 2440B: Discrete Mathematics for Engineers Handout 7: Recurrences (Cont d) 2018 19 First Term Instructor: Anthony Man Cho So October 8, 2018 In the last handout, we studied techniques for solving linear

More information

1 Examples of Weak Induction

1 Examples of Weak Induction More About Mathematical Induction Mathematical induction is designed for proving that a statement holds for all nonnegative integers (or integers beyond an initial one). Here are some extra examples of

More information

Ex. Here's another one. We want to prove that the sum of the cubes of the first n natural numbers is. n = n 2 (n+1) 2 /4.

Ex. Here's another one. We want to prove that the sum of the cubes of the first n natural numbers is. n = n 2 (n+1) 2 /4. Lecture One type of mathematical proof that goes everywhere is mathematical induction (tb 147). Induction is essentially used to show something is true for all iterations, i, of a sequence, where i N.

More information

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University U Kang 1 In This Lecture Set Concepts and Notation Relation Logarithm and Summations Recurrence Relations Recursion

More information

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska LECTURE 1 INTRODUCTION Course Web Page www.cs.stonybrook.edu/ cse547 The webpage contains: detailed lectures notes slides; very detailed

More information

1 Recursive Algorithms

1 Recursive Algorithms 400 lecture note #8 [ 5.6-5.8] Recurrence Relations 1 Recursive Algorithms A recursive algorithm is an algorithm which invokes itself. A recursive algorithm looks at a problem backward -- the solution

More information

Why do we need math in a data structures course?

Why do we need math in a data structures course? Math Review 1 Why do we need math in a data structures course? To nalyze data structures and algorithms Deriving formulae for time and memory requirements Will the solution scale? Quantify the results

More information

Recursion: Introduction and Correctness

Recursion: Introduction and Correctness Recursion: Introduction and Correctness CSE21 Winter 2017, Day 7 (B00), Day 4-5 (A00) January 25, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Today s Plan From last time: intersecting sorted lists and

More information

Cpt S 223. School of EECS, WSU

Cpt S 223. School of EECS, WSU Math Review 1 Why do we need math in a data structures course? To nalyze data structures and algorithms Deriving formulae for time and memory requirements Will the solution scale? Quantify the results

More information

Jong C. Park Computer Science Division, KAIST

Jong C. Park Computer Science Division, KAIST Jong C. Park Computer Science Division, KAIST Today s Topics Introduction Solving Recurrence Relations Discrete Mathematics, 2008 2 Computer Science Division, KAIST Definition A recurrence relation for

More information

Divide and Conquer. Recurrence Relations

Divide and Conquer. Recurrence Relations Divide and Conquer Recurrence Relations Divide-and-Conquer Strategy: Break up problem into parts. Solve each part recursively. Combine solutions to sub-problems into overall solution. 2 MergeSort Mergesort.

More information

Recurrence Relations

Recurrence Relations Recurrence Relations Winter 2017 Recurrence Relations Recurrence Relations A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms

More information

Linear Recurrence Relations

Linear Recurrence Relations Linear Recurrence Relations Linear Homogeneous Recurrence Relations The Towers of Hanoi According to legend, there is a temple in Hanoi with three posts and 64 gold disks of different sizes. Each disk

More information

Notes on Continued Fractions for Math 4400

Notes on Continued Fractions for Math 4400 . Continued fractions. Notes on Continued Fractions for Math 4400 The continued fraction expansion converts a positive real number α into a sequence of natural numbers. Conversely, a sequence of natural

More information

Logic and Discrete Mathematics. Section 6.7 Recurrence Relations and Their Solution

Logic and Discrete Mathematics. Section 6.7 Recurrence Relations and Their Solution Logic and Discrete Mathematics Section 6.7 Recurrence Relations and Their Solution Slides version: January 2015 Definition A recurrence relation for a sequence a 0, a 1, a 2,... is a formula giving a n

More information

Binomial Coefficient Identities/Complements

Binomial Coefficient Identities/Complements Binomial Coefficient Identities/Complements CSE21 Fall 2017, Day 4 Oct 6, 2017 https://sites.google.com/a/eng.ucsd.edu/cse21-fall-2017-miles-jones/ permutation P(n,r) = n(n-1) (n-2) (n-r+1) = Terminology

More information

CS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh

CS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh CS 2210 Discrete Structures Advanced Counting Fall 2017 Sukumar Ghosh Compound Interest A person deposits $10,000 in a savings account that yields 10% interest annually. How much will be there in the account

More information

Recursion and Induction

Recursion and Induction Recursion and Induction Themes Recursion Recurrence Definitions Recursive Relations Induction (prove properties of recursive programs and objects defined recursively) Examples Tower of Hanoi Gray Codes

More information

Advanced Counting Techniques. 7.1 Recurrence Relations

Advanced Counting Techniques. 7.1 Recurrence Relations Chapter 7 Advanced Counting Techniques 71 Recurrence Relations We have seen that a recursive definition of a sequence specifies one or more initial terms and a rule for determining subsequent terms from

More information

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu Analysis of Algorithm Efficiency Dr. Yingwu Zhu Measure Algorithm Efficiency Time efficiency How fast the algorithm runs; amount of time required to accomplish the task Our focus! Space efficiency Amount

More information

Recurrences COMP 215

Recurrences COMP 215 Recurrences COMP 215 Analysis of Iterative Algorithms //return the location of the item matching x, or 0 if //no such item is found. index SequentialSearch(keytype[] S, in, keytype x) { index location

More information

The Principle of Linearity applications in the areas of algebra and analysis

The Principle of Linearity applications in the areas of algebra and analysis Proseminar Mathematisches Problemlösen University of Karlsruhe SS 6 The Principle of Linearity applications in the areas of algebra and analysis Franziska Häfner Contents Converting complex problems into

More information

CSI2101-W08- Recurrence Relations

CSI2101-W08- Recurrence Relations Motivation CSI2101-W08- Recurrence Relations where do they come from modeling program analysis Solving Recurrence Relations by iteration arithmetic/geometric sequences linear homogenous recurrence relations

More information

Practical Session #3 - Recursions

Practical Session #3 - Recursions Practical Session #3 - Recursions Substitution method Guess the form of the solution and prove it by induction Iteration Method Convert the recurrence into a summation and solve it Tightly bound a recurrence

More information

15 DIFFERENCE EQUATIONS 2

15 DIFFERENCE EQUATIONS 2 5 DIFFERENCE EQUATIONS 2 Chapter 5 Difference Equations 2 Objectives After studying this chapter you should be able to obtain the solution of any linear homogeneous second order difference equation; be

More information

CSC2100B Data Structures Analysis

CSC2100B Data Structures Analysis CSC2100B Data Structures Analysis Irwin King king@cse.cuhk.edu.hk http://www.cse.cuhk.edu.hk/~king Department of Computer Science & Engineering The Chinese University of Hong Kong Algorithm An algorithm

More information

Recursion and Induction

Recursion and Induction Recursion and Induction Themes Recursion Recursive Definitions Recurrence Relations Induction (prove properties of recursive programs and objects defined recursively) Examples Tower of Hanoi Gray Codes

More information

Discrete Mathematics. Kishore Kothapalli

Discrete Mathematics. Kishore Kothapalli Discrete Mathematics Kishore Kothapalli 2 Chapter 4 Advanced Counting Techniques In the previous chapter we studied various techniques for counting and enumeration. However, there are several interesting

More information

CDM. Recurrences and Fibonacci

CDM. Recurrences and Fibonacci CDM Recurrences and Fibonacci Klaus Sutner Carnegie Mellon University 20-fibonacci 2017/12/15 23:16 1 Recurrence Equations Second Order The Fibonacci Monoid Recurrence Equations 3 We can define a sequence

More information

Legendre s Equation. PHYS Southern Illinois University. October 18, 2016

Legendre s Equation. PHYS Southern Illinois University. October 18, 2016 Legendre s Equation PHYS 500 - Southern Illinois University October 18, 2016 PHYS 500 - Southern Illinois University Legendre s Equation October 18, 2016 1 / 11 Legendre s Equation Recall We are trying

More information

Lecture 12 : Recurrences DRAFT

Lecture 12 : Recurrences DRAFT CS/Math 240: Introduction to Discrete Mathematics 3/1/2011 Lecture 12 : Recurrences Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last few classes we talked about program correctness. We

More information

A SUMMARY OF RECURSION SOLVING TECHNIQUES

A SUMMARY OF RECURSION SOLVING TECHNIQUES A SUMMARY OF RECURSION SOLVING TECHNIQUES KIMMO ERIKSSON, KTH These notes are meant to be a complement to the material on recursion solving techniques in the textbook Discrete Mathematics by Biggs. In

More information

CDM. Recurrences and Fibonacci. 20-fibonacci 2017/12/15 23:16. Terminology 4. Recurrence Equations 3. Solution and Asymptotics 6.

CDM. Recurrences and Fibonacci. 20-fibonacci 2017/12/15 23:16. Terminology 4. Recurrence Equations 3. Solution and Asymptotics 6. CDM Recurrences and Fibonacci 1 Recurrence Equations Klaus Sutner Carnegie Mellon University Second Order 20-fibonacci 2017/12/15 23:16 The Fibonacci Monoid Recurrence Equations 3 Terminology 4 We can

More information

CS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University

CS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University CS 5321: Advanced Algorithms - Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating example:

More information

CS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline

CS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline CS 5321: Advanced Algorithms Analysis Using Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating

More information

Recurrent Problems. ITT9131 Konkreetne Matemaatika. Chapter One The Tower of Hanoi Lines in the Plane The Josephus Problem

Recurrent Problems. ITT9131 Konkreetne Matemaatika. Chapter One The Tower of Hanoi Lines in the Plane The Josephus Problem Recurrent Problems ITT93 Konkreetne Matemaatika Chapter One The Tower of Hanoi Lines in the Plane The Josephus Problem Contents The Tower of Hanoi Lines in the Plane 3 The Josephus Problem 4 Intermezzo:

More information

Discrete Mathematics -- Chapter 10: Recurrence Relations

Discrete Mathematics -- Chapter 10: Recurrence Relations Discrete Mathematics -- Chapter 10: Recurrence Relations Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, National Cheng Kung University First glance at recurrence F n+2

More information

Math.3336: Discrete Mathematics. Advanced Counting Techniques

Math.3336: Discrete Mathematics. Advanced Counting Techniques Math.3336: Discrete Mathematics Advanced Counting Techniques Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu

More information

Introduction to Algorithms 6.046J/18.401J/SMA5503

Introduction to Algorithms 6.046J/18.401J/SMA5503 Introduction to Algorithms 6.046J/8.40J/SMA5503 Lecture 3 Prof. Piotr Indyk The divide-and-conquer design paradigm. Divide the problem (instance) into subproblems. 2. Conquer the subproblems by solving

More information

Solving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 =

Solving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 = Solving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 = 0 a 1 = 2 0 + 1 = 1 a 2 = 2 1 + 1 = 3 a 3 = 2 3 + 1

More information

Reductions, Recursion and Divide and Conquer

Reductions, Recursion and Divide and Conquer Chapter 5 Reductions, Recursion and Divide and Conquer CS 473: Fundamental Algorithms, Fall 2011 September 13, 2011 5.1 Reductions and Recursion 5.1.0.1 Reduction Reducing problem A to problem B: (A) Algorithm

More information

CHAPTER 8 Advanced Counting Techniques

CHAPTER 8 Advanced Counting Techniques 96 Chapter 8 Advanced Counting Techniques CHAPTER 8 Advanced Counting Techniques SECTION 8. Applications of Recurrence Relations 2. a) A permutation of a set with n elements consists of a choice of a first

More information

1 Sequences and Summation

1 Sequences and Summation 1 Sequences and Summation A sequence is a function whose domain is either all the integers between two given integers or all the integers greater than or equal to a given integer. For example, a m, a m+1,...,

More information

CS Analysis of Recursive Algorithms and Brute Force

CS Analysis of Recursive Algorithms and Brute Force CS483-05 Analysis of Recursive Algorithms and Brute Force Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/

More information

CHAPTER 4 SOME METHODS OF PROOF

CHAPTER 4 SOME METHODS OF PROOF CHAPTER 4 SOME METHODS OF PROOF In all sciences, general theories usually arise from a number of observations. In the experimental sciences, the validity of the theories can only be tested by carefully

More information

4 Linear Recurrence Relations & the Fibonacci Sequence

4 Linear Recurrence Relations & the Fibonacci Sequence 4 Linear Recurrence Relations & the Fibonacci Sequence Recall the classic example of the Fibonacci sequence (F n ) n=1 the relations: F n+ = F n+1 + F n F 1 = F = 1 = (1, 1,, 3, 5, 8, 13, 1,...), defined

More information

MI 4 Mathematical Induction Name. Mathematical Induction

MI 4 Mathematical Induction Name. Mathematical Induction Mathematical Induction It turns out that the most efficient solution to the Towers of Hanoi problem with n disks takes n 1 moves. If this isn t the formula you determined, make sure to check your data

More information

Recursion and Induction

Recursion and Induction Recursion and Induction Themes Recursion Recursive Definitions Recurrence Relations Induction (prove properties of recursive programs and objects defined recursively) Examples Tower of Hanoi Gray Codes

More information

Quiz 3 Reminder and Midterm Results

Quiz 3 Reminder and Midterm Results Quiz 3 Reminder and Midterm Results Reminder: Quiz 3 will be in the first 15 minutes of Monday s class. You can use any resources you have during the quiz. It covers all four sections of Unit 3. It has

More information

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University U Kang 1 In This Lecture Set concepts and notation Logarithms Summations Recurrence Relations Recursion Induction Proofs

More information

Algorithms CMSC The Method of Reverse Inequalities: Evaluation of Recurrent Inequalities

Algorithms CMSC The Method of Reverse Inequalities: Evaluation of Recurrent Inequalities Algorithms CMSC 37000 The Method of Reverse Inequalities: Evaluation of Recurrent Inequalities László Babai Updated 1-19-2014 In this handout, we discuss a typical situation in the analysis of algorithms:

More information

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2. Chapter 1 LINEAR EQUATIONS 11 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,, a n, b are given real

More information

A matrix over a field F is a rectangular array of elements from F. The symbol

A matrix over a field F is a rectangular array of elements from F. The symbol Chapter MATRICES Matrix arithmetic A matrix over a field F is a rectangular array of elements from F The symbol M m n (F ) denotes the collection of all m n matrices over F Matrices will usually be denoted

More information

ELEMENTARY LINEAR ALGEBRA

ELEMENTARY LINEAR ALGEBRA ELEMENTARY LINEAR ALGEBRA K R MATTHEWS DEPARTMENT OF MATHEMATICS UNIVERSITY OF QUEENSLAND First Printing, 99 Chapter LINEAR EQUATIONS Introduction to linear equations A linear equation in n unknowns x,

More information

Math 2142 Homework 5 Part 1 Solutions

Math 2142 Homework 5 Part 1 Solutions Math 2142 Homework 5 Part 1 Solutions Problem 1. For the following homogeneous second order differential equations, give the general solution and the particular solution satisfying the given initial conditions.

More information

Introduction to Techniques for Counting

Introduction to Techniques for Counting Introduction to Techniques for Counting A generating function is a device somewhat similar to a bag. Instead of carrying many little objects detachedly, which could be embarrassing, we put them all in

More information

Discrete Structures Lecture Sequences and Summations

Discrete Structures Lecture Sequences and Summations Introduction Good morning. In this section we study sequences. A sequence is an ordered list of elements. Sequences are important to computing because of the iterative nature of computer programs. The

More information

On Linear Recursive Sequences with Coefficients in Arithmetic-Geometric Progressions

On Linear Recursive Sequences with Coefficients in Arithmetic-Geometric Progressions Applied Mathematical Sciences, Vol. 9, 015, no. 5, 595-607 HIKARI Ltd, www.m-hikari.com http://dx.doi.org/10.1988/ams.015.5163 On Linear Recursive Sequences with Coefficients in Arithmetic-Geometric Progressions

More information

A System of Difference Equations with Solutions Associated to Fibonacci Numbers

A System of Difference Equations with Solutions Associated to Fibonacci Numbers International Journal of Difference Equations ISSN 0973-6069 Volume Number pp 6 77 06) http://campusmstedu/ijde A System of Difference Equations with Solutions Associated to Fibonacci Numbers Yacine Halim

More information

3 Finite continued fractions

3 Finite continued fractions MTH628 Number Theory Notes 3 Spring 209 3 Finite continued fractions 3. Introduction Let us return to the calculation of gcd(225, 57) from the preceding chapter. 225 = 57 + 68 57 = 68 2 + 2 68 = 2 3 +

More information

Factoring Polynomials. Review and extend factoring skills. LEARN ABOUT the Math. Mai claims that, for any natural number n, the function

Factoring Polynomials. Review and extend factoring skills. LEARN ABOUT the Math. Mai claims that, for any natural number n, the function Factoring Polynomials GOAL Review and extend factoring skills. LEARN ABOUT the Math Mai claims that, for any natural number n, the function f (n) 5 n 3 1 3n 2 1 2n 1 6 always generates values that are

More information

Recurrence Relations

Recurrence Relations Recurrence Relations Recurrence Relations Reading (Epp s textbook) 5.6 5.8 1 Recurrence Relations A recurrence relation for a sequence aa 0, aa 1, aa 2, ({a n }) is a formula that relates each term a k

More information

COMP 555 Bioalgorithms. Fall Lecture 3: Algorithms and Complexity

COMP 555 Bioalgorithms. Fall Lecture 3: Algorithms and Complexity COMP 555 Bioalgorithms Fall 2014 Lecture 3: Algorithms and Complexity Study Chapter 2.1-2.8 Topics Algorithms Correctness Complexity Some algorithm design strategies Exhaustive Greedy Recursion Asymptotic

More information

Mathematical Structures Combinations and Permutations

Mathematical Structures Combinations and Permutations Definitions: Suppose S is a (finite) set and n, k 0 are integers The set C(S, k) of k - combinations consists of all subsets of S that have exactly k elements The set P (S, k) of k - permutations consists

More information

Section 11.1 Sequences

Section 11.1 Sequences Math 152 c Lynch 1 of 8 Section 11.1 Sequences A sequence is a list of numbers written in a definite order: a 1, a 2, a 3,..., a n,... Notation. The sequence {a 1, a 2, a 3,...} can also be written {a

More information

Recurrence Relations

Recurrence Relations Recurrence Relations Simplest Case of General Solutions Ioan Despi despi@turing.une.edu.au University of New England September 13, 2013 Outline Ioan Despi AMTH140 2 of 1 Simplest Case of General Solutions

More information

CS483 Design and Analysis of Algorithms

CS483 Design and Analysis of Algorithms CS483 Design and Analysis of Algorithms Lecture 6-8 Divide and Conquer Algorithms Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: STII, Room 443, Friday 4:00pm - 6:00pm or by appointments

More information

n F(n) 2n F(2n) Here are some values of the series in comparison to Fibonacci number:

n F(n) 2n F(2n) Here are some values of the series in comparison to Fibonacci number: I did my exploration on Lucas numbers because different series fascinate me and it was related to the Fibonacci numbers which is pretty well known to all the mathematicians across the world so I wanted

More information

CS361 Homework #3 Solutions

CS361 Homework #3 Solutions CS6 Homework # Solutions. Suppose I have a hash table with 5 locations. I would like to know how many items I can store in it before it becomes fairly likely that I have a collision, i.e., that two items

More information

The Trees of Hanoi. Joost Engelfriet

The Trees of Hanoi. Joost Engelfriet The Trees of Hanoi Joost Engelfriet Leiden Institute of Advanced Computer Science Leiden University, The Netherlands j.engelfriet@liacs.leidenuniv.nl Abstract The game of the Towers of Hanoi is generalized

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics I- MCA / III- CS & IS LECTURE NOTES (B. E OF VTU) VTU-EDUSAT Programme-17 Dr. V. Lokesha Professor of Mathematics DEPARTMENT OF MATHEMATICS ACHARYA INSTITUTE OF TECNOLOGY Soldevanahalli,

More information

What we have learned What is algorithm Why study algorithm The time and space efficiency of algorithm The analysis framework of time efficiency Asympt

What we have learned What is algorithm Why study algorithm The time and space efficiency of algorithm The analysis framework of time efficiency Asympt Lecture 3 The Analysis of Recursive Algorithm Efficiency What we have learned What is algorithm Why study algorithm The time and space efficiency of algorithm The analysis framework of time efficiency

More information

Appendix G: Mathematical Induction

Appendix G: Mathematical Induction Appendix G: Mathematical Induction Introduction In this appendix, you will study a form of mathematical proof called mathematical induction. To see the logical need for mathematical induction, take another

More information

CS Non-recursive and Recursive Algorithm Analysis

CS Non-recursive and Recursive Algorithm Analysis CS483-04 Non-recursive and Recursive Algorithm Analysis Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/

More information

Generalizations of Fibonacci and Lucas sequences

Generalizations of Fibonacci and Lucas sequences Note di Matematica 1, n 1, 00, 113 1 Generalizations of Fibonacci Lucas sequences Nihal Yilmaz Özgür Balikesir Universitesi, Fen-Edebiyat Fakultesi Matematik Bolumu, 10100 Balikesir/Turkey nihal@balikesiredutr

More information

ASSIGNMENT 12 PROBLEM 4

ASSIGNMENT 12 PROBLEM 4 ASSIGNMENT PROBLEM 4 Generate a Fibonnaci sequence in the first column using f 0 =, f 0 =, = f n f n a. Construct the ratio of each pair of adjacent terms in the Fibonnaci sequence. What happens as n increases?

More information

Divide and Conquer. Maximum/minimum. Median finding. CS125 Lecture 4 Fall 2016

Divide and Conquer. Maximum/minimum. Median finding. CS125 Lecture 4 Fall 2016 CS125 Lecture 4 Fall 2016 Divide and Conquer We have seen one general paradigm for finding algorithms: the greedy approach. We now consider another general paradigm, known as divide and conquer. We have

More information

Notes for Recitation 14

Notes for Recitation 14 6.04/18.06J Mathematics for Computer Science October 7, 006 Tom Leighton and Ronitt Rubinfeld Notes for Recitation 14 Guessing a Particular Solution A general linear recurrence has the form: fn) = b 1

More information

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence Section 2.4 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations Introduction Sequences are ordered lists of elements.

More information

Introduction to Lucas Sequences

Introduction to Lucas Sequences A talk given at Liaoning Normal Univ. (Dec. 14, 017) Introduction to Lucas Sequences Zhi-Wei Sun Nanjing University Nanjing 10093, P. R. China zwsun@nju.edu.cn http://math.nju.edu.cn/ zwsun Dec. 14, 017

More information

Some Review Problems for Exam 2: Solutions

Some Review Problems for Exam 2: Solutions Math 5366 Fall 017 Some Review Problems for Exam : Solutions 1 Find the coefficient of x 15 in each of the following: 1 (a) (1 x) 6 Solution: 1 (1 x) = ( ) k + 5 x k 6 k ( ) ( ) 0 0 so the coefficient

More information

CS 4104 Data and Algorithm Analysis. Recurrence Relations. Modeling Recursive Function Cost. Solving Recurrences. Clifford A. Shaffer.

CS 4104 Data and Algorithm Analysis. Recurrence Relations. Modeling Recursive Function Cost. Solving Recurrences. Clifford A. Shaffer. Department of Computer Science Virginia Tech Blacksburg, Virginia Copyright c 2010,2017 by Clifford A. Shaffer Data and Algorithm Analysis Title page Data and Algorithm Analysis Clifford A. Shaffer Spring

More information

Intermediate Math Circles March 11, 2009 Sequences and Series

Intermediate Math Circles March 11, 2009 Sequences and Series 1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Intermediate Math Circles March 11, 009 Sequences and Series Tower of Hanoi The Tower of Hanoi is a game

More information

MEETING 9 - INDUCTION AND RECURSION

MEETING 9 - INDUCTION AND RECURSION MEETING 9 - INDUCTION AND RECURSION We do some initial Peer Instruction... Predicates Before we get into mathematical induction we will repeat the concept of a predicate. A predicate is a mathematical

More information

Applications. More Counting Problems. Complexity of Algorithms

Applications. More Counting Problems. Complexity of Algorithms Recurrences Applications More Counting Problems Complexity of Algorithms Part I Recurrences and Binomial Coefficients Paths in a Triangle P(0, 0) P(1, 0) P(1,1) P(2, 0) P(2,1) P(2, 2) P(3, 0) P(3,1) P(3,

More information

arxiv:math/ v1 [math.co] 8 Oct 2003

arxiv:math/ v1 [math.co] 8 Oct 2003 arxiv:math/0310109v1 [math.co] 8 Oct 2003 Shortest paths in the Tower of Hanoi graph and finite automata Dan Romik February 1, 2008 Abstract We present efficient algorithms for constructing a shortest

More information

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency Lecture 2 Fundamentals of the Analysis of Algorithm Efficiency 1 Lecture Contents 1. Analysis Framework 2. Asymptotic Notations and Basic Efficiency Classes 3. Mathematical Analysis of Nonrecursive Algorithms

More information

Solving Recurrences. 1. Express the running time (or use of some other resource) as a recurrence.

Solving Recurrences. 1. Express the running time (or use of some other resource) as a recurrence. Solving Recurrences Recurrences and Recursive Code Many (perhaps most) recursive algorithms fall into one of two categories: tail recursion and divide-andconquer recursion. We would like to develop some

More information

Solving Recurrences. 1. Express the running time (or use of some other resource) as a recurrence.

Solving Recurrences. 1. Express the running time (or use of some other resource) as a recurrence. 1 Recurrences and Recursive Code Solving Recurrences Many (perhaps most) recursive algorithms fall into one of two categories: tail recursion and divide-andconquer recursion. We would like to develop some

More information

Computational Complexity. This lecture. Notes. Lecture 02 - Basic Complexity Analysis. Tom Kelsey & Susmit Sarkar. Notes

Computational Complexity. This lecture. Notes. Lecture 02 - Basic Complexity Analysis. Tom Kelsey & Susmit Sarkar. Notes Computational Complexity Lecture 02 - Basic Complexity Analysis Tom Kelsey & Susmit Sarkar School of Computer Science University of St Andrews http://www.cs.st-andrews.ac.uk/~tom/ twk@st-andrews.ac.uk

More information