Generating Functions
Total Page:16
File Type:pdf, Size:1020Kb
MATH 324 Summer 2012 Elementary Number Theory Notes on Generating Functions Generating Functions In this note we will discuss the ordinary generating function of a sequence of real numbers, and then find the generating function for some sequences, including the sequence of Mersenne numbers and the sequence of Fibonacci numbers. Definition. Given a sequence ak k≥0 of real numbers, the ordinary generating function, or generating f g function, of the sequence ak k≥0 is defined to be f g 1 k 2 G(x) = akx = a0 + a1x + a2x + : ( ) k=0 · · · ∗ X The sum is finite if the sequence is finite, and infinite if the sequence is infinite. In the latter case, we will think of ( ) as either a power series with x chosen so that the sum converges, or as a formal power series, where we ∗are not concerned with convergence. Example 1. Suppose that n is a fixed positive integer and n ak = k for k = 0; 1; : : : ; n: From the binomial theorem we have n n n n n n (1 + x) = + x + x2 + + x ; 0 1 2 · · · n n and the generating function for the sequence ak k is f g =0 n G(x) = (1 + x) : Note: The advantage of what we have done is that we have expressed G(x) in a very simple encoded form. If we know this encoded form for G(x); it is now easy to derive ak by decoding or expanding G(x) as a k power series and finding the coefficient of x : Often we will be able to find G(x) without knowing ak; and then be able to solve for ak by expanding G(x): Example 2. Suppose that the generating function for the sequence an n≥0 is given by f g 1 n G(x) = anx ; n=0 X and we know that 1 G(x) = 1 + x for x = 1: This is the sum of a simple geometric series 6 − 1 = 1 x + x2 x3 + ; 1 + x − − · · · n which converges for x < 1; and from this we can see that an = ( 1) for n = 0; 1; 2; : : : : j j − Cauchy Product of Series In what follows we will want to be able to find the series expansion of the product of two generating functions. For example, suppose that an n≥0 and bn n≥0 are sequences of real numbers with generating functions f g f g 1 1 n n F (x) = anx and G(x) = bnx ; n=0 n=0 X X respectively. Treating these as formal power series, we can find the product by multiplying these series term-by-term and collecting the coefficients of like powers of x as follows: 2 3 2 3 a0 + a1x + a2x + a3x + b0 + b1x + b2x + b3x + · · · · · · 2 3 = a0b0 + (a0b1 +a1b0)x + (a0b2 + a1b1 + a2b0)x + (a0b3 + a1b2 + a2b1 + a3b0)x + ; · · · from which the pattern is clear. Thus, as formal power series, 1 1 1 n n n anx bnx = cnx ; ( ) n=0 ! n=0 ! n=0 ∗∗ X X X where n cn = akbn−k = a0bn + a1bn−1 + a2bn−2 + + an−1b1 + anb0 k=0 · · · X for n 0: The power series on the right in ( ) is called the Cauchy product of the two power series on ≥ ∗∗ the left, and formally, the generating function for the sequence cn n≥0 is f g 1 n H(x) = cnx : n=0 X However, if we want to be able to recognize H(x) as the product of the two generating functions F (x) and G(x); then we have to be able to say something about the convergence of the series involved. Luckily, we have the following theorems due to Mertens and Abel. Theorem (Mertens). If an n≥0 and bn n≥0 are sequences of real numbers such that f g f g 1 an converges absolutely to A; n=0 X and 1 bn converges to B; n=0 X then the Cauchy product of these two series, 1 n cn; where cn = akbn−k for n 0; n=0 k=0 ≥ X X converges to A B: · In fact, we can do away with the absolute convergence of one of the series if we assume that their Cauchy product converges. 1 1 1 Theorem (Abel). Let an and bn be two convergent series and let cn denote their Cauchy n=0 n=0 n=0 1 P P P product. If cn converges, then n=0 P 1 1 1 cn = an bn : n=0 n=0 ! n=0 ! X X X A proof of both Mertens' theorem and Abel's theorem can be found in the text Mathematical Analysis, 2nd ed. by T. Apostol. Note: The previous theorems can be used to find the generating function for a product of power series by 1 n n n replacing an by anx ; replacing bn by bnx ; and noting that if anx converges absolutely for x < R n=0 j j 1 n P and bnx converges for x < R; then the Cauchy product of these two series is n=0 j j P 1 1 n 1 n k n−k n cn = akx bn−kx = akbn−k x ; n=0 n=0 k=0 ! n=0 k=0 ! X X X X X and from Mertens' theorem this converges for x < R to the product of the two power series. j j Example 3. The geometric series 1 1 n n = ( 1) x x 1 + n=0 − X converges for x < 1; and we have j j 1 1 1 n n n n = ( 1) x ( 1) x ; x 2 (1 + ) n=0 − ! n=0 − ! X X and from Mertens' theorem, 1 n 1 k n k n = ( 1) ( 1) − x (1 + x)2 n=0 k=0 − − ! X X 1 n n n = ( 1) x n=0 k=0 − ! X X 1 n n = ( 1) (n + 1)x n=0 − X for x < 1: j j Example 4. The negative binomial theorem states that if r is a positive integer, then 1 1 r + n n = x x r+1 n (1 ) n=0 − X for all real numbers x with x < 1: Using the previous example as the base case, and the Cauchy product, it is an easy exercise to showj thatj n r 1 + k r + n − = k n k=0 X to obtain a proof of the negative binomial theorem using the principle of mathematical induction. Example 5. The series expansions 1 1 n = x x 1 n=0 − X and 1 1 n n = 2 x x 1 2 n=0 − X 1 both converge absolutely for x < : Hence, by Mertens' theorem, so does their Cauchy product, and j j 2 1 1 1 1 1 n n n n = x 2 x = cnx ; x x 1 · 1 2 n=0 ! n=0 ! n=0 − − X X X where n n+1 k n 2 1 cn = 2 1 = 1 + 2 + + 2 = − ; k=0 · · · · 2 1 X − that is, n+1 cn = 2 1 − for all n 0: ≥ Therefore, 1 1 1 n+1 n 2 = 2 1 x = M1 + M2x + M3x + 1 x · 1 2x − · · · − − n=0 n th X where Mn = 2 1 is the n Mersenne number. − 0 Since M0 = 2 1 = 1 1 = 0; then the generating function for the Mersenne numbers is − − 1 x n M(x) = = Mnx : x x (1 )(1 2 ) n=0 − − X Example 6. The Fibonacci sequence an n≥0 is defined recursively by the discrete initial value problem f g an+2 = an+1 + an; n 0; ≥ a0 = 0; (+) a1 = 1; for n 0: ≥ If the generating function for the Fibonacci sequence is 1 n G(x) = anx ; n=0 X and we multiply (+) by xn+2 and sum, then we get 1 1 1 n+2 n+1 2 n an+2x = x an+1x + x anx ; n=0 n=0 n=0 X X X so that 2 G(x) a0 a1x = x (G(x) a0) + x G(x); − − − and G(x) x = xG(x) + x2G(x): − Therefore, x G(x) = ; (++) 1 x x2 − − n−1 1 + p5 and since 0 an α for all n 2; where α = ; then the generating function for the Fibonacci ≤ ≤ ≥ 2 1 p5 1 series converges to (++) for all x such that x < = − : j j α 2 Now, 2 1 5 1 p5 1 p5 x2 + x 1 = x + = x + x + + ; − 2 − 4 2 − 2 2 2 ! ! and multiplying this expression by 1 p5 1 + p5 − = 1; 2 ! 2 ! − we get 1 x x2 = (1 αx)(1 βx) − − − − 1 + p5 1 p5 where α = and β = − : 2 2 The partial fraction expansion of G(x) is then 1 n n x 1 1 α β n = = − x x x2 1 p5(1 αx) − p5(1 βx) n=0 p5 − − − − X p5 1 where both series converge for x < − : Therefore, we have j j 2 αn βn an = − p5 for n 0: This is Binet's formula for the Fibonacci sequence an n≥0: ≥ f g.