3. Generating Functions

Size: px
Start display at page:

Download "3. Generating Functions"

Transcription

1 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions

2 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3a.GFs.OGFs

3 Ordinary generating functions Definition. () = is the ordinary generating function (OGF) of the sequence,,,...,,... Notation. [z N ]A(z) is the coefficient of z N in A(z) sequence 1, 1, 1, 1, 1,... 1, 1/2, 1/6, 1/24,... OGF =! = [z N ]e z = 1/N! Significance. Can represent an entire sequence with a single function. 3

4 Operations on OGFs: Scaling If () = is the OGF of,,,...,,... then () = is the OGF of,,,,... sequence 1, 1, 1, 1, 1,... 1, 2, 4, 8, 16, 32,... OGF = = [ ] = 4

5 Operations on OGFs: Addition If () = is the OGF of,,,...,,... and () = is the OGF of,,,...,,... then ()+() is the OGF of +, +, +,..., +... Example: sequence 1, 1, 1, 1, 1,... 1, 2, 4, 8, 16, 32,... 0, 1, 3, 7, 15, 31,... OGF = = 5

6 Operations on OGFs: Differentiation If () = is the OGF of,,,...,,... then () = is the OGF of,,,,...,,... OGF = ( ) = ( ) = ( ) ( ) = ( ) + sequence 1, 1, 1, 1, 1,... 0, 1, 2, 3, 4, 5,... 0, 0, 1, 3, 6, 10,... 0,..., 1, M+1, (M+2)(M+1)/2,... ( ) + = + 1, M+1, (M+2)(M+1)/2,... 6

7 Operations on OGFs: Integration If () = is the OGF of,,,...,,... then () =,,,,..., is the OGF of,... Example: OGF = sequence 1, 1, 1, 1, 1,... ln = 0, 1, 1/2, 1/3, 1/4, 1/5,... 7

8 Operations on OGFs: Partial sum If () = is the OGF of,,,...,,... then () is the OGF of, +, + +,... Proof. Distribute Change n to n k Switch order of summation. Change k to n k () = = + = = ( ) = ( ) 8

9 = = = = Operations on OGFs: Partial sum If () = is the OGF of,,,...,,... then () is the OGF of, +, + +,... Example: OGF () = + sequence = 1, 1, 1, 1, 1,... ln = 0, 1, 1/2, 1/3, 1/4, 1/5,... ln = 1, 1 + 1/2, 1 + 1/2 + 1/3,... 9

10 Operations on OGFs: Convolution If () = is the OGF of,,,...,,... () = and is the OGF of,,,...,,... then ()() is the OGF of, +,...,,... Proof. ()() = Distribute = + Change n to n k = Switch order of summation. = 10

11 Operations on OGFs: Convolution If () = is the OGF of,,,...,,... () = and is the OGF of,,,...,,... then ()() is the OGF of, +,...,,... Example: OGF = sequence 1, 1, 1, 1, 1,... ( ) = ( + ) 1, 2, 3, 4, 5,... 11

12 Expanding a GF (summary) The process of expressing an unknown GF as a power series (finding the coefficients) is known as expanding the GF. Techniques we have been using: 1. Taylor theorem: () =()+ () + ()! + ()! + () +...! Example. = + +! +! +! Reduce to known GFs. Example. [ ] ( ) ln = = Integrate then convolve to get ln with ln 12

13 In-class exercise Exercise 3.4 Prove that =( + )( + ) ln 1. Find GF for LHS (convolve with ) ln ( ) 2. Expand GF to find RHS coefficients (convolve ln with ( ) ) [ ] ln ( ) = ( + ) 3. Do some math =( + ) =( + )( + =( + )( + + ) ) 13

14 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3a.GFs.OGFs

15 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3b.GFs.recurrences

16 Solving recurrences with OGFs General procedure: Make recurrence valid for all n. Multiply both sides of the recurrence by z n and sum on n. Evaluate the sums to derive an equation satisfied by the OGF. Solve the equation to derive an explicit formula for the OGF. (Use the initial conditions!) Expand the OGF to find coefficients. recurrence sequence 16

17 Solving recurrences with GFs For linear recurrences with constant coefficients, the GF equation is a polynomial, so the general procedure is a algorithm. Example 4 from previous lecture. Expand. = = = Make recurrence valid for all n. = + Multiply by z n and sum on n. () =() ()+ Solve. () = Use partial fractions: solution must be of the form Solve for coefficients. () = = = + = Solution is c 0 = 1 and c 1 = 1 () = 17

18 Solving linear recurrences with GFs For linear recurrences with constant coefficients, the GF equation is a polynomial, so the general procedure is a algorithm. Example with multiple roots. = + =, = = Make recurrence valid for all n. = + + Multiply by z n and sum on n. () =() ()+ ()+ Solve. () = + Simplify. () = ( ) ( )( ) = ( ) Expand. = multiplicity 3 gives terms of the form n 2 β n, etc. 18

19 Solving linear recurrences with GFs For linear recurrences with constant coefficients, the GF equation is a polynomial, so the general procedure is a algorithm. Example with complex roots. = + =, = = Make recurrence valid for all n. = + + Multiply by z n and sum on n. () =() ()+ ()+ Solve. Simplify. () = Use partial fractions. () = + ( )( + ) = ( + ) () = + + Expand. = ( +( ) )= ( +( ) ) 1, 0, -1, 0, 1, 0, -1, 0,

20 Solving linear recurrences with GFs (summary) Solution to = is a linear combination of t terms. Suppose the roots of the polynomial are β1, β2,..., βr where the multiplicity of βi is mi so = Solution is < β + < β < β t terms The t constants cij are determined from the initial conditions. Note: complex roots (and 1) introduce periodic behavior. 20

21 Solving the Quicksort recurrence with OGFs = + + = ( + )+ Multiply both sides by N. Multiply by zn and sum. = ( + ) + homogeneous equation Evaluate sums to get an ordinary differential equation ( )= ( ) ( ) + ( )= ( )/( solution (integration factor) ( ) = /( Solve the ODE. (( ) Integrate. Expand. ( )) = ( ) =( ) ( )= =[ ] ( ( ) ) ln ) ( ) ( ( ) ) ) ( ) ( ) = ln = ( + )( + ) 21

22 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3b.GFs.recurrences

23 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3c.GFs.Catalan

24 Catalan numbers How many triangulations of an (N+2)-gon? Tk TN 1 k T0 = 1 T1 = 1 T2 = 2 = < + T3 = 5 T4=14 24

25 Catalan numbers How many gambler s ruin sequences with N wins? Tk TN 1 k T0 = 1 T1 = T2 = T3 = 5 = < + T4=14 25

26 Catalan numbers How many binary trees with N nodes? Tk TN 1 k k nodes N 1 k nodes = < + 26

27 Catalan numbers How many trees with N+1 nodes? Tk TN 1 k k+1 nodes N k nodes = < + 27

28 Solving the Catalan recurrence with GFs Recurrence that holds for all N. = + δ < Multiply by z N and sum. () = < + Switch order of summation () = + > Change N to N+k+1 () = + ++ convolution (backwards) Distribute. () = + () = + () 28

29 Common-sense rule for working with GFs It is always worthwhile to check your math with your computer. Known from initial values: () = Check: () = + () sage: ZP.<z> = ZZ[] sage: 1 + z*(1+z+2*z^2+5*z^3+14*z^4)*(1+z+2*z^2+5*z^3+14*z^4) 196*z^ *z^8 + 81*z^7 + 48*z^6 + 42*z^5 + 14*z^4 + 5*z^3 + 2*z^2 + z + 1 not valid because z^5 and beyond missing in factors 29

30 Solving the Catalan recurrence with GFs (continued) Functional GF equation. () = + () Solve with quadratic formula. () = ( ± ) Expand via binomial theorem. () = ( ) Set coefficients equal = Expand via definition. = Distribute ( 2) N among factors. = + ( )+ ( )( )...( )( ) + ( + )! ( ) ( + )! Substitute (2/1)(4/2)(6/3)... for 2 N. = ( +! = + ) 30

31 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3c.GFs.Catalan

32 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3d.GFs.EGFs

33 Exponential generating functions (EGFs) Definition. () =! is the exponential generating function (EGF) of the sequence,,,...,,... sequence 1, 1, 1, 1, 1,... 1, 2, 4, 8, 16, 32,... 1, 1, 2, 6, 24, EGF! =! =!! = 33

34 Operations on EGFs: Binomial convolution If () =! is the EGF of,,,...,,... and () = is the EGF of,,,...,,...! then ()() is the EGF of, +,...,,... Proof. ()() = Distribute. = Change n to n k = Multiply and divide by n! = Switch order of summation. =!!!! +! ( )!!! 34

35 Solving recurrences with EGFs Choice of EGF vs. OGF is typically dictated naturally from the problem. Example. = Multiply by z n /n! and sum on n. () = Switch order of summation. () =!! Change n to n+k. () = Simplify. () = + (/)!! + ( + )! binomial convolution (backwards) Distribute. () = Evaluate and telescope. (/)! () = (/) = +/+/+/+... =! convergence not assured Expand. = Check. = 35

36 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3d.GFs.EGFs

37 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3e.GFs.counting

38 Counting with generating functions An alternative (combinatorial) view of GFs Define a class of combinatorial obects with associated size function. GF is sum over all members of the class. Example. T set of all binary trees t number of internal nodes in t T TN number of t T with t = N () T = Decompose from definition Distribute () = + ( )( ) = tl tl nodes tr tr nodes = + () 38

39 Combinatorial view of Catalan GF Each term z N in the GF corresponds to an object of size N. Collect all the terms with the same exponent to expose counts. Each term z i z j in a product corresponds to an object of size i + j. () = = () = + () = + ( )( ) =

40 Values of parameters ("costs") are often the object of study in the analysis of algorithms. How many 1 bits in a random bitstring? (Easy) How many leaves in a random binary tree? (Not so easy) leaf 40

41 Computing expected costs by counting An alternative (combinatorial) view of probability Define a class of combinatorial obects. Model: All objects of size N are equally likely P P P = () P = Expected cost of an object of size N = PNk/PN is the probability that the cost of on object of size N is k cumulated cost Def. Cumulated cost is total cost of all objects of a given size. Expected cost is cumulated cost divided by number of objects. 41

42 Counting with generating functions: cumulative costs An alternative (combinatorial) view of GFs Define a class of combinatorial obects. Model: All objects of size N are equally likely GF is sum over all members of the class. P P P = () Counting GF () P = Cumulative cost GF Average cost () () = P [ ]()/[ ]() Bottom line: Reduces computing expectation to GF counting 42

43 Warmup: How many 1 bits in a random bitstring? B is the set of all bitstrings. b is the number of bits in b. ones(b) is the number of 1 bits in b. BN is the # of bitstrings of size N (2 N ). CN is the total number of 1 bits in all bitstrings of size N. Counting GF. () = = = Cumulative cost GF. () = Average # 1 bits in a random bitstring of length N. = () + + ( ) = ()+() = ( ) [ ]() [ ]() = = 0 b 1 b ( ) = () 43

44 Leaves in binary trees are internal nodes whose children are both external. Definitions: TN is the # of binary trees with N nodes. tnk is the # of N-node binary trees with k leaves CN is the average # of leaves in a random N-node binary tree C0 = 0 t11=1 C1 = 1 t21=2 C2 = 1 t31=4 t32=1 C3 = 1.2 t41=8 t42=6 C4 = Q. How many leaves in a random binary tree? 44

45 How many leaves in a random binary tree? T is the set of all binary trees. t is the number of internal nodes in t. leaves(t ) is the number of leaves in t. TN is the # of binary trees of size N (Catalan). CN is the total number of leaves in all binary trees of size N. Counting GF. () = T = = + Cumulative cost GF. () = () Average # leaves in a random N-node binary tree. [ ]() [ ]() = [ ]() Next: Derive a functional equation for the CGF. 45

46 CGF functional equation for leaves in binary trees CGF. () = Decompose from definition. () tl tl nodes leaves(tl) leaves tr tr nodes leaves(tr) leaves () = + ( )+( ) + + = + ( ) + ( ) = + ()() 46

47 How many leaves in a random binary tree? CGF. () = () Decompose from definition. () = + ( )+( ) + + = + ()() Compute number of trees T N. () = () =[ ] Catalan numbers = ( ) = + ( ) Compute cumulated cost C N. () = + ()() = () = =[ ] = Compute average number of leaves. / = + = ( + ) ( ) / 47

48 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions OF OGFs Solving recurrences Catalan numbers EGFs Counting with GFs 3e.GFs.counting

49 Exercise 3.20 Solve a linear recurrence. Initial conditions matter. AN INTRODUCTION TO THE ANALYSIS OF ALGORITHMS S E C O N D E D I T I O N R O B E R T S E D G E W I C K PHILIPPE FLAJOLET 49

50 Exercise 3.28 The art of expanding GFs. AN INTRODUCTION TO THE ANALYSIS OF ALGORITHMS S E C O N D E D I T I O N R O B E R T S E D G E W I C K PHILIPPE FLAJOLET 50

51 Assignments for next lecture 1. Use a symbolic mathematics system to check initial values for C(z) = z + 2C(z)T(z). 2. Read pages in text. AN INTRODUCTION TO THE ANALYSIS OF ALGORITHMS S E C O N D E D I T I O N 3. Write up solutions to Exercises 3.20 and R O B E R T S E D G E W I C K PHILIPPE FLAJOLET 51

52 ANALYTIC COMBINATORICS P A R T O N E 3. Generating Functions

5. Analytic Combinatorics

5. Analytic Combinatorics ANALYTIC COMBINATORICS P A R T O N E 5. Analytic Combinatorics http://aofa.cs.princeton.edu Analytic combinatorics is a calculus for the quantitative study of large combinatorial structures. Features:

More information

4. Complex Analysis, Rational and Meromorphic Asymptotics

4. Complex Analysis, Rational and Meromorphic Asymptotics ANALYTIC COMBINATORICS P A R T T W O 4. Complex Analysis, Rational and Meromorphic Asymptotics http://ac.cs.princeton.edu ANALYTIC COMBINATORICS P A R T T W O Analytic Combinatorics Philippe Flajolet and

More information

Notes by Zvi Rosen. Thanks to Alyssa Palfreyman for supplements.

Notes by Zvi Rosen. Thanks to Alyssa Palfreyman for supplements. Lecture: Hélène Barcelo Analytic Combinatorics ECCO 202, Bogotá Notes by Zvi Rosen. Thanks to Alyssa Palfreyman for supplements.. Tuesday, June 2, 202 Combinatorics is the study of finite structures that

More information

DISCRETE AND ALGEBRAIC STRUCTURES

DISCRETE AND ALGEBRAIC STRUCTURES DISCRETE AND ALGEBRAIC STRUCTURES Master Study Mathematics MAT40 Winter Semester 015/16 (Due to organisational reasons register for the course at TU and KFU) Edited by Mihyun Kang TU Graz Contents I Lectures

More information

Unlabelled Structures: Restricted Constructions

Unlabelled Structures: Restricted Constructions Gao & Šana, Combinatorial Enumeration Notes 5 Unlabelled Structures: Restricted Constructions Let SEQ k (B denote the set of sequences of exactly k elements from B, and SEQ k (B denote the set of sequences

More information

LECTURE Questions 1

LECTURE Questions 1 Contents 1 Questions 1 2 Reality 1 2.1 Implementing a distribution generator.............................. 1 2.2 Evaluating the generating function from the series expression................ 2 2.3 Finding

More information

On (Effective) Analytic Combinatorics

On (Effective) Analytic Combinatorics On (Effective) Analytic Combinatorics Bruno Salvy Inria & ENS de Lyon Séminaire Algorithmes Dec. 2017 Combinatorics, Randomness and Analysis From simple local rules, a global structure arises. A quest

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

FINITE DIFFERENCES. Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations.

FINITE DIFFERENCES. Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations. FINITE DIFFERENCES Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations. 1. Introduction When a function is known explicitly, it is easy

More information

Notes on the Catalan problem

Notes on the Catalan problem Notes on the Catalan problem Daniele Paolo Scarpazza Politecnico di Milano March 16th, 2004 Daniele Paolo Scarpazza Notes on the Catalan problem [1] An overview of Catalan problems

More information

Combinatorial/probabilistic analysis of a class of search-tree functionals

Combinatorial/probabilistic analysis of a class of search-tree functionals Combinatorial/probabilistic analysis of a class of search-tree functionals Jim Fill jimfill@jhu.edu http://www.mts.jhu.edu/ fill/ Mathematical Sciences The Johns Hopkins University Joint Statistical Meetings;

More information

Combinatorial Enumeration. Jason Z. Gao Carleton University, Ottawa, Canada

Combinatorial Enumeration. Jason Z. Gao Carleton University, Ottawa, Canada Combinatorial Enumeration Jason Z. Gao Carleton University, Ottawa, Canada Counting Combinatorial Structures We are interested in counting combinatorial (discrete) structures of a given size. For example,

More information

are the q-versions of n, n! and . The falling factorial is (x) k = x(x 1)(x 2)... (x k + 1).

are the q-versions of n, n! and . The falling factorial is (x) k = x(x 1)(x 2)... (x k + 1). Lecture A jacques@ucsd.edu Notation: N, R, Z, F, C naturals, reals, integers, a field, complex numbers. p(n), S n,, b(n), s n, partition numbers, Stirling of the second ind, Bell numbers, Stirling of the

More information

DISCRETE AND ALGEBRAIC STRUCTURES

DISCRETE AND ALGEBRAIC STRUCTURES DISCRETE AND ALGEBRAIC STRUCTURES Master Study Mathematics MAT.40 Winter Semester 015/016 & 016/17 (Due to organisational reasons register for the course at TU and KFU) Parts I & II Contents I Combinatorics

More information

LECTURE 7. 2 Simple trees and Lagrange Inversion Restricting the out-degree Lagrange Inversion... 4

LECTURE 7. 2 Simple trees and Lagrange Inversion Restricting the out-degree Lagrange Inversion... 4 Contents 1 Recursive specifications 1 1.1 Binary Trees B............................................ 1 1.1.1 A recursive structure.................................... 1.1. Decomposition........................................

More information

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 14 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 14 Notes Goals for this week Big-O complexity

More information

Generating Functions

Generating Functions Semester 1, 2004 Generating functions Another means of organising enumeration. Two examples we have seen already. Example 1. Binomial coefficients. Let X = {1, 2,..., n} c k = # k-element subsets of X

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

k-protected VERTICES IN BINARY SEARCH TREES

k-protected VERTICES IN BINARY SEARCH TREES k-protected VERTICES IN BINARY SEARCH TREES MIKLÓS BÓNA Abstract. We show that for every k, the probability that a randomly selected vertex of a random binary search tree on n nodes is at distance k from

More information

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 3

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 3 MA008 p.1/37 MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 3 Dr. Markus Hagenbuchner markus@uow.edu.au. MA008 p.2/37 Exercise 1 (from LN 2) Asymptotic Notation When constants appear in exponents

More information

Generating Functions

Generating Functions 8.30 lecture notes March, 0 Generating Functions Lecturer: Michel Goemans We are going to discuss enumeration problems, and how to solve them using a powerful tool: generating functions. What is an enumeration

More information

Algorithmic Tools for the Asymptotics of Diagonals

Algorithmic Tools for the Asymptotics of Diagonals Algorithmic Tools for the Asymptotics of Diagonals Bruno Salvy Inria & ENS de Lyon Lattice walks at the Interface of Algebra, Analysis and Combinatorics September 19, 2017 Asymptotics & Univariate Generating

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 9 Divide and Conquer Merge sort Counting Inversions Binary Search Exponentiation Solving Recurrences Recursion Tree Method Master Theorem Sofya Raskhodnikova S. Raskhodnikova;

More information

Catalan numbers Wonders of Science CESCI, Madurai, August

Catalan numbers Wonders of Science CESCI, Madurai, August Catalan numbers Wonders of Science CESCI, Madurai, August 25 2009 V.S. Sunder Institute of Mathematical Sciences Chennai, India sunder@imsc.res.in August 25, 2009 Enumerative combinatorics Enumerative

More information

Taylor and Maclaurin Series

Taylor and Maclaurin Series Taylor and Maclaurin Series MATH 211, Calculus II J. Robert Buchanan Department of Mathematics Spring 2018 Background We have seen that some power series converge. When they do, we can think of them as

More information

Symbolic-Numeric Tools for Multivariate Asymptotics

Symbolic-Numeric Tools for Multivariate Asymptotics Symbolic-Numeric Tools for Multivariate Asymptotics Bruno Salvy Joint work with Stephen Melczer to appear in Proc. ISSAC 2016 FastRelax meeting May 25, 2016 Combinatorics, Randomness and Analysis From

More information

Generating Function Notes , Fall 2005, Prof. Peter Shor

Generating Function Notes , Fall 2005, Prof. Peter Shor Counting Change Generating Function Notes 80, Fall 00, Prof Peter Shor In this lecture, I m going to talk about generating functions We ve already seen an example of generating functions Recall when we

More information

Diagonals: Combinatorics, Asymptotics and Computer Algebra

Diagonals: Combinatorics, Asymptotics and Computer Algebra Diagonals: Combinatorics, Asymptotics and Computer Algebra Bruno Salvy Inria & ENS de Lyon Families of Generating Functions (a n ) 7! A(z) := X n 0 a n z n counts the number of objects of size n captures

More information

Recursion. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

Recursion. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007 Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Fall 2007 1 / 47 Computer Science & Engineering 235 to Discrete Mathematics Sections 7.1-7.2 of Rosen Recursive Algorithms 2 / 47 A recursive

More information

COUNTING WITH AB-BA=1

COUNTING WITH AB-BA=1 COUNTING WITH AB-BA=1 PHILIPPE FLAJOLET, ROCQUENCOURT & PAWEL BLASIAK, KRAKÓW COMBINATORIAL MODELS OF ANNIHILATION-CREATION ; IN PREP. (2010) 1 A. = + + B. = 2 Annihilation and Creation A = Annihilate

More information

Lecture 7: Dynamic Programming I: Optimal BSTs

Lecture 7: Dynamic Programming I: Optimal BSTs 5-750: Graduate Algorithms February, 06 Lecture 7: Dynamic Programming I: Optimal BSTs Lecturer: David Witmer Scribes: Ellango Jothimurugesan, Ziqiang Feng Overview The basic idea of dynamic programming

More information

and the compositional inverse when it exists is A.

and the compositional inverse when it exists is A. Lecture B jacques@ucsd.edu Notation: R denotes a ring, N denotes the set of sequences of natural numbers with finite support, is a generic element of N, is the infinite zero sequence, n 0 R[[ X]] denotes

More information

MIDTERM Fundamental Algorithms, Spring 2008, Professor Yap March 10, 2008

MIDTERM Fundamental Algorithms, Spring 2008, Professor Yap March 10, 2008 INSTRUCTIONS: MIDTERM Fundamental Algorithms, Spring 2008, Professor Yap March 10, 2008 0. This is a closed book exam, with one 8 x11 (2-sided) cheat sheet. 1. Please answer ALL questions (there is ONE

More information

COMP 382: Reasoning about algorithms

COMP 382: Reasoning about algorithms Fall 2014 Unit 4: Basics of complexity analysis Correctness and efficiency So far, we have talked about correctness and termination of algorithms What about efficiency? Running time of an algorithm For

More information

Ma/CS 6a Class 24: More Generating Functions

Ma/CS 6a Class 24: More Generating Functions Ma/CS 6a Class 24: More Generating Functions Road signs from http://www.math.ucla.edu/~pak/ By Adam Sheffer Reminder: Generating Functions Given an infinite sequence of numbers a 0, a 1, a 2, the generating

More information

BT Research at Martlesham, Suffolk

BT Research at Martlesham, Suffolk Connectivity of random graphs Keith Briggs Keith.Briggs@bt.com research.btexact.com/teralab/keithbriggs.html Alan Turing Institute 2004 November 19 1330 typeset 2004 November 17 10:55 in pdflatex on a

More information

1 Solving Linear Recurrences

1 Solving Linear Recurrences Solving Linear Recurrences Suppose we have a sequence a n defined by the formula The first couple terms of the sequence are a n = 3a n +, a 0 =, 4, 3, 40, 2,... Can you find a general closed for expression

More information

De part en retraite de Pierre

De part en retraite de Pierre Introduction Combinatorics Generating Series Oracle Conclusion De part en retraite de Pierre Villetaneuse, fe vrier 2013 1 / 41 De part en retraite de Pierre Introduction Combinatorics Generating Series

More information

q-counting hypercubes in Lucas cubes

q-counting hypercubes in Lucas cubes Turkish Journal of Mathematics http:// journals. tubitak. gov. tr/ math/ Research Article Turk J Math (2018) 42: 190 203 c TÜBİTAK doi:10.3906/mat-1605-2 q-counting hypercubes in Lucas cubes Elif SAYGI

More information

Applications of Discrete Mathematics to the Analysis of Algorithms

Applications of Discrete Mathematics to the Analysis of Algorithms Applications of Discrete Mathematics to the Analysis of Algorithms Conrado Martínez Univ. Politècnica de Catalunya, Spain May 2007 Goal Given some algorithm taking inputs from some set Á, we would like

More information

Power Series Solutions We use power series to solve second order differential equations

Power Series Solutions We use power series to solve second order differential equations Objectives Power Series Solutions We use power series to solve second order differential equations We use power series expansions to find solutions to second order, linear, variable coefficient equations

More information

Asymptotic Analysis. Slides by Carl Kingsford. Jan. 27, AD Chapter 2

Asymptotic Analysis. Slides by Carl Kingsford. Jan. 27, AD Chapter 2 Asymptotic Analysis Slides by Carl Kingsford Jan. 27, 2014 AD Chapter 2 Independent Set Definition (Independent Set). Given a graph G = (V, E) an independent set is a set S V if no two nodes in S are joined

More information

Review problems solutions

Review problems solutions Review problems solutions Math 3152 December 15, 2017 1. Use the binomial theorem to prove that, for all n 1 and k satisfying 0 k n, ( )( ) { n i ( 1) i k 1 if k n; i k 0 otherwise. ik Solution: Using

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

Today s Outline. CS 362, Lecture 4. Annihilator Method. Lookup Table. Annihilators for recurrences with non-homogeneous terms Transformations

Today s Outline. CS 362, Lecture 4. Annihilator Method. Lookup Table. Annihilators for recurrences with non-homogeneous terms Transformations Today s Outline CS 362, Lecture 4 Jared Saia University of New Mexico Annihilators for recurrences with non-homogeneous terms Transformations 1 Annihilator Method Lookup Table Write down the annihilator

More information

Some Catalan Musings p. 1. Some Catalan Musings. Richard P. Stanley

Some Catalan Musings p. 1. Some Catalan Musings. Richard P. Stanley Some Catalan Musings p. 1 Some Catalan Musings Richard P. Stanley Some Catalan Musings p. 2 An OEIS entry A000108: 1,1,2,5,14,42,132,429,... Some Catalan Musings p. 2 An OEIS entry A000108: 1,1,2,5,14,42,132,429,...

More information

The Subtree Size Profile of Bucket Recursive Trees

The Subtree Size Profile of Bucket Recursive Trees Iranian Journal of Mathematical Sciences and Informatics Vol., No. (206, pp - DOI: 0.7508/ijmsi.206.0.00 The Subtree Size Profile of Bucket Recursive Trees Ramin Kazemi Department of Statistics, Imam Khomeini

More information

The Subtree Size Profile of Plane-oriented Recursive Trees

The Subtree Size Profile of Plane-oriented Recursive Trees The Subtree Size Profile of Plane-oriented Recursive Trees Michael Fuchs Department of Applied Mathematics National Chiao Tung University Hsinchu, Taiwan ANALCO11, January 22nd, 2011 Michael Fuchs (NCTU)

More information

arxiv: v1 [math.co] 12 Sep 2018

arxiv: v1 [math.co] 12 Sep 2018 ON THE NUMBER OF INCREASING TREES WITH LABEL REPETITIONS arxiv:809.0434v [math.co] Sep 08 OLIVIER BODINI, ANTOINE GENITRINI, AND BERNHARD GITTENBERGER Abstract. In this paper we study a special subclass

More information

Analytic Combinatorics: A Primer

Analytic Combinatorics: A Primer Analytic Combinatorics: A Primer Conrado Martínez Univ. Politècnica de Catalunya, Spain April 2011 What is this course about? Analytic Combinatorics seeks to develop mathematical techniques that help us

More information

ADDITIONAL NOTES. 3 Surjections 6

ADDITIONAL NOTES. 3 Surjections 6 Contents Labelling Atoms. Well-labelling............................................. The Exponential Generating Function egf............................3 Examples................................................

More information

A REFINED ENUMERATION OF p-ary LABELED TREES

A REFINED ENUMERATION OF p-ary LABELED TREES Korean J. Math. 21 (2013), No. 4, pp. 495 502 http://dx.doi.org/10.11568/kjm.2013.21.4.495 A REFINED ENUMERATION OF p-ary LABELED TREES Seunghyun Seo and Heesung Shin Abstract. Let T n (p) be the set of

More information

A BIJECTION BETWEEN WELL-LABELLED POSITIVE PATHS AND MATCHINGS

A BIJECTION BETWEEN WELL-LABELLED POSITIVE PATHS AND MATCHINGS Séminaire Lotharingien de Combinatoire 63 (0), Article B63e A BJECTON BETWEEN WELL-LABELLED POSTVE PATHS AND MATCHNGS OLVER BERNARD, BERTRAND DUPLANTER, AND PHLPPE NADEAU Abstract. A well-labelled positive

More information

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 15 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 15 Notes Goals for this week Big-O complexity

More information

Analysis of Algorithms Generating Functions II. Holger Findling

Analysis of Algorithms Generating Functions II. Holger Findling Generating Functions II Holger Findling Lecture notes are obtained from Fundamentals of Algorithmics, Gilles Brassard and Paul Bratley. Inhomogeneous Recurrences. The solution of a linear recurrence with

More information

Refining the Stern Diatomic Sequence

Refining the Stern Diatomic Sequence Refining the Stern Diatomic Sequence Richard P. Stanley Massachusetts Institute of Technology Cambridge, MA 0139-4307 Herbert S. Wilf University of Pennsylvania Philadelphia, PA 19104-6395

More information

Fast reversion of formal power series

Fast reversion of formal power series Fast reversion of formal power series Fredrik Johansson LFANT, INRIA Bordeaux RAIM, 2016-06-29, Banyuls-sur-mer 1 / 30 Reversion of power series F = exp(x) 1 = x + x 2 2! + x 3 3! + x 4 G = log(1 + x)

More information

CIS Spring 2018 (instructor Val Tannen)

CIS Spring 2018 (instructor Val Tannen) CIS 160 - Spring 018 (instructor Val Tannen) Lecture 11 Tuesday, February 0 PROOFS: STRONG INDUCTION Example 1.1 Any integer n can be written as the product of one or more (not necessarily distinct) prime

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

Some Catalan Musings p. 1. Some Catalan Musings. Richard P. Stanley

Some Catalan Musings p. 1. Some Catalan Musings. Richard P. Stanley Some Catalan Musings p. 1 Some Catalan Musings Richard P. Stanley Some Catalan Musings p. 2 An OEIS entry A000108: 1,1,2,5,14,42,132,429,... Some Catalan Musings p. 2 An OEIS entry A000108: 1,1,2,5,14,42,132,429,...

More information

Algorithmic Approach to Counting of Certain Types m-ary Partitions

Algorithmic Approach to Counting of Certain Types m-ary Partitions Algorithmic Approach to Counting of Certain Types m-ary Partitions Valentin P. Bakoev Abstract Partitions of integers of the type m n as a sum of powers of m (the so called m-ary partitions) and their

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

FastTrack - MA109. Exponents and Review of Polynomials

FastTrack - MA109. Exponents and Review of Polynomials FastTrack - MA109 Exponents and Review of Polynomials Katherine Paullin, Ph.D. Lecturer, Department of Mathematics University of Kentucky katherine.paullin@uky.edu Monday, August 15, 2016 1 / 25 REEF Question

More information

Algorithms for Combinatorial Systems: Between Analytic Combinatorics and Species Theory.

Algorithms for Combinatorial Systems: Between Analytic Combinatorics and Species Theory. Algorithms for Combinatorial Systems: Between Analytic Combinatorics and Species Theory. Carine Pivoteau - LIGM - december 2011 joint work with Bruno Salvy and Michèle Soria Algorithms for Combinatorial

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

A196837: Ordinary Generating Functions for Sums of Powers of the First n Positive Integers

A196837: Ordinary Generating Functions for Sums of Powers of the First n Positive Integers Karlsruhe October 14, 2011 November 1, 2011 A196837: Ordinary Generating Functions for Sums of Powers of the First n Positive Integers Wolfdieter L a n g 1 The sum of the k th power of the first n positive

More information

7 Planar systems of linear ODE

7 Planar systems of linear ODE 7 Planar systems of linear ODE Here I restrict my attention to a very special class of autonomous ODE: linear ODE with constant coefficients This is arguably the only class of ODE for which explicit solution

More information

What you learned in Math 28. Rosa C. Orellana

What you learned in Math 28. Rosa C. Orellana What you learned in Math 28 Rosa C. Orellana Chapter 1 - Basic Counting Techniques Sum Principle If we have a partition of a finite set S, then the size of S is the sum of the sizes of the blocks of the

More information

Series Solutions Near a Regular Singular Point

Series Solutions Near a Regular Singular Point Series Solutions Near a Regular Singular Point MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Fall 2018 Background We will find a power series solution to the equation:

More information

Elliptic Curves Spring 2013 Lecture #8 03/05/2013

Elliptic Curves Spring 2013 Lecture #8 03/05/2013 18.783 Elliptic Curves Spring 2013 Lecture #8 03/05/2013 8.1 Point counting We now consider the problem of determining the number of points on an elliptic curve E over a finite field F q. The most naïve

More information

Woon s Tree and Sums over Compositions

Woon s Tree and Sums over Compositions 2 3 47 6 23 Journal of Integer Sequences, Vol. 2 208, Article 8.3.4 Woon s Tree and Sums over Compositions Christophe Vignat L.S.S., CentraleSupelec Université Paris Sud Orsay, 992 France and Department

More information

Ch 5.7: Series Solutions Near a Regular Singular Point, Part II

Ch 5.7: Series Solutions Near a Regular Singular Point, Part II Ch 5.7: Series Solutions Near a Regular Singular Point, Part II! Recall from Section 5.6 (Part I): The point x 0 = 0 is a regular singular point of with and corresponding Euler Equation! We assume solutions

More information

Series Solutions Near an Ordinary Point

Series Solutions Near an Ordinary Point Series Solutions Near an Ordinary Point MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Spring 2018 Ordinary Points (1 of 2) Consider the second order linear homogeneous

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

Arithmetic properties of lacunary sums of binomial coefficients

Arithmetic properties of lacunary sums of binomial coefficients Arithmetic properties of lacunary sums of binomial coefficients Tamás Mathematics Department Occidental College 29th Journées Arithmétiques JA2015, July 6-10, 2015 Arithmetic properties of lacunary sums

More information

2 Generating Functions

2 Generating Functions 2 Generating Functions In this part of the course, we re going to introduce algebraic methods for counting and proving combinatorial identities. This is often greatly advantageous over the method of finding

More information

Least Squares Regression

Least Squares Regression Least Squares Regression Chemical Engineering 2450 - Numerical Methods Given N data points x i, y i, i 1 N, and a function that we wish to fit to these data points, fx, we define S as the sum of the squared

More information

Logarithmic and Exponential Equations and Change-of-Base

Logarithmic and Exponential Equations and Change-of-Base Logarithmic and Exponential Equations and Change-of-Base MATH 101 College Algebra J. Robert Buchanan Department of Mathematics Summer 2012 Objectives In this lesson we will learn to solve exponential equations

More information

Last Update: March 1 2, 201 0

Last Update: March 1 2, 201 0 M ath 2 0 1 E S 1 W inter 2 0 1 0 Last Update: March 1 2, 201 0 S eries S olutions of Differential Equations Disclaimer: This lecture note tries to provide an alternative approach to the material in Sections

More information

Fourth Lecture: 11/4

Fourth Lecture: 11/4 Fourth Lecture: 11/4 Definition 4.1. A sequence a n ) n=1 of complex numbers is said to be defined recursively, or to satsify a recurrence relation, if there exists a fixed k N, called the degree of the

More information

Algebra II. A2.1.1 Recognize and graph various types of functions, including polynomial, rational, and algebraic functions.

Algebra II. A2.1.1 Recognize and graph various types of functions, including polynomial, rational, and algebraic functions. Standard 1: Relations and Functions Students graph relations and functions and find zeros. They use function notation and combine functions by composition. They interpret functions in given situations.

More information

6 Continuous-Time Birth and Death Chains

6 Continuous-Time Birth and Death Chains 6 Continuous-Time Birth and Death Chains Angela Peace Biomathematics II MATH 5355 Spring 2017 Lecture notes follow: Allen, Linda JS. An introduction to stochastic processes with applications to biology.

More information

Mapping the Discrete Logarithm: Talk 2

Mapping the Discrete Logarithm: Talk 2 Mapping the Discrete Logarithm: Talk 2 Joshua Holden Joint work with Daniel Cloutier, Nathan Lindle (Senior Theses), Max Brugger, Christina Frederick, Andrew Hoffman, and Marcus Mace (RHIT REU) Rose-Hulman

More information

Review of Power Series

Review of Power Series Review of Power Series MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Fall 2018 Introduction In addition to the techniques we have studied so far, we may use power

More information

1 Recurrence relations, continued continued

1 Recurrence relations, continued continued 1 Recurrence relations, continued continued Linear homogeneous recurrences are only one of several possible ways to describe a sequence as a recurrence. Here are several other situations which may arise.

More information

Algebra. Practice Pack

Algebra. Practice Pack Algebra Practice Pack WALCH PUBLISHING Table of Contents Unit 1: Algebra Basics Practice 1 What Are Negative and Positive Numbers?... 1 Practice 2 Larger and Smaller Numbers................ 2 Practice

More information

ENUMERATION OF CONNECTED CATALAN OBJECTS BY TYPE. 1. Introduction

ENUMERATION OF CONNECTED CATALAN OBJECTS BY TYPE. 1. Introduction ENUMERATION OF CONNECTED CATALAN OBJECTS BY TYPE BRENDON RHOADES Abstract. Noncrossing set partitions, nonnesting set partitions, Dyck paths, and rooted plane trees are four classes of Catalan objects

More information

Spanning Trees in Grid Graphs

Spanning Trees in Grid Graphs Spanning Trees in Grid Graphs Paul Raff arxiv:0809.2551v1 [math.co] 15 Sep 2008 July 25, 2008 Abstract A general method is obtained for finding recurrences involving the number of spanning trees of grid

More information

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek Finite Fields In practice most finite field applications e.g. cryptography and error correcting codes utilizes a specific type of finite fields, namely the binary extension fields. The following exercises

More information

Problem: Data base too big to fit memory Disk reads are slow. Example: 1,000,000 records on disk Binary search might take 20 disk reads

Problem: Data base too big to fit memory Disk reads are slow. Example: 1,000,000 records on disk Binary search might take 20 disk reads B Trees Problem: Data base too big to fit memory Disk reads are slow Example: 1,000,000 records on disk Binary search might take 20 disk reads Disk reads are done in blocks Example: One block read can

More information

CSE 421 Algorithms. T(n) = at(n/b) + n c. Closest Pair Problem. Divide and Conquer Algorithms. What you really need to know about recurrences

CSE 421 Algorithms. T(n) = at(n/b) + n c. Closest Pair Problem. Divide and Conquer Algorithms. What you really need to know about recurrences CSE 421 Algorithms Richard Anderson Lecture 13 Divide and Conquer What you really need to know about recurrences Work per level changes geometrically with the level Geometrically increasing (x > 1) The

More information

Algorithmic Tools for the Asymptotics of Linear Recurrences

Algorithmic Tools for the Asymptotics of Linear Recurrences Algorithmic Tools for the Asymptotics of Linear Recurrences Bruno Salvy Inria & ENS de Lyon Computer Algebra in Combinatorics, Schrödinger Institute, Vienna, Nov. 2017 Motivation p 0 (n)a n+k + + p k (n)a

More information

Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018

Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018 CS17 Integrated Introduction to Computer Science Klein Contents Lecture 17: Trees and Merge Sort 10:00 AM, Oct 15, 2018 1 Tree definitions 1 2 Analysis of mergesort using a binary tree 1 3 Analysis of

More information

On Arithmetic Properties of Bell Numbers, Delannoy Numbers and Schröder Numbers

On Arithmetic Properties of Bell Numbers, Delannoy Numbers and Schröder Numbers A tal given at the Institute of Mathematics, Academia Sinica (Taiwan (Taipei; July 6, 2011 On Arithmetic Properties of Bell Numbers, Delannoy Numbers and Schröder Numbers Zhi-Wei Sun Nanjing University

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

Sequences that satisfy a(n a(n)) = 0

Sequences that satisfy a(n a(n)) = 0 Sequences that satisfy a(n a(n)) = 0 Nate Kube Frank Ruskey October 13, 2005 Abstract We explore the properties of some sequences for which a(n a(n)) = 0. Under the natural restriction that a(n) < n the

More information

REPRESENTATION THEORY OF S n

REPRESENTATION THEORY OF S n REPRESENTATION THEORY OF S n EVAN JENKINS Abstract. These are notes from three lectures given in MATH 26700, Introduction to Representation Theory of Finite Groups, at the University of Chicago in November

More information

arithmetic properties of weighted catalan numbers

arithmetic properties of weighted catalan numbers arithmetic properties of weighted catalan numbers Jason Chen Mentor: Dmitry Kubrak May 20, 2017 MIT PRIMES Conference background: catalan numbers Definition The Catalan numbers are the sequence of integers

More information

Notes on counting. James Aspnes. December 13, 2010

Notes on counting. James Aspnes. December 13, 2010 Notes on counting James Aspnes December 13, 2010 1 What counting is Recall that in set theory we formally defined each natural number as the set of all smaller natural numbers, so that n = {0, 1, 2,...,

More information

Administrivia. COMP9020 Lecture 7 Session 2, 2017 Induction and Recursion. Lecture 6 recap. Lecture 6 recap

Administrivia. COMP9020 Lecture 7 Session 2, 2017 Induction and Recursion. Lecture 6 recap. Lecture 6 recap Administrivia COMP9020 Lecture 7 Session 2, 2017 Induction and Recursion Guidelines for good mathematical writing Assignment 1 Solutions now available; marks available soon Assignment 2 available on Saturday,

More information