Partition of Integers into Even Summands We ask for the number of partitions of m Z + into positive even integers The desired number is the coefficient of x m in + x + x 4 + ) + x 4 + x 8 + ) + x 6 + x + ) + x m/ + x 4 m/ + ) We are more economical than in partition of integers into odd summands by removing higher-order terms Partition of Integers into Distinct Summands with Upper Bounds We ask for the number of partitions of m Z + into distinct positive integers at most n The desired number is the coefficient of x m in + x) + x ) + x 3 ) + x n ) No known closed-form formula Applications in computational finance a Can calculate all nn + )/ coefficients in time on 3 )? a Lyuu 00) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 433 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 43 Partition of Integers into Even Numbers of Each Summand We ask for the number of partitions of m Z + into positive integer summands where each summand appears an even number of times The desired number remains the coefficient of x m in + x + x 4 + ) + x 4 + x 8 + ) + x 6 + x + ) + x m/ + x 4 m/ + ) appears an even number of times, appears an even number of times, etc Note that An Example + x) + x ) + x 3 ) + x 4 ) + x ) + x 6 ) = + x + x + x 3 + x 4 + 3x + 4x 6 + 4x 7 + + x So there are 4 ways to partition 7 into distinct positive integers at most 6 Indeed, the partitions are: 6 +, +, 4 + 3, 4 + + In fact, we solved problems: The coefficient of x i, where i, represents the number of ways to partition i into distinct positive integers at most 6 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 434 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 436
Partition of Integers into Summands 0 mod k The desired number is the coefficient of x m in + x + x + ) + x + x 4 + ) + x k + x k ) + ) + x k+ + x k+) + ) In other words, terms + x ik + x ik + ), where k Z +, are missing The Proof concluded) The count is the same as that of partitions into positive integers where no summands appear > k times This generalizes results on p 4 and p 43 a With k =, we have an alternative proof of Euler s theorem p 43) b a An alternative proof uses the principle of inclusion and exclusion b Observation by Mr Ansel Lin B9390003) on November 9, 004 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 437 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 439 Partition of Integers vs Integer Solution of Linear Equations The Proof continued) Now, the desired number is the coefficient of x m in = x x x k x k+ i= xik ) i= x i ) = x ik x i i= = + x + x + + x k ) + x + x 4 + + x k ) ) These two issues are often related in subtle ways To wit, what is the number of partitions of m N into n nonnegative integers where the order of summands is relevant? Each nonnegative integer solution of x + x + + x n = m corresponds to a valid partition The answer is thus ) n+m m from p 43 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 438 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 440
Partition of Integers as Linear Equation What is the number of integer solutions of x + x + + x n = n, where 0 x x x n? A solution corresponds to a partition of n into positive integers the order of summands is irrelevant) 0, 0, 0,,, 3) 6 = + + 3 From Eq 4) on p 4, the number equals the coefficient of x n in x) x ) x n ) Partition of Integers as Linear Equation continued) Alternatively, each solution corresponds to a partition of integer m into n positive integers Yet alternatively, each solution corresponds to a partition of m into summands at most n See the Ferrers graph on the next page The desired number hence equals the coefficient of x m in x) x ) x n ) 8) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 44 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 443 Partition of Integers as Linear Equation continued) In general, what is the number of integer solutions of The Ferrers Graph where 0 x x x n? x + x + + x n = m, 7) Each solution corresponds to a partition of integer m into n nonnegative integers! a 0, 0,,, 3) 6 = 0 + 0 + + + 3 a Professor Andrews, private communication, October 00 x x x 3 x 4 x x 6 9 = 0 +0 + + + +3 9 = 4 +4 + c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 44 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 444
Partition of Integers as Linear Equation continued) For instance, x) x ) x 3 ) = + x + x + 3x 3 + 4x 4 + x +7x 6 + 8x 7 + 0x 8 + x 9 + 4x 0 + 6x + 9x + There are 7 ways to partition 6 into 3 nonnegative integers: 0 + 0 + 6, 0 + +, 0 + + 4, 0 + 3 + 3, + + 4, + + 3, + + Partition of Integers as Linear Equation continued) The desired number is therefore the coefficient of x m in x from Eq 8) on p 443 x x 3 x n 60) In summary, if p n m) denotes the number of partitions of m into summands at most n, then Eq 60) is the generating function for { p n m) } m=0,, If q n m) denotes the number of partitions of m into at most n summands, then p n m) = q n m) recall p 443) Furthermore, pm) = p n m) for all n > m p 40) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 44 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 447 Partition of Integers as Linear Equation continued) What is the number of integer solutions to where x i 0? x + x + 3x 3 + + nx n = m, 9) Well, it is the same partition-of-integers problem considered at Eq 7) on p 44 As on p 47, each solution corresponds to a partition m into x s, x s, etc Partition of Integers as Linear Equation continued) Recall that the number of nonnegative integer solutions to Eq 9) on p 446, x + x + 3x 3 + + nx n = m, is the coefficient of x m in x by Eq 60) on p 447 x x 3 x n We now arrive at the answer in a more direct way c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 446 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 448
Partition of Integers as Linear Equation continued) Define x n = w, x n = w w, x n = w 3 w, x = w n w n The above mapping is bijective Recurrence Relations for p n m) and q n m) p 447) Lemma 66 q n m) = q n m) + q n m n) Recall that q n m) denotes the number of partitions of m into at most n summands Consider m identical objects and n identical containers There are q n m) q n m) ways to partition the m objects into n containers with none left empty Or, we can distribute one object into each container and then the remaining m n objects, in q n m n) ways Hence q n m) q n m) = q n m n) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 449 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 4 Partition of Integers as Linear Equation concluded) Next, m = w n w n ) + w n w n ) +3w n w n 3 ) + + nw = w n + w n + w n + + w, where 0 w w w 3 w n But this problem had been addressed at Eq 7) on p 44 Partition of Integers with Exact Number of Summands and Largest Summand Let pm, n) denote the number of partitions of m with largest summand equal to n Let qm, n) denote the number of partitions of m into exactly n summands Similar to p n m) = q n m) on p 447, pm, n) = qm, n) pm, n) = p n m) p n m) = q n m) q n m) = qm, n) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 40 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 4
Partition of Integers with Exact Number of Summands and Largest Summand continued) We knew that pm, n) = p n m) p n m) and the generating function for { p n m) } m=0,,, p 447) x x x 6) 3 x n Thus the generating function for { pm, n) } m=0,, is x = x n x x x n x x n x x x 3 x 6) n Partition of Integers with Exact Number of Summands and Largest Summand continued) Lemma 68 a) pm, n) = pm n) for n m/ b) pn, n) = pn) pm, n) equals the coefficient of x m in Eq 6): x n x x x 3 x n c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 43 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 4 Partition of Integers with Exact Number of Summands and Largest Summand continued) Lemma 67 pm, n) = p n m n) The coefficient of x m in Eq 6) on p 43 equals that of x m n in Eq 6) on p 43) Partition of Integers with Exact Number of Summands and Largest Summand continued) From Eq ) on p 4, pm n) equals the coefficient of x m n in = x x x x 3 x x 3 x n + xn+ + ) Observe that m n n + ) = m n < 0 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 44 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 46
Partition of Integers with Exact Number of Summands and Largest Summand continued) So pm n) equals the coefficient of x m n in x x x 3 x n For b), simply note that pn, n) = pn) by a) Partition of Integers into Distinct Summands Revisited Let q # m, n) denote the number partitions of m Z + into n distinct summands Lemma 70 q # m, n) = qm ) n, n) a x + x + + x n = m, where 0 < x < x < < x n, has q # m, n) integer solutions a Recall that qm, n) denotes the number of partitions of m into exactly n summands p 4) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 47 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 49 Partition of Integers with Exact Number of Summands and Largest Summand concluded) Lemma 69 pm + n, n) = pm, ) + pm, ) + + pm, n) From Lemma 68a p 4), pm + n, n) = p n m) On the other hand, pm, ) + pm, ) + + pm, n) = p n m) by definition Partition of Integers into Distinct Summands Revisited continued) Adopt the following bijective transformation: x = w, x = w +, x 3 = w 3 +, x n = w n + n ) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 48 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 460
Some Properties of Exponential Generating Functions Partition of Integers into Distinct Summands Revisited concluded) The equation becomes w + w + + w n = m where 0 < w w w 3 w n ) n, This equation has qm n ), n) integer solutions If fx) is the exponential generating function for {a i } i=0,,, then xf x) is the generating function for { ia i } i=0,, a If fx) is the exponential generating function for { a i } i=0,, and gx) is the exponential generating function for { b i } i=0,,, then fx) gx) is the exponential generating function for { h i } i=0,,, where h i = i k=0 a kb i k is the convolution of a i and b i b a Review p 39 b Review p 398 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 46 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 463 Exponential Generating Functions Let a 0, a, a, be a sequence of real numbers The function x fx) = a 0 + a! + a x! + = i=0 a i x i i! is called the exponential generating function for the given sequence {a i } i=0,, We may call the earlier generating function ordinary generating function to avoid ambiguity Some Properties of Exponential Generating Functions concluded) Lemma 7 Let fx) = i=0 a i x i i! be the exponential generating function for { a i } i=0,, Then a i = di fx) dx i, i = 0,,, x=0 By Taylor s expansion review p 397) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 46 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 464
Generating Function for Bell Numbers Let px) = n=0 P n n! xn be the exponential generating function for the Bell numbers { P n } n=0,,, defined on p 8 From relation 8) on p 3, n px) = + = + n= k=0 x n n! P k k! k=0 n=k+ n k x n n ) P k n k )! Recurrence Relations Difference Equations) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 46 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 467 Differentiate to obtain p x) = The Proof concluded) = k=0 P k k! P k x k k=0 k! n=k+ r=0 x n n k )! x r r! = px) ex In other words, lnpx)) = p x)/px) = e x Hence px) = e ex +c for some constant c As = p0) = e e0 +c, we conclude that c = and px) = e ex Recurrence Relations Arise Naturally When a problem has a recursive nature, recurrence relations often arise A problem can be solved by solving subproblems of the same nature When an algorithm is of the divide-and-conquer type, a recurrence relation describes its running time Sorting, fast Fourier transform, etc Certain combinatorial objects are constructed recursively such as hypercubes p 7) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 466 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 468
First-Order Linear Homogeneous Recurrence Relations Consider the recurrence relation a n+ = da n, where n 0 and d is a constant The general solution is given by for any constant C a n = Cd n It satisfies the relation: Cd n+ = dcd n There are infinitely many solutions, one for each choice of C First-Order Linear Nonhomogeneous Recurrence Relations Consider the recurrence relation n 0 d is a constant fn) : N N a n+ + da n = fn) A general solution no longer exists c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 469 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 47 First-Order Linear Homogeneous Recurrence Relations concluded) Now suppose we impose the initial condition a 0 = A Then the unique) particular solution is a n = Ad n Because A = a 0 = Cd 0 = C Note that a n = na n is not a first-order linear homogeneous recurrence relation Its solution is n! when a 0 = kth-order Linear Homogeneous Recurrence Relations with Constant Coefficients Consider the kth-order recurrence relation C n a n + C n a n + + C n k a n k = 0, 63) where C n, C n,,c n k R, C n 0, and C n k 0 Add k initial conditions for a 0, a,,a k Clearly, a n is well-defined for each n = k, k +, c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 470 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 47
kth-order Linear Homogeneous Recurrence Relations with Constant Coefficients concluded) A solution y for a n is general if for any particular solution y, the undetermined coefficients of y can be found so that y is identical to y Any general solution for a n that satisfies the k initial conditions and Eq 63) is a particular solution In fact, it is the unique particular solution because any solution agreeing at n = 0,,,k must agree for all n 0 Conditions for the General Solution Theorem 7 Let a ) n, a ) n,,a k) n be k particular solutions of Eq 63) If a ) 0 a ) 0 a k) 0 a ) a ) a k) a ) k a ) k a k) k 0, 64) then a n = C a ) n + C a ) n + + C k a k) n is the general solution, where C, C,,C k are arbitrary constants a a Samuel Goldberg, Introduction to Difference Equations 986) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 473 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 47 The Updating Rule Fundamental Sets The particular solutions of Eq 63) on p 47, a ) n, a ) n,,a k) n, that also satisfy inequality 64) in Theorem 7 p 47) are said to form a fundamental set of solutions Solving a linear homogeneous recurrence equation thus reduces to finding a fundamental set! c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 474 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 476
kth-order Linear Homogeneous Recurrence Relations with Constant Coefficients: Distinct Roots Let r, r,,r k be the characteristic) roots of the characteristic equation C n r k + C n r k + + C n k = 0 6) If r, r,,r k are distinct, then the general solution has the form a n = c r n + c r n + + c k r n k, for constants c, c,,c k determined by the initial conditions The Proof continued) r r r k r k r k r k k 0 The k k matrix is called a Vandermonde matrix, which is nonsingular whenever r, r,,r k are distinct a a This is a standard result in linear algebra c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 477 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 479 The Proof concluded) The Proof Assume a n has the form cr n for nonzero c and r After substitution into recurrence equation 63) on p 47, r satisfies characteristic equation 6) Let r, r,,r k be the k distinct nonzero) roots Hence a n = r n i is a solution for i k Solutions r n i form a fundamental set because Hence is the general solution a n = c r n + c r n + + c k r n k The k coefficients c, c,,c k are determined uniquely by the k initial conditions a 0, a,,a k : a 0 c a r r r k c = 66) a k r k r k r k k c k c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 478 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 480
The Fibonacci Relation Consider a n+ = a n+ + a n The initial conditions are a 0 = 0 and a = The characteristic equation is r r = 0, with two roots ± )/ The fundamental set is hence { + ) n ) n }, Solve The Fibonacci Relation concluded) 0 = a 0 = c + c = a = c + for c = / and c = / The solution is finally a n = + ) n + c ) n, known as the Binet formula c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 48 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 483 For example, as The Fibonacci Relation continued) + + ) n+ = The general solution is hence + a n = c ) n satisfies the Fibonacci relation, + ) n+ + ) n + c + ) n ) n 67) a = Don t Believe It? + ) = + + 4 a 3 = + ) + 4 ) 3 ) 3 = = + 3 + + 3 + 8 8 = c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 48 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 484
Initial Conditions Different initial conditions give rise to different solutions Suppose a 0 = and a = Then solve = a 0 = c + c, = a = c + for c = [ + )/ ] / and c = [ )/ ] / to obtain a n = + ) n+ + c, ) n+ 68) A Formula for the Fibonacci Numbers ) ) n n n 3 a n = + + 0 ) + + n n/ n/ From Eq 69) on p 486, the generating function is = a 0 x + a 0 + a x x x x x + x) = x + x + x) + x 3 + x) + +x n + x) n + x n + x) n + [ n n/ ) n ) n ) ] = + + + + x n + n/ 0 ) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 48 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 487 Generating Function for the Fibonacci Numbers From a n+ = a n+ + a n, we obtain a n+ x n+ = a n+ x n+ + a n x n+ ) n=0 n=0 Let fx) be the generating function for { a n } n=0,,, Then Hence fx) a 0 a x = x[ fx) a 0 ] + x fx) fx) = a 0x + a 0 + a x x x 69) Number of Binary Sequences without Consecutive 0s Let a n denote the number of binary sequences of length n without consecutive 0s There are a n valid sequences with the nth symbol being There are a n valid sequences with the nth symbol being 0 because any such sequence must end with 0 Hence a n = a n + a n, a Fibonacci sequence Because a = and a = 3, we must have a 0 = to retrofit the Fibonacci sequence The formula is Eq 68) on p 48 contrast it with p 70) c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 486 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 488
Number of Subsets without Consecutive Numbers A binary sequences b b b n of length n can be interpreted as the set { i : b i = 0 } {,,,n} Hence there are a n subsets of {,,,n} that contain no consecutive integers a n is the Fibonacci number with a 0 = and a = formula on p 48) How many subsets of {,,,n} contain no consecutive integers when and n are considered consecutive? Assume n 3 Number of Subsets without Consecutive Numbers concluded) Solve = L 0 = c + c, = L = c + for c = and c = The solution is finally L n = + ) n + + c, ) n c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 489 c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 49 Number of Subsets without Consecutive Numbers continued) There are a n acceptable subsets that do not contain n If n is included, an acceptable subset cannot contain Hence there are a n such subsets The total is therefore L n a n + a n, the Lucas number Surely, L n = L n + L n with L = and L = 3 The general solution is hence + L n = c by Eq 67) on p 48 ) n + c ) n c 004 Prof Yuh-Dauh Lyuu, National Taiwan University Page 490