Volume C1 · Basic concepts · TAOCP Section 1.2.6
Binomial coefficients
Draft. This chapter is written and checked by the tools of the project, and a person has not reviewed it yet. Read it with care.
Read it next to Section 1.2.6 of the book. The nodes and the exercises of the section.
The coefficients and their identities
Overview
Section 1.2.6 of TAOCP starts from a count: how many ways are there to choose objects out of , when the order of the chosen objects does not matter. The answer is the binomial coefficient , and the section turns it into a tool. It extends the coefficient to every real upper index , so that is a polynomial in of degree . It lists the basic operations on the coefficients, in the order of the letters A to I of the book: the factorial form, the symmetry, the moving of a factor in and out of the coefficient, the addition formula, the sums along a row, a column and a diagonal of Pascal's triangle, the binomial theorem, the negation of the upper index, the products of two coefficients and the sums of such products. Five worked problems then show how the operations combine. This first file of the chapter covers eqs. (1) to (30), that is, the definitions, the basic operations, Vandermonde's convolution and its relatives, Rothe's convolution (26), and the model problems that lead to eqs. (27) to (30). The second file covers the inversion method, the partial sums, the generalizations and the Stirling numbers. The section uses the factorial and the falling power of Section 1.2.5, the sums of Section 1.2.3 and induction from Section 1.2.1.
The ideas
Counting by overcounting. The number of ordered choices of objects is the falling power of Section 1.2.5. Each unordered choice appears in exactly of the ordered ones, so the number of unordered choices is the quotient of the two. The same idea, to count a larger set and divide by a known multiplicity, is behind many of the identities below.
A formula that is a polynomial can be stretched. For a fixed integer the coefficient is a polynomial in . If two polynomials of degree at most agree for values of the variable, they are the same polynomial. So an identity that is shown for all positive integers holds for all real , as long as both sides are polynomials in for fixed integer indices. This is the way the book gets from combinatorial counting, where is a natural number, to real , and C1 uses it at each such step.
Two ways to split a sum, and one way to split a product. The addition formula (9) splits a coefficient into two. The convolution (21) splits a coefficient of a sum of upper indices into a sum of products. The product rule (20) moves an index that appears twice to a single place. Almost every identity of the section is a chain of these three steps, with the symmetry (6) and the negation (17) to turn an upper index into a lower one or the reverse.
Sums over a diagonal and over a column come from the addition formula alone. Apply (9) again and again and the terms telescope. This gives (10) and (11) and, with the negation (17), (18).
A hard sum is made harder on purpose. In the third model problem the sum has no direct reduction, so the book replaces a coefficient by a sum of simpler ones, swaps the order of the double sum, and applies a known result inside. C1 shows where each condition on the indices is needed.
C1 differs from the book in a few places. It proves the binomial series (15) for real by a differential equation, and it proves Abel's formula (16) by one calculation that combines the book's two steps of exercises 50 and 51. It proves Rothe's convolution (26) by an induction on that needs one value of , where the book leaves the argument to exercises 22 to 24. It proves (23) by finite differences and (24) with power series. It uses the forms of the section with the restrictions that the book lists, and it says which restriction each proof uses.
Definitions, results and proofs
Example (the ten choices of three letters from five, TAOCP eq. 1.2.6(1)). The combinations of the five letters taken three at a time are .
Node: TAA0HS0JNT · status: not stated yet
Explanation. A combination is a choice of letters in which the order is not recorded, so and are the same combination. The ten rows are listed in the order of the alphabet, by the first letter, then the second, then the third. The first letter is in six rows, in three rows and in one row, and . The same list in Lean is the finset of the subsets of size of a five-element type, Finset.powersetCard 3 s, from Mathlib.
Example. The Python call list(itertools.combinations('abcde', 3)) returns these ten rows in this order, and math.comb(5, 3) gives . The rows that contain the letter are , six rows, and the rows without are the four combinations of taken three at a time, as the later formula (9) predicts: .
Proof. The list is complete and has no repeat. A combination of three of the five letters, written in the order of the alphabet, is a word with . Each such word is in the list once, since the list runs through the words in lexicographic order. There are of them, and the count by the first letter is .
Theorem (the number of -combinations, TAOCP eq. 1.2.6(2)). For integers , the number of -element subsets of an -element set is
Node: TAGVB6EYV8 · status: proved
Explanation. The book introduces the symbol by this count, and then it takes the quotient of products as the formula to extend. The numerator is the falling power of eq. 1.2.5(2), the number of -permutations of the objects. The denominator is . In Lean the number of subsets of size of a finset is Finset.card_powersetCard, and its value is Nat.choose s.card k, both from Mathlib. The symbol Nat.choose n k is defined by the addition formula (9), and the quotient form is Nat.choose_eq_descFactorial_div_factorial.
Example. For and the quotient is , and math.comb(6, 4) gives . In the list of the four-letter words of the alphabet to in increasing order, is the first and is the last, and there are rows in all.
Proof. Let be the number of -element subsets. Count the -permutations of the objects, the ordered rows of different objects, in two ways. By eq. 1.2.5(2) there are of them. On the other hand, a -permutation is made by choosing the set of its objects, in ways, and then ordering this set, in ways by eq. 1.2.5(2) with . Different choices of the set or of the order give different rows, so there are rows. Then , and division by gives the formula.
Definition (the binomial coefficient for a real upper index, TAOCP eq. 1.2.6(3)). For every real number and every integer ,
Node: TAR88GD350 · Lean: TAOCP.binom, TAOCP.S1_2_6.eq3, TAOCP.S1_2_6.eq3_neg · status: proved
Explanation. The quotient (2) makes sense for every real , since it only multiplies and divides by non-zero integers. The upper index may be negative, a fraction or irrational, and the lower index is an integer. For a fixed the value is a polynomial in of degree with leading coefficient . The convention of zero for negative makes many sums run over all integers. The empty product for gives . In the code of the project, TAOCP.binom r k takes r in a field and k an integer and it is defined by this rule. Mathlib has Ring.choose r k for a natural and Nat.choose n k for natural and , and the project proves that they agree: TAOCP.binom_natCast and TAOCP.binom_eq_ringChoose.
Example. For and the product is . For and it is , and for and it is . For and one factor is , so the value is , and for the value is by the rule. Python with fractions.Fraction confirms all five values.
Proof. The three product forms of the definition are the same number: by eq. 1.2.5(18), and the product is the quotient written factor by factor. For a natural number and the value agrees with (2). For the numerator has the factor , and the value is , which is the number of -element subsets of a smaller set.
Theorem (the values for lower index 0, 1 and 2, TAOCP eq. 1.2.6(4)). For every real ,
Node: TARSX7SBQQ · Lean: TAOCP.S1_2_6.eq4 · status: proved
Explanation. These are the definition (3) read with . The first is the empty product. For the numerator is and the denominator is . For the numerator is and the denominator is . The Lean lemma TAOCP.binom_zero_right gives the first of the three, and Mathlib has Nat.choose_zero_right, Nat.choose_one_right and Nat.choose_two_right for natural arguments.
Example. For the three values are , and . For they are , and . For they are , and .
Proof. In (3) with the product has no factor, so the value is . With the product has the single factor . With it has the two factors and , and their product is .
Theorem (the form with three factorials, TAOCP eq. 1.2.6(5)). For integers ,
Node: TASM3DCEB1 · Lean: TAOCP.S1_2_6.eq5 · status: proved
Explanation. This form lets one trade a quotient of factorials for a binomial coefficient and back. It needs and to be natural numbers with , since the factorial of a negative integer or of a number larger than the upper index has no meaning here. The Lean lemma Nat.choose_eq_factorial_div_factorial states it with a hypothesis k ≤ n, and Nat.choose_mul_factorial_mul_factorial states it without a division as .
Example. For and the quotient , and as well. For the formula reads .
Proof. Multiply the numerator and the denominator of (2) by . The numerator becomes , and the denominator becomes .
Theorem (the symmetry of the coefficients, TAOCP eq. 1.2.6(6)). For an integer and every integer ,
Node: TA7P7ECNEB · Lean: TAOCP.S1_2_6.eq6 · status: proved
Explanation. In Pascal's triangle each row reads the same from the left and from the right. The statement holds for all integers : when or both sides are by the definition (3), since one of and is negative. The condition that is a non-negative integer is needed; for the value differs from . In Lean, Nat.choose_symm takes the hypothesis k ≤ n, and Nat.choose_symm_add is a variant.
Example. For : . For or both and are . For the row is .
Proof. If , then (5) gives , and the same formula with replaced by gives the same fraction, since the two factorials in the denominator are exchanged. If or , then or , and both coefficients are : the first by the definition for , and for because the numerator of (3) contains the factor ; and the second the same way.
Theorem (moving a factor in and out, when , TAOCP eq. 1.2.6(7)). For every real and every integer ,
Node: TAPSHK05AG · Lean: TAOCP.S1_2_6.eq7 · status: proved
Explanation. The identity pulls a factor out of the numerator of the coefficient and lowers both indices. It is most used in the equivalent forms , valid for all integers , and , valid when no division by zero occurs. These forms let one absorb a loose factor or in a sum into a coefficient. The Mathlib lemma for natural arguments is Nat.add_one_mul_choose_eq.
Example. . Also . For and : .
Proof. Take . Then , and the numerator is times , which is the numerator of . Also . Dividing out gives . For both sides are , since too. The form holds also for , as both sides are , and for the same way.
Theorem (moving a factor in and out, when , TAOCP eq. 1.2.6(8)). For every real and every integer ,
Node: TAH0TQCS7T · Lean: TAOCP.S1_2_6.eq8 · status: proved
Explanation. This is the companion of (7), which lowers both indices, and it lowers only the upper one. It is the same as , which needs no condition on and . The book proves it by the symmetry (6) and (7) when is a positive integer different from , and then extends it to all real by the fact that both sides of are polynomials in . C1 gives a direct proof.
Example. . For and : , and .
Proof. The claim is for all real and integers . For both sides are . For the left side is . The right side is . The two numerators have the same factors . If , division by gives (8).
Theorem (the addition formula, TAOCP eq. 1.2.6(9)). For every real and every integer ,
Node: TA32KRG1YP · Lean: TAOCP.S1_2_6.eq9 · status: proved
Explanation. In Pascal's triangle each entry is the sum of the entry above it and the entry above and to the left. The identity holds for real and for all integers , which is what lets one extend the triangle upward to negative rows. The book gives a proof from (7) and (8) when . For natural numbers, Lean states it as Nat.choose_succ_succ: . For a general ring, Ring.choose_succ_succ states it for Ring.choose.
Example. . For and : . For and : .
Proof. For check directly: if all three terms are ; if the terms are , and . Take and . By (8) and (7), and . Add: . Divide by . Both sides of (9) are polynomials in for a fixed , and they agree at all , which are infinitely many values, so they are equal at also.
Theorem (a sum along a diagonal, TAOCP eq. 1.2.6(10)). For every real and every integer ,
Node: TAVXNSS0N6 · Lean: TAOCP.S1_2_6.eq10 · status: proved
Explanation. The terms lie on a diagonal of Pascal's triangle, each one step down and one step to the right of the one before, and the sum is the entry below the last term and to the right. For natural Mathlib states the sum as Nat.sum_range_add_choose. The general real is the form that the book proves, and it is used in the proof of (18) below.
Example. For and : .
Proof. Induct on . For both sides are , as . If the formula holds for , then by (9) with and ,
Theorem (a sum down a column, TAOCP eq. 1.2.6(11)). For integers and ,
Node: TA9Y0JGGN3 · Lean: TAOCP.S1_2_6.eq11 · status: proved
Explanation. The terms lie in one column of Pascal's triangle, and the sum is the entry that is one step down and to the right of the last. For it is the sum of an arithmetic progression, . The Lean lemma Nat.sum_Icc_choose states the sum over from to , which is the same, since the terms with are zero. The proof below is an induction. The book derives it also from (10) with two uses of (6).
Example. For and : .
Proof. Induct on . For the left side is and the right side is . For both are , and for both are . For the step, by (9), where the sum up to is by the hypothesis, and the last step is (9) with and .
Example (the sum of squares by (11), TAOCP eq. 1.2.6(12)). For every integer ,
Node: TAVKZESWFB · Lean: TAOCP.S1_2_6.eq12 (partial) · status: proved
Explanation. The method of the book is to write the summand as a combination of binomial coefficients with the index in the upper place, and then to apply (11) to each term. Here . The method works for every polynomial in , since the polynomials have degrees and so form a basis of the polynomials of degree at most . In Lean the sum of the first powers is Finset.sum_range_id_mul_two, which has the sum over range n, so the index is shifted by one.
Example. For : , and . The closed form gives too.
Proof. Since , one gets . Sum over from to and apply (11) with and : .
Theorem (the binomial theorem, TAOCP eq. 1.2.6(13)). For an integer and any numbers and ,
Node: TAER5MY5KP · Lean: TAOCP.S1_2_6.eq13 · status: proved
Explanation. The sum runs over all integers , and the terms with or are zero, so it is the same as . The book prefers the form with no limits, since manipulations of sums are simpler when the range of the index is the set of all integers. The numbers and can be in any commutative ring. Mathlib states it as add_pow : (x + y) ^ n = ∑ m ∈ range (n + 1), x ^ m * y ^ (n - m) * n.choose m for a commutative semiring, and Commute.add_pow when and only commute. The name of the coefficient comes from this theorem.
Example. With , and the sum is .
Proof. Induct on . For both sides are , with as in (14). Suppose that the formula holds for with . Then . Replace by in the first sum, which gives . The two sums combine to , and (9) turns the bracket into .
Definition (the convention , TAOCP eq. 1.2.6(14)). The symbol means .
Node: TAH396BRK7 · Lean: TAOCP.S1_2_6.eq14 · status: proved
Explanation. The theorem (13) is wrong at or unless , as the proof of (13) just showed: with , and the sum has the single term , . The same convention makes for all , makes the polynomial equal to at , and is the one that Lean and Python use: 0 ^ 0 = 1 in Mathlib (pow_zero) and 0 ** 0 == 1 in Python. For real functions the limit of at does not exist, so the convention is a choice made for algebra and not a result of analysis.
Example. Put and in (13): the left side is and the right side is . With both are . Python's 0**0 returns , and so does pow(0, 0).
Proof. A definition has no proof, and the reason for the choice is that (13) holds for and all only with it. Suppose that for all numbers, with a value for . Set , and : the left side is , and the right side is . Hence .
Theorem (the binomial theorem with one variable, TAOCP eq. 1.2.6(15)). For every real and every real with , and also for every integer and every ,
Node: TA8N294CZG · Lean: TAOCP.S1_2_6.eq15 (partial), binomialSeries, from Mathlib · status: proved
Explanation. This is (13) with . For a non-integer the sum is an infinite series, since no coefficient with is zero, and it converges for . At it can converge or not, depending on . Mathlib has the series as binomialSeries in Mathlib/Analysis/Analytic/Binomial.lean, with the coefficients Ring.choose a n, and Real.one_add_rpow_hasFPowerSeriesOnBall_zero states that its sum is for . Newton announced the result in letters of 1676 and gave no proof. Euler tried a proof in 1774, and the first complete proof is due to Gauss in 1812.
Example. For and the coefficients are , and the series is . It converges to . Two hundred terms in Python give .
Proof. For an integer this is (13). Let be any real number, and . If is an integer the series is finite; otherwise has absolute value that tends to , so by the ratio test the series converges for and its derivative is the termwise derivative. From the definition (3), , so . Then Let for . Then , so is constant on the interval, and . Hence .
Theorem (Abel's form of the binomial theorem, TAOCP eq. 1.2.6(16)). For an integer and numbers , and ,
Node: TAC6E39R6A · status: not stated yet
Explanation. When this is the binomial theorem (13), since . The identity holds for three variables, and the factor at is read as , since . The formula is due to N. H. Abel, 1826. For a negative the two sides can differ, as exercise 52 shows, so it is a theorem about polynomials.
Example. With , , , the left side is . The right side has the four terms : ; : ; : ; : . The sum is . For the rational values , , and the exact fractions in Python agree on both sides.
Proof. Write and . For each expand by (13). Then the right side of (16) is By (20), . Put . The inner sum becomes , since . If , the function is a polynomial in of degree less than , and by (34) below the sum is for a polynomial of degree less than . If , that is , the only term is , and . So the whole sum is .
Theorem (negation of the upper index, TAOCP eq. 1.2.6(17)). For every real and every integer ,
Node: TAZZRHBKEZ · Lean: TAOCP.S1_2_6.eq17 · status: proved
Explanation. It turns a negative upper index into a positive one, and the reverse. The project has no statement of (17) for TAOCP.binom yet. Mathlib has Ring.choose_neg in Mathlib/RingTheory/Binomial.lean, which is (17) with replaced by and a natural lower index, and for the alternating sum of a row it has Int.alternating_sum_range_choose.
Example. , and . Also for all .
Proof. For both sides are . For negate each of the factors in the numerator of : . The product is in the opposite order, which is the numerator of . The denominators agree.
Theorem (an alternating partial sum of a row, TAOCP eq. 1.2.6(18)). For every real and every integer ,
Node: TAZFT7NKQS · Lean: TAOCP.S1_2_6.eq18 (partial) · status: proved
Explanation. The sum of the whole row with alternating signs has no closed form for general , but the partial sum up to has one. The Lean lemma states it for natural in the form . For both sides are .
Example. For and : . For and the sum is the full alternating row, . For and : .
Proof. By (17), . Put , so that the sum is . For this is the sum (10) with replaced by , which has the value . Now apply (17) once more: . For every term and the right side are .
Theorem (negation of the upper index for an integer upper index, TAOCP eq. 1.2.6(19)). For integers and ,
Node: TA89F6D5F9 · Lean: TAOCP.S1_2_6.eq19 · status: proved
Explanation. The upper index becomes a lower index , and the new upper index is negative and fixed when is fixed. This lets one sum over instead of over , as in the proof of (24).
Example. , where . For and both sides are .
Proof. Apply (17) with and : . By the symmetry (6), valid for and all integers , .
Theorem (the product of two coefficients with a shared index, TAOCP eq. 1.2.6(20)). For every real and all integers and ,
Node: TAJNS2M4G8 · Lean: TAOCP.S1_2_6.eq20 · status: proved
Explanation. The index stands in the lower place of the first coefficient and in the upper place of the second. The formula moves it to one place only. Both sides count the ways to choose a set of objects out of and then a subset of objects out of those , and the right side first chooses the objects and then the others. The case is (7). In Mathlib, the lemma Nat.choose_mul states it for natural numbers: .
Example. and . For , and the left side is and the right side is .
Proof. If or , with , both sides are : on the left , and on the right for and for . If , then and the right side has with for , and for , so it is too. Now take . For an integer use (5): For fixed and both sides are polynomials in of degree , and they agree at , so they agree for every real .
Theorem (Vandermonde's convolution, TAOCP eq. 1.2.6(21)). For all real and and every integer ,
Node: TAK5XM05A4 · Lean: TAOCP.S1_2_6.eq21 (partial) · status: proved
Explanation. It is the identity of the section that is used most often. For natural and both sides count the -element subsets of a set with red and blue elements, and the term for counts the subsets with red elements. It is named for A. Vandermonde (1772), but the Chinese treatise of Chu Shih-Chieh (1303) already has it. Mathlib has two versions. Nat.add_choose_eq is for natural numbers, with a sum over the antidiagonal of , and Ring.add_choose_eq is for a binomial ring, and so for the integers and the rationals, with a natural lower index. The form with real upper indices is the one proved here. Exercise 17 derives it from (15) by comparing the coefficients of , and the proof of (28) uses it with a negative upper index.
Example. For , and : . For the real values , and the exact fractions give on both sides.
Proof. If both sides are . For the left side has only the terms . First take natural numbers and . Take a set of red and blue elements and its -element subsets. Sort them by the number of red elements: there are subsets with red elements, so the sum over is the number of all of them. Now fix a natural and . Both sides are polynomials in of degree at most , and they agree at , so they are equal for all real . Fix a real and a natural . Both sides are now polynomials in of degree at most and they agree at , hence for all real .
Theorem (a convolution with shifted lower indices, TAOCP eq. 1.2.6(22)). For integers , and and every real ,
Node: TAP8HSPY9S · status: not stated yet
Explanation. The running index now appears in both lower places with a plus sign. Reflect the first coefficient by (6) and the sum becomes the convolution (21). The condition that is a non-negative integer is needed for (6).
Example. For , , and the sum runs over the terms with and . The right side is , and Python gives for both. A use of (22) with a loose factor: for an integer and real , . Take and . The left side is , and the right side is .
Proof. By (6), for . Put . The sum is and (21) with replaced by gives .
Proof of the use. By (8) in the form , the sum is , and (22) with and in place of gives .
Theorem (an alternating convolution with an upper index that moves, TAOCP eq. 1.2.6(23)). For integers and and every real ,
Node: TA4BKSTGJG · status: not stated yet
Explanation. This is a difference formula in disguise: the left side is the th finite difference of the function at , and each difference lowers by one. The book proves it as an exercise by induction (exercise 19). The case is the inversion formula (33).
Example. For , and : . For , and : . For the right side has a negative lower index and is .
Proof. Let be the shift operator , let , and let . Then by (9), for every integer . By induction . The operators and commute, so the binomial theorem (13) holds for them: . Apply it to at : .
Theorem (an alternating sum over the upper index, TAOCP eq. 1.2.6(24)). For integers , and and every real ,
Node: TA74N9ZXM4 · status: not stated yet
Explanation. Here the running index moves the upper index of one coefficient and the lower index of the other. The sum is cut off at , which is part of the identity. The book proves it with (21) and (19); C1 uses the generating function of the column of Pascal's triangle, which keeps the cut-off visible.
Example. For , , and the terms are : ; : ; : ; and for . The sum is , and the right side is . An integer case: , , , gives .
Proof. Put and . If the sum is empty and the right side is , since its lower index is negative. For the terms have , and the claim is . Consider the formal power series and . The coefficient of in is the left side. By (17), , so . By (21), the formal series satisfy , since the coefficient of in the product is the left side of (21). Hence , and the coefficient of is the coefficient of in , which is . By (17) with and this is .
Theorem (a convolution over the upper indices, TAOCP eq. 1.2.6(25)). For integers , and ,
Node: TAP4T67P0P · status: not stated yet
Explanation. Both coefficients have the running index in the upper place, one with a minus sign and one with a plus sign. The sum is cut off at , and the condition makes the terms with vanish, so that the cut-off is natural. The book calls (23) and (25) the expansions of in terms of , (23) for negative and (25) for positive , and it advises to replace a simple coefficient by such a sum when it helps.
Example. For , , and the terms for are . Their sum is . If the identity can fail: for , , , the left side is and the right side is . The two missing terms are the values of the full sum, which the condition removes.
Proof. Put and . The sum is . Since , for , so the sum can start at . Now counts the subsets of of size . Sort them by the st smallest element . There are ways to choose the smaller elements from and ways to choose the larger elements from . Sum over .
Theorem (Rothe's convolution, TAOCP eq. 1.2.6(26)). For an integer and real , , ,
Node: TA60MA975H · status: not stated yet
Explanation. For both sides are . When the quotient is read as the polynomial for and as for , so the identity is a polynomial identity in , and . The case is Vandermonde's convolution (21), since the factor is then . For general the upper indices drift with the running index , and the extra factor repairs the drift. The book states the result and leaves the proof to Exercises 22 to 24 and to the generating functions of Exercises 25 to 27. The proof below follows the plan of Exercises 22 to 24, with its own choice of the starting value.
Example. Take , , and . The five terms, for , are , , , and , and their sum is . The right side is . An integer case: , , , gives on both sides.
Proof. Write , so that and is a polynomial in and , and let and . Fix and a real such that for all , and prove as functions of by induction on . For both sides are . Let and assume the claim for and all .
The first step is a recursion in . By the addition formula (9), . Summing against , the first part gives . In the second part the term vanishes, and for the coefficient is , so the second part is . Thus . The same addition formula gives , because . By the induction hypothesis , so the difference satisfies for every real . Since is a polynomial in and it takes the same value at for any , it is constant. It is enough to find one with .
Take . Then . For , the lower index of the second factor is and the upper index is . By the negation formula (17), . By (20) with the upper index , , and by (7), . Hence The coefficient is a polynomial in of degree at most . By (34) of the next file, or by the fact that the th finite difference of a polynomial of degree less than is zero, the alternating sum is . So , hence for all real .
Finally, both sides are polynomials in for fixed and , and they agree for all but finitely many , hence for all . The same argument in shows the identity for all real .
Lemma (the first reduction of Example 2, TAOCP eq. 1.2.6(27)). For an integer ,
Node: TACZ5TWFFJ · status: not stated yet
Explanation. The left sum has the running index in six places. Two basic operations remove two of them: the product rule (20) and the factor rule (7). The result is a sum of two coefficients, which the next result evaluates. Both sums have only terms with , because for and for .
Example. For the five terms of the left side, , are , and so are the five terms of the right side. Their sum is . For the right side has the terms , with sum .
Proof. By (20) with the upper index , the middle index and the lower index , , since and . Next, (7) gives , so . Multiply the two facts.
Theorem (the value of Example 2, TAOCP eq. 1.2.6(28)). For an integer ,
Node: TA530FJH9J · status: not stated yet
Explanation. The sum is for and for every other . It is the building block of the next example, where it is used as a way to cut a sum down to a single term. The book gives two derivations from (27). One uses (23), the other uses (17) and (22). The proof below is the second, with (22) written out as (6) and (21).
Example. The sums for are . For , the form of (27) is .
Proof. By (27) it is enough to show that . By (17), , so the signs cancel and the sum is . By the symmetry (6), . Vandermonde's convolution (21) with the upper indices and and the total gives . And is for and for . Dividing by keeps .
Theorem (the double sum of Example 3 and its value, TAOCP eq. 1.2.6(29)). For integers and , the sum equals the double sum
Node: TA9A3TR0GA · status: not stated yet
Explanation. The double sum (29) is the step that turns the single sum of Example 3 into a sum that (28) can evaluate. The proof below derives it by (25) and evaluates it. When the product rule (20) no longer applies to the first coefficient. The remedy is to replace by a sum of coefficients of the form , which (28) can handle. This is a step in the wrong direction at first sight, because it adds a summation, and it pays because the new inner sum has the known value . The delicate point is the range of and when the sums are interchanged.
Example. For and the terms with are , , , , with sum . The terms with vanish, since .
Proof. Fix . By (25) with , , the pair of that equation replaced by , and the condition fulfilled, . Put this in the sum to get the double sum of (29). Terms with (which occur only for ) have , hence . So the range of can be cut to without changing the sum, and for these every is allowed, so the two sums can be interchanged. The inner sum over is by (28), with . Therefore the total is , and only survives, with value .
Theorem (the addition rule for the polynomials , TAOCP eq. 1.2.6(30)). Let for , extended to a polynomial in and . For an integer ,
Node: TA7WNB4E05 · status: not stated yet
Explanation. This is a version of (26) with the product in place of one factor. The identity says that the polynomials add their arguments in the way the coefficients do by (21), which is the case . The book reduces (30) to (26) by partial fractions, and Exercise 27 gives a second proof by generating functions. The proof below is the reduction by partial fractions, written with the values of this file.
Example. For , , and , the five products are , , , and . Their sum is , and has the same value.
Proof. Both sides are polynomials in , and , so it may be assumed that , for and . Put and , so that . From the product is Sum over . The part with is times , and this is by (26). For the part with replace by : it becomes times , which is by (26) with and exchanged. The total is .
Algorithms and programs
The section has no algorithm and no program. Its only procedures are by hand: the building of Pascal's triangle by the addition formula (9), and the reduction of a sum by the chain of operations shown in the model problems of eqs. (27) to (30).
The exercises
The table has the exercises 1 to 30 of Section 1.2.6, which belong to the material of this file. The exercises 31 to 68 are in the second file, together with the equations they use. The kind is the class of spec 06.3 that C1 proposes.
| Exercise | Rating | Markers | Kind | Lean | Solution |
|---|---|---|---|---|---|
| 1.2.6-1 | 00 | K3 | not yet stated | X1, 1.2.6-1 | |
| 1.2.6-2 | 00 | K3 | not yet stated | X1, 1.2.6-2 | |
| 1.2.6-3 | 00 | K3 | not yet stated | X1, 1.2.6-3 | |
| 1.2.6-4 | 10 | K3 | not yet stated | X1, 1.2.6-4 | |
| 1.2.6-5 | 05 | informal | not yet stated | X1, 1.2.6-5 | |
| 1.2.6-6 | 10 | K3 | not yet stated | X1, 1.2.6-6 | |
| 1.2.6-7 | 12 | K2 | not yet stated | X1, 1.2.6-7 | |
| 1.2.6-8 | 00 | informal | not yet stated | X1, 1.2.6-8 | |
| 1.2.6-9 | 01 | K3 | not yet stated | X1, 1.2.6-9 | |
| 1.2.6-10 | 25 | M | K1 | not yet stated | X1, 1.2.6-10 |
| 1.2.6-11 | 20 | M | K1 | not yet stated | X1, 1.2.6-11 |
| 1.2.6-12 | 22 | M | K2 | not yet stated | X1, 1.2.6-12 |
| 1.2.6-13 | 13 | M | K1 | not yet stated | X1, 1.2.6-13 |
| 1.2.6-14 | 21 | M | K3 | not yet stated | X1, 1.2.6-14 |
| 1.2.6-15 | 15 | M | K1 | not yet stated | X1, 1.2.6-15 |
| 1.2.6-16 | 15 | M | K1 | not yet stated | X1, 1.2.6-16 |
| 1.2.6-17 | 18 | M | K1 | not yet stated | X1, 1.2.6-17 |
| 1.2.6-18 | 15 | M | K1 | not yet stated | X1, 1.2.6-18 |
| 1.2.6-19 | 18 | M | K1 | not yet stated | X1, 1.2.6-19 |
| 1.2.6-20 | 20 | M | K1 | not yet stated | X1, 1.2.6-20 |
| 1.2.6-21 | 05 | M | informal | not yet stated | X1, 1.2.6-21 |
| 1.2.6-22 | 20 | M | K1 | not yet stated | X1, 1.2.6-22 |
| 1.2.6-23 | 13 | M | K1 | not yet stated | X1, 1.2.6-23 |
| 1.2.6-24 | 15 | M | informal | not yet stated | X1, 1.2.6-24 |
| 1.2.6-25 | 30 | HM | K1 | not yet stated | X1, 1.2.6-25 |
| 1.2.6-26 | 25 | HM | K1 | not yet stated | X1, 1.2.6-26 |
| 1.2.6-27 | 21 | HM | K1 | not yet stated | X1, 1.2.6-27 |
| 1.2.6-28 | 25 | M | K1 | not yet stated | X1, 1.2.6-28 |
| 1.2.6-29 | 20 | M | K1 | not yet stated | X1, 1.2.6-29 |
| 1.2.6-30 | 24 | M | K1 | not yet stated | X1, 1.2.6-30 |
The order to do them: start with 1.2.6-1 to 4, 6, 8 and 9, which are counts and the edge values of the triangle, and 1.2.6-5 and 7 for its shape. Exercises 1.2.6-10, 11 and 12 are the facts about divisibility by a prime, with Kummer's carry rule in 1.2.6-11. Exercises 1.2.6-13, 14, 15, 16 and 19 are the sums and the binomial theorem of eqs. (10) to (13), (18) and (23). Exercises 1.2.6-17, 18, 20 and 21 belong to Vandermonde's family, eqs. (21) to (25), and 1.2.6-29 links the polynomial rule (34) of the second file to exercise 1.2.3-33. The group 1.2.6-22, 23, 24, 25, 26, 27 and 28 is about Rothe's convolution and its generating functions: 22 to 24 are the proof sketched in the book and written out above, and 25 to 27 are the proof from the series . Exercise 1.2.6-30 asks for the better way to solve Example 3, with (26) in place of the (28) route.
Lean
The Lean repository tamnd/taocp-lean at main (commit b48ef97) has the file TAOCP/V1/S1_2_6.lean. It states eqs. (3) to (15) and (17) to (21) as TAOCP.S1_2_6.eq3 to TAOCP.S1_2_6.eq21, over a field of characteristic zero, with natural numbers where the book needs them. Four of them are weaker than the book, and their Node lines say "partial". Eq. (12) states the closed form of the sum of squares only. Eq. (15) is the case of a natural exponent. Eqs. (18) and (21) take a natural . It has the definition TAOCP.binom for eq. (3), over a field and with an integer lower index, and the lemmas TAOCP.binom_natCast_right, TAOCP.binom_of_neg, TAOCP.binom_zero_right (the first value of eq. (4)), TAOCP.binom_natCast, TAOCP.binom_eq_ringChoose and TAOCP.binom_eq_fallingPow_div. The Stirling numbers of the second file are there too. Every other Node line of this file that has no Lean name says "not yet stated". The Mathlib names the statements use are listed here, each found in the source of Mathlib.
- The coefficient:
Nat.choose, withNat.choose_eq_factorial_div_factorial,Nat.choose_symm,Nat.choose_succ_succandNat.choose_eq_descFactorial_div_factorial. The set of the combinations isFinset.powersetCard, withFinset.card_powersetCard. - The sums:
Nat.sum_range_add_choose(eq. (10)) andNat.sum_Icc_choose(eq. (11)). - The binomial theorem:
add_powfor natural exponents, andbinomialSeriesfor the generalized series of eq. (15). - The extension to a general upper index:
Ring.choose, withRing.choose_negfor eq. (17). - The alternating sum of eq. (18):
Int.alternating_sum_range_choose_eq_choose. - Vandermonde's convolution, eq. (21):
Nat.add_choose_eq.
Rothe's convolution (26) and its consequences (27) to (30) have no counterpart in Mathlib. The project will state them for Ring.choose over a field of characteristic zero, and the proof above, an induction on with a base value found by the negation formula, is the route to follow.
Notes and history
Pascal's treatise on the arithmetical triangle, written in the 1650s and printed in 1665, made the triangle famous in Europe, but it is much older. The Chinese mathematician Chu Shih-Chieh drew it in 1303 in a book that already presents the triangle as an old tool, and Yang Hui showed it in 1261, quoting an earlier source. In India Halayudha gave the triangle as a commentary on a rule for the number of metres in the tenth century, and Mahavira (about 850) and Bhaskara (1150) have rules for the number of combinations. The symbol is from Andreas von Ettingshausen (1826).
Newton described the binomial series for an arbitrary exponent in letters of 1676, and Gauss studied the convergence of such series in 1812. Niels Henrik Abel proved his extension of the theorem in 1826, which is eq. (16). The convolution (21) was published by Alexandre Vandermonde in 1772. It is often named after him alone, but the book points out that Chu Shih-Chieh had it in 1303.
Heinrich August Rothe published (26) and (30) in 1793 in the book on the reversion of series. The history of these identities, which are rediscovered often, and their generalizations are collected in the paper of H. W. Gould and J. Kaucky in the Journal of Combinatorial Theory, volume 1 (1966). The identity (28) and the technique of Examples 2 and 3 show the advice of the book: complicate the sum on purpose when this lets a known identity apply.
The project has no errata of Section 1.2.6 to report for the first thirty equations.
Inversion, generalizations and Stirling numbers
Overview
This second file of Section 1.2.6 covers eqs. (31) to (60). It opens with Example 5, in which a sum of binomial coefficients is inverted with the help of eq. (33), and it turns the method into the polynomial rule (34) and its use (35). It then shows a few sums that do and do not have closed forms, (36) to (38), and the generalizations of the coefficient: hypergeometric series (39), the -nomial coefficient (40) and the multinomial coefficient (41) to (43). The last part is the Stirling numbers, which are the coefficients that convert between the powers and the falling powers , eqs. (44) to (58), with their extension to a real upper index in (57) to (60). The proofs use only the first file, the falling powers of Section 1.2.5 and induction. Three claims lean on analysis that this chapter does not prove: the nonexistence of a closed form in (36), the convergence in (59) and the asymptotic series of the logarithm of the gamma function behind (60). Each of the three is marked where it occurs.
The ideas
Inversion by a sum that vanishes. Eq. (33) says that is for and otherwise. If a quantity is given as , then multiplying by and summing over picks out . The same idea inverts the relation between the Stirling numbers of the two kinds.
A polynomial is a combination of binomial coefficients. The polynomials have degrees , so every polynomial of degree at most in is a unique combination of them, and its coefficient on is times the coefficient of . The same fact is true of , and it is the reason that the Stirling numbers are well defined.
Two polynomials that agree on the integers agree. A polynomial that vanishes at infinitely many integers is zero. Many identities below are proved for integer values of a parameter and then read as identities of polynomials. The step from a difference rule to a polynomial is the same each time: if for two polynomials and is given, then is determined.
Definitions, results and proofs
Example (the numbers with , TAOCP eq. 1.2.6(31)). There is exactly one sequence of rationals such that for every integer and it is .
Node: TATGXMVC19 · status: not stated yet
Explanation. The sum on the right ends at , because for . So the equation for involves and the coefficient of is . This is a triangular system and it has a unique solution. The point of the example is to find the solution by a method that does not need a guess. The answer was stated without proof as eq. 1.2.5(11), and is the number of derangements of objects.
Example. The first values are . For the right side is .
Proof. Existence and uniqueness follow from the triangular shape. Since , the equation reads , which is eq. (32). Multiply by and sum over from to . The right side becomes , and the inner sum is by (33). So . Divide by and use : .
Lemma (the binomial form of Example 5, TAOCP eq. 1.2.6(32)). For every integer ,
Node: TA3X6XPRCT · status: not stated yet
Explanation. It is the same equation as (31), with the falling power written as a binomial coefficient. In this form the unknown appears in a convolution that is of the type of eq. (33), which is the reason for the rewriting. It is an instance of the general relation between a sequence and its binomial transform, and eq. (33) will give the inverse transform.
Example. The numbers are , the derangement numbers. For : .
Proof. By eq. 1.2.5(2) and the definition (3), for every integer . Put this in (31).
Theorem (the inversion sum, TAOCP eq. 1.2.6(33)). For integers and ,
Node: TA6WYX552Z · status: not stated yet
Explanation. It is eq. (23) with . The sum is nonzero only when the two indices match, so it acts as a Kronecker delta in the variable . If a sequence is given by , then , which is the inversion of the binomial transform used in Example 5.
Example. For and : . For the sum is , since the terms with vanish.
Proof. Put in (23): . The value of is for and for any other integer , by definition (3) for and because for .
Theorem (the polynomial rule, TAOCP eq. 1.2.6(34)). For an integer and any numbers ,
Node: TARZSHY1GN · status: not stated yet
Explanation. It says that the th difference of a polynomial of degree at most is the constant times its leading coefficient. Taking shows that the th difference of a polynomial of lower degree is zero. This is what the proof of Rothe's convolution in the first file uses. Exercise 29 of the book asks for the connection with Exercise 1.2.3-33.
Example. For and the sum is . The values of at are , so the sum is .
Proof. The polynomials for have degree and leading coefficient , so they form a basis of the polynomials of degree at most : subtract a multiple of to remove , then of , and so on. Hence and since only has degree . By (33), , so the sum is .
Theorem (a sum that equals a power, TAOCP eq. 1.2.6(35)). For an integer and real , ,
Node: TA1K1VBZZA · status: not stated yet
Explanation. Rule (34) settles many sums of this shape in one line. This is the model case. The coefficient is a polynomial in of degree , so (34) applies and only the leading coefficient matters.
Example. For , , : the terms are , , , , and the sum is .
Proof. The leading term of in is , so its leading coefficient is . By (34), . Multiply by to turn the sign into .
Observation (the partial row sum, TAOCP eq. 1.2.6(36)). For integers the sum has no known simple closed form in and .
Node: TA0Z00TTE3 · status: not stated yet
Explanation. The sum of the whole row is by (13) with and the alternating sum of a row is given by (18), but the partial sum is not a known simple expression. The book does not prove its impossibility either. It points to the algorithm of Gosper and Zeilberger, which decides whether a sum of this type has a closed form in the class of hypergeometric terms and which gives a negative answer here. C1 does not prove that statement. What it proves is the exact recurrence that the sum satisfies, which shows that the sum is simple only in the sense of a recurrence.
Example. For the partial sums for are . The last one is . The recurrence below gives , which is .
Proof. Write . By the addition formula (9), . It does not give a closed form, because the term is added in each step. The nonexistence of a closed form is the theorem of the Gosper and Zeilberger method, which is cited and not proved here.
Theorem (a partial sum for a negative upper index, TAOCP eq. 1.2.6(37)). For an integer ,
Node: TAWB5TM9W8 · status: proved
Explanation. When the upper index is a negative integer, the coefficients are polynomials in with alternating signs and the partial sums are explicit. The simplest case is .
Example. For the terms are and the sum is . For the sum is .
Proof. By (17), . Let be the sum. For , . Suppose the formula holds for and add the term . If is even, , so . If is odd, , so .
Theorem (a partial sum with a linear weight, TAOCP eq. 1.2.6(38)). For real and an integer ,
Node: TAH8VPQ8EZ · status: proved
Explanation. This partial sum has the same shape as (36), but it has a closed form, because the weight is the one that makes the sum telescope. The two partial sums of the row that occur cancel except for a boundary term.
Example. For and the terms are , and , with sum . The right side is .
Proof. Let , with . By (7), , so . By (9), . Hence the sum is .
Definition (hypergeometric series, TAOCP eq. 1.2.6(39)). For numbers , and a variable ,
Node: TATAWVWG6A · status: not stated yet
Explanation. This is a definition and it has nothing to prove, but two of its cases show what it does. The numerator and the denominator use the rising powers of eq. 1.2.5(19). With the single upper parameter and no lower parameter, the series is , and with it ends after terms. The book recommends hypergeometric series as the systematic tool for sums of binomial coefficients: a sum with a rational function of is a series of this kind.
Example. . And .
Proof. For one upper parameter, by (17) (the rising power equals ). So for by the binomial series (15). For with an integer, and it vanishes for , which gives .
Definition (the -nomial coefficient, TAOCP eq. 1.2.6(40)). For a real number , an integer and a number such that no factor of the denominator is zero, the -nomial coefficient is
Node: TA79DJC3AM · status: not stated yet
Explanation. The claim of the book is that when . The -nomial coefficient replaces each integer of the product of (3) by the quotient . For an integer the coefficient is a polynomial in , and its coefficients count the combinations by a statistic. The book sends the properties, including the -nomial theorem , to Exercise 58. This chapter proves only what the display claims, the limit.
Example. For and : . At this is .
Proof. For a real number , , because the quotient is a difference quotient of at and the derivative of at is . Divide the top and the bottom of each of the factors by , as for . The limit is .
Definition (the multinomial coefficient, TAOCP eq. 1.2.6(41)). For integers ,
Node: TAEWGC3KRA · Lean: Nat.multinomial, from Mathlib · status: proved
Explanation. For it is the binomial coefficient . The meaning is the number of words of length that have exactly letters of the th kind. Mathlib has the same quantity as Nat.multinomial s f, and its defining property is Nat.multinomial_spec.
Example. The letters of the word can be arranged in ways. For the coefficient is .
Proof. Take the orderings of distinct letters, with of them marked with the color . Two orderings give the same word of colors exactly when one is got from the other by permuting the letters inside each color class. Each word of colors comes from orderings, so the number of words is the quotient.
Theorem (the multinomial theorem, TAOCP eq. 1.2.6(42)). For an integer and elements of a commutative ring,
Node: TAB75G84QN · Lean: Finset.sum_pow_eq_sum_piAntidiag, from Mathlib · status: proved
Explanation. It extends the binomial theorem (13) to terms, and the sum is over the -tuples of nonnegative integers with sum . The coefficient counts the ways to choose from which factors of the product each is taken.
Example. For and the coefficients are (for , three terms), (for , six terms) and (for ), and , the value at .
Proof. Induction on . For both sides are . For apply (13) to : the power is . By the case , . Put . Then , and the pairs correspond to the tuples with sum .
Theorem (the multinomial coefficient as a product of binomial coefficients, TAOCP eq. 1.2.6(43)). For integers ,
Node: TA2EH1FR0F · status: proved
Explanation. It shows that every multinomial coefficient is an integer and that the methods for binomial coefficients apply. The book notes that both sides of the product rule (20) are the trinomial coefficient .
Example. For the right side is , which is the value of .
Proof. Let with . The th factor of the product is . The factor of the th term cancels the factor in the numerator of the st, and the product is .
Definition (the Stirling numbers of the first kind, TAOCP eq. 1.2.6(44)). The numbers , which are nonnegative integers with unless and with , are defined by
Node: TAM0WWAGGJ · Lean: TAOCP.stirling1 · status: proved
Explanation. The numbers are the absolute values of the coefficients of the polynomial in the powers of , so that the sign is taken out. They count the permutations of objects that have cycles (Exercise 64 for the second kind has the analogous meaning). The table of the book has them for , with for . In Lean, TAOCP.stirling1 is an alias of the unsigned Nat.stirlingFirst of Mathlib.
Example. From the row of the table, . The numbers for are and .
Proof. The product is a monic polynomial of degree with integer coefficients, so the numbers exist, are integers, and . The coefficient of is for , as is a factor. The sign and the nonnegativity follow from the recurrence , which is derived in the proof of (46) from the identity alone and which gives the claim by induction on .
Theorem (the Stirling numbers of the second kind, TAOCP eq. 1.2.6(45)). For every integer there are unique numbers , nonnegative integers that are zero unless and with , such that
Node: TA8J6AGPPG · Lean: TAOCP.stirling2 · status: proved
Explanation. The numbers convert the ordinary powers into the falling powers. Stirling introduced them in 1730 for this use. They count the partitions of an -element set into nonempty blocks (Exercise 64), and TAOCP.stirling2 is an alias of Nat.stirlingSecond, with the statement of (45) in Mathlib as Nat.pow_eq_sum_stirlingSecond_mul_descFactorial for natural .
Example. , from the row . In the binomial basis, , as . At the term is , and .
Proof. The polynomials are monic of degrees , so they are a basis of the polynomials of degree at most , over the integers, by the same reduction as in (34). The monic has unique coefficients, and the coefficient of is . Nonnegativity is proved with the recurrence of (46).
Theorem (the addition formulas, TAOCP eq. 1.2.6(46)). For integers , with and the value for a negative lower index,
Node: TAW9C17PC7 · Lean: TAOCP.stirling1_succ_succ, TAOCP.stirling2_succ_succ · status: proved
Explanation. They are the Stirling analogues of Pascal's rule (9), and they build the two triangles of the book row by row. The Lean statements are the same recurrences with .
Example. From : . From : .
Proof. First kind: . Write for the coefficient of in . Comparing the coefficients of in gives , that is, . This is the first formula. For , gives , and the formula for reads . Since , induction on shows that all the numbers are nonnegative integers, which also completes the proof of (44).
Second kind: for each , , because . Then . The coefficient of is . By the uniqueness of the expansion (45) it is . Induction on from gives the nonnegativity and the integrality.
Theorem (the two inversion formulas, TAOCP eq. 1.2.6(47)). For integers ,
Node: TAT1JHV93G · status: not stated yet
Explanation. It says that the two triangles, with the signs of (44) attached to the first, are inverse matrices. It is the Stirling counterpart of (33), which says the same of Pascal's triangle with alternating signs. The sign in the second sum can be or , as the two differ by the constant , which is when .
Example. For , : has the terms : ; : ; : ; : , and . For the sum is .
Proof. Put the expansion (45) into (44): . Since the expansion of in the falling powers is unique, the coefficient of is , which is the first formula. In the same way, put (44) into (45): , and the uniqueness of the expansion in powers gives . When the signs and agree, and when both sides vanish.
Theorem (the special values at the edge of the triangles, TAOCP eq. 1.2.6(48)). For every integer ,
Node: TAZZEGMXBK · status: proved
Explanation. The first row of each triangle is the unit row, as for Pascal's triangle, and the diagonal is .
Example. , , , and for the coefficient of in both expansions is .
Proof. For , , so and are for and otherwise. The value of is the same by (3). The numbers and are the leading coefficients of two monic polynomials, hence . by (6).
Theorem (the next diagonal, TAOCP eq. 1.2.6(49)). For every integer ,
Node: TAZ34427QM · status: proved
Explanation. It is the first instance of the polynomial behavior of in that the book describes after (56). Mathlib has the first kind as Nat.stirlingFirst_succ_self_left, which states that .
Example. From Table 2, .
Proof. The coefficient of in is the negative of the sum of the numbers , which is . By (44) it is . For the second kind, . The coefficient of on the left is , so .
Theorem (the first columns, TAOCP eq. 1.2.6(50)). For every integer ,
Node: TAC9T6MG0Q · status: proved
Explanation. The first column of the first triangle counts the cyclic arrangements of objects. The second column of the second triangle is the number of ways to split a set of elements into two nonempty parts. In Mathlib, Nat.stirlingFirst_one_right and Nat.stirlingSecond_one_right give two of the four values.
Example. For : , and .
Proof. Put in and in : the first has the factor and the second vanishes, so the constant coefficient of (44) and the coefficient of in (45) are both . The coefficient of in is , which is by (44). Put in (45): for , , so . Put : , and for , so and .
Theorem (the first expansion formulas, TAOCP eq. 1.2.6(51)). For integers ,
Node: TACGT944TN · status: not stated yet
Explanation. The first formula expands a Stirling number of one step further in and in by the binomial coefficients, and the second is its inverse by the rule of (33). They are the analogue of (10) and (11) for the first kind.
Example. For , : . The inverse: for is .
Proof. Let with . For , . For the step, (46) gives , and by (9) the last sum is . So . By the induction hypothesis this is , by (46), and for the second term is by (50). For the second formula, let and . Then . The inner sum is by (33), since and agree when . So the sum is .
Theorem (the second expansion formulas, TAOCP eq. 1.2.6(52)). For integers ,
Node: TAHMGM6CV1 · status: not stated yet
Explanation. Same as (51) for the second kind. The first formula says that a partition of elements into blocks is built by choosing the block of the last element and partitioning what is left, which is the combinatorial meaning that Exercise 64 proves.
Example. For , : . And over is .
Proof. Let . By (9), , and by (46), , so . Since , induction on gives , because . For the second formula put and . By (33), .
Theorem (powers as an alternating sum, TAOCP eq. 1.2.6(53)). For integers ,
Node: TAQHYWMM64 · status: not stated yet
Explanation. The left side is the th finite difference of the power at . It is for , it is for , and in general it is the number of surjections of an -element set onto an -element set, since counts the ways to partition into blocks and label them.
Example. For , : .
Proof. By (45), . Multiply by and sum over . By (33), , so only remains and the sum is .
Theorem (the Stirling numbers as sums of binomial coefficients, TAOCP eq. 1.2.6(54)). For integers ,
Node: TASJDZVAFP · status: not stated yet
Explanation. The Stirling numbers of the diagonal , as functions of , are polynomials of degree at most (see (57)). Each formula expresses such a polynomial in a basis built from the two binomial coefficients, with the numbers of the other kind as the coefficients. The sum has the terms only. The proof here uses the duality (58), proved below, and does not depend on this equation.
Example. For , the terms are , and for , and the sum is . With in place of the terms are , , and the sum is .
Proof. Fix . By (57) and (58) below there are polynomials and of degree at most with and for integers and with and for integers . Put . By the symmetry (6), , and with the first sum is , where is a polynomial of degree in . For integers with holds: the first factor needs and the second needs . Hence has degree at most and takes the value at and at . The polynomial has the same degree bound and the same values: at , with , it is , and at with it is because the lower index is negative or, for , is and . Two polynomials of degree at most that agree at points are equal, so , which is the first formula for (and for every as a polynomial identity). The second formula is the same argument with the roles of and exchanged, using .
Theorem (a sum with Stirling numbers of the first kind, TAOCP eq. 1.2.6(55)). For integers ,
Node: TAQSW9YHMT · status: not stated yet
Explanation. The binomial coefficient on the right is the entry of Pascal's triangle that is obtained by passing through both Stirling triangles. It complements (52).
Example. For , : . The middle terms use and with and .
Proof. By the first formula of (52), . Then the sum is . By the second formula of (47), the inner sum is (the sign differs from by the constant , which is at ). So the result is .
Theorem (two sums over a growing index, TAOCP eq. 1.2.6(56)). For integers ,
Node: TADTW32S6W · status: not stated yet
Explanation. Both are obtained by unrolling one of the recurrences (46) in with the other index fixed. Each step multiplies the previous total by a factor, in the first sum and in the second.
Example. For , : . And .
Proof. Let be the first sum. For it is . For the step, , because the term has the factor and the terms have the factor . By the hypothesis and (46), . For the second sum, call it . Then and by (46).
Theorem (the diagonals as polynomials, TAOCP eq. 1.2.6(57)). For every integer there are polynomials and of degree at most with and for all integers . For and ,
Node: TAPNCH8JNK · status: not stated yet
Explanation. The proof builds and from the recurrences (46) written as difference equations in . The degree is at most , and the book states that it is exactly . The leading coefficient is positive, but C1 does not need or prove this. These polynomials define and for real , which the next three results use.
Example. For : , , and .
Proof. The first fact: for a polynomial there is exactly one polynomial with and , of degree (and for ). Write as in the proof of (34) and put , using from (9). If is another solution then vanishes at every integer , so it is zero.
Put . For let be the solution for and the solution for . By induction the degrees are at most . The values at integers: for , and . If and , then by (46) with . This also holds when , where all the numbers are except for , . For the second kind with , in the same way.
The explicit cases. since . Let . Then and , so . For , one gets , with by the same computation, and , so . For let . Then and , which has degree . The polynomial also has degree at most , and at both take the values . So they are equal, and . In the same way has and , and this agrees with at (values ), so .
Theorem (the duality of the two kinds, TAOCP eq. 1.2.6(58)). With and for real , for all integers
Node: TA2CK985V6 · status: not stated yet
Explanation. With the claim is . It says that the two triangles are the same function after the reflection of the upper index. In the book this is described as implicit in Stirling's original work. The proof works for each polynomial and is valid for all real arguments, so it also gives .
Example. With and : and . Here and by (17).
Proof. The claim is for all as polynomials, by induction on . For both are . Let and assume . Put . By the difference rule of , . This is the difference rule of . Also . So and agree at all integers , and they are equal. The claim follows with and .
Theorem (the generalized Stirling expansion of a power, TAOCP eq. 1.2.6(59)). For real and complex with , with the falling power of Section 1.2.5, the series in the following display converges and its sum is :
Node: TANT3EY8C6 · status: not stated yet
Explanation. The identity (45) is a finite sum for an integer. For other it becomes an infinite series. C1 proves the part that can be proved from the polynomial facts above, that the series is an asymptotic expansion of as , in the sense of the statement at the end of the proof. The convergence for is not proved here. It is Exercise 65 of the book, rated HM35, and it uses analysis of the gamma function that this chapter does not develop.
Example. For and the terms are . The partial sums for are , , and , which approach .
Proof. Put . By (60) below, for each fixed , for real . The claim to prove is that for every , , as a polynomial in . For an integer , expand by (45) as and each by (44) as . The coefficient of is on the left and on the right, by (57). So the polynomial vanishes (for ) or equals (for ) at every integer , hence it does so identically. Now take any real and a fixed . Using the expansion of each with , . This proves that the series is an asymptotic expansion of .
Theorem (the generalized Stirling expansion of a falling power, TAOCP eq. 1.2.6(60)). For a real number and an integer , as ,
Node: TA7NQT3SKN · status: not stated yet
Explanation. It is (44) for a real exponent, with the sum cut at , and the series does not converge in general. The proof takes as an input the asymptotic series of the logarithm of the gamma function with a shift. That series is a standard result of analysis (Stirling's series with Bernoulli polynomials) and it is cited here and not proved. For the asymptotic input is the series behind Stirling's approximation, eq. 1.2.5(7). Mathlib has the Bernoulli polynomials as Polynomial.bernoulli, but not this expansion.
Example. For and the coefficients are , and the sums for are , , and . The exact value is .
Proof. The input is: for fixed real , as , , where is the Bernoulli polynomial. Take and and subtract: , where is a polynomial in of degree at most . Exponentiating a series of this kind, has the form , where is a finite sum of products with and rational coefficients. Its degree is at most . So each is a polynomial of degree at most in . For an integer the left side is the finite sum (44), , so by the uniqueness of the asymptotic coefficients for all integers . Two polynomials that agree at infinitely many points are equal, so and the expansion is the claim.
Algorithms and programs
The section has no algorithm and no program. The only procedure in this part of the text is the method of inversion of Example 5. The Gosper and Zeilberger procedure that the book cites for the sums with closed forms is outside the section and is not described here.
The exercises
The table has the exercises 31 to 68 of Section 1.2.6. The exercises 1 to 30 are in the first file. The kind is the class of spec 06.3 that C1 proposes.
| Exercise | Rating | Markers | Kind | Lean | Solution |
|---|---|---|---|---|---|
| 1.2.6-31 | 20 | M | K3 | not yet stated | X1, 1.2.6-31 |
| 1.2.6-32 | 20 | M | K1 | not yet stated | X1, 1.2.6-32 |
| 1.2.6-33 | 20 | M | K1 | not yet stated | X1, 1.2.6-33 |
| 1.2.6-34 | 23 | M | K1 | not yet stated | X1, 1.2.6-34 |
| 1.2.6-35 | 23 | M | K1 | not yet stated | X1, 1.2.6-35 |
| 1.2.6-36 | 10 | M | K3 | not yet stated | X1, 1.2.6-36 |
| 1.2.6-37 | 10 | M | K3 | not yet stated | X1, 1.2.6-37 |
| 1.2.6-38 | 30 | HM | K1 | not yet stated | X1, 1.2.6-38 |
| 1.2.6-39 | 10 | M | K3 | not yet stated | X1, 1.2.6-39 |
| 1.2.6-40 | 17 | HM | K1 | not yet stated | X1, 1.2.6-40 |
| 1.2.6-41 | 22 | HM | K1 | not yet stated | X1, 1.2.6-41 |
| 1.2.6-42 | 10 | HM | K2 | not yet stated | X1, 1.2.6-42 |
| 1.2.6-43 | 20 | HM | K1 | not yet stated | X1, 1.2.6-43 |
| 1.2.6-44 | 20 | HM | K1 | not yet stated | X1, 1.2.6-44 |
| 1.2.6-45 | 21 | HM | K2 | not yet stated | X1, 1.2.6-45 |
| 1.2.6-46 | 21 | M | K2 | not yet stated | X1, 1.2.6-46 |
| 1.2.6-47 | 21 | M | K1 | not yet stated | X1, 1.2.6-47 |
| 1.2.6-48 | 25 | M | K1 | not yet stated | X1, 1.2.6-48 |
| 1.2.6-49 | 20 | M | K2 | not yet stated | X1, 1.2.6-49 |
| 1.2.6-50 | 20 | M | K1 | not yet stated | X1, 1.2.6-50 |
| 1.2.6-51 | 21 | M | K1 | not yet stated | X1, 1.2.6-51 |
| 1.2.6-52 | 11 | HM | K1 | not yet stated | X1, 1.2.6-52 |
| 1.2.6-53 | 25 | M | K1 | not yet stated | X1, 1.2.6-53 |
| 1.2.6-54 | 21 | M | K2 | not yet stated | X1, 1.2.6-54 |
| 1.2.6-55 | 21 | M | K2 | not yet stated | X1, 1.2.6-55 |
| 1.2.6-56 | 20 | K3 | not yet stated | X1, 1.2.6-56 | |
| 1.2.6-57 | 22 | M | K1 | not yet stated | X1, 1.2.6-57 |
| 1.2.6-58 | 23 | M | K1 | not yet stated | X1, 1.2.6-58 |
| 1.2.6-59 | 25 | M | K1 | not yet stated | X1, 1.2.6-59 |
| 1.2.6-60 | 23 | M | K2 | not yet stated | X1, 1.2.6-60 |
| 1.2.6-61 | 25 | M | K2 | not yet stated | X1, 1.2.6-61 |
| 1.2.6-62 | 23 | M | K1 | not yet stated | X1, 1.2.6-62 |
| 1.2.6-63 | 30 | M | K1 | not yet stated | X1, 1.2.6-63 |
| 1.2.6-64 | 20 | M | K1 | not yet stated | X1, 1.2.6-64 |
| 1.2.6-65 | 35 | HM | K1 | not yet stated | X1, 1.2.6-65 |
| 1.2.6-66 | 30 | HM | K1 | not yet stated | X1, 1.2.6-66 |
| 1.2.6-67 | 20 | M | K1 | not yet stated | X1, 1.2.6-67 |
| 1.2.6-68 | 25 | M | K1 | not yet stated | X1, 1.2.6-68 |
The order to do them: start with 1.2.6-36, 37 and 39, which are the sums of a row of each triangle. Exercise 1.2.6-31 is a triple sum of binomial coefficients, and 1.2.6-32 and 33 carry the binomial theorem to the rising and the falling powers. Exercise 1.2.6-34 does the same for Abel's formula, and 1.2.6-35 proves the addition formulas (46) from the definitions. Exercises 1.2.6-38 and 1.2.6-47 to 52 are extensions of the binomial theorem and of the sums of this file. The group 1.2.6-40 to 45 defines the beta function and uses it to give the binomial coefficient a real lower index. Exercise 1.2.6-46 is the large-argument estimate by Stirling's formula, 1.2.6-67 is an upper bound of , and 1.2.6-68 is de Moivre's mean absolute deviation of the binomial distribution. Exercise 1.2.6-53 is a sum proved by induction, 1.2.6-54 inverts Pascal's triangle as a matrix and 1.2.6-55 inverts the two Stirling triangles. Exercise 1.2.6-61 is a sum of Stirling numbers in the spirit of (55), 1.2.6-62 and 63 are sums of products of binomial coefficients, 1.2.6-64 is the proof that counts partitions, 1.2.6-56 is the combinatorial number system, 1.2.6-57 the original generalization of the factorial by Stirling and 1.2.6-58 the -nomial theorem of eq. (40). Exercise 1.2.6-59 is about the sequences with a binomial recurrence, 1.2.6-60 counts the combinations with repetition, and 1.2.6-65 is the proof of (59) and (60) that is left open in this chapter. Exercise 1.2.6-66 is an inequality on real numbers. Do 1.2.6-65 last.
Lean
The Lean repository tamnd/taocp-lean at main has these declarations for this file: TAOCP.stirling1 and TAOCP.stirling2, which are aliases of the Mathlib functions Nat.stirlingFirst and Nat.stirlingSecond, and the two recurrences TAOCP.stirling1_succ_succ and TAOCP.stirling2_succ_succ of eq. (46). Every other Node line of this file that has no Mathlib name says "not yet stated". The names of Mathlib that the statements will use were found in its source.
- The Stirling numbers:
Nat.stirlingFirstandNat.stirlingSecond, withNat.stirlingFirst_succ_succ,Nat.stirlingSecond_succ_succ,Nat.stirlingFirst_self,Nat.stirlingSecond_self,Nat.stirlingFirst_succ_self_left,Nat.stirlingFirst_one_rightandNat.stirlingSecond_one_right. The expansion of a power in the falling powers, eq. (45), isNat.pow_eq_sum_stirlingSecond_mul_descFactorial. - The multinomial coefficient:
Nat.multinomialwithNat.multinomial_spec, and the multinomial theoremFinset.sum_pow_eq_sum_piAntidiag. - The falling power:
Nat.descFactorial,descPochhammeranddescPochhammer_eval_eq_descFactorial. - Bernoulli polynomials, for the input of the proof of (60):
Polynomial.bernoulli. The gamma function:Real.Gamma,Real.Gamma_add_oneandComplex.Gamma_nat_eq_factorial.
Mathlib has no theorem for the inversion formulas (47), the polynomial behavior (57) or the duality (58), and no -nomial coefficient. Its hypergeometric function ordinaryHypergeometric covers only the case of (39) with two upper and one lower parameter. The project will state them for the Mathlib functions, and (59) and (60) will wait until the expansion of is in Mathlib.
Notes and history
The inversion of Example 5 is an instance of what later literature calls binomial inversion: the relations and are equivalent, and eq. (33) is the identity behind it. The Stirling inversion (47) is its analogue for the two triangles.
The multinomial theorem (42) was found by Abraham de Moivre in a paper of 1697. The name -nomial coefficient in (40) is the book's, and the same numbers are called Gaussian binomial coefficients, after Gauss. Hypergeometric series (39) go back to Euler and to Gauss, who gave them the notation in 1812. The method of Gosper (1978) and of Zeilberger (1990) for sums of hypergeometric terms is explained in the book of Petkovsek, Wilf and Zeilberger, A = B, of 1996.
The two kinds of Stirling numbers are named after James Stirling, who introduced the second kind in the Methodus Differentialis of 1730 for the expansion (45). The notation with brackets and braces is that of Jovan Karamata (1935). The asymptotic behavior of the numbers for large was studied by L. Moser and M. Wyman (1958) and later by N. M. Temme, H. S. Wilf and H.-K. Hwang. The duality (58) is hidden in Stirling's own treatment.
The project has no errata of Section 1.2.6 to report.
Section 1.2.6 of TAOCP defines the binomial coefficient for a real number and an integer , and it gathers the identities that the analysis of algorithms uses every day: symmetry, the addition formula, the sums over a row, a column and a diagonal of Pascal's triangle, the binomial theorem, the negation of the upper index, the products of two coefficients and Vandermonde's convolution. It then solves five model problems, shows the inversion method that turns one sum into its inverse, and ends with the multinomial, -binomial and hypergeometric generalizations and with the Stirling numbers of both kinds. This chapter of C1 explains each of the 60 numbered equations and proves each, except for three inputs from analysis that the second file marks. It is cut in two files. The first file, up to eq. (30), has the coefficients themselves and the first four model problems, up to the convolution of Rothe. The second file, from eq. (31), has the fifth model problem, the inversion formulas, the partial sums, the generalizations and the Stirling numbers.
The source of this page. Something is wrong? Report it.