Quick viewing(Text Mode)

Combinatorics

METU DEPARTMENT OF MATHEMATICS

MATH 405

LECTURE NOTES CHAPTER II

SPECIAL

Ali Doğanaksoy

Ankara – 1999 4th Ed. v2.0 - 2019

1. BINOMIAL COEFFICIENTS 1 2. HARMONIC NUMBERS 27

3. CATALAN NUMBERS 49 4. FIBONACCI NUMBERS 59

5. STIRLING NUMBERS 73 6. EULERIAN NUMBERS 95 7. DERANGEMENTS 101

APPENDIX – A – FINITE SUMS 107

APPENDIX – B - RANDOM MAPPINGS AND 129 APPENDIX –C – ROOK POLYNOMIALS 143

Binomial coefficients are one of the most common and useful family of real numbers which arise in many areas of mathematics, especially in combinatorics. A has two indices, and 푟 the coefficient indexed by 푟, 푘 is denoted usually by (푘) read as ‘푟 choose 푘’ . There are many ways to introduce the binomial coefficients. The one which explains the naming is that, a binomial is an algebraic expression that contains two terms, for example, 푥 + 푦, where 푥 and 푦 are real numbers. 푟 푘 푟−푘 ( )푟 Then the binomial coefficient (푘) is the coefficient of 푥 푦 when we expand 푥 + 푦 . Due to the simple and symmetric form of (푥 + 푦)푟, it is not surprising to face with this expression in almost all areas of mathematics. For this reason, binomial coefficients appear in almost all areas of mathematics. There is a combinatorial property of binomial coefficients which dominates all other properties: When 푛 the indices are nonnegative and 푘 ≤ 푛, the binomial coefficient (푘) is equal to the number of 푟 푘 element subsets of an 푛 element set. This is the reason why we read (푘) as ‘푟 choose 푘’ even when 푟 is not an and there is nothing to choose. Again for this reason, in many books this property is taken as definition of binomial coefficients. Some special cases of the binomial theorem were known from ancient times. For example, Euclid mentioned the the binomial theorem for (푥 + 푦)2 . In 6th century, (푥 + 푦)3was considered in India. In fact, by the 6th century, the Hindu mathematicians probably knew how to compute binomial coeffficients, and a clear statement of this rule can be found in the 12th century text by Bhaskara. The binomial theorem as such can be found in the work of 11th-century Arabian mathematician Al- Karaji, who described the triangular pattern of the binomial coefficients. He also provided a mathematical proof of both the binomial theorem and Pascal's triangle, using a primitive form of mathematical induction. The problem was also discussed by the Omar Khayyam, who was probably familiar with the formula to higher orders. The term “binomial coefficient” was introduced in 1544 푛 by Michael Stifeland and the notation (푘) was introduced by Andreas von Ettingshausen in 1826. Some alternative notations 푛 푛 푘 are 퐶(푛, 푘), 퐶푘, 푛퐶푘, 퐶푘 , 퐶푛 , 퐶푛,푘.

Binomial Coefficients | 3

푟 For a nonzero 푟 ∈ ℝ and a positive integer 푘, the binomial coefficient (푘) is the coefficient of 푥푘 in the power series representation of (1 + 푥)푟:

∞ 푟 (1 + 푥)푟 = ∑ ( ) 푥푘 푘 푘=0 where |푥| < 1.

푟 푟−푘 푟 ∞ Since the 푘-th derivative of (1 + 푥) is 푟(푟 − 1) ⋯ (푟 − 푘 + 1)(1 + 푥) , (1 + 푥) = ∑푘=0 푟(푟 − 푥푘 1) ⋯ (푟 − 푘 + 1) and consequently 푘!

푟 푟푘 푟(푟 − 1) ⋯ (푟 − 푘 + 1) ( ) = = . 푘 푘! 푘!

푟 0 By convention we take (0) = 1 for any 푟 ∈ ℝ and (푘) = 0 for any positive integer 푘.

Example 1. 푟 a) (1) = 푟,

푟(푟−1) b) (푟) = , 2 2

5⋅4⋅3 c) (5) = = 10, 3 6

1 1 1 1 2푘−3 (−1)푘−1 (2푘−2)! (−1)푘−1 (2푘−2)! (−1)푘−1 d) (2) = ( ) (− ) ⋯ (− ) = ⋅ = ⋅ = ⋅ 푘 푘! 2 2 2 2푘푘! 2⋅4⋯(2푘−2) 22푘−1푘! (푘−1)! 22푘−1푘

2푘−2 ( 푘−1 ),

(−3)(−4)(−5)(−6) e) (−3) = = 15. 4 4!

B I NO M IA L COEFFICIENTS AND NUM B E R O F S UBSETS

푛 If 푛 is a positive integer and 푘 ≤ 푛, then the expression for (푘) can be written as

푛 푛(푛 − 1) ⋯ (푛 − 푘 + 1) (푛 − 푘)! 푛! ( ) = ⋅ = . 푘 푘! (푛 − 푘)! 푘! (푛 − 푘)!

+ 푛 It is seen that for 푛 ∈ ℤ and 푘 ≤ 푛, the binomial coefficient (푘) agrees with 퐶(푛, 푘), the number of 푘-subsets of an 푛-set. For this reason, in some sources binomial coefficients are defined to be 푛 the number of 푘-subsets and the notation (푘) is used to mean 퐶(푛, 푘).

4 | Binomial Coefficients

푛 (푘) and 퐶(푛, 푘) are two functions which act with the same rule on different domains. In fact 푛 퐶(푛, 푘) is a restriction of the function (푘) to a smaller set. It follows then, a property or identity 푛 proved to be true for (푘) is necessarily true for 퐶(푛, 푘). But a proof given for some property of 푛 퐶(푛, 푘) is required to be extended to (푘), by checking whether the property is valid for non-integer values of 푛.

Combinatorial Proofs and Polynomial Argument

In dealing with counting issues, there are two common classes of proofs: algebraic proofs and combinatorial proofs. An algebraic proof of a property is achieved by transforming the expres- sions with the aid of substitutions and arithmetic operations. A combinatorial proof (or bijective proof or double counting) is achieved by showing that both sides of the equality count the same thing. In general, a combinatorial proof considers integer arguments whereas an algebraic proof respects all possible points in the domain.

푛 A property of 퐶(푛, 푘) which is proved to be true algebraically, holds for (푘) (푛 no more re- stricted to integers) as well. If a property is proved combinatorically to be true for 퐶(푛, 푘), in order 푛 to extend it to (푘), we commonly use an important propery which is known as the polynomial argument. This argument goes like that: if two polynomials of degree at most 푑 agree at 푑 + 1 distinct points, then they agree everywhere. It follows that if an equality, whose both sides are polynomials, is proved to be true by a combinatorial proof, then by polynomial argument it holds everywhere.

푛! 푛! For example, from the expressions 퐶(푛, 푘) = and 퐶(푛, 푛 − 푘) = it follows that 푘!(푛−푘)! (푛−푘)!푘! 푛 푛 퐶(푛, 푘) = 퐶(푛, 푛 − 푘). This is an algebraic proof which automatically covers the case (푘) = (푛−푘) as well. On the other hand, we can say that 퐶(푛, 푘) counts all subsets with 푘 elements and 퐶(푛, 푛 − 푘) counts complements of these subsets. Since each subset has a unique complement, 퐶(푛, 푘) = 퐶(푛 − 푘). This is a combinatorial proof and it guarantees the equality only to hold only for integer 푛 푛 values of 푛, thus it does not directly implies that (푘) = (푛−푘). But, 퐶(푛, 푘) are 퐶(푛, 푛 − 푘) are both polynomial expressions which agree on integers, then by polynomial argument they agree every- 푟 푟 where, thus (푘) = (푟−푘) for any 푟 ∈ ℝ.

For integers 푛 and 푘, if we set 퐶(푛, 푘) = 0 for 푘 < 0 or 푘 > 푛, then the binomial theorem 푛 푛 푛 푘 푛−푘 (푎 + 푏) = ∑푘=0(푘)푎 푏 where 푎, 푏 ∈ ℝ can be written as

∞ (푎 + 푏)푛 = ∑ 퐶(푛, 푘) 푎푘푏푛−푘. 푘=0

Binomial Coefficients | 5

LEMMA 1.1. For any real number 푟 and a nonnegative integer 푘, −푟 푟 + 푘 − 1 ( ) = (−1)푘 ( ). 푘 푘

Proof. A straightforward computation yields −푟 1 ( ) = ⋅ (−푟)(−푟 − 1) ⋯ (−푟 − 푘 + 1) 푘 푘! 1 = (−1)푘 (푟 + 푘 − 1) ⋯ (푟 + 1)푟 푘! which gives the desired result. ∎

The property

푟 −푟 + 푘 − 1 (1) ( ) = (−1)푘 ( ) 푘 푘

is known as upper negation.

We observe an interesting between the binomial ceofficients and the number of 푘-

푛+푘−1 subsets. For a set with 푛 elements, recall that ( 푘 ) is the number of ways of choosing 푘 ele-

( )푘 −푛 푛 ments of 푋 if repetitions are allowed. Then we see that −1 ( 푘 ) and (푘) denote respectively, the number of ways of choosing 푘 elements if repetitions are allowed and not allowed, respec- tively.

−푟 ( )푘 푟+푘−1 Using the identity ( 푘 ) = −1 ( 푘 ), for any 푟 ∈ ℝ, we obtain the power series represen-

1 tation of as (1−푥)푟

1 = (1 − 푥)−푟 (1 − 푥)푟 ∞ −푟 = ∑ ( ) (−푥)푘 푘=0 푘 ∞ 푟 + 푘 − 1 = ∑ ( ) 푥푘. 푘=0 푘

6 | Binomial Coefficients

푥푛 It follows that = ∑∞ (푛+푘)푥푘+푛. Since (푛+푘) = (푛+푘) and (푚) = 0 for integers (1−푥)푛+1 푘=0 푘 푘 푛 푛

푥푛 푚 < 푛, we can write the power series representation of as (1−푥)푛+1

∞ 푥푛 푘 = ∑ ( ) 푥푘. (2) (1 − 푥)푛+1 푛 푘=0

B A S I C P ROPERTIES

Let 푋 be set with 푛 elements. It has only one subset which contains no elements, namely the and it has only one subset which has 푛 elements, the set 푋 itself. This means that 퐶(푛, 1) = 퐶(푛, 푛)=1 and by polynomial argument 푟 푟 ( ) = ( ) = 1, 푟 ∈ ℝ. 0 푟

For each element 푥, 푋 has a unique subset with one element (the subset which includes only 푥) and a unique subset with 푛 − 1 (the subset which excludes only 푥). Then 퐶(푛, 1) = 퐶(푛, 푛 − 1) = 푛 and by polynomial argument 푟 푟 ( ) = ( ) = 푟, 푟 ∈ ℝ. 1 푟 − 1

퐶(푛, 푘) and 퐶(푛, 푛 − 푘) count respectively, the subset with 푘 elements and subset 푛 − 푘 ele- ments. If we associate each subset with its complement, to each subset with 푘 elements there cor- responds a unique subset with 푛 − 푘 elements. Then 퐶(푛, 푘) = 퐶(푛, 푛 − 푘) and by polynomial ar- gument 푟 푟 ( ) = ( ) , 푟 ∈ ℝ, 푘 ∈ ℕ . 푘 푟 − 푘 0

푛 From the definition it follows that if 푛 is a positive integer and 푘 > 푛, then (푘) = 0. That is 푟 ( ) = 0, 푟, 푘 ∈ ℕ , 푘 > 푟. 푘 0

푟 By convention we may define the binomial coefficient (푘) for negative integer 푘 by setting 푟 (푘) = 0: 푟 ( ) = 0, 푟 ∈ ℝ, 푘 ∈ ℕ−. 푘

The following theorem gathers the identities which are useful in computations which involve binomial coefficients.

Binomial Coefficients | 7

THEOREM 1.2. Let 푟 be a real number, 푘 and 푚 are nonnegative integers. We have the following identities.

푟 푟 푟 − 1 ( ) = ( ), (3) 푘 푟 − 푘 푘

푟 푟 푟 − 1 ( ) = ( ), (4) 푘 푘 푘 − 1

푟 푟 − 푘 + 1 푟 ( ) = ( ), (5) 푘 푘 푘 − 1

푟 − 1 푟 − 1 푟 − 2푘 푟 ( ) − ( ) = ( ), (6) 푘 푘 − 1 푟 푘

푟 − 1 푟 − 1 푟 ( ) + ( ) = ( ), (7) 푘 푘 − 1 푘

푟 푟 − 푚 푟 푟 − 푘 ( ) ( ) = ( ) ( ), (8) 푚 푘 푘 푚

푟 푚 푟 푟 − 푘 ( ) ( ) = ( ) ( ). (9) 푚 푘 푘 푚 − 푘

Proof. All the identities can be obtained by simple algebraic manipulations. Identities (3), (4) and (5) are obtained by quite similar steps:

푟 푟! 푟 (푟 − 1)! 푟 푟 − 1 ( ) = = ⋅ = ( ) , 푘 푘! (푟 − 푘)! 푟 − 푘 푘! (푟 − 푘 − 1)! 푟 − 푘 푘 푟 푟! 푟 (푟 − 1)! 푟 푟 − 1 ( ) = = ⋅ = ( ) , 푘 푘! (푟 − 푘)! 푘 (푘 − 1)! (푟 − 푘)! 푘 푘 − 1 푟 푟! 푟 − 푘 + 1 푟! 푟 − 푘 + 1 푟 ( ) = = ⋅ = ( ). 푘 푘! (푟 − 푘)! 푘 (푘 − 1)! (푟 − 푘 + 1)! 푘 푘 − 1

The difference and sum of (3) and (4) give the identities (6) and (7):

푟 − 1 푟 − 1 푟 − 푘 푘 푟 푟 − 2푘 푟 ( ) − ( ) = ( − ) ( ) = ( ) 푘 푘 − 1 푟 푟 푘 푟 푘 푟 − 1 푟 − 1 푟 ( ) + ( ) = ( ). 푘 푘 − 1 푘

(8) is obtained as follows:

푟 푟 − 푚 푟! (푟 − 푚)! ( ) ( ) = ⋅ 푚 푘 푚! (푟 − 푚)! 푘! (푟 − 푚 − 푘)!

8 | Binomial Coefficients

푟! (푟 − 푘)! = ⋅ 푘! (푟 − 푘)! 푚! (푟 − 푘 − 푚!) 푟 푟 − 푘 = ( ) ( ). 푘 푚

(9) can be proved as

푟 푚 푟! 푚! ( ) ( ) = ⋅ 푚 푘 푚! (푟 − 푚)! 푘! (푚 − 푘)! 푟! (푟 − 푘)! = ⋅ 푘! (푟 − 푘)! (푟 − 푚)! (푚 − 푘)! 푟 푟 − 푘 = ( ) ( ). 푘 푚 − 푘

which is the desired result. ∎

Identity (4) is known as absorption property. Now we provide a combinatorial proof for this identity. First express (4) as

푟 푟 − 1 푘 ( ) = 푟 ( ). 푘 푘 − 1

The left hand side counts the number of pairs (푥, 푆), where 푆 ⊂ {1,2, … , 푟} with 푘 elements and

푟 푥 ∈ 푆. There are (푘) choices for 푆, and for each of these there are 푘 choices for 푥. The right hand side counts the same thing in a different order. First choose 푥 (there are 푟 choices) and then

푟−1 choose the other 푘 − 1 elements among the remainig 푟 − 1 elements there are (푘−1) choices.

A combinatorial proof of identity (9) is as follows. In a group of 푛 students, just 푚 students are wearing hats and exactly 푘 of these students have ribbons wrapped around their hats. Now consider the identitiy

푟 푚 푟 푟 − 푘 ( ) ( ) = ( ) ( ). 푚 푘 푘 푚 − 푘

The left hand side counts the ways of first choosing 푚 students to wear the hats and then choosing 푘 of these, to wrap ribbons around their hats. Right hand side counts the ways of first choosing 푘 students to wear hats with ribbons and then choose 푚 − 푘 students out of remaining 푟 − 푘 students to wear hats without ribbons.

Binomial Coefficients | 9

P ASCAL ’ S I DENTITY AND P ASCAL ’ S T RIANGLE

Identity (7) is particularly important and is known as Pascal’s1 identity. In this section we examine this identity in more details and we give a combinatorial proof for it.

Pascal's Identity is a useful theorem of combinatorics which is often used to simplify compli- cated expressions involving binomial coefficients. For a selection of 푘 ≥ 1 objects from the set {1,2, … , 푛} there are two choices. The selection contains 푛 or does not contain it. A selection not containing 푛 has to be composed of the remaining 푛 − 1 elements thus, it can be composed in 퐶(푛 − 1, 푘) different ways. If the selection contains 푛, then we have to choose the remaining 푘 − 1 elements out of 푛 − 1 elements and for this choice we have 퐶(푛 − 1, 푘 − 1) possibilities. Then we conclude 퐶(푛, 푘) = 퐶(푛 − 1, 푘) + 퐶(푛 − 1, 푘 − 1), and by polynomial argument 푛 푛 − 1 푛 − 1 ( ) = ( ) + ( ). 푘 푘 − 1 푘

Naturally, the identity makes sense for 1 ≤ 푘 < 푛. It is seen that Pascal’s identity is also the 0 basic for the binomial coefficients. Starting with the initial condition (0) = 0, this iden- tity enables us to compute all binomial coefficients recursively. Pascal’s triangle2 is a way of listing binomial coefficients as below:

0 ( ) 0 1 1 ( ) ( ) 0 1 2 2 2 ( ) ( ) ( ) 0 1 2 3 3 3 3 ( ) ( ) ( ) ( ) 0 1 2 3 4 4 4 4 4 ( ) ( ) ( ) ( ) ( ) 0 1 2 3 4 5 5 5 5 5 5 ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 3 4 5 6 6 6 6 6 6 6 ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 3 4 5 6 7 7 7 7 7 7 7 7 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 3 4 5 6 7 8

1 Blaise Pascal (1623-1662), French mathematician, physicist, writer and philosopher. 2 Pascal’s identity and triangle were known long before Pascal by Chinese scholar Jia Xian, six hundred years before Pascal. Work of Jia Xian has passed us by Yang Hui (1238-1298). In Iran the triangle is known as the Hayyam triangle, named after Ömer Hayyam (1048-1131).

10 | Binomial Coefficients

Pascal’s identity implies that each term of the array (except the rightmost and leftmost terms at each row) is equal to the sum of two terms in the row above which lie above-left and above- right. A simple construction of the triangle proceeds in the following manner. In row 0, the top- 0 most row, the entry is 1 (that is, (0)). Then, to construct the elements of the following rows, the 푛 푛 elemets at leftmost or rightmost columns are always 1 ((0) and (0)). For the remaining terms, add the number above-left with the number above-the right of the given position. First 8 rows of the Pascal’s triangle is shown below.

1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1

Sums of Row, Column and Diagonal Entries

푛 Row 푛 of Pascal’s triangle consists of the terms (푘), 푘 = 0, … , 푛. Consequently, the sum of all 푛 푛 terms in a row is the number of all subsets of a set with 푛 terms, that is ∑푘=0 퐶(푛, 푘) = 2 . Since 푟 푟 푟 the right hand side is not a polynomial we can not directly write ∑푘=0(푘) = 2 . But, using the 푟 ∞ 푟 푘 푟 power series expansion (1 + 푥) = ∑푘=0(푘) 푥 of (1 + 푥) with 푥 = 1 we get

∞ 푟 ∑ ( ) = 2푟. (10) 푘 푘=0

In Pascal’s triangle we consider some particular sequences

푘 푘+1 푘+2 푘-th column: (푘), ( 푘 ), ( 푘 ), …

푘 푘+1 푘+2 푘-th NW-SE diagonal: (0), ( 1 ), ( 2 ), …

푛 푛−푘 푚 푛/2 푛-th NE-SW diagonal: (0), … , ( 푘 ), … , ( 푡 ) (the last term is (푛/2) if 푛 is even;

(푛+1)/2 ((푛−1)/2) otherwise).

Binomial Coefficients | 11

푘 푘 Observe that the identity (푖 ) = (푘−푖) implies that the 푘-th column and 푘-th NW diagonal are composed of equal terms.

When we arrange Pascal’s triangle in the following manner, it is more clear to understand why 푘 푘+1 푘+2 the sequence (푘), ( 푘 ), ( 푘 ), … is called the 푘-th column.

0 0 0 ( ) ( ) ( ) 0 0 0 1 1 1 1 1 1 ( ) ( ) ( ) ( ) ( ) ( ) 0 1 0 1 0 1 2 2 2 2 2 2 2 2 2 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 0 1 2 0 1 2 3 3 3 ퟑ ퟑ 3 3 3 3 3 3 3 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ ퟎ 1 2 3 0 1 2 3 4 4 4 ퟒ 4 4 ퟒ 4 4 4 4 4 4 4 ퟒ ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 0 ퟏ 2 3 4 0 1 2 3 ퟒ 5 5 5 ퟓ 5 5 5 5 ퟓ 5 5 5 5 5 5 ퟓ 5 5 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 0 1 ퟐ 3 4 5 0 1 2 ퟑ 4 5 6 6 6 ퟔ 6 6 6 6 6 6 ퟔ 6 6 6 6 6 ퟔ 6 6 6 6 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 6 0 1 2 ퟑ 4 5 6 0 1 ퟐ 3 4 5 6 7 7 7 ퟕ 7 7 7 7 7 7 7 7 ퟕ 7 7 7 7 ퟕ 7 7 7 7 7 7 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 6 7 0 1 2 3 ퟒ 5 6 7 0 ퟏ 2 3 4 5 6 7 8 8 8 ퟖ 8 8 8 8 8 8 8 8 8 8 ퟖ 8 8 8 ퟖ 8 8 8 8 8 8 8 8 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 6 7 8 0 1 2 3 4 ퟓ 6 7 8 ퟎ 1 2 3 4 5 6 7 8

0 0 0 ( ) ( ) ( ) 0 0 0 1 1 1 1 1 1 ( ) ( ) ( ) ( ) ( ) ( ) 0 1 0 1 0 1 2 2 2 2 2 2 2 2 2 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 0 1 2 0 1 2 3 3 3 ퟑ ퟑ 3 3 3 3 3 3 3 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ ퟎ 1 2 3 0 1 2 3 4 4 4 ퟒ 4 4 ퟒ 4 4 4 4 4 4 4 ퟒ ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 0 ퟏ 2 3 4 0 1 2 3 ퟒ 5 5 5 ퟓ 5 5 5 5 ퟓ 5 5 5 5 5 5 ퟓ 5 5 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 0 1 ퟐ 3 4 5 0 1 2 ퟑ 4 5 6 6 6 ퟔ 6 6 6 6 6 6 ퟔ 6 6 6 6 6 ퟔ 6 6 6 6 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 6 0 1 2 ퟑ 4 5 6 0 1 ퟐ 3 4 5 6 7 7 7 ퟕ 7 7 7 7 7 7 7 7 ퟕ 7 7 7 7 ퟕ 7 7 7 7 7 7 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 6 7 0 1 2 3 ퟒ 5 6 7 0 ퟏ 2 3 4 5 6 7 8 8 8 ퟖ 8 8 8 8 8 8 8 8 8 8 ퟖ 8 8 8 ퟖ 8 8 8 8 8 8 8 8 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) 0 1 2 ퟑ 4 5 6 7 8 0 1 2 3 4 ퟓ 6 7 8 ퟎ 1 2 3 4 5 6 7 8

rd rd th 3 column 3 NW-SE diagonal 8 NE-SW diagonal

The following theorem gives the sum of first 푘 terms of the 푛 −th column.

THEOREM 1.3 (Upper Summation Formula). For any nonnegative integers 푛 and 푘, the sum 푛+1 of first 푛 terms of the 푘-th column is (푘+1): 푛 푖 푛 + 1 ∑ ( ) = ( ). (11) 푘 푘 + 1 푖=0

0 1 푘−1 푘 푘+1 푘+2 Proof. Since (푘) + (푘) + ⋯ + ( 푘 ) = 0, we have to compute the sum (푘) + ( 푘 ) + ( 푘 ) + 푛−1 푛 푘 푘+1 ⋯ + ( 푘 ) + (푘). Replace (푘) with (푘+1). Then, by Pascal’s identity, the sum of first two terms is 푘+2 푘+3 (푘+1). Now the sum of first two terms of the resulting sequence is (푘+1). Continuing in this manner 푛+1 we reach the sum (푘+1).

12 | Binomial Coefficients

An illustration of the proof is:

푘 + 1 푘 + 1 푘 + 2 푘 + 3 푘 + 푛 − 1 푘 + 푛 ( ) + ( ) + ( ) + ( ) + ⋯ + ( ) + ( ). ⏟푘 + 1 푘 푘 푘 푘 푘 푘+2 ⏟ ( 푘+ 1 ) 푘+3 ⏟ ( 푘+ 1 ) 푘+4 ⏟ ( 푘+ 1 ) ⏟ ⋱ 푛 ⏟ ( 푘+ 1 ) 푛+1 (푘+1)

푛+1 Eventually (푘+1) is obtained. ∎

Combinatorial Proof. The number of ways of distributing 푚 candies to 푘 + 1 children is

푚+푘 ( 푘 ). Now consider the problem of distributing at most 푚 candies to 푘 + 1 children. This means that we distribute 0 or 1 or 2 … or 푚 candies. Then the number of ways of distributing candies is

푘 푘+1 푚+푘 푚+푘 푖 (푘) + ( 푘 ) + ⋯ + ( 푘 ) = ∑푖=푘 (푘). On the other hand, when we distribute some of the candies, say 푡 ≤ 푚 candies, to 푘 + 1 children, there are 푚 − 푡 candies left. Then we can consider a ‘푘 + 2’nd child who is taking the remaining candies. So the number of ways of distributing some of 푚 candies to 푘 + 1 children is same with the number of distributing all of 푚 candies to 푘 + 2 children which

풎+풌+ퟏ is given by ( 풌+ퟏ ). Then we conclude

푚+푘 푖 푚 + 푘 + 1 ∑ ( ) = ( ) 푘 푘 + 1 푖=푘

which gives the equality (11) after the substitution 푛 = 푚 + 푘. ∎

COROLLARY 1.4 (Parallel Summation Formula). For nonnegative integers 푛 and 푘, the sum of 푛+1 first 푛 terms of the 푘-th NW-SE diagonal is (푘+1):

푛 푘 + 푖 푛 + 1 ∑ ( ) = ( ). (12) 푖 푘 + 1 푖=0

푘+푖 푘+푖 Proof. Since( 푖 ) = ( 푘 ), result follows directly from the previous theorem. ∎

Denote the sum of 푛-th NE-SW diagonal entries by 푆푛

0 For n=0 we have 푆0 = (0) = 1

1 For 푛 = 1 푆1 = (0) = 1

Binomial Coefficients | 13

2 1 For 푛 = 2 푆2 = (0) + (0) = 2

3 2 For 푛 = 3 푆3 = (0) + (1) = 3

4 3 2 For 푛 = 4 푆4 = (0) + (1) + (2) = 5

First terms of the sequence {푆푛} are 1,1,2,3,5, …. This resembles the Fibonacci sequence {픣푛} = 0, 1, 1, 2, 3, 5, … each of whose terms, starting from the third, is the sum of preceding two terms.

THEOREM 1.5. The sum of 푛-th NE-SW diagonal entries is the 픣푛+1.

Proof. From the computations above we have 푆0 = 픣1, 푆1 = 픣2. Now it is sufficient to show that the terms of the sequence {푆푛} satisfy the recursion 푆푛 = 푆푛−1 + 푆푛−2 for any integer 푛 ≥ 3. We have

⌊푛⁄2⌋ 푛 − 푘 푆 = ∑ ( ) 푛 푘 푘=0 ⌊푛⁄2⌋ ⌊푛⁄2⌋ 푛 − 푘 − 1 푛 − 푘 − 1 = 1 + ∑ ( ) + ∑ ( ) 푘 푘 − 1 푘=1 푘=1 ⌊푛⁄2⌋ ⌊푛⁄2⌋ 푛 − 푘 − 1 푛 − 푘 − 2 = ∑ ( ) + ∑ ( ) 푘 푘 푘=0 푘=0

= 푆푛−1 + 푆푛−2 which proves the assertion. ∎

F I N I T E S U M S I N V O L V I N G B I N O M I A L C OEFFICIENTS

In the previous section we have shown that the sum of the 푛 th row terms of Pascal’s triangle 푛 ∑푛 푛 푛 is 2 , namely 푘=0(푘) = 2 . Unfortunately, we do not have any closed form to express the partial sum

푚 푛 ∑ ( ). 푘 푘=0

∑푛 ( )푘 푛 Now consider the alternating sum 푘=0 −1 (푘). Let 푛 > 0, then by substituting 푥 = 1 in ( )푛 ∑푛 ( )푘 푛 푘 1 − 푥 = 푘=0 −1 (푘) 푥 , we immediately have

푛 푛 ∑(−1)푘 ( ) = 0. (13) 푘 푘=0

14 | Binomial Coefficients

Since (−1)푘 = 1 for even 푘 and (−1)푘 = −1 for odd 푘, if 푛 > 0, then (13) can be written as ∑푛 푛 ∑푛 푛 푘 even(푘) − 푘 odd(푘) = 0.

∑푛 푛 ∑푛 푛 푛−1 Then 푘 even(푘) = 푘 odd(푘) = 2 or

푛 푛 ∑ ( ) = 2푛−1 2푘 푘=0 and

푛 푛 ∑ ( ) = 2푛−1 2푘 + 1 푘=0 which means that, for any nonempty set, the number of subsets with an odd number of elements is equal to the number of subsets with an even number of elements.

Moreover, for the partial sums we have:

푚 푛 푛 − 1 ∑(−1)푘 ( ) = (−1)푚 ( ). 푘 푚 푘=0

The equality for partial sums can be obtained as follows:

푚 푚 푚 푛 푛 − 1 푛 − 1 ∑(−1)푘 ( ) = 1 + ∑(−1)푘 ( ) + ∑(−1)푘 ( ) 푘 푘 푘 − 1 푘=0 푘=1 푘=1 푚−1 푚−1 푛 − 1 푛 − 1 푛 − 1 = ∑ (−1)푘 ( ) + (−1)푚 ( ) − ∑ (−1)푘 ( ) 푘 푚 푘 푘=0 푘=0 푛 − 1 = (−1)푚 ( ). 푚

( )푛 ∑푛 푛 푘 The binomial formula 1 + 푥 = 푘=0(푘) 푥 is very useful to obtain interesting identities. 푛−1 푛 푛 푘−1 For example, differentiating both sides we have 푛(1 + 푥) = ∑푘=0 푘(푘) 푥 . By substituting 푥 = 1 we get

푛 푛 ∑ 푘 ( ) = 푛2푛−1. (14) 푘 푘=0

Now we provide a combinatorial proof of (14). In a class with 푛 students we wish to choose a committee and a chairperson for that committee. Right hand side counts the number of ways of choosing the chairman (푛 ways) and then among the remaining 푛 − 1 students, choosing other members of the committee consisting of any number of members, probably empty (2푛−1 ways).

Binomial Coefficients | 15

푛 Left hand side counts the number of ways of first choosing some committee of 푘 members ((푘) ways) then among choosing a chairperson among them (푘 ways). As 푘 may take any value, 푘 = 0, … , 푛, by summation we obtain the equality.

푛 It should be noted that, a set with 푛 elements has (푘) subsets ech of which contains 푘 elements. 푛 Then the total number of elements in these subsets is 푘(푘). This observation leads us to an inter- pretation of (14). The sum on the left hand side is the total number of all elements in all subsets of the set. On the other hand, each particular element of the set appears in exactly 2푛−1 subsets. It follows that the total number of all elements in all subsets is 푛2푛−1 which is the right hand side.

푛 Since the set has 2푛 subsets, the average number of elements of a subset is . 2

Differentiating both sides of the binomial formula once more we get

푛 푛 푛(푛 − 1)(1 + 푥)푛−2 = ∑ 푘(푘 − 1) ( ) 푥푘−2 푘 푘=0

푛 2 푛 푛−2 which gives the identity ∑푘=0(푘 − 푘)(푘) = 푛(푛 − 1)2 for 푥 = 1 . Then we have

푛 푛 ∑ 푘2 ( ) = 푛(푛 + 1)2푛−2. (15) 푘 푘=0

Now for arbitrary 푟, 푠 ∈ ℝ we write

∞ 푟 ∑ ( ) 푥푚 = (1 + 푥)푟 푚 푚=0 = (1 + 푥)푠(1 + 푥)푟−푠

∞ ∞ 푠 푟 − 푠 = (∑ ( ) 푥푛) (∑ ( ) 푥푗) 푛 푗 푛=0 푗=0 ∞ ∞ 푠 푟 − 푠 = ∑ ∑ ( ) ( ) 푥푛+푗 푛 푗 푛=0 푗=0 ∞ 푚 푠 푟 − 푠 = ∑ (∑ ( ) ( )) 푥푚. 푘 푚 − 푘 푚=0 푘=0

Comparing the coefficients of 푥푚 we obtain the identity which is called Vandermonde’s con- volution:

푚 푠 푟 − 푠 푟 ∑ ( ) ( ) = ( ). (16) 푘 푚 − 푘 푚 푘=0

16 | Binomial Coefficients

For a combinatorial proof of this equality, notice that the right hand side counts the number of ways to choose a group of 푚 students from a class of 푟 students. Assume that there are 푠 ≥ 푚 girls and 푟 − 푠 boys at the class. The left hand side counts the same thing according to cases de- pending on the number of girls 푖 on the committee, which can range from 0 to 푚. Since in such a 푠 푟−푠 case, there are (푘) ways to select the girls and (푚−푘) ways to select the boys, the number of such 푠 푟−푠 committees is (푘)(푚−푘). Now the result follows.

When 푠 = 1 Vandermonde’s convolution gives Pascal’s identity in the form

푟 푟 − 1 푟 − 1 ( ) = ( ) + ( ). 푘 푘 푘 − 1

For 푠 = 2 we obtain the identity

푟 푟 − 2 푟 − 2 푟 − 2 ( ) = ( ) + 2 ( ) + ( ). 푘 푘 푘 − 1 푘 − 2

In Vandernomnde’s convolution, by taking 푟 = 2푛 and 푠 = 푚 = 푛, for a positive integer 푛 we obtain 푛 푛 2 2푛 ∑ ( ) = ( ). 푘 푛 (17) 푘=0

Now let 푛, 푘 be positive integers. Using (2) we write

∞ 푖 푥푘+1 ∑ ( ) 푥푖 = 푘 + 1 (1 − 푥)푘+2 푖=0 푥푗 푥푘−푗 = 푥 ( ) ( ) (1 − 푥)푗+1 (1 − 푥)푘−푗+1

∞ ∞ 푎 푏 = 푥 (∑ ( ) 푥푎) (∑ ( ) 푥푏) 푗 푘 − 푗 푎=0 푏=0 ∞ ∞ 푎 푏 = ∑ ∑ ( ) ( ) 푥푎+푏+1 푗 푘 − 푗 푎=0 푏=0 ∞ 푛 푚 푖 − 푚 = ∑ ( ∑ ( ) ( )) 푥푖+1 . 푗 푘 − 푗 푖=0 푚=0

By comparing the coefficients of 푥푛+1 we obtain

푛 푚 푛 − 푚 푛 + 1 ∑ ( ) ( ) = ( ). (18) 푗 푘 − 푗 푘 + 1 푚=0

∑푛 푚 푛+1 Note that, taking 푗 = 푘 in (18) gives (11) in the form 푚=0( 푘 ) = (푘+1).

Binomial Coefficients | 17

To obtain a generalization of (14), we apply the binomial formula to (2 + 푥)푛 in two different ways:

푛 (2 + 푥)푛 = (1 + (1 + 푥))

푛 푛 = ∑ ( ) (1 + 푥)푘 푘 푘=0

푛 푘 푛 푘 = ∑ ( ) ∑ ( ) 푥푖 푘 푖 푘=0 푖=0

푛 푘 푛 푘 = ∑ ∑ ( ) ( ) 푥푖 푘 푖 푘=0 푖=0 푛 푛 푛 푘 = ∑ ∑ ( ) ( ) 푥푖 푘 푖 푖=0 푘=푖

and

푛 푛 (2 + 푥)푛 = ∑ ( ) 2푛−푖푥푖. 푖 푖=0

By comparing the coefficients of 푥푖 in these expressions, we have

푛 푛 푘 푛 ∑ ( ) ( ) = ( ) 2푛−푖 (19) 푘 푖 푖 푘=푖

for any nonnegative integers 푛 and 푖. By substitutions 푖 = 푛 − 푚, and 푘 = 푛 − 푖 the identity

푛 푛 푛−푖 푛 푚 (19) gives ∑푖=0(푖 )(푛−푚) = (푚)2 which can be rearranged to write

푛 푛 푛 − 푘 푛 ∑ ( ) ( ) = ( ) 2푚. (19’) 푘 푚 − 푘 푚 푘=0

To have a combinatorial proof of this equality, we generalize the idea which is followed for the identity (14). Now our model is to choose a committee and 푖 distinguished members of this com- mittee. Rest of the proof is similar to that of (14).

18 | Binomial Coefficients

B I N O M I A L I N V E R S I O N F ORMULA

In this section we develop a technique, known as binomial inversion which has many interesting applications .

LEMMA 1.6. If 푛 and 푚 ≤ 푛 are positive integers, then

푛 푛 푘 ∑(−1)푘 ( ) ( ) = (−1)푚훿푛 . 푘 푚 푚 푘=0

Proof.

푛 푥푛 = (1 + (푥 − 1)) 푛 푛 = ∑ ( ) (푥 − 1)푘 푘 푘=0 푛 푘 푛 푘 = ∑ ( ) ∑ ( ) (−1)푘−푚푥푚 푘 푚 푘=0 푚=0 푛 푘 푛 푘 = ∑ ∑ (−1)푘−푚 ( ) ( ) 푥푚 푘 푚 푘=0 푚=0 푛 푛 푛 푘 = ∑ ( ∑ (−1)푘−푚 ( ) ( )) 푥푚. 푘 푚 푚=0 푘=푚

Comparing the coefficients of 푥푚 claim follows. ∎

The transform of a given a sequence {푓푛}, under binomial inversion is the sequence {푔푛} with

푛 푛 푔 = ∑(−1)푘 ( ) 푓 . 푛 푘 푘 푘=0

THEOREM 1.7 (Binomial Inversion Formula). The transform under binomial inversion is an involution.That is, if {푓푛} and {푔푛} are sequences such that

푛 푛 푔 = ∑(−1)푘 ( ) 푓 , 푛 푘 푘 푘=0

then

푛 푛 푓 = ∑(−1)푘 ( ) 푔 . 푛 푘 푘 푘=0

Binomial Coefficients | 19

Proof. We simply compute the transform of {푔푛}:

푛 푛 푘 푛 푛 푘 ∑(−1)푘 ( ) 푔 = ∑(−1)푘 ( ) ∑(−1)푖 ( ) 푓 푘 푘 푘 푖 푖 푘=0 푘=0 푖=0 푛 푘 푛 푘 = ∑(−1)푘 ∑(−1)푖 ( ) ( ) 푓 푘 푖 푖 푘=0 푖=0 푛 푛 푛 푘 = ∑(−1)푖푓 ∑(−1)푘 ( ) ( ) 푖 푘 푖 푖=0 푘=푖 푛 푛 = ∑ 푓푖훿푖 푖=0

The last term we have obtained is 푓푛. ∎

If {푔푛} is the transform of {푓푛}, we call these sequences a binomial inversion pair. An alternative version of the theorem is as follows.

THEOREM 1.8. If {푓푛} and {푔푛} are sequences such that

푛 푛 푔 = ∑ ( ) 푓 , 푛 푘 푘 푘=0

then

푛 푛 푓 = ∑(−1)푛−푘 ( ) 푔 . ∎ 푛 푘 푘 푘=0

Example 2. If we let {푓푛} to be the constant sequence 푓푛 = 1 for 푛 = 0,1, …, then

푛 푛 푛 푛 ∑ ( ) 푓 = ∑ ( ) = 2푛 = 푔 . 푘 푘 푘 푛 푘=0 푘=0

By binomial inversion we have 푛 푛 푛 푛 ∑(−1)푛−푘2푘 ( ) = ∑(−1)푛−푘 ( ) 푔 = 푓 푘 푘 푘 푛 푘=0 푘=0

which gives

푛 푛 ∑(−2)푘 ( ) = (−1)푛. 푘 푘=0

20 | Binomial Coefficients

Example 3. 푛 ∑푛 푛 ∑푛 푛 푘 Let 푛 and 푖 ≤ 푛 be positive integers. If 푓푛 = ( 푖 ), then 푘=0(푘)푓푘 = 푘=0(푘)( 푖 ) = 푛 푛−푖 ( 푖 )2 = 푔푛 and by binomial inversion 푛 ( ) = 푓 푖 푛 푛 푛 푘 = ∑(−1)푛−푘 ( ) ( ) 2푘−푖 푘 푖 푘=0 푛 푛 푘 = ∑(−1)푛−푘 ( ) ( ) 2푘−푖 푘 푖 푘=0 푛 푛 푘 = (−1)푛2−푖 ∑(−2)푘 ( ) ( ). 푘 푖 푘=0

So we obtain

푛 푛 푘 푛 ∑(−2)푘 ( ) ( ) = (−1)푛2푛−푖 ( ). 푘 푖 푖 푘=0

G E N E R A T I N G F UNCTIONS

푟 THEOREM 1.9. For a fixed real number 푟, of the sequence {(푘)} is

∞ 푟 ∑ ( ) 푥푘 = (1 + 푥)푟. 푘 푘=0

Proof. Assertion is just rephrasing the definition of binomial coefficients. ∎

푛 THEOREM 1.10. For a fixed nonnegative 푘, generating function of the sequence {(푘)} is

∞ 푛 푥푘 ∑ ( ) 푥푛 = . 푘 (1 − 푥)푘+1 푛=0

Proof. Assertion follows from equation (2). ∎

THEOREM 1.11. A bivariate generating function of the binomial coefficients is

∞ ∞ 푛 1 ∑ ∑ ( ) 푥푘푦푛 = . 푘 1 − 푦 − 푥푦 푛=0 푘=0

Binomial Coefficients | 21

1 Proof. Write the power series representation of : 1−푦−푥푦

∞ 1 = ∑ 푦푛(1 + 푥)푛 1 − 푦(1 + 푥) 푛=0 ∞ ∞ 푛 = ∑ 푦푛 ∑ ( ) 푥푘. 푘 푛=0 푘=0

Then, claim follows. ∎

THEOREM 1.12. A bivariate generating function of the binomial coefficients is

∞ ∞ 푛 + 푘 1 ∑ ∑ ( ) 푥푘푦푛 = . 푘 1 − 푥 − 푦 푛=0 푘=0

1 Proof. Just write the power series representation of : 1−푥−푦

∞ 1 = ∑(푥 + 푦)푛 1 − (푥 + 푦) 푛=0 ∞ ∞ 푛 = ∑ ∑ ( ) 푥푘 푦푛−푘 푘 푛=0 푘=0 ∞ ∞ 푛 + 푘 = ∑ ∑ ( ) 푥푘 푦푛. 푘 푛=0 푘=0 This completes the proof. ∎

THEOREM 1.13. The exponential bivariate generating function of the binomial coefficients is

∞ ∞ 1 푛 + 푘 ∑ ∑ ( ) 푥푘푦푛 = 푒푥+푦. (푛 + 푘)! 푘 푛=0 푘=0

Proof. Writing the power series representation of 푒푥+푦 leads the proof directly. ∎

M ULTINOMIAL C OEFFICIENTS

Binomial coefficients are generalized to multinomial coefficients as follows. For a non-nega- tive integer 푛 and non-negative integers 푘1, 푘2, … , 푘푟 such that 푘1 + 푘2 + ⋯ + 푘푟 = 푛, multinomial coefficient ( 푛 ) is 푘1,푘2,…,푘푟 푛 푛! ( ) = . 푘1, 푘2, … , 푘푟 푘1! ⋯ 푘푟!

22 | Binomial Coefficients

Note that the multinomial coefficient ( 푛 ) is the binomial coefficient ( 푛 ). It is also easy to 푘1,푘2 푘1 verify that

푛 푛 푛 − 푘 푛 − 푘 − 푘 푛 − 푘 − ⋯ − 푘 ( ) = ( ) ( 1) ( 1 2) ⋯ ( 1 푟−2). 푘1, 푘2, … , 푘푟 푘1 푘2 푘3 푘푟−1

푛 푘1 푘2 푘푟 푛 Multinomial coefficient ( ) is coefficient of 푥 푥 ⋯ 푥 in (푥1 + ⋯ + 푥푟) in 푘1,푘2,…,푘푟 1 2 푟

∞ 푛 푛 푘1 푘2 푘푟 (푥1 + 푥2 + ⋯ + 푥푟) = ∑ ( ) 푥1 푥2 ⋯ 푥푟 . 푘1, 푘2, … , 푘푟 푘1,푘2,…,푘푟=0 푘1+⋯+푘푟=푛

S O M E O T H E R P ROPERTIES

푛 - Binomial coefficient (푘), where 0 < 푘 < 푛, is divisible by a prime 푝 if and only if 푛 is a power of 푝. 푛 푛+1 푛+2 푛+푘 - Let 푘, 푚 > 1 and 푛 be nonnegtive integers. At least one of (푘), ( 푘 ), ( 푘 ), … , ( 푘 ) is not divisible by 푚. 푛 푛 푛+1 - Let 푘 and 푛 be positive integers and 푝 be a prime. If (푘−1) ∤ 푝 and (푘) ∤ 푝, then ( 푘 ) ∤ 푝, except the case, when 푛 + 1 is divisible by 푝. - Lucas Theorem. Write the positive integers 푛 and 푘 in a prime base 푝: 푑 푑−1 푛 = 푛푑푝 + 푛푑−1푝 + ⋯ + 푛1푝 + 푛0, 푑 푑−1 푘 = 푘푑푝 + 푘푑−1푝 + ⋯ + 푘1푝 + 푘0. Then 푛 푛 푛 푛 푛 ( ) ≡ ( 푑) ( 푑−1) ⋯ ( 1) ( 0) (mod 푝). 푘 푘푑 푘푑−1 푘1 푘0 - If 푛 is a positive integer and 푝 is a prime such that (푝 − 1)|푛, then 푛 푛 푛 푛 ( ) + ( ) + ( ) ⋯ + ( ) ≡ 1 (mod 푝) 푝 − 1 2(푝 − 1) 3(푝 − 1) 푛

- If 푝 ≥ 5 is a prime, then 2푝 ( ) ≡ 2 (mod 푝3), 푝 푝2 ( ) ≡ 푝 (mod 푝5), 푝 푝3 푝2 ( ) ≡ ( ) (mod 푝8). 푝2 푝

Binomial Coefficients | 23

T A B L E O F B I N O M I A L C OEFFICIENTS

n\k 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 5 10 10 5 1 6 1 6 15 20 15 6 1 7 1 7 21 35 35 21 7 1 8 1 8 28 56 70 56 28 8 1 9 1 9 36 84 126 126 84 36 9 1 10 1 10 45 120 210 252 210 120 45 10 1 11 1 11 55 165 330 462 462 330 165 55 11 1 12 1 12 66 220 495 792 924 792 495 220 66 12 1 13 1 13 78 286 715 1287 1716 1716 1287 715 286 78 13 1 14 1 14 91 364 1001 2002 3003 3432 3003 2002 1001 364 91 14 1 15 1 15 105 455 1365 3003 5005 6435 6435 5005 3003 1365 455 105 15 1 16 1 16 120 560 1820 4368 8008 11440 12870 11440 8008 4368 1820 560 120 16 1 17 1 17 136 680 2380 6188 12376 19448 24310 24310 19448 12376 6188 2380 680 136 17 1

푛 Table of binomial coefficients (푚) for 0 ≤ 푛 ≤ 17.

E XERCISES

1. Let 푛, 푚 be positive integers. Prove the following.

푛 푛 푛 푛 2 2 푛 2 2푛 − 2 a) ( ) < 푚 푛−푚, e) ∑ 푘 ( ) = 푛 ( ), 푚 푚 (푛 − 푚) 푘 푛 − 1 푛 푘=0 푘+푛 푛 푛 푛 b) ∑(−1) ( ) 푘 = 푛!, 2푘 2(푛 − 푘) 푘 f) ∑ ( ) ( ) = 4푛, 푘=0 푘 푛 − 푘 푛 푘=0 푛+1 1 푛 c) ∑(−1) ( ) = 퐻 푛−1 푘 푘 푘, 푛 − 1 (푘 + 1)! 푘=1 g) ∑ ( ) = 푛! 푘 푛푘 푛 푘=0 푛 2 푛 2푛 d) ∑ 푘 ( ) = ( ), 푘 2 푛 푘=0

2. Let 푛, 푚 be positive integers. Provide combinatorial proofs for the following identities. 2푛 푛 푛 2 푛 a) ( ) = 2 ( ) + 푛 , c) ∑ 푘3 ( ) = 푛2(푛 + 3)2푛−3, 2 2 푘 푘=1 푚 + 푛 푚 푛 푛 b) ( ) = ( ) + ( ) + 푚푛, 푛 2 2 2 d) ∑ 2푘 ( ) = 3푛. 푘 푘=0

24 | Binomial Coefficients

3. Evaluate

2푛 푛 푛 ( )푘 푛 2푛 d) ∑ ( ) 2푘−푛, a) ∑ −1 푘 ( 푘 ), 푘=0 푘=0 푘 푛 푛 푘 푛 2푘 b) ∑ (−1)푘 ( ) (1 − ), e) ∑ ( ) 4−푘, 푘=0 푘 푛 푘=0 푘

푛 3 ( )푘 푛 c) ∑ −1 (푘) , 푘=0

4. Let 퐴 be a set with 푛 elements. Show that 3푛 ∑ |푋 ∪ 푌| = , 4 푋,푌⊂𝐴 푛 ∑ |푋 ∩ 푌| = . 4 푋,푌⊂𝐴

5. Let 퐴 be a set with 푛 elements and 푋, 푌 are two arbitrary subsets with |퐴| = |퐵| = 푘 elements. Compute the expected values of |푋 ∩ 푌| and |푋 ∪ 푌|.

푎 푏 푐 6. Show that for any nonnegative integer 푛, the equation (1) + (2) + (3) = 푛 has a unique solution. 7. Show that if 8|푛, then the number of subsets of {1, … , 푛} whose number of elements is divisible by 4 is 2푛−2 + 2푛⁄2−1. Discuss the case when 8 ∤ 푛.

8. Let 푝 be a prime and 푛, 푘 nonnegative integers. Show that 푝 − 1 a) ( ) ≡ (−1)푘 (mod 푝) 푘 푝 b) ( ) ≡ 0 (mod 푝) 푘 = 1, 2, … , 푝 − 1. 푘

2푛 (푝 − 1)⁄2 푝 − 1 c) ( ) ≡ (−4)푛 ( ) (mod 푝) where 푛 ≤ . 푛 푛 2

푘 푘 ( 2 3)푛 푛 푛 9. Show that the coefficient of 푥 in 1 + 푥 + 푥 + 푥 is ∑ ( 푖 )(푘−2푖). 푖=0 10. In this question we focus on parities of binomial coefficients in Pascal’s triangle.

a) Prove that the number of odd binomial coefficients in 푛-th row of Pascal triangle is equal to 2푟, where 푟 is the number of 1’s in the binary expansion of 푛.

푘 푛 b) Prove that if 푛 = 2 − 1 for some 푘, then (푚) is odd for all 푚 = 0,1, … , 푛.

푛 푛 푛 c) Let 푛 be odd. Show that the set {(1), (2), … , (푚)} , where 푚 = (푛 − 1)/2, contains an odd number of odd integers.

d) Prove that in the first 106 rows of Pascal’s triangle, the percentage of odd coefficients is less than 1%.

푑 1 11. Let 푘 be a fixed positive integer. Show that (푥) = (푥) ∑푘−1 . 푑푥 푘 푘 푖=0 푥−푖 ( ) 푥 12. Let 푘 be a fixed positive integer. Find the local maximum value of the function 푓 푥 = (푘).

Binomial Coefficients | 25

L I S T O F B A S I C I D E N T I T I E S I N V O L V I N G B I N O M I A L C OEFFICIENTS

In the following, 푛, 푚 and ℎ are nonnegative integers, 푟 and 푠 are real numbers.

Basic Definition Row-Column-Diagonal Sums 푟 푟(푟 − 1) ⋯ (푟 − 푘 + 1) 푛 ( ) = 푛 Lower 푚 푘! ∑ ( ) = 2푛 푘 Summation 푛 푛! Factorial 푘=0 ( ) = 푚 푚! (푛 − 푚)! Expansion 푚 푛 푛 − 1 Alternating Special Values ∑(−1)푘 ( ) = (−1)푚 ( ) Lower 푘 푚 0 푘=0 Summation ( ) = 0 푚 푛 푖 푛 + 1 푟 푛 ∑ ( ) = ( ) Upper ( ) = ( ) = 1 푘 푘 + 1 Summation 0 푟 푖=0 푟 푟 ( ) = ( ) = 푟 푛 1 푟 − 1 푘 + 푖 푛 + 1 ∑ ( ) = ( ) Parallel 푟 푟 푟(푟 − 1) 푖 푘 + 1 Summation ( ) = ( ) = 푖=0 2 푟 − 2 2 ⌊푛⁄2⌋ Symmetry 푛 − 푘 ∑ ( ) = 픣 Column Sums 푟 푟 푘 푛+1 ( ) = ( ) 푘=0 푚 푛 − 푚 Finite Sums Factoring 푛 푛 푟 푟 푟 − 1 ∑ ( ) = 2푛−1 Number of ( ) = ( ) 2푘 Even Subsets 푚 푟 − 푚 푚 푘=0 푟 푟 푟 − 1 Absorption 푛 ( ) = ( ) 푛 푚 푚 푚 − 1 푚≠0 ∑ ( ) = 2푛−1 Number of 2푘 + 1 Odd Subsets 푟 푟 − 푚 + 1 푟 푘=0 ( ) = ( ) 푚≠0 푚 푚 푚 − 1 푛 푛 Basic Identities ∑ 푘 ( ) = 푛2푛−1 Sum of Subset 푟 푚 − 푟 − 1 푘 Cardinalities ( ) = (−1)푚 ( ) Upper 푘=0 Negation 푚 푚 푛 푛 푟 − 1 푟 − 1 푟 − 2푚 푟 ∑ 푘2 ( ) = 푛(푛 + 1)2푛−2 ( ) − ( ) = ( ) 푟 ≠ 0 푘 푚 푚 − 1 푟 푚 푘=0 푟 − 1 푟 − 1 푟 ( ) + ( ) = ( ) Basic Recursion Sums of Products 푚 푚 − 1 푚 Pascal’s Identity 푚 푠 푟 − 푠 푟 푟 푟 − 푚 푟 푟 − ℎ ∑ ( ) ( ) = ( ) Vandermone ( ) ( ) = ( ) ( ) 푘 푚 − 푘 푚 Convolution 푚 ℎ ℎ 푚 푘=0 푟 푚 푟 푟 − ℎ Trinomial Revision 푛 ( ) ( ) = ( ) ( ) 푛 2 2푛 푚 ℎ ℎ 푚 − ℎ ∑ ( ) = ( ) Square 푖 푛 Summation Generating Functions 푖=0 ∞ 푛 푟 푘 푟 푚 푛 − 푚 푛 + 1 ∑ ( ) 푥 = (1 + 푥) ∑ ( ) ( ) = ( ) 푘 푗 푘 − 푗 푘 + 1 푘=0 푚=0 ∞ 푘 푛 푛 푛 푥 푛 푛 − 푘 푛 ∑ ( ) 푥 = ∑ ( ) ( ) = ( ) 2푚 푘 (1 − 푥)푘+1 푘 푚 − 푘 푚 푛=0 푘=0

∞ 푛 푛 푘 푛 1 푛 푘 푛 ∑ ( ) 푥 푦 = ∑ ( ) ( ) = ( ) 2푛−푚 Subset Subset 푘 1 − 푦 − 푥푦 푘 푚 푖 Sum 푛,푘=0 푘=푖 ∞ 푛 + 푘 1 Binomial Inversion ∑ ( ) 푥푘푦푛 = 푘 1 − 푥 − 푦 푛 푛 푛,푘=0 푘 푛 푘 푛 푔푛 = ∑(−1) ( ) 푓푘 ⇔ 푓푛 = ∑(−1) ( ) 푔푘 ∞ 푘 푘 1 푛 + 푘 푘=0 푘=0 ∑ ( ) 푥푘푦푛 = 푒푥+푦 (푛 + 푘)! 푘 or 푛,푘=0 푛 푛 푛 푛−푘 푛 ∞ −푛 1 푔푛 = ∑ ( ) 푓푘 ⇔ 푓푛 = ∑(−1) ( ) 푔푘 ( )푘 푘 푘 푘 ∑ −1 ( ) 푥 = 푟 푘=0 푘=0 푘=0 푘 (1 − 푥)

MONIC NUMBERS

26 | Binomial Coefficients

The sum of reciprocals of first 푛 positive integers is 푛-th harmonic number. Harmonic numbers are important in many brances of mathematics, especially in number theory. Harmonic numbers are called harmonic series as well. They are closely related to the Riemann zeta function, and appear in the expressions of various special functions.

For each positive integer 푛, the 푛 th harmonic number 푯풏 is defined as

1 1 1 퐻 = 1 + + + ⋯ + 푛 2 3 푛 and by convention 퐻0 = 0.

H A R M O N I C N U M B E R S A N D L OGARITHMIC F UNCTION

1 푛 1 As 퐻 = ∑푛 and the logarithmic function computes ln(푛) = ∫ 푑푥 harmonic numbers can 푛 푘=1 푘 1 푥 be visualized as the discrete version of the logarithmic function. In fact, the similarity is quite be- 푑 1 yond just being visual. For example, we may compare the derivative ln 푥 = of the logarithmic 푑푥 푥 1 function and the finite difference Δ퐻 = of the harmonic number. 푘 푘+1

It is easy to observe that for 푛 > 1,

ln 푛 < 퐻푛 < 1 + ln 푛.

Harmonic Numbers| 27

Following figure illustrates the graphs of 푦 = ln 푥, 푦 = 1 + ln 푥 and 푦 = 퐻푥.

It follows that a rough approximation for 퐻푛 is

퐻푛 ≈ ln 푛.

The observation 퐻푛 > ln 푛 implies divergence of the sequence {퐻푛}. Below theorem proves this fact with a different approach.

THEOREM 2.1. The sequence {퐻푛} is divergent.

Proof. Write

푘−1 groups, sum of each >1/2 1 ⏞ 1 1 1 1 1 1 1 1 퐻 푘 = 1 + + + + + + + + ⋯ + + ⋯ + . 2 2 3⏟ 4 5⏟ 6 7 8 2⏟푘 − 1 + 1 2 푘 2 terms 4 terms 2푘−1 terms smallest 1/4 smallest 1/8 smallest 1⁄2푘

It follows that for 푘 > 1,

푘 퐻 푘 > 1 + 2 2 which implies that {퐻푛} is divergent. ∎

28 | Harmonic Numbers

THEOREM 2.2. For any integer 푛 > 1, 푛 1 + < 퐻 푛 < 푛. 2 2

Proof. First inequality is already obtained in the proof of previous theorem. For any positive integer 푛, we have 퐻푛 ≤ 1 + ln 푛. In particular for any 푘 > 1, 퐻2푘 < 1 + 푘 ln 2 < 푘. ∎

THEOREM 2.3. 퐻푛 is an integer only when 푛 = 1.

Proof. Let 푛 > 1 and 푏 be the least common multiple of the integers 1, … , 푛. We can write 푏 = 푏 푏 푏 푏 2푘푚 for some odd integer 푚 and 푘 > 1 such that 2푘 ≤ 푛. Then 푏퐻 = + + ⋯ + + ⋯ + and 푛 1 2 2푘 푛 exactly one term on the right hand side is odd. Therefore, the sum on right hand side is odd. Since

푏 is even, 퐻푛 cannot be an integer. ∎

G E N E R A T I N G F U N C T I O N O F { 푯풏}

THEOREM 2.4. Generating function of {퐻푛} is

∞ ln(1 − 푥) − = ∑ 퐻 푥푛. 1 − 푥 푛 푘=1

1 푥푘 Proof. By integrating both sides of = ∑∞ 푥푘, we see that − ln(1 − 푥) = ∑∞ is the 1−푥 푘=0 푘=1 푘 1 1 generating function of the sequence 1, , , … of reciprocals of natural numbers. Consequently, 2 3 1 − ln(1 − 푥) ⋅ is the generating function of the partial sums of reciprocals of natural numbers, 1−푥 namely the harmonic numbers. ∎

GENERALIZED HARMONIC NUMBERS - A BETTER APPROXIMATION FOR 푯풏

(푟) For any integer 푟 > 1, the generalized harmonic number 퐻푛 is defined as follows

푛 (푟) 1 퐻푛 = ∑ 푟. 푘=1 푘

Harmonic Numbers| 29

∞ 푟 Since the series ∑푘=0 1⁄푘 is convergent when 푟 > 1, we can define

푛 1 (푟) 휁(푟) = lim ∑ = 퐻∞ . 푛→∞ 푘푟 푘=푟

The function 푧 ↦ 휁(푧) is called Riemann3 zeta function. Euler has proven that if 푛 is a positive integer, then 푝 휁(2푛) = 휋2푛 푞 for some positive integers 푝 and 푞. No such representation in terms of 휋 is known for the values ζ(2n+1).

Some values of 휁 function are

휋2 휁(2) = 6 휁(3) = 1.20205 ⋯

휋4 휁(4) = 휁(5) = 1.03692 ⋯ 90

휋6 휁(6) = 휁(7) = 1.00834 ⋯ 945

푥−푖 1 1 푖 Derivative of the function 퐹(푥) = ∑∞ = ∑∞ ( ) is 푖=1 푖 푖=1 푖 푥

∞ ∞ 1 1 푖−1 1 1 푖 퐹′(푥) = ∑ − ( ) = − ∑ ( ) 푥2 푥 푥2 푥 푖=1 푖=0

1 1 = − ( ) 2 1 푥 1 − 푥 1 = − 푥(푥 − 1) 1 1 = − . 푥 (푥 − 1)

3 Georg Friedrich Bernhard Riemann (1826-1866), German mathematician.

30 | Harmonic Numbers

1 1 1 1 푖 It follows that ln 푥 − ln(푥 − 1) = ∫ ( − ) 푑푡 = ∫ 퐹′(푥)푑푥 = 퐹(푥) = ∑∞ ( ) . Then we 푥 (푥−1) 푖=0 푖 푥 푘 1 1 1 have ln = + + + ⋯ which is convergent for 푘 > 1. Write the equations for 푘 = 푘−1 푘 2푘2 3푘3 2,3, ⋯ , 푛 ∶

1 1 푘 = 2 ln 2 − ln 1 = + + ⋯ 2 2⋅22

1 1 푘 = 3 ln 3 − ln 2 = + + ⋯ 3 2⋅32

⋮ ⋮

1 1 푘 = 푛 ln 푛 − ln(푛 − 1) = + + ⋯ 푛 2⋅푛2

Term by term summation gives

1 1 ln 푛 − ln 1 = 퐻 − 1 + (퐻(2) − 1) + (퐻(3) − 1) + ⋯ 푛 2 푛 3 푛 ∞ 1 = 퐻 − 1 + ∑ (퐻(푘) − 1) 푛 푘 푛 푘=2

or

∞ 1 퐻 − ln 푛 = 1 − ∑ (퐻(푘) − 1). 푛 푘 푛 푘=2

∞ 1 (푘) ∞ 1 The limit lim [1 − ∑푘=2 (퐻푛 − 1)] = 1 − ∑푘=2 (휁(푘) − 1) exists and its value 훾 is known as 푛→∞ 푘 푘 Euler4 Mascheroni5 constant6, that is

∞ 1 1 − ∑ (휁(푘) − 1) = 훾. 푘 푘=2

Now we have

1 1 lim (퐻푛 − ln 푛) = 1 − (휁(2) − 1) − (휁(3) − 1) − ⋯ = 훾. 푛→∞ 2 3

As a precise approximation for 퐻푛 we can write

퐻푛 ≈ ln 푛 + 훾.

4 Leonhard Euler (1707-1703), Swiss mathematician. One of the greatest three mathematicians of all times. 5 Lorenzo Mascheroni (1750-1800), Italian mathematician. 6 훾 = 0.57721 56649 01532 86060 65120 90082 40243 10421 59335 93992 ⋯

Harmonic Numbers| 31

In fact

1 1 휀 퐻 = ln 푛 + 훾 + − + 푛 0 < 휀 < 1. 푛 2푛 12푛2 120푛4 푛

Two useful bounds for 퐻푛 are given by the following inequalities:

1 1 < 퐻 − ln 푛 − 훾 < , 2(푛 + 1) 푛 2푛

1 1 1 < 퐻 − ln (푛 + ) − 훾 < . 24(푛 + 1)2 푛 2 24푛2

F I N I T E S U M S I N V O L V I N G H A R M O N I C N UMBERS

In this section we compute the first nine of the following finite sums: 푛

∑ 퐻푘 = (푛 + 1)퐻푛 − 푛 푘=1 푛 (푟) (푟) (푟−1) ∑ 퐻푘 = (푛 + 1)퐻푛 − 퐻푛 푘=1 푛 푛(푛 + 1) 1 ∑ 푘퐻 = (퐻 − ) 푘 2 푛+1 2 푘=1 푛 푘 푛 + 2 ∑ ∑ 퐻 = ( ) (퐻 − 퐻 ) 푖 2 푛+2 2 푘=1 푘=푖 푛 퐻 1 ∑ 푘 = ((퐻 )2 + 퐻(2)) 푘 2 푛 푛 푘=1 푛 1 푛 − 1 1 ∑(−1)푘−1 ( ) = 푘 푘 − 1 푛 푘=1 푛 푛 1 ∑(−1)푘−1 ( ) = 퐻 푘 푘 푛 푘=1 푛 푛 1 ∑(−1)푘−1 ( ) 퐻 = 푘 푘 푛 푘=1 푛 푘 푛 + 1 1 ∑ ( ) 퐻 = ( ) (퐻 − ) 푚 푘 푚 + 1 푛+1 푚 + 1 푘=푚 푛 푛 푛 1 ∑ ( ) 퐻 = 2푛 (퐻 − ∑ ) 푘 푘 푛 푘2푘 푘=0 푘=1 푛 푛 2 2푛 ∑ ( ) 퐻 = ( ) (2퐻 − 퐻 ) 푘 푘 푛 푛 2푛 푘=1

32 | Harmonic Numbers

PROPOSITION 2.5. Partial sums of harmonic numbers and generalized harmonic numbers are as follows: 푛

∑ 퐻푘 = (푛 + 1)퐻푛 − 푛, 푘=1 푛 (푟) (푟) (푟−1) ∑ 퐻푘 = (푛 + 1)퐻푛 − 퐻푛 . 푘=1

Proof. For the partial sums of harmonic numbers

푛 푛 푘 푛 푛 1 1 ∑ 퐻 = ∑ ∑ = ∑ ∑ 푘 푖 푖 푘=1 푘=1 푖=1 푖=1 푘=푖

푛 푛 − 푖 + 1 = ∑ 푖 푘=1

푛 1 = (푛 + 1) ∑ − 푛 푖 푘=1

= (푛 + 1)퐻푛 − 푛.

For the partial sums of generalized harmonic numbers we have

푛 푛 푘 1 ∑ 퐻(푟) = ∑ ∑ 푘 푖푟 푘=1 푘=1 푖=1

푛 1 = ∑ (푛 + 1 − 푖) 푖푟 푖=1

(푟) (푟−1) = (푛 + 1)퐻푛 − 퐻푛 .

This completes the proof. ∎

We could obtain the first equality of the above proposition using the generating functions. Let

{푆푛} be the sequence of partial sums of harmonic numbers, namely {푆푛} = 퐻1 + ⋯ + 퐻푛. Since ln(1−푥) ln(1−푥) 1 generating function of {퐻 } is − , generating function of 푆 is − ⋅ . That is 푛 1−푥 푛 1−푥 1−푥

∞ ∞ 푛 ln(1 − 푥) − = ∑ 푆 푥푛 = ∑ (∑ 퐻 ) 푥푛. (1 − 푥)2 푛 푘 푛=1 푛=1 푘=1

푥푖 1 On the other hand − ln(1 − 푥) = ∑∞ and = ∑∞ 푗 푥푗−1 so we get 푖=1 푖 (1−푥)2 푗=1

Harmonic Numbers| 33

∞ ∞ ∞ ∞ ln(1 − 푥) 푥푖 푗 − = ∑ ⋅ ∑ 푗 푥푗−1 = ∑ ∑ 푥푖+푗−1 (1 − 푥)2 푖 푖 푖=1 푗=1 푖=1 푗=1

∞ 푛 푛 + 1 − 푘 = ∑ (∑ ( )) 푥푛 푘 푛=1 푘=1

∞ 푛 = ∑((푛 + 1)퐻푛 − 푛)) 푥 . 푛=1

It follows that 푆푛 = (푛 + 1)퐻푛 − 푛, in other words

∑ 퐻푘 = (푛 + 1)퐻푛 − 푛. 푘=0

Now define {휉푛} to be the sequence of partial sums of {푆푛}, that is 휉푛 = 푆1 + 푆2 + ⋯ + 푆푛. Gen- ln(1−푥) ln(1−푥) erating function of {푆 } is − , so generating function of {휉 } is − : 푛 (1−푥)2 푛 (1−푥)3

∞ ∞ 푛 ln(1 − 푥) − = ∑ 휉 푥푛 = ∑ (∑ 푆 ) 푥푛 (1 − 푥)3 푛 푖 푛=1 푛=1 푖=1

∞ 푛 푛 = ∑ (∑((푘 + 1)퐻푘 − 푘)) 푥 푛=1 푘=1

∞ 푛 푛(푛 + 3) = ∑ ((푛 + 1)퐻 − + ∑ 푘퐻 ) 푥푛. 푛 2 푘 푛=1 푘=1 which implies that

푛 푛(푛 + 3) 휉 = (푛 + 1)퐻 − + ∑ 푘퐻 푛 푛 2 푘. 푘=1

On the other hand

∞ ∞ ln(1 − 푥) 푥푖 푗 + 2 − = ∑ ⋅ ∑ ( ) 푥푗 (1 − 푥)3 푖 2 푖=1 푗=0

∞ ∞ 푥푖 푗 + 1 = ∑ ⋅ ∑ ( ) 푥푗−1 푖 2 푖=1 푗=1

∞ ∞ 1 푥푖 = ∑ ⋅ ∑ 푗(푗 + 1) 푥푗−1 2 푖 푖=1 푗=1

∞ ∞ 1 푗(푗 + 1) = ∑ ∑ 푥푖+푗−1 2 푖 푖=1 푗=1

34 | Harmonic Numbers

∞ 푛 1 (푛 + 1 − 푘)(푛 + 2 − 푘) = ∑ (∑ ( )) 푥푛 2 푘 푛=1 푘=1

∞ 1 푛(푛 + 1) = ∑ ((푛 + 1)(푛 + 2)퐻 − 푛(2푛 + 3) + ) 푥푛 2 푛 2 푛=1

∞ 1 3푛2 + 5푛 = ∑ ((푛 + 1)(푛 + 2)퐻 − ) 푥푛 2 푛 2 푛=1

so that

1 3푛2 + 5푛 휉 = ((푛 + 1)(푛 + 2)퐻 − ). 푛 2 푛 2

Now we have

푛 푛(푛 + 3) 1 3푛2 + 5푛 (푛 + 1)퐻 − + ∑ 푘퐻 = ((푛 + 1)(푛 + 2)퐻 − ) 푛 2 푘 2 푛 2 푖=1 which can be rearranged to write

푛 1 3푛2 + 5푛 ∑ 푘퐻 = (((푛 + 1)(푛 + 2) − 2(푛 + 1))퐻 + 푛(푛 + 3) − ) 푘 2 푛 2 푘=1

1 푛2 푛 1 푛2 푛 = (푛(푛 + 1)퐻 − + ) = (푛(푛 + 1)퐻 − − ) 2 푛 2 2 2 푛+1 2 2 which simplifies into

푛 푛(푛 + 1) 1 ∑ 푘퐻 = (퐻 − ). 푘 2 푛+1 2 푘=1

PROPOSITION 2.6. For any positive integer 푛,

푛 푛(푛 + 1) 1 ∑ 푘퐻 = (퐻 − ) , 푘 2 푛+1 2 푘=1 푛 푘 푛 + 2 ∑ ∑ 퐻 = ( ) (퐻 − 퐻 ). 푖 2 푛+2 2 푘=1 푘=푖

Harmonic Numbers| 35

Proof. In the paragraph preceding the statement of the proposition, the first equality has been obtained already. The second equality follows easily from the first one:

푛 푘 푛

∑ ∑ 퐻푖 = ∑((푘 + 1)퐻푘 − 푘) 푘=1 푘=푖 푘=1

= ∑(푘퐻푘 + 퐻푘 − 1)) 푘=1

푛(푛 + 1) 1 푛(푛 + 1) = (퐻 − ) + (푛 + 1)퐻 − 푛 − 2 푛+1 2 푛 2

(푛 + 1)(푛 + 2) 3 = (퐻 − ). 2 푛+2 2

(푛+1)(푛+2) 3 By writing = (푛+2) and = 퐻 we obtain the desired equality. ∎ 2 2 2 2

PROPOSITION 2.7. For any positive integer 푛,

푛 퐻 1 ∑ 푘 = ((퐻 )2 + 퐻(2)). 푘 2 푛 푛 푘=1

Proof. We write

푛 푛 푘 푛 푛 푛 퐻 1 1 1 1 1 ∑ 푘 = ∑ ∑ ⋅ = ∑ ∑ = ∑ (퐻 − 퐻 ) 푘 푘 푖 푖 푘 푖 푛 푖−1 푘=1 푘=1 푖=1 푖=1 푘=푖 푖=1 푛 푛 1 1 1 = (퐻 )2 − ∑ 퐻 = (퐻 )2 − ∑ (퐻 − ) 푛 푖 푖−1 푛 푖 푖 푖 푖=1 푖=1 푛 푛 1 1 = (퐻 )2 − ∑ 퐻 + ∑ 푛 푖 푖 푖2 푖=1 푖=1

퐻 which results in 2 ∑푛 푘 = (퐻 )2 + 퐻(2). ∎ 푘=1 푘 푛 푛

PROPOSITION 2.8. For any positive integer 푛,

푛 1 푛 − 1 1 ∑(−1)푘−1 ( ) = , 푘 푘 − 1 푛 푘=1

푛 1 푛 ∑(−1)푘−1 ( ) = 퐻 , 푘 푘 푛 푘=1

푛 푛 1 ∑(−1)푘−1 ( ) 퐻 = . 푘 푘 푛 푘=1

36 | Harmonic Numbers

Proof. We compute the sum on the right hand side of the first equality:

푛 푛 1 푛 − 1 1 푛 ∑(−1)푘−1 ( ) = ∑(−1)푘−1 ( ) 푘 푘 − 1 푛 푘 푘=1 푘=1

푛 1 푛 = (1 − ∑(−1)푘 ( ) ) 푛 푘 푘=0

1 = (1 − (1 − 1)푛) 푛 1 = . 푛

Similarly, for the second one we have:

푛 푛−1 1 푛 1 푛 ∑(−1)푘−1 ( ) = ∑(−1)푘 ( ) 푘 푘 푘 + 1 푘 + 1 푘=1 푘=0

푛−1 푛−1 1 푖 = ∑(−1)푘 ∑ ( ) 푘 + 1 푘 푘=0 푖=푘

푛−1 푖 1 푖 = ∑ ∑(−1)푘 ( ) 푘 + 1 푘 푖=0 푘=0

푛−1 푖+1 1 푖 = ∑ ∑(−1)푘−1 ( ) 푘 푘 − 1 푖=0 푘=1

푛−1 1 = ∑ 1 + 푖 푖=0

= 퐻푛.

푛 푘 푛 푛 푘 푛 푖−1 푘 푛 Since ∑푘=0(−1) (푘) = 0, we can write − ∑푘=푖(−1) (푘) = ∑푘=0(−1) (푘). We use this equal- ity to prove the last inequality:

푛 푛 푘 푛 푛 1 ∑(−1)푘−1 ( ) 퐻 = ∑ ∑(−1)푘−1 ( ) 푘 푘 푘 푖 푘=1 푘=1 푖=1

푛 푛 1 푛 = ∑ ∑(−1)푘−1 ( ) 푖 푘 푖=1 푘=푖

Harmonic Numbers| 37

푛 푖−1 1 푛 = ∑ ∑(−1)푘 ( ) 푖 푘 푖=1 푘=0

푛 1 푛 − 1 = ∑ (−1)푖−1 ( ) 푖 푖 − 1 푖=1

푛 1 푛 = ∑(−1)푖−1 ( ) 푛 푖 푖=1

1 = . ∎ 푛

푡 푖 푛 푖 푛−1 Note that, the equality ∑푖=0(−1) (푖 ) = (−1) ( 푖 ), which holds for all integers 0 < 푛 and 푡 < 푛, is used in the proof.

A one line proof of the last equality is obtained once we notice that, from the second equality,

1 {퐻 } is transform of { } under binomial inversion. Thus the third equality follows immediately. 푛 푛

PROPOSITION 2.9. For any positive integers 푛 and 푚

푛 푘 푛 + 1 1 ∑ ( ) 퐻 = ( ) (퐻 − ). 푚 푘 푚 + 1 푛+1 푚 + 1 푘=푚

Proof.

푛 푛 푘 푘 1 푘 ∑ ( ) 퐻 = ∑ ∑ ( ) 푚 푘 푘 푚 푘=푚 푘=푚 푖=1

푛 푘 1 푘 = ∑ ∑ ( ) 푖 푚 푘=푚 푖=1

푛 푚 푛 푘 1 푘 1 푘 = ∑ ∑ ( ) + ∑ ∑ ( ) 푖 푚 푖 푚 푘=푚 푖=1 푘=푚+1 푖=푚+1

푛 푚 푛 푛 푘 1 1 푘 = ( ∑ ( )) (∑ ) + ∑ ∑ ( ) 푚 푖 푖 푚 푘=푚 푖=1 푖=푚+1 푘=푖

푛 푛 + 1 1 푛 + 1 푖 = ( ) 퐻 + ∑ (( ) − ( )) 푚 + 1 푚 푖 푚 + 1 푚 + 1 푖=푚+1

푛 푛 + 1 푛 + 1 1 푖 = ( ) 퐻 + ( ) (퐻 − 퐻 ) − ∑ ( ) 푚 + 1 푚 푚 + 1 푛 푚 푖 푚 + 1 푖=푚+1

38 | Harmonic Numbers

푛 푛 + 1 1 푖 − 1 = ( ) 퐻 − ∑ ( ) 푚 + 1 푛 푚 + 1 푚 푖=푚+1

푛 + 1 1 푛 = ( ) 퐻 − ( ) 푚 + 1 푛 푚 + 1 푚 + 1

푛 + 1 1 푛 + 1 1 푛 = ( ) 퐻 − ( ) − ( ) 푚 + 1 푛+1 푛 + 1 푚 + 1 푚 + 1 푚 + 1

푛 + 1 1 푛 1 푛 = ( ) 퐻 − ( ) − ( ) 푚 + 1 푛+1 푚 + 1 푚 푚 + 1 푚 + 1

푛 + 1 1 푛 푛 = ( ) 퐻 − (( ) + ( )). 푚 + 1 푛+1 푚 + 1 푚 푚 + 1

푛 푛 푛+1 Now, using the identity (푚) + (푚+1) = (푚+1) we obtain the desired equality. ∎

AN INTEGRAL REPRESENTATION AND EXTENSION TO REAL NUMBERS

1−푥푛 A direct consequence of the identity = 1 + 푥 + ⋯ + 푥푛−1 is 1−푥

1 1 − 푥푛 퐻푛 = ∫ 푑푥. 0 1 − 푥

With the transform 푢 = 1 − 푥 in the above integral we get

1 1 − (1 − 푢)푛 퐻푛 = ∫ 푑푢 0 푢

푛 1 푛 = ∫ [∑(−1)푘−1 ( ) 푢푘−1 ] 푑푢 푘 0 푘=1

푛 푛 1 = ∑(−1)푘−1 ( ) ∫ 푢푘−1푑푢 푘 푘=1 0

푛 1 푛 = ∑(−1)푘−1 ( ). 푘 푘 푘=1

Harmonic Numbers| 39

Then

푛 1 푛 퐻 = ∑(−1)푘−1 ( ). 푛 푘 푘 푘=1

For any real number 0 < 푥 < 1 we define 퐻푥 by setting

1 1 − 푡푥 퐻푥 = ∫ 푑푡. 0 1 − 푡

Values of 퐻푥 for 푥 > 1 or 푥 < 0 can be computed from the recurence 1 퐻 = 퐻 + . 푥 푥−1 푥

Some examples are

퐻1 = 2 − 2 ln 2, 2 휋 3 퐻1 = 3 − − ln 3, 3 2√3 2 4 휋 퐻3 = − 3 ln 2 + . 4 3 2

I D E N T I T I E S I N V O L V I N G 푯풙

∞ 1 푥 ∑ = 퐻 , 푘(푥 + 푘) 푥 푘=1 1 퐻 = (퐻 + 퐻 1) + ln 2, 2푥 푥 푥− 2 2 1 ∫ 퐻푥푑푥 = 훾, 0 푛 ∫ 퐻푥푑푥 = 푛훾 + ln(푛!), 0 푎 2 (2) 휋 ∫ 퐻푥 푑푥 = 푎 − 퐻푎, 0 6 푎 (3) 1 (2) ∫ 퐻푥 푑푥 = 푎휁(3) − 퐻푎 . 0 2

40 | Harmonic Numbers

S O M E I N F I N I T E S U M S I N V O L V I N G H A R M O N I C N UMBER S

∞ 1 ∑ = 푥 ⋅ 퐻 , 푘(푘 + 푥) 푥 푘=1 ∞ (−1)푘−1 푛 ∑ ( ) 퐻 = 퐻(2), 푘 푘 푘 푛 푘=1 ∞ 퐻 ∑ 푘 = 2휁(3), 푘2 푘=1 ∞ 퐻 1 1 ∑ 푘 = 휁(2) = 휋2, 푘2푘 2 12 푘=1 ∞ 퐻2 17 17 ∑ 푘 = 휁(4) = 휋4, 푘2 4 360 푘=1 ∞ 퐻2 11 11 ∑ 푘 = 휁(4) = 휋4, (푘 + 1)2 4 360 푘=1 ∞ 퐻 5 1 ∑ 푘 = 휁(4) = 휋4. 푘3 4 72 푘=1 T A B L E O F H A R M O N I C N UMBERS

푛 퐻푛 푛 퐻푛 푛 퐻푛 푛 퐻푛 푛 퐻푛 푛 퐻푛 1 1 21 3,64536 41 4,30293 61 4,69626 81 4,97782 100 5,18738 2 1,50000 22 3,69081 42 4,32674 62 4,71239 82 4,99002 200 5,87803 3 1,83333 23 3,73429 43 4,35000 63 4,72827 83 5,00207 300 6,28266 4 2,08333 24 3,77596 44 4,37273 64 4,74389 84 5,01397 400 6,56993 5 2,28333 25 3,81596 45 4,39495 65 4,75928 85 5,02574 500 6,79282 6 2,45000 26 3,85442 46 4,41669 66 4,77443 86 5,03737 600 6,97497 7 2,59286 27 3,89146 47 4,43796 67 4,78935 87 5,04886 700 7,12901 8 2,71786 28 3,92717 48 4,45880 68 4,80406 88 5,06022 800 7,26245 9 2,82897 29 3,96165 49 4,47921 69 4,81855 89 5,07146 900 7,38016 10 2,92897 30 3,99499 50 4,49921 70 4,83284 90 5,08257 1000 7,48547 11 3,01988 31 4,02725 51 4,51881 71 4,84692 91 5,09356 2000 8,17836 12 3,10321 32 4,05850 52 4,53804 72 4,86081 92 5,10443 3000 8,58375 13 3,18013 33 4,08880 53 4,55691 73 4,87451 93 5,11518 4000 8,87139 14 3,25156 34 4,11821 54 4,57543 74 4,88802 94 5,12582 5000 9,09450 15 3,31823 35 4,14678 55 4,59361 75 4,90136 95 5,13635 6000 9,27681 16 3,38073 36 4,17456 56 4,61147 76 4,91451 96 5,14676 7000 9,43095 17 3,43955 37 4,20159 57 4,62901 77 4,92750 97 5,15707 8000 9,56447 18 3,49511 38 4,22790 58 4,64625 78 4,94032 98 5,16728 9000 9,68225 19 3,54774 39 4,25354 59 4,66320 79 4,95298 99 5,17738 10000 9,78760 20 3,59774 40 4,27854 60 4,67987 80 4,96548 100 5,18738 100000 12,09015

Harmonic Numbers| 41

P R O B L E M S I N V O L V I N G H A R M O N I C N UMBERS

There are many interesting problems whose solutions involve harmonic numbers. Here we give several examples of such questions. Exercises 9-10, at the end of this section are also exam- ples of such problems.

1 1 1 Problem 1. Remove those terms in 1 + + + + ⋯ such that its denominator in decimal ex- 2 3 4 pansion contains the digit 9, then prove that the sequence is bounded.

The integers without the digit 9 in the interval [10푚−1, 10푚 − 1] are 푚-digit num- bers. The first digit from the left cannot be the digits 0 and 9, (8 choices), the other digits cannot contain 9, hence nine choices for each. Altogether there are 8 · 9푚−1

9 푚−1 such integers. The sum of their reciprocals is less than 8 ( ) . The sum of all such 10 numbers is therefore less then

∞ 9 푚−1 1 ∑ 8 ( ) = 8 ⋅ = 80. 9 10 1 − 푚=1 10

Problem 2. Assume that we start keeping snowfall records this year. We wish to find the ex- pected number of records that will occur in the next 20 years.

The first year is necessarily a record. The second year will be a record if the snowfall in the second year is greater than that in the first year. By symmetry, this probability

is 1⁄2. In general let 푃푘 be 1 if the 푘-th year is a record and 0 otherwise. To find

퐸(푃푘 ), we need only find the probability that the 푘-th year is a record. But the record snowfall for the first 푘 years is equally likely to fall in any one of these years, so

퐸(푃푘 ) = 1/푘. Therefore, if 푆푛 is the total number of records observed in the first 푛 1 1 1 years, (푆 ) = 1 + + + ⋯ + = 퐻 . Therefore, in ten years the expected 푛 2 3 푛 푛

number of records is 퐻20 ≈ ln 20 + 훾 = 3.98 ⋯ .

Problem 3. A folk dance performance group of 푛 dancers is to be splitted into two circular for- mations. In how many different ways can this be done?

Distinguish one of the dancers, say 퐴 and form the circles groups in two steps:

(푛−1)! - First pick 푘 dancers to join 퐴 and form a circle ((푛−1)푘! = ways), 푘 (푛−푘−1)!

- Next form the second circle with the remaining dancers ((푛 − 푘 − 2)! ways).

42 | Harmonic Numbers

(푛−1)! Since for each 푘 = 0, … , 푛 − 2, there are ways, number of total ways is (푛−푘−1)

1 1 1 (푛 − 1)! [ + + ⋯ + + 1] = (푛 − 1)! 퐻 . 푛 − 1 푛 − 2 2 푛−1

푛 The problem actually asks to compute [2]. Thus, we have obtained the relation 푛 [ ] = (푛 − 1)! 퐻 . 2 푛−1

between harmonic numbers and Stirling numbers (See Section 5 of this chapter).

Problem 4. We have 푛 identical books of unit length. What is the maximum overhang that can be achieved when the books are stacked as a pile (of one book at each level) at the edge of a table?

Let 푑푛 be the maximum offset dis- tance of a stack of 푛 books. When the largest offset is obtained, the center of mass of the 푛 books must lie right above the table’s edge and the center of mass of the 푛 − 1 top books must lie right above the edge of the book at the bottom. By computing the total mo- ment of 푛 books with respect to the right edge we obtain

1 푛푑 = (푑 + ) + (푛 − 1)푑 . 푛 푛−1 2 푛−1

1 This relation can be solved for 푑 to obtain the 푑 = 푑 + . 푛 푛 푛−1 2푛

By iteration we get

1 푑 = 푑 + 2 1 4 1 1 1 푑 = 푑 + = 푑 + + 3 2 6 1 4 6 1 1 1 1 푑 = 푑 + = 푑 + + + . 4 3 8 1 4 6 8 It is easy to see that

1 1 1 1 푑 = (2푑 + + + ⋯ + ) . 푛 2 1 2 3 푛

Harmonic Numbers| 43

1 1 For only one book obviously 푑 = . Then we conclude 푑 = 퐻 . Since the sequence 1 2 푛 2 푛

{퐻푛} is divergent, the maximum amount of overhang will become arbitrarily large as the number of books grows.

Problem 5. One end of an infinitely stretchable rubber band, initially 1-meter-long, is nailed to a

wall. A bug is on the rubber band at the end attached to wall. At each second, the ant crawls 1 centimeter toward the other end and when the ant stops, the band is stretched by 1 meter. In the first second ant crawls 1 cm and after the band is stretched, it is 2 centimeters apart from the wall. Two seconds later it is 4.5 centime-

ters apart, so on. Will the bug ever reach the other end? If so, when?

Let 퐿푛 be the length of the band after 푛 seconds, then 퐿푛 = 퐿0 + 푛퐿0 = (1 + 푛)퐿0

where 퐿0 = 100 푐푚 is the length of the band at the beginning. Let 푆푛 be the distance (in terms of centimeters) of ant from the wall after 푛 seconds.

At the beginning of 푛 th second, length of band is 퐿푛−1 = 푛퐿0 centimeters and the ant

is 푆푛−1 centimeters apart from the wall. Now, ant crawls to the point 푆푛−1 + 1 and the

band is stretched to length 퐿푛 = (1 + 푛)퐿0. As a result, ant is now

1 + 푛 푆 = (푆 + 1) 푛 푛 푛−1

centimeters apart from the wall. We write first few terms of the sequence {푆푡}

2 푆 = ⋅ 1 1 1 3 2 1 S = ( + 1) = 3 (1 + ) 2 2 1 2 4 3 3 1 1 푆 = ⋅ ( + + 1) = 4 (1 + + ) 3 3 3 2 2 3 5 4 4 4 1 1 1 푆 = ( + + + 1) = 5 (1 + + + ) 4 4 4 2 3 2 3 4

Inductively it can be shown that 푆푛 = (푛 + 1)퐻푛. The ant reaches the other end of the

band after 푛0 seconds if 푆푛0 ≥ 퐿푛0 or (푛0 + 1)퐻푛0 ≥ (1 + 푛0)퐿0 that is , 퐻푛0 ≥ 퐿0.

The sequence {퐻푛} is divergent so, no matter how large 퐿0 is, for some 푛0, eventually

we will have 퐻푛0 ≥ 퐿0. Using the rough approximation 퐻푛 ≈ ln 푛, we can write 푛0 ≈

퐿0 100 35 푒 . When 퐿0 is 100, it requires 푒 seconds (more than 8 × 10 years) for the ant to reach the other end.

44 | Harmonic Numbers

Problem 6. The secretary problem is an optimal stopping problem that has been studied exten- sively in the fields of applied probability, statistics, and decision theory. It is also known as the marriage problem, the sultan’s dowry problem, the fussy suitor prob- lem, and the best choice problem. The problem can be stated as follows:

– There is a single position to fill, – There are 푛 applicants for the position, – The applicants can be ranked from best to worst with no ties, – The applicants are interviewed sequentially in a random order, – After each interview, the applicant is accepted or rejected, – The decision to accept or reject an applicant can be based only on the relative - ranks of the applicants interviewed so far, – Rejected applicants cannot be recalled.

The object is to select the best applicant. The payoff is 1 for the best applicant and zero otherwise. We can go through some of the applicants and use that information in order to choose the best applicant out of the rest we have not seen so far. For ex- ample, we if look at 푘 applicants and see who is the best applicant out of them, then we look through the 푛 − 푘 applicants and choose the first one who is better than the best of the first 푘. Find the value of 푘 for which choosing the best applicant is maxi- mum.

If the best applicant is among the first 푘, probability to win is clearly 0. If the best applicant is at 푡 th place (푡 > 푘), he could chosen only if the best of the first 푡 − 1 ap- plicants is among the first 푘. Probability of this event is

푘 푝 = 푡 − 1

for 푡 = 푘 + 1, 푘 + 2, … , 푛. Since the applicant can be at any position with probability 1 overall probability to win is 푛

푘 1 1 1 푘 푃 = ( + + ⋯ + ) = (퐻 − 퐻 ). 푘 푛 푘 푘 + 1 푛 − 1 푛 푛−1 푘−1

For the maximum value of 푃푘 we must have 푃푘 ≥ 푃푘−1 푎푛푑 푃푘 ≥ 푃푘+1.

First inequality gives

푘 푘 − 1 (퐻 − 퐻 ) ≥ (퐻 − 퐻 ) 푛 푛−1 푘−1 푛 푛−1 푘−2

푘퐻푛−1 − 푘퐻푘−1 ≥ 푘퐻푛−1 − 퐻푛−1 − 푘퐻푘−2 + 퐻푘−2

퐻푛−1 ≥ 푘(퐻푘−1 − 퐻푘−2) + 퐻푘−2

that is 퐻푛−1 = 1 + 퐻푘−1.

Harmonic Numbers| 45

Second inequality gives

푘 푘 + 1 (퐻 − 퐻 ) ≥ (퐻 − 퐻 ) 푛 푛−1 푘−1 푛 푛−1 푘

푘퐻푛−1 − 푘퐻푘−1 ≥ 푘퐻푛−1 + 퐻푛−1 − 푘퐻푘 − 퐻푘

so 퐻푛−1 ≤ 1 + 퐻푘.

Combining two results we get 퐻푘−1 ≤ 퐻푛−1 − 1 ≤ 퐻푘 or

1 퐻 − 1 ≤ 퐻 ≤ 퐻 − 1 + . 푛−1 푘 푛−1 푘

Then we conclude that 푘 is the smallest integer for which 퐻푘 ≥ 퐻푛−1 − 1.

For large values of 푛, the approximation 퐻푛 ≈ ln 푛 + 훾 yields

ln 푘 + 훾 ≥ ln(푛 − 1) + 훾 − ln 푒

푛−1 which gives that 푘 = ⌈ ⌉. 푒

E XERCISES

1. Prove that the following equalities hold for any positive integer 푛:

퐻 1 a) ∑푛 푘 = ((퐻 )2 + 퐻(2) ), 푘=1 푘+1 2 푛+1 푛+1

퐻 1 1 b) ∑푛 푘 = ((퐻 )2 + 퐻(2) ) + − 1, 푘=1 푘+2 2 푛+2 푛+3 푛+2

퐻 1 3 1 7 c) ∑푛 푘 = ((퐻 )2 + 퐻(2) ) + + − , 푘=1 푘+3 2 푛+3 푛+3 2(푛+3) 2(푛+2) 4

1 2 d) ∑푛 = 퐻 . 푘=1 푘(푛−푘+1) 푛+1 푛

2. Evaluate

∞ 퐻 ∑ 푘. 2푘 푘=1

46 | Harmonic Numbers

3. Define the sequence 푊푛 as follows: 푊푛 = 1 and for 푛 > 1

푊푛−1 if decimal representation of 푛 contains at least one even digit

푊푛 = { 1 . 푊 + if otherwise 푛−1 푛

Show that 푊푛 < 7 for any positive integer 푛.

4. Show that

1 a) 푛(푛 + 1)푛 < 푛 + 퐻푛 for 푛 > 1,

−1/(푛−1) b) (푛 − 1)푛 < 푛 − 퐻푛 for 푛 > 2.

5. Let 푚 and 푛 be positive integers with 푚 > 푛. Prove that

2푛 1 2푛 + 1 ∑ > , 푚 − 푛 + 푘 푚 푘=0

3푟−1 and deduce that, if 푟 > 1 is an integer and 푠 = , then 2

퐻푟 > 푠.

6. Let {푎푛} be a sequence of distinct positive integers. Prove that for any positive integer 푛,

푛 푎 퐻 ≤ ∑ 푘 . 푛 푘2 푘=1

7. For each positive integer 푘, let 퐻푛(푘) be the smallest harmonic number larger than 푘 and define

the 푘-th excess as 퐸(푘) = 퐻푛(푘) − 푘.

a) Determine whether the seuqence of excesses is convergent or not.

b) Observe that

퐸(1) = 0.5, 퐸(3) = 0.0833 ⋯ , 퐸(3) = 0.0199 ⋯ , 퐸(4) = 0.0272 ⋯.

It is seen that the sequence of excesses is not monotonically decreasing. Find the smallest 푛 > 4

such that 퐸(푛) < 퐸(푛 + 1).

Harmonic Numbers| 47

8. In single-lane traffic, with no overtaking, each slow car is followed by a bunch of cars wishing to

go faster, but unable to do so. If 푛 cars set out, expectedly how many bunches will form?

9. Suppose you have a thousand wooden beams and want to find their minimum breaking strain.

You build a simple machine which applies a gradually increasing force 퐹 to a beam which is sup-

ported at its ends in a horizontal position. By increasing the force 퐹 until the beam breaks, you

can find the breaking strain of each beam. Suppose we denote the breaking strain of the 푛 th beam

by 퐹푛. A test to destruction carried out in this way has one major disadvantage. At the end you

know the precise value of 퐹푛 for every 푛 but have destroyed all the beams in the process. However,

we did not actually want the precise value of 퐹푛 for every 푛, only the minimum value of 퐹푛 for 1 <

푛 < 1000. Develop a procedure to find that minimum value by breaking, expectedly, no more

than 10 beams.

10. Your aim is to cross 1000 kilometers of desert using a jeep which can carry at most 80 liters of

fuel at any time and can travel 5 kilometers of distance on 1 liter of fuel assuming that the jeep's

fuel consumption is constant. At the beginning you are at a base where there is an unlimited sup-

ply of fuel. We assume that you can deposit fuel in containers at any point along the route for later

use. Thus, for example, you can travel 100 kilometers into the desert, drop off 40 liters, and have

just enough to get back to the starting point and refill. Now you can make a second trip. When you

reach to the drop-off point, you have 60 liters left. You refill from the deposit and go another 100

miles into the desert. There you drop off 40 liters, get back to the deposit point and refill, getting

just enough fuel to get back to the base. You now have no fuel at the 100 kilometer mark, but 40

liters at 200 kilometers into the desert. Can you get across the desert, and, if so, how many trips

would it take?

48 | Harmonic Numbers

The Catalan sequence was described in the 18th century by Leonhard Euler, who was interested in the number of different ways of dividing a polygon into triangles. The sequence is named after Eu- gène Charles Catalan, who discovered the connection to parenthesized expressions during his explo- ration of the Towers of Hanoi puzzle. The counting trick for Dyck words was found by D. André in 1887.

In 1988, it came to light that the sequence had been used in China by the Mongo- lian mathematician Mingantu by 1730. That is when he started to write his book Ge Yuan Mi Lu Jie Fa, which was completed by his student Chen Jixin in 1774 but published sixty years later. P.J. Larcombe (1999) sketched some of the features of the work of Mingantu, including the stimulus of Pierre Jartoux, who brought three infinite series to China early in the 1700s.

D Y C K S EQUENCES

Consider the following binary sequence 푠 which consists of six 0’s and six 1’s:

푢푛: 0 1 0 1 0 0 0 1 1 0 1 1. An important property of this sequence is that, starting from the first term, 1’s are never on the majority throughout the sequence. In the below table, 푘 th column of third and fourth rows show the number of 0’s and 1’s appearing in the first 푘 terms of the se- quence. The tie in the last column is a direct consequence of the fact that the sequence is balanced.

We have another tie on the fourth column and except these ties, at each column, fourth row entry is less than the third row entry.

Catalan Numbers | 49

푛 1 2 3 4 5 6 7 8 9 10 11 12

푢푛 0 1 0 1 0 0 0 1 1 0 1 1

# 0’s 1 1 2 2 3 4 5 5 5 6 6 6

# 1’s 0 1 1 2 2 2 2 3 4 4 5 6

The fourth row of the table is in fact the sequence of partial sums {푆푘} of {푢푘}. Then, above property is equivalent to say that 2푆푘 ≤ 푘 for any 푘 = 1, … ,12.

7 A finite binary sequence 푢1, … , 푢푛 is called a Dyck sequence if 2(푢1 + ⋯ + 푢푘) ≤ 푘 for 푘 =

1, … , 푛.

Call a binary sequence a (푝, 푞) sequence where 푝 and 푞 are the numbers of 0’s and 1’s, respec- tively. We wish to find the number 퐶푝,푞 of (푝, 푞) Dyck sequences. If 푝 ≤ 푞, then 퐶푝,푞 = 0 , so we naturally assume that 푝 ≥ 푞.

THEOREM 3.1. For any integers 푝 ≥ 푞 ≥ 0, the number of (푝, 푞) Dyck sequences is given by

푝 + 1 − 푞 푝 + 푞 ( ). 푝 + 1 푝

Proof. Let 푆 be a (푝, 푞) sequence which is not a Dyck sequence. Let 푡 be the smallest index such that among the first 푡 terms, the number of 1’s outweighs the number of 0’s. If we flip (0 ↔ 1) the first 푡 terms of the sequence we obtain a (푝 + 1, 푞 − 1) sequence.

Conversely, given an arbitrary (푝 + 1, 푞 − 1) sequence. Since 푝 + 1 > 푞 − 1, there is a smallest index 푡 such that among the first 푡 terms, the number of 0’s outweighs the number of 1’s. If we flip (0 ↔ 1) the first 푡 terms of the sequence we obtain a (푝, 푞) sequence which is not a Dyck se- quence.

7 Walther Franz Anton von Dyck (1856-1934), German mathematician.

50 | Catalan Numbers

Combining the above arguments, we see that the set of (푝 + 1, 푞 − 1) sequences and the set

(푝, 푞) non-Dyck sequences are in 1-1 correspondence. It follows that the number of non-Dyck se-

푝+푞 푝+푞 quences is (푝+1). Since the number of all (푝, 푞) sequences is ( 푝 ) we conclude that the number

푞 푝+1−푞 of Dyck sequences is (푝+푞) − (푝+푞) = (푝+푞) − (푝+푞) = (푝+푞). ∎ 푝 푝+1 푝 푝 푝 푝+1 푝

C A T A L A N N UMBERS

8 For each positive integer 푛, the Catalan number 풞푛 is the number of balanced (푝 = 푞 =

푛) Dyck sequences:

1 2푛 풞 = ( ). 푛 푛 + 1 푛

For 푛 = 0, by convention, 풞0 = 1.

First few terms of the sequence {풞푛} are 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, ⋯.

LEMMA 3.2. For 푛 ≥ 0, Catalan numbers satisfy the recursion

2(2푛 + 1) 풞 = 풞 . 푛+1 푛 + 2 푛

Proof. It follows from the definition that

1 2푛 + 2 풞 = ( ) 푛+1 푛 + 2 푛 + 1

1 (2푛 + 2)(2푛 + 1) 2푛 = ⋅ ( ) . 푛 + 2 (푛 + 1)2 푛

Then proof follows. ∎

8 Eugène Charles Catalan (1814 –1894, French and Belgian mathematician.

Catalan Numbers | 51

From the theorem it immediately follows that

풞 lim ( 푛 ) = 4. n→∞ 풞푛+1

We observe another interesting recursion satisfied by the first terms of the sequence.

풞1 = 풞0풞0 = 1 ⋅ 1 = 1

풞2 = 풞0풞1 + 풞1풞0 = 1 ⋅ 1 + 1 ⋅ 1 = 2

풞3 = 풞0풞2 + 풞1풞1 + 풞2풞0 = 1 ⋅ 2 + 1 ⋅ 1 + 2 ⋅ 1 = 5

풞4 = 풞0풞3 + 풞1풞2 + 풞2풞1 + 풞3풞0 = 1 ⋅ 5 + 1 ⋅ 2 + 2 ⋅ 1 + 5 ⋅ 1 = 14

In fact, above property is satisfied by all the terms of the sequence.

THEOREM 3.3. The sequence {풞푛} of Catalan numbers satisfies the recursion

푛−1

풞푛 = 풞0풞푛−1 + 풞1풞푛−1 + 풞2풞푛−2 + ⋯ + 풞푛−1풞0 = ∑ 풞푘풞푛−1−푘 푘=0

for 푛 > 0.

Proof. Let 푠1, 푠2, ⋯ 푠2푛 be a (푛, 푛) Dyck sequence and let 푆1, 푆2, … , 푆2푛 be the sequence of partial sums. Necessarily 푆1 = 푠1 = 0 and 푆2푛 = 푛. Let 2푡 be the smallest index for which 푆2푡 = 푡. Note that it may happen that 푡 = 푛. When 푆2푡 = 푡, it is certain that 푠2푡 = 1. Then the sequence is of the form

0 , 푠2 , ⋯ , 푠2푡−1 , 1 , 푠2푡+1 , ⋯ , 푠2푛.

Subsequences 푠2 ⋯ 푠2푡−1 and 푠2푡+1 ⋯ 푠2푛 are both Dyck sequences of lengths 2푡 − 2 and 2푛 −

2푡 respectively. The number of such sequences is 풞푡−1풞푛−푡 for 푡 = 1,2, … , 푛. Sum of all such terms is the right hand side of the given equality and this completes the proof. ∎

푛−1 COROLLARY 3.4. If 푎0, 푎1, … , 푎푛, … is a sequence such that 푎푛 = ∑푘=0 푎푘푎푛−1−푘 for 푛 > 0, then

푛+1 the general term is given by 푎푛 = 풞푛푎0 .

52 | Catalan Numbers

2 Proof. (Induction on 푛) It is clear that the assertion holds for 푛 = 1: 푎1 = 푎0. Now assume that

푛+1 푎푛 = 풞푛푎0 for all 푛 ≤ 푛0 for some integer 푛0 ≥ 1. Then

푛0

푎푛0+1 = ∑ 푎푘푎푛0−푘 푘=0

푛0 푘+1 푛0−푘+1 = ∑ 풞푘푎0 ⋅ 풞푛0−푘푎0 푘=0

푛0−1

푛0+2 = 푎 ∑ 풞푘풞푛0−1−푘. 푘=0

∑푛0−1 Since 푘=0 풞푘풞푛0−1−푘 = 풞푛0, claim follows. ∎

2THEOREM 3.5. Generating function of the sequence of Catalan numbers is

1 − √1 − 4푥 풞(푥) = . 2푥

푘 Proof. Let {푤푛} be the convolution of {풞푛} with itself: {푤푛} = {풞푛 ∘ 풞푛}. Since 푤푘 = ∑푖=0 풞푖풞푘−푖,

푘 = 1,2, … generating function of {푤푛} is

∞ 푘 푤(푥) = ∑ 푤푘푥 푘=0

∞ 푘 푘 = ∑ (∑ 풞푖풞푘−푖) 푥 . 푘=0 푖=0

Using the previous theorem, we see that

∞ 푘 푤(푥) = ∑ 풞푘+1푥 푘=0 ∞ 푘−1 = ∑ 풞푘푥 푘=1 = ( 풞(푥) − 1)푥−1

2 where 풞(푥) = 1 + 풞1푥 + 풞2푥 + ⋯ is the generating function of {풞푛}. Since the generating func- tion of a convolution of two sequences is the product of the generating functions of convoluted sequences we have

Catalan Numbers | 53

푤(푥) = 풞2(푥).

Equating the two expressions for 푤(푥), we obtain

푥풞2(푥) − 풞(푥) + 1 = 0 which can be solved for 풞(푥) to give 2푥 풞(푥) = (1 ± √1 − 4푥). The condition 풞(0) = 1 forces us to choose the negative square root so that

1 − √1 − 4푥 풞(푥) = . 2푥

Alternative proof. Recall that

1 1 3 2푘 − 3 1⁄2 ⋅ (− ) ⋅ (− ) ⋯ (− ) ( ) = 2 2 2 2 푘 푘!

1 ⋅ 3 ⋯ (2푘 − 3) 2 ⋅ 4 ⋅ 6 ⋯ (2푘 − 2) = (−1)푘−1 ⋅ 2푘 ⋅ 푘! 2 ⋅ 4 ⋅ 6 ⋯ (2푘 − 2) (2푘 − 2)! = (−1)푘−1 푘! 22푘−1 (푘 − 1)!

(−1)푘−1 2 2푘 − 2 (−1)푘−1 = ⋅ ( ) = ⋅ 2 풞 4푘 푘 푘 − 1 4푘 푘−1

so that

∞ 1 1⁄2 (1 − 4푥)2 = ∑ ( ) (−4)푘푥푘 푘 푘=0 ∞ (−1)푘−1 = 1 + ∑ ⋅ 2 풞 (−4)푘푥푘 4푘 푘−1 푘=1 ∞ 푘 = 1 − 2 ∑ 풞푘−1푥 . 푘=1 Then,

∞ 1 − √1 − 4푥 = ∑ 풞 푥푘−1. 2푥 푘−1 푘=1

Thus we obtain the generating function 풞(푥). ∎

54 | Catalan Numbers

1 ퟐ풏 − 2 COROLLARY 3.6. Generating function of the sequence {( 풏 )} is (1 − 4푥) .

1 ∞ 푘 Proof. In the proof of above theorem, we have obtained that (1 − 4푥)2 = 1 − 2 ∑푘=1 풞푘−1푥 . Differentiating both sides of the equality we have

∞ 1 − 푘−1 −2(1 − 4푥) 2 = −2 ∑ 푘풞푘−1푥 푘=1 ∞ 푘 = −2 ∑(푘 + 1) 풞푘푥 푘=0 ∞ 2푘 = −2 ∑ ( ) 푥푘. ∎ 푘 푘=0

An Approximation for 퓒풏

푛 푛 22푛 Using the Stirling approximation 푛! = ( ) √2휋푛 for 푛! , one obtains (2푛) ≈ 푒 푛 √휋푛 and

22푛 4푛 풞푛 ≈ ≈ . (푛 + 1)√휋푛 푛3⁄2√휋

T A B L E O F C A T A L A N N UMBERS

Below table is a list of 풞푛 and its approximations for 푛 = 0,1,2, … ,16.

22푛 4푛 n 풞푛 . (푛 + 1)√휋푛 푛3⁄2√휋 0 1 1 1 1,13 2,26 2 2 2,13 3,19 3 5 5,21 6,95 4 14 14,44 18,05 5 42 43,06 51,67 6 132 134,78 157,24 7 429 436,72 499,11 8 1430 1452,51 1634,07 9 4862 4929,96 5477,74 10 16796 17007,18 18707,90 11 58786 59457,60 64862,84 12 208012 210189,50 227705,30 13 742900 750075,90 807774,10 14 2674440 2698421 2891165 15 9694845 9775958 10427688 16 35357670 35634938 37862122

Catalan Numbers | 55

P R O B L E M S I N V O L V I N G C A T A L A N N UMBERS

There are many interesting problems whose solutions involve Catalan numbers. To give some examples, they are related with the number of binary bracketings of 푛 letters, the ballot problem, the number of trivalent planted planar trees, the number of states possible in an 푛-flexagon, the number of different diagonals possible in a frieze pattern, the number of Dyck paths with 푛 strokes, the number of ways of forming an 푛-fold exponential, the number of rooted planar binary trees with 푛 internal nodes, the number of rooted plane bushes with 푛 graph edges, the number of extended binary trees with 푛 internal nodes, and the number of mountains which can be drawn with 푛 upstrokes and 푛 downstrokes, the number of noncrossing handshakes possible across a round table between 푛 pairs of people. The book Enumerative Combinatorics: Volume 2, by Richard P. Stanley describes many different interpretations of the Catalan numbers.

Here we give several examples of such questions. Exercises at the end of this chapter also con- sider such problems.

Problem 1. There are 2푛 distinct points given on a circle. If no pair of chords intersect in or on the circle, find the number of drawing 푛 chords whose end points are the given points.

in the clockwise sense, label each point either 0 or 1. Assign a 0 to the first point. For the following points, if the point is end point of a chord whose other end is already has been labeled assign 1, otherwise assign 0. In this man- ner we obtain a balanced Dyck sequence. It is not difficult to show that the drawings and labelings are in one-to-one correspondence. It follows that the number of such

drawings is 풞푛.

Problem 2. Find the of ways of distributing 20 balls to 20 labeled boxes such that the total number of balls in the first 푘 boxes is at least 푘 for 푘 = 1, … ,20.

Assume that the balls are distributed in the desired manner. Represent the 푘-th box

with the array 푢푘 = 0 ⋯ 01 where the number of zeroes is equal to the number of balls

in that box. Then the concatenation 푢1 ∥ ⋯ ∥ 푢20 of these arrays is a balanced Dyck ar-

ray. The number of distributions is 풞푛.

Problem 3. Find the number of ways of arranging the integers 1,2, … ,2푛 as a 2 × 푛 array such that each row is in ascending order and 푘 th term of the first row is larger than the 푘 th term of second row for 푘 = 1,2, … , 푛.

56 | Catalan Numbers

Assume that we are given an arrangement satisfying the required conditions. Define

the sequence 푠1, … , 푠2푛 such that 푠푖 = 푎 if 푖 is in the first array or 푠푖 = 푏 otherwise. Then

necessarily, {푠푛} is a Dyck sequence. Then the arrangement given below

2 5 6 8 11 12

1 3 4 7 9 10

corresponds to the sequence {푠푛} as follows:

푛 1 2 3 4 5 6 7 8 9 10 11 12

푠푛 b a b b a a b a b b a a

It follows that the number of such arrangements is 풞푛.

Problem 4. A triangulation of a plane region is a partition of the region into pairwise non-inter- secting triangles. Find the number of all triangulations a convex 푛-gon by non-inter- secting diagonals. The following hexagons illustrate the case 푛 = 6.

Let 푇푛 be the number of triangulations of a convex 푛-gon 푛 = 4,5, …. It is obvious that

푇4 = 2, 푇5 = 5, … . By convention we set 푇2 = 푇3 = 1. Assume that 퐴1퐴2 ⋯ 퐴푛 is a

given convex 푛-gon. In each triangulation of the 푛-gon, the side 퐴1퐴2 will be a side of

the triangle 퐴1퐴2퐴푘 for some 푘 = 3, … , 푛.

If 푘 = 3, then 푛-gon is subdivided into two regions: a triangle (퐴1퐴2퐴3) and a (푛 − 1)-

gon (퐴1퐴3퐴4 ⋯ 퐴푛) . Since the (푛 − 1)-gon can be triangulated in 푇푛−1 ways, 퐴1퐴2퐴3

appears in 푇푛−1 triangulations. If 푘 = 4, … , 푛 − 1, then 푛-gon is subdivided into three regions: a 푘 − 1-gon

(퐴2퐴3 ⋯ 퐴푘), a triangle (퐴1퐴2퐴푘) and a (푛 − 푘 + 2)-gon (퐴1퐴푘 … 퐴푛). Therefore the

퐴1퐴2퐴푘 appears in 푇푘−1 ⋅ 푇푛−푘+2 triangulations.

If 푘 = 푛, then 푛-gon is subdivided into two regions: a (푛 − 1)-gon (퐴2퐴3 ⋯ 퐴푛) and a

triangle (퐴1퐴2퐴푛). Then, 퐴1퐴2퐴푛 appears in 푇푛−1 triangulations. Since the cases for 푘 = 3, … , 푛 are all pairwise disjoint, the number of all triangulations of the 푛-gon is the sum of numbers triangulations in all these cases.

Then we obtain the recursion

푇푛 = 푇푛−1 + 푇3푇푛−2 + 푇4푇푛−3 + ⋯ + 푇푛−3푇4 + 푇푛−2푇3 + 푇푛−1.

Catalan Numbers | 57

Using the convention 푇2 = 1, the recursion can be written as

푇푛 = 푇2푇푛−1 + 푇3푇푛−2 + 푇4푇푛−3 + ⋯ + 푇푛−3푇4 + 푇푛−2푇3 + 푇푛−1푇2. or

푇푛+2 = 푇2푇푛+1 + 푇3푇푛 + 푇4푇푛−1 + ⋯ + 푇푛−1푇4 + 푇푛푇3 + 푇푛+1푇2.

Now, substitution 퐶푛 = 푇푛+2 leads to write

퐶푛 = 퐶0퐶푛−1 + 퐶1퐶푛−2 + 퐶2퐶푛−3 + ⋯ + 퐶푛−3퐶2 + 퐶푛−2퐶1 + 퐶푛−1퐶0. The last recursion we have obtained is the recursion satisfied by Catalan numbers.

Since 퐶0 = 푇2 = 1 = 풞0, we conclude that 퐶푛 = 풞0. It follows that the number of possi-

ble triangulations is 푇푛 = 풞푛−2.

E XERCISES

1. 푝 students, each one having a single 10 TL banknote and 푞 students, each one having a single 20 TL banknote, form a queue in front of a counter to buy 10 TL worth tickets. Each student is to buy only one ticket. At the beginning there are no banknotes at the counter. The counter quits selling tickets once he faces with a 20 TL banknote when he has no change to re-pay 10 TL. If we call a queue, ‘good queue’ if all the students buy tickets, find the number of good queues.

2. Suppose we have an election between two candidates and the ballots are counted one-by-one. Further suppose that the first candidate is never behind (she’s always ahead or tied), but that the final count ends in a tie with each candidate getting n votes. How many ways can this hap- pen?

3. Let ∗ be a non-associative binary operation defined on a set 푋. For 푥1, 푥2, … , 푥푛 ∈ 푋, find the

number of distinct ways of performing the operation 푥1 ∗ 푥2 ∗ ⋯ ∗ 푥푛. 4. Find the number of expressions containing 푛 pairs of parentheses which are correctly matched: ((())) ()(()) ()()() (())() (()()).

5. A monotonic path along the edges of a grid with 푛 × 푛 square cells is one which starts in the lower left corner, fin- ishes in the upper right corner, and consists entirely of edges pointing rightwards or upwards. Find the number of monotonic paths which do not pass above the diagonal. The following diagrams show the case 푛 = 4

6. Find the number of ways to tile a stair step shape of height 푛 with 푛 rectangles. The fol- lowing figure illustrates the case 푛 = 4.

58 | Catalan Numbers

Fibonacci or Leonard of Pisa (1170-1250), played an important role in reviving ancient mathe- matics while making significant contributions of his own. He traveled to North Africa, Egypt, Syria, recognizing the advantages of the mathematical systems used in these countries. Liber Abaci, published in 1202 after his return to Italy, is based on bits of arithmetic and algebra that Leonardo had accumulated during his travels. The Liber Abbaci introduced the Hindu-Arabic place-valued decimal system and the use of Arabic numerals into Europe. In Liber Abaci the following problem is posed: How many pairs of rabbits will be produced in a year, beginning with a single pair, if in every month each pair bears a new pair which be- comes productive from the second month on? Today the solution to this problem is known as the Fibonacci sequence, or Fibonacci numbers. A search of the Internet for “Fibonacci” will find doz- ens of Web sites and hundreds of pages of material. There is even a Fibonacci Association that pub- lishes a scholarly journal, the Fibonacci Quarterly.

F IBONACCI ' S R ABBITS

The problem posed in Liber Abaci of Fibonacci can be formulated as follows. Beginning with a pair of new born rabbits, how many pairs of rabbits could be reached in a year assuming that

 each rabbit reaches maturity after one month,  the gestation period of a rabbit is one month,  each mature female rabbit gives birth to one male and one female rabbit every month,  no rabbits die during the year. After one month, the first pair is not mature and can't mate. At two months, the rabbits have mated but not yet given birth, resulting in only one pair of rabbits. After three months, the first pair will give birth to another pair, resulting in two pairs. At the fourth month mark, the original pair gives birth again, and the second pair mates but does not yet give birth, leaving the total at three pairs. This continues until a year has passed. Say that the number of newborn and mature

Fibonacci Numbers | 59

pairs at month 푛 are 픟푛 and 픪푛, respectively. Next month all these rabbits will be mature, i.e., 픪푛+1 = 픪푛 + 픟푛. For each mature pair of 푛th month, there will be a pair of newborn pair in next month: 픟푛+1 = 픪푛. Now we have 픪푛+1 + 픟푛+1 = (픪푛 + 픟푛) + 픪푛 = (픪푛 + 픟푛) + (픪푛−1 +

픟푛−1). Denoting the number of all rabbits in the 푛th month by 픯푛, that is, 픯푛 = 픪푛 + 픟푛, we get the relation 픯푛+1 = 픯푛 + 픯푛−1 for 푛 = 1,2,3, … . Since we have started with a pair of new born pair 픯1 =

1. One month later we have a pair of mature rabbits, thus 픯2 = 1. Then the remaining terms of the sequence {픯푛} can be computed as 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233. One year later there will be 233 pairs of rabbits.

F I B O N A C C I S EQUENCE

Let {푎푛} be a solution of the recursion

푎푛+2 = 푎푛+1 + 푎푛. (1)

∞ 푛+2 2 We can write ∑푘=0(푎푛+2 − 푎푛+1 − 푎푛) 푥 = 0. By letting 푎(푥) = 푎0 + 푎1푥 + 푎2푥 + ⋯ to be 2 the generating function of {푎푛} we see that 푎(푥) − 푎1푥 − 푎0 − 푥푎(푥) + 푥푎0 − 푥 푎(푥) = 0 which gives

푎 + (푎 − 푎 )푥 (2) 푎(푥) = 0 1 0 . 1 − 푥 − 푥2

1+ 5 1− 5 Now, (1 − 휑푥)(1 − 휓푥) of 1 − 푥 − 푥2, where 휑 = √  and 휓 = √ yields 2 2 1 푎 − 휓푎 휑푎 − 푎 푎(푥) = ( 1 0 + 0 1) √5 1 − 휑푥 1 − 휑푥

∞ ∞ 1 푘 1 푘 = (푎1 − 휓푎0) ∑(휑푥) + (휑푎0 − 푎1) ∑(휓푥) 5 5 √ 푘=0 √ 푘=0

∞ 1 푘 푘 푘 = ∑((푎1 − 휓푎0)휑 + (휑푎0 − 푎1)휓 ) 푥 . 5 √ 푘=0

Thus, the general term of {푎푛} is

1 푛 푛 (3) 푎푛 = ((푎1 − 휓푎0)휑 + (휑푎0 − 푎1)휓 ). √5

1+ 5  휑 = √ =1.618033⋯ is known as the golden ratio. 2

60 | Fibonacci Numbers

Fibonacci sequence {픣푛} is the solution of (1) with the initial values 픣0 = 0, 픣1 = 1. Each term of this sequence is called a Fibonacci number. First few Fibonacci numbers are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, ⋯. From (3), the general term of this sequence is

1 푛 푛 픣푛 = (휑 − 휓 ). √5

This expression for the general term is known as Binet’s formula9. From (2) we obtain the generating function of {픣푛} as

푥 픣(푥) = . 1 − 푥 − 푥2

For 푛 ≤ 1, by writing the basic recursion as 픣푛−2 = 픣푛 − 픣푛−1 , Fibonacci numbers 픣−1, 픣−2, … with negative indices can be defined:

For 푛 = 1, 픣−1 = 픣1 − 픣0 = 1

For 푛 = 0, 픣−2 = 픣0 − 픣−1 = −1

For 푛 = −1, 픣−3 = 픣−1 − 픣−2 = 2

For 푛 = −2, 픣−4 = 픣−2 − 픣−3 = −3

For 푛 = −3, 픣−5 = 픣−3 − 픣−4 = 5

∞ The resulting ‘bidirectional’ sequence {픣푛}푛=−∞ is

⋯ , −55, 34, −21, 13, −8, 5, −3, 2, −1, 1, 0, 1, 1, 2, 3, 5, ⋯

It can be shown that

푛+1 픣−푛 = (−1) 픣푛 .

Binet’s formula holds for negative indices as well.

PROPOSITION 4.1. General term of the solution {푎푛} of (1) with initial terms 푎0, 푎1 is

푎푛 = 푎1픣푛 + 푎0픣푛−1.

9 Jacques Philippe Marie Binet (1786 –1856), French mathematician, physicist and astronomer.

Fibonacci Numbers | 61

Proof. From (3) we obtain

1 푛 푛 푎푛 = ((푎1 − 휓푎0)휑 + (휑푎0 − 푎1)휓 ) √5

1 푛 푛 푛 푛 = (푎1(휑 − 휓 ) + 푎0(−휓휑 + 휑휓 )) √5

1 푛 푛 푛−1 푛−1 = (푎1(휑 − 휓 ) + 푎0(휑 − 휓 )) . √5

Now the claim follows from Binet's formula. ∎

Example 1 The solution {ℒ푛} of (1) with initial conditions ℒ0 = 2, ℒ1 = 1 is called the Lucas se- (Lucas10 Numbers). quence. Then, the general term of this sequence is

ℒ푛 = 픣푛 + 2픣푛−1 1 = (휑푛 + 2휑푛−1 − 휓푛 − 2휓푛−1) √5 1 = (휑푛−1(휑 + 2) − 휓푛−1(휓 + 2)) √5

Note that 휑 + 2 = √5 휑 and 휓 + 2 = −√5 휓. Then

푛 푛 ℒ푛 = 휑 + 휓 .

2−푥 Generating function of the Lucas sequence is ℒ(푥) = . Each term of this sequence is 1−푥−푥2 called a . First few Lucas numbers are:

2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, ⋯

Matrix Representation o f Fibonacci Numbers

For any integer 푛, basic recursion of Fibonacci sequence can be written as

픣푛+1 1 1 픣푛 ( ) = ( ) ( ) . 픣푛 1 0 픣푛−1

10 François Édouard Anatole Lucas (1842 –1891), French mathematician.

62 | Fibonacci Numbers

It follows that

푛 픣푛+1 1 1 1 ( ) = ( ) ( ) . 픣푛 1 0 0

It is easy to observe that

1 1 푛 픣 픣 ( ) = ( 푛+1 푛 ). 1 0 픣푛 픣푛−1

B A S I C I DENTITIES

In this section we prove that the following equalities hold for all integers 푛, 푚 and 푟.

픣푛+푚 = 픣푛+1픣푚 + 픣푛픣푚−1

픣2푛 = 픣푛+1픣푛 + 픣푛픣푛−1

2 2 픣2푛+1 = 픣푛+1 + 픣푛

2 푛−1 11 픣푛 − 픣푛+1픣푛−1 = (−1) (Cassini’s Identity)

2 푛−푟 2 픣푛 − 픣푛+푟픣푛−푟 = (−1) 픣푟 (Catalan’s Identity)

푛 12 픣푚+1픣푛 − 픣푚픣푛+1 = (−1) 픣푚−푛. (D’Ocagne’s Identity)

THEOREM 4.2. For any integers 푚 and 푛, Fibonacci numbers satisfy the following:

픣푛+푚 = 픣푛+1픣푚 + 픣푛픣푚−1.

Proof. Since for any integers 푛 and 푚, 퐴푛퐴푚 = 퐴푛+푚 for any square matrix 퐴, we can write

1 1 푛+푚 1 1 푛 1 1 푚 ( ) = ( ) ( ) which is equivalent to write 1 0 1 0 1 0

픣 픣 픣 픣 픣 픣 ( 푛+푚+1 푛+푚 ) = ( 푛+1 푛 ) . ( 푚+1 푚 ) 픣푛+푚 픣푛+푚−1 픣푛 픣푛−1 픣푚 픣푚−1 픣 픣 + 픣 픣 픣 픣 + 픣 픣 = ( 푛+1 푚+1 푛 푚 푛+1 푚 푛 푚−1). 픣푛픣푚+1 + 픣푛−1픣푚 픣푛픣푚 + 픣푛−1픣푚−1

Comparing the corresponding entries of these matrices, desired identity follows. ∎

11 Giovanni Domenico Cassini (1625 –1712), Italian mathematician,astronomer, astrologer and engineer. 12 Philbert Maurice d'Ocagne (1862 –1938), French engineer and mathematician.

Fibonacci Numbers | 63

COROLLARY 4.3. For any integer 푛, the following equalities hold true:

2 2 픣2푛 = 픣푛+1 − 픣푛−1, 2 2 픣2푛+1 = 픣푛+1 + 픣푛 .

Proof. In the theorem substitute 푚 = 푛 to obtain the first identity:

2 2 픣2푛 = 픣푛+1픣푛 + 픣푛픣푛−1 = 픣푛(픣푛+1 + 픣푛−1) = (픣푛+1 − 픣푛−1)(픣푛+1 + 픣푛−1) = 픣푛+1 − 픣푛−1. The second identity is obtained directly from the theorem by substituting 푚 = 푛 + 1. ∎

THEOREM 4.4 (Cassini’s Identity). For any integer 푛, Fibonacci numbers satisfy the following identity:

2 푛−1 픣푛 − 픣푛+1픣푛−1 = (−1) .

Proof. Result directly follows from

푛 픣푛+1 픣푛 2 1 1 푛 det ( ) = 픣푛+1픣푛−1 − 픣푛 = det ( ) = (−1) . ∎ 픣푛 픣푛−1 1 0

LEMMA 4.5. For any integer 푚, the following equality holds:

2 2 푚 픣푚+1 − 픣푚픣푚+1 − 픣푚 = (−1) . Proof.

2 2 푓푚+1 − 픣푚픣푚+1 − 픣푚 = (픣푚+1+픣푚)(픣푚+1 − 픣푚)−픣푚픣푚+1

= 픣푚+1픣푚−1 + 픣푚픣푚−1 − 픣푚픣푚+1 2 푛 = 픣푚 + (−1) − 픣푚(픣푚+1 − 픣푚−1) 2 푚 2 = 픣푚 + (−1) − 픣푚 = (−1)푚.

The claim follows. ∎

The following is a generalization of Cassini’s identity.

THEOREM 4.6 (Catalan’s Identity). For all integers 푛 and 푟 the following identity is true. 2 푛−푟 2 픣푛 − 픣푛+푟픣푛−푟 = (−1) 픣푟.

Proof. For arbitrary integers 푚 and 푎 we have

2 2 픣푚+푎 − 픣푚+2푎픣푚 = (픣푚+1픣푎 + 픣푚픣푎−1) − (픣푚+1픣2푎 + 픣푚픣2푎−1)픣푚 2 2 2 2 = 픣푚+1픣푎 + 푓푚픣푎−1 + 2픣푚+1픣푎픣푚픣푎−1 2 2 = −픣푚[픣푚+1(픣푎+1픣푎 + 픣푎픣푎−1) + 픣푚(픣푎 + 픣푎−1)] 2 2 2 2 = 픣푚+1픣푎 + 픣푚+1픣푎픣푚픣푎−1 − 픣푚픣푚+1픣푎픣푎+1 − 픣푚픣푎

64 | Fibonacci Numbers

2 2 2 2 2 = 픣푚+1픣푎 − 픣푚픣푚+1픣푎 + 픣푚픣푎 2 2 2 = ( 픣푚+1 − 픣푚픣푚+1 − 픣푚)픣푎 푚 2 = (−1) 픣푎.

Now substitute 푚 = 푛 − 푟 and 푟 = 푎. ∎

THEOREM 4.7 (d'Ocagne's Identity). For all integers 푚 and 푛 the following identity is true. 푛 픣푚픣푛+1 − 픣푚+1픣푛 = (−1) 픣푚−푛.

Proof.

1 푚 푚 푛+1 푛+1 푚+1 푚+1 푛 푛 픣푚픣푛+1 − 픣푚+1픣푛 = [(휑 − 휓 )(휑 − 휓 ) − (휑 − 휓 )(휑 − 휓 )] √5 1 = (−휑푚휓푛+1 − 휓푚휑푛+1 + 휑푚+1휓푛 + 휓푚+1휑푛) √5 1 = [휑푚휓푛(휑 − 휓) − 휑푛휓푚(휑 − 휓)] √5 1 = 휑푛휓푛[휑푚−푛 − 휓푚−푛] √5

Now the result follows from Binet’s formula and the fact that 휑휓 = −1. ∎

D E C I M A T E D S UBSEQUENCES

In this section we investigate the properties of decimated subsequences of {픣푛}. Since a regular decimation of a sequence does not increase the linear complexity, any decimated subsequence of

{픣푛} has linear complexity at most 2.

Example 2. Let {픤푛} be the 2 −decimated subsequence of {픣푛}, that is 픤푛 = 픣2푛, 푛 = 1,2, …. If 픤(푥)

is the generating function of {픤푛}, then 1 픤(푥) = [픣(√푥) + 픣(−√푥)] 2 1 √푥 −√푥 = ( + ) 2 1 − √푥 − 푥 1 + √푥 − 푥 푥 = . 1 − 3푥 − 푥2

It follows that 픤푛+2 = 3픤푛+1 − 픤푛.

Fibonacci Numbers | 65

LEMMA 4.8. For any positive integer 푘, Fibonacci numbers satisfy the relation

푘 픣푛+푘 + (−1) 픣푛−푘 = ℒ푘픣푛

푛 = 푘, 푘 + 1, … where ℒ푘 is the 푘 th Lucas number.

Proof. By Binet’s formula

1 푛 푛 푘 푘 ℒ푘픣푛 = (휑 − 휓 )(휑 + 휓 ) √5 1 = (휑푛+푘 − 휓푛+푘 + 휑푘휓푘(휑푛−푘 − 휓푛−푘)). √5

Since 휑휓 = −1, claim follows. ∎

THEOREM 4.9. If {푤푛} is a 휆 −decimated subsequence of {픣푛}, that is 푤푛 = 픣휆푛+휇 for some inte- gers 0 ≤ 휇 < 휆 , then terms of {푤푛} satisfy the linear recursion

휆 푤푛+1 = ℒ휆푤푛 − (−1) 푤푛−1.

Proof. Using the lemma, we write

휆 휆 푤푛+1 + (−1) 푤푛−1 = 픣휆푛+휇+휆 + (−1) 픣휆푛+휇−휆 = ℒ휆픣휆푛+휇.

Since 픣휆푛+휇 = 푤푛, the desired equality is obtained. ∎

Example 3. Below table demonstrates subsequences {픣휆푛+휇} for several values of 휆 and 휇 to-

gether with the recursion of the subsequence.

(휆, 휇) {픣휆푛+휇} recursion

(2,0) 0 1 3 8 21 55 144 377 987 2584 ⋯ 푢푛 = 3푢푛−1 − 푢푛−2

(3,0) 0 2 8 34 144 610 2584 10946 46368 196418 ⋯ 푢푛 = 4푢푛−1 + 푢푛−2

(3,1) 1 3 13 55 233 987 4181 17711 75025 317811 ⋯ 푢푛 = 4푢푛−1 + 푢푛−2

(3,2) 1 5 21 89 377 1597 6765 28657 121393 514229 ⋯ 푢푛 = 4푢푛−1 + 푢푛−2

(4,3) 1 8 55 377 2584 17711 121393 832040 5702887 39088169 ⋯ 푢푛 = 7푢푛−1 − 푢푛−2

(5,0) 0 5 55 610 6765 75025 832040 9227465 102334155 ⋯ 푢푛 = 11푢푛−1 + 푢푛−2

(5,3) 2 21 233 2584 28657 317811 3524578 39088169 433494437 ⋯ 푢푛 = 11푢푛−1 + 푢푛−2

(6,2) 1 21 377 6765 121393 2178309 39088169 701408733 ⋯ 푢푛 = 18푢푛−1 − 푢푛−2

(7,0) 0 13 377 10946 317811 9227465 267914296 7778742049 ⋯ 푢푛 = 29푢푛−1 + 푢푛−2

(8,1) 1 34 1597 75025 3524578 165580141 7778742049 ⋯ 푢푛 = 47푢푛−1 − 푢푛−2

66 | Fibonacci Numbers

F I N I T E S U M S I N V O L V I N G 햋풏

In this section we compute the following finite sums:

∑ 픣푘 = 픣푛+2 − 1, 푘=0 푛

∑ 푘픣푘 = (푛 + 1)픣푛+2 − 픣푛+4 + 2, 푘=0 푛

∑ 픣2푘 = 픣2푛+1 − 1, 푘=0 푛

∑ 픣2푘+1 = 픣2푛+2, 푘=0 푛 2 ∑ 픣푘 = 픣푛픣푛+1. 푘=0 First recall that if 푢 and 푈 are functions defined on integers such that Δ푈(푘) = 푈(푘 + 1) − 푈(푘) = 푢(푘), then

∑ 푢푘 = 푈(푏 + 1) − 푈(푎). 푘=푎

The following proposition computes two useful differences concerning Fibonacci numbers.

PROPOSITION 4.10. For any integer 푘 we have

Δ픣푘+1 = 픣푘,

Δ[푘픣푘+1 − 픣푘+3] = 푘픣푘.

Proof. Since for any 푘 ≥ 1, Δ픣푘 = 픣푘+1 − 픣푘 = 픣푘−1 we obtain the first equality. For the second equality, first observe that Δ푘픣푘+1 = (푘 + 1)픣푘+2 − 푘픣푘+1 = 푘(픣푘+2 − 픣푘+1) + 픣푘+2 = 푘픣푘 + 픣푘+2.

On the other hand, Δ픣푘+3 = 픣푘+2 , so Δ[푘픣푘+1 − 픣푘+3] = 푘픣푘. ∎

푛 Using the above proposition we immediately obtain ∑푘=1 픣푘 = 픣푛+2 − 1 and similarly

∑ 푘픣푘 = (푛 + 1)픣푛+2 − 픣푛+4 + 픣3 = (푛 + 1)픣푛+2 − 픣푛+4 + 2. 푘=0

Each of the remaining three sums can be written as a telescoping series:

Fibonacci Numbers | 67

∑ 픣2푘 = 픣0 + 픣2 + 픣4 + 픣6 + ⋯ + 픣2푛−2 + 픣2푛 푘=0

= 0 + (픣3 − 픣1) + (픣5 − 픣3) + (픣7 − 픣5) + ⋯ + (픣2푛−1 − 픣2푛−3) + (픣2푛+1 − 픣2푛−1)

= 픣2푛+1 − 픣1.

∑ 픣2푘+1 = 픣1 + 픣3 + 픣5 + 픣7 + ⋯ + 픣2푛−1 + 픣2푛+1 푘=0

= (픣2 − 픣0) + (픣4 − 픣2) + (픣6 − 픣4) + (픣8 − 픣6) + ⋯ + (픣2푛+1 − 픣2푛−2)

+ (픣2푛+2 − 픣2푛)

= 픣2푛+2.

푛 2 2 2 2 2 2 ∑ 픣푘 = 픣1 + 픣2 + 픣3 + ⋯ + 픣푛−1 + 픣푛 푘=0

= (픣1픣2 − 픣1픣0) + (픣2픣3 − 픣2픣1) + (픣3픣4 − 픣3픣2) + ⋯ + (픣푛−1픣푛 − 픣푛−1픣푛−2)

+ (픣푛픣푛+1 − 픣푛픣푛−1)

= 픣푛픣푛+1.

C ONVERGENCE OF R ATIOS AND THE G E N E R A T I N G F UNCTION

픣 픣 For any positive integer 푛, 푐onsider the ratio 푛+1 which can be written as 푛+1 = 픣푛 픣푛

휑푛+1−휓푛+1 휑−휓 (휓⁄휑)푛 휓 = . Since |휑| > |휓|, we have lim ( ) = 0, then 휑푛−휓푛 1−(휓⁄휑)푛 푛→∞ 휑

픣푛+1 lim ( ) = 휑. 푛→∞ 픣푛

휑푛+푘−휓푛+푘 휑푘−휓푘 (휓⁄휑)푛 Similarly, for any positive integer 푘, the ratio 픣 ⁄픣 can be written as = . 푛+푘 푛 휑푛−휓푛 1−(휓⁄휑)푛

Then

픣 lim ( 푛+푘) = 휑푘. 푛→∞ 픣푛

1 1 The series ∑∞ 픣 푥푘 is convergent for − < 푥 < and for such 푥, the sum is given by 푘=0 푘 휑 휑

∞ 푥 ∑ 픣 푥푘 = . 푘 1 − 푥 − 푥2 푘=0

68 | Fibonacci Numbers

1 Example 4. By substituting 푥 = in the generating function of {픣 } we have 2 푛

∞ 픣 ∑ 푘 = 2. 2푘 푘=0

픣푛 1 ∞ 푘 Note that < if and only if 푛 is even. Then the sequence ∑푘=0 픣푘푥 is convergent 픣푛+1 휑 픣 for 푥 = 2푛 where 푛 is some fixed integer. We obtain 픣2푛+1

∞ 푘 픣2푛 픣2푛픣2푛+1 ∑ ( ) 픣푘 = 2 2 픣2푛+1 픣 − 픣2푛픣2푛+1 − 픣 푘=0 2푛+1 2푛

2 2 푚 But since 픣푚+1 − 픣푚픣푚+1 − 픣푚 = (−1) for any integer 푚, denominator of the righthandside is 1. S we get

∞ 푘 픣2푛 ∑ ( ) 픣푘 = 픣2푛픣2푛+1. 픣2푛+1 푘=0

S O M E O T H E R P ROPERTIES

- For each positive integer 푛, the sequence 푛 푛−1 푛−2 푛−3 푛−푘 (0), ( 1 ), ( 2 ), ( 3 ), … ( 푘 ) where 푘 = ⌊푛/2⌋ is called a shallow diagonal of the Pascal’s triangle. The sum of all terms on a shallow diagonal is a Fibonacci number: ⌊푛/2⌋ 푛 − 푘 ∑ ( ) = 픣 . 푘 푛 푘=0

(See Theorem 1.5.)

- We have two more examples which involve Fibonacci numbers and binomial coefficients: 푛 푛 푛 푛 ∑ ( ) 픣 = 픣 , ∑ ( ) 2푘픣 = 픣 . 푘 푘 2푛 푘 푘 3푛 푘=0 푘=0

- Applying binomial inversion to above expressions we have:

푛 푛 푛 푛 ∑(−1)푛−푘 ( ) 픣 = 픣 , ∑(−1)푛−푘 ( ) 픣 = 2푛픣 . 푘 2푘 푛 푘 3푘 푛 푘=0 푘=0

Fibonacci Numbers | 69

휑푛 - We can compute the 푛th Fibonacci number by rounding up to the closest integer. In √5 1 |휓| 1 Binet’s formula 픣 = (휑푛 − 휓푛), since < , for any integer 푛, 픣 is the closest integer 푛 √5 √5 2 푛 휑푛 to . That is, √5

휑푛 픣푛 = [ ]. √5

- Any power of the golden ratio can be written as a linear combination of 휑 and 1 with inte- 푛 ger coefficients as 휑 = 휑픣푛 + 픣푛−1.

- Golden ratio is the limit of a continuous fraction:

1 휑 = 1 + . 1 1 + 1 1 + 1 1 + 1+⋱

∞ 1 - Reciprocal Fibonacci constant: ∑푘=1 = 3.359885 ⋯. 픣푘

- Golden ratio is the limit of a nested square roots:

휑 = √1 + √1 + √1 + ⋯.

- An integer 푚 is a Fibonacci number if and only if at least one of 5푚2 + 4 and 5푚2 − 4 is a perfect square.

- If it is known that a given integer is a Fibonacci number, then the index of 퐹 in the sequence

{픣푛} is

1 푛(퐹) = ⌊log ( + 퐹 ⋅ √5)⌋. 휑 2

- For any positive integers 푚 and 푛, if 푚|푛, then 픣푚|픣푛.

- For any positive integers 푚 and 푛, gcd(픣푚, 픣푛) = 픣gcd (푚,푛).

2 2 - For any integer 푛 > 1, (픣2푛−1 , 2픣푛픣푛−1 , 픣푛 − 픣푛−1) is a Phytogoran triple.

70 | Fibonacci Numbers

E XERCISES

1. Show that

a) 픣푛−1 + 픣푛+1 = ℒ푛,

b) ℒ푛−1 + ℒ푛+1 = 5픣푛,

c) 픣2푛 = ℒ푛픣푛,

푛 d) 픣푛푚 = ℒ푛픣푛(푚−1) − (−1) 픣푛(푚−2),

1 e) 픣 픣 = [ℒ − (−1)푚ℒ ]. 푛 푚 5 푛+푚 푛−푚

2. Prove that greatest common of two Fibonacci numbers is again a Fibonacci numbers. Spe-

cifically

gcd(픣푛, 픣푚) = 픣gcd(푚,푛).

3. Prove that

푛 푛 + 푘 ∑ ( ) = 픣 . 2푘 2푛+1 푘=0

4. Let {픣푛} be the standard Fibonacci sequence (픣0 = 픣1 = 1). For each of the following, write first

few terms of {푢푛}, find the generating function of {푢푛}, find a constant coefficient, linear, homo-

geneous linear recursion of smallest possible value satisfied by {푢푛}, evaluate lim 푢푛+1/푢푛 and 푛→∞

determine whether {푢푛} is periodic.

2 a) 푢푛 = (픣푛) , 1 + 픣푛 2|푛 g) 푢푛 = { , 푛 + 픣푛 otherwise 2 b) 푢푛 = 픣푛 + 푛 ,

c) 푢푛 = 픣푛 + 3, 픣푛 + 1 2|푛 h) 푢푛 = { , 픣푛 − 1 otherwise d) 푢푛 = 픣2푛,

e) 푢푛 = 픣0 + 픣1 + ⋯ + 픣푛, 3 + 픣푛 2|푛 or/and 3|푛 i) 푢푛 = { . 푛 + 픣푛 otherwise 1 + 픣푛 2|푛 f) 푢푛 = { , 푛 + 픣푛 otherwise

5. Show that the number of ways to cover a 2 × 푛 checkerboard by 2 × 1 dominoes is 픣푛+1. The figure

shows all possible 픣6 = 8 ways of covering a 2 × 5 checkerboard.

Fibonacci Numbers | 71

6. Find the number of subsets of {1,2, … , 푛} which do not contain any pair of two consecutive num-

bers.

7. Compute the probability of not getting two heads in a row of 푛 tosses of a coin.

8. Find the number of ways in which 푛 coin tosses can be made such that there are not three con-

secutive heads or tails.

9. Find the number of binary strings of length 푛 without consecutive1’s. List of 13 such strings of

length 5 is: 00000, 00001, 00010, 00100, 00101, 01000, 01001, 01010, 10000, 10001, 10010,

10100, 10101.

10. Show that the number of binary strings of length 푛 without an odd number of consecutive 1’s is

the Fibonacci number 픣푛+1.

11. Find the number of binary strings of length 푛 without an even number of consecutive 0’s or 1’s.

12. Find the number of permutations 휎1휎2 ⋯ 휎푛 of {1,2, … , 푛} such that |휎푖 − 푖| ≤ 1 for 푖 = 1,2, … 푛.

13. Find the number of ways of arranging coins in rows such that

there are no gaps between blocks of coins in each row, each

coin except ones on the bottom row touches two coins on the

row below, and there are 푛 coins in the bottom row. The figure shows all possible ways for 푛 =

1,2,3,4.

72 | Fibonacci Numbers

James Stirling13 (1692-1770), remembered for the Stirling numbers, the Stirling's interpolation formula, and the formula for the Gamma function among many other things, was one of the great minds of classic numerical analysis. Among Stirling's goals was to find methods to speed up series convergence. The studies yield interesting number sequences that are now known as Stirling numbers. Stirling numbers have applications in various fields of study, particularly in combinatorial problems. Generalized definitions and implementations for the two types of Stirling numbers are desired. Following types of problems are related with Stirling numbers: finding the number of ways to distribute 푛 distinct objects into 푘 non-empty, indistinct bins; number of partitions of a set of 푛 objects into k non-empty subsets; number of equivalence relations with k equivalence classes, defined on a set with n elements; number of , each with exactly k factors greater than 1, of a square- free positive integer that has exactly n different prime factors.

There are two kinds of Stirling numbers and in most cases it is more convenient to start with the second kind.

13 James Stirling (1692-1770), Scottish mathematician.

Stirling Numbers | 73

S T I R L I N G N UMBERS OF T H E S E C O N D K IND

The number of ways of partitioning an 푛 −set into 푚 disjoint subsets is called a Stirling num-

푛 0 푛 ber of the second kind and is denoted by {푚}, by convention we set {0} = 1 and {0} = 0 for any positive integer 푛.

Example 1. Partitions of {1,2,3,4}

1 part {1,2,3,4}

2 parts {1,2,3}{4} {1,2,4}{3} {1,3,4}{2} {2,3,4}{1}

{1,2}{3,4} {1,3}{2,4} {1,4}{2,3}

3 parts {1,2}{3}{4} {1,3}{2}{4} {1,4}{2}{3}

{2,3}{1}{4} {2,4}{1}{3} {3,4}{1}{2}

4 parts {1}{2}{3}{4}

Then we conclude 4 4 4 4 { } = 1 { } = 7 { } = 6 { } = 1. 1 2 3 4

푛 It is easy to observe that {1} = 1, because the only option is to place all the objects into the 푛 single subset. Similarly {푛} = 1, for we must place each object in a different subset. Thus

푛 푛 { } = 1, { } = 1. 1 푛

Choose any nonempty proper subset of a given set 푋 with 푛 elements. This choice, together with its complement, constitutes a partition of 푋 into two subsets. In this way each partition is counted twice, so

푛 { } = 2푛−1 − 1. 2

Any partitioning of 푋 into 푛 − 1 subsets consists of 푛 − 2 subsets with one element and one subset with two elements. Such a partition is completely determined when the subset with two elements is determined. Then

푛 푛 { } = ( ). 푛 − 1 2

74 | Stirling Numbers

THEOREM 5.1 (Basic recursion of the Stirling numbers of the second kind). For any inte- gers 푛 ≥ 2 and 1 ≤ 푚 ≤ 푛, Stirling numbers of the second kind satisfy the recurrence 푛 푛 − 1 푛 − 1 { } = 푚 { } + { }. 푚 푚 푚 − 1

Proof. In a partition of {1, 2, . . . , 푛} into 푚 nonempty subsets, the element 푛 either appears as a singleton or it is in of the 푘 nonempty subsets with more than one element. In the first case, the partition is {푛} together with a partition of {1, 2, . . . , 푛 − 1} into 푚 − 1 nonempty parts. There are 푛−1 {푚−1} of them. In the second case, take a collection of 푚 nonempty subsets partitioning 푛−1 {1, 2, . . . , 푛 − 1}. There are { 푚 } of them. The number 푛 can be put back into any of the 푚 parts. ∎ Example 2. 5 Compute {3}.

5 We will obtain {3} by counting all partitions of the set {퐴, 퐵, 퐶, 퐷, 퐸} into three parts. Below we see that each partition of {퐴, 퐵, 퐶, 퐷, 퐸} into three parts can be obtained from partitions of the set {퐴, 퐵, 퐶, 퐷} into two parts and three parts:

4 4 First recall that {2} = 7 and {3} = 6 (Example 1).

4 We have {3} = 6 and all partitions of {퐴, 퐵, 퐶, 퐷} into 3 parts are: {퐴, 퐵}{퐶}{퐷} {퐴, 퐶}{퐵}{퐷} {퐴, 퐷}{퐵}{퐶} {퐵, 퐶}{퐴}{퐷} {퐵, 퐷}{퐴}{퐶} {퐶, 퐷}{퐴}{퐵}

We can insert the fifth element ‘퐸’, into any one of the existing parts so that

{퐴, 퐵}{퐶}{퐷} ⟼ {퐴, 퐵, 푬}{퐶}{퐷} {퐴, 퐵}{퐶, 푬}{퐷} {퐴, 퐵}{퐶}{퐷, 푬} {퐴, 퐶}{퐵}{퐷} ⟼ {퐴, 퐶, 푬}{퐵}{퐷} {퐴, 퐶}{퐵, 푬}{퐷} {퐴, 퐶}{퐵}{퐷, 푬} {퐴, 퐷}{퐵}{퐶} ⟼ {퐴, 퐷, 푬}{퐵}{퐶} {퐴, 퐷}{퐵, 푬}{퐶} {퐴, 퐷}{퐵}{퐶, 푬} {퐵, 퐶}{퐴}{퐷} ⟼ {퐵, 퐶, 푬}{퐴}{퐷} {퐵, 퐶}{퐴, 푬}{퐷} {퐵, 퐶}{퐴}{퐷, 푬} {퐵, 퐷}{퐴}{퐶} ⟼ {퐵, 퐷, 푬}{퐴}{퐶} {퐵, 퐷}{퐴, 푬}{퐶} {퐵, 퐷}{퐴}{퐶, 푬} {퐶, 퐷}{퐴}{퐵} ⟼ {퐶, 퐷, 푬}{퐴}{퐵} {퐶, 퐷}{퐴, 푬}{퐵} {퐶, 퐷}{퐴}{퐵, 푬}

4 and in this manner we obtain 3 ⋅ {3} = 18 partitions of {퐴, 퐵, 퐶, 퐷, 퐸} into 3 parts.

4 Now we consider the partitions of {퐴, 퐵, 퐶, 퐷} into two parts. We have {2} = 7 and all such partitions are:

{A,B,C}{D} {A,B,D}{C} {A,C,D}{B} {B,C,D}{A} {A,B}{C,D} {A,C}{B,D} {A,D}{B,C}

By appending {퐸} as an additional new part in each of these partitions we get

{A,B,C}{D}{퐸} {A,B,D}{C}{퐸} {A,C,D}{B}{퐸} {B,C,D}{A}{퐸}

{A,B}{C,D}{퐸} {A,C}{B,D}{퐸} {A,D}{B,C}{퐸}

4 {2} = 7 more partitions of {퐴, 퐵, 퐶, 퐷, 퐸} into 3 parts. Then

5 4 4 {3} = 3{3} + {2} = 3 ⋅ 6 + 7 = 25.

Stirling Numbers | 75

THEOREM 5.2. Let 푋 and 푌 be two sets with |푋| = 푛 and |푌| = 푚. The number of functions 푓: 푋 → 푌 such that |푓(푋)| = 푘 is 푚! 푛 { }. (푚 − 푘)! 푚

Proof. Assume that the size of image set 푓(푋) of 푓 is 푘. If 푓(푋) = {푦1, 푦2, ⋯ , 푦푘}, then

−1 −1 푓 (푦1), ⋯ , 푓 (푦푘) is a partition of 푋 into 푘 pairwise disjoint subsets. Consequently any function which has 푘 points in the image set describes a partition of 푋 into 푘 subsets. On the other hand, assume that we have given a partition of 푋 into 푘 subsets, say 푋1, … , 푋푘. Each arrangement

푦1푦2 ⋯ 푦푘 of 푘 elements of 푌 describes a function 푋 → 푌 by setting 푓(푥) = 푦푖 for all 푥 ∈ 푋푖, 푖 =

푚! 1, … , 푘. Thus, each partition of 푋 into 푘 subsets defines (푚)푘! = functions each of which 푘 (푚−푘)! has 푘 points in the image set. ∎

COROLLARY 5.3. Let 푋 and 푌 be two sets with |푋| = 푛 and |푌| = 푚. The number of onto func- 푛 tions 푓: 푋 → 푌 is 푚! {푚}.

Proof. Just write 푘 = 푚 in the theorem. ∎

푚 푚−푘 푚 푛 Since the number of onto functions is given by ∑푘=0(−1) ( 푘 )푘 , a closed form expression 푛 for {푚} is 푚 푛 1 푚 { } = ∑(−1)푚−푘 ( ) 푘푛. 푚 푚! 푘 푘=0

COROLLARY 5.4. For any integers 0 ≤ 푚 ≤ 푛, the following equality holds

푚 푚 푛 ∑ 푘! ( ) { } = 푚푛. 푘 푘 푘=1

Proof. Each side of the equality counts the number of all functions from a set with 푛 elements into a set of 푚 elements in another way. ∎

Now we obtain ordinary and exponential generating functions of Stirling numbers of the sec- ond kind.

76 | Stirling Numbers

LEMMA 5.5. If 푘 ≥ 0, then

푘 푥푘 1 푘 1 = ∑(−1)푘−푗 ( ) . (1 − 푥)(1 − 2푥) ⋯ (1 − 푘푥) 푘! 푗 1 − 푗푥 푗=0

푥 Proof. (By induction on 푘. ) For 푘 = 1 equality holds: left hand side is and right hand side 1−푥

1 푥 is −1 + = . Assume that the equality holds for some integer 푘 ≥ 0 then 1−푥 1−푥

푘 푥푘+1 1 푘 푥 1 = ∑(−1)푘−푗 ( ) ⋅ . (1 − 푥)(1 − 2푥) ⋯ (1 − (푘 + 1)푥) 푘! 푗 1 − (푘 + 1)푥 1 − 푗푥 푗=0

Now we can write the quotient in the summation as

푥 1 1 1 = ( − ) (1 − (푘 + 1)푥)(1 − 푗푥) 푘 + 1 − 푗 1 − (푘 + 1)푥 1 − 푗푥 to obtain

푘 푥푘+1 1 푘 1 1 1 = ∑(−1)푘−푗 ( ) ( − ) (1 − 푥)(1 − 2푥) ⋯ (1 − (푘 + 1)푥) 푘! 푗 푘 + 1 − 푗 1 − (푘 + 1)푥 1 − 푗푥 푗=0

푘 1 푘 + 1 1 1 = ∑ [(−1)푘−푗 ( ) ( − )] (푘 + 1)! 푗 1 − (푘 + 1)푥 1 − 푗푥 푗=0

푘 1 1 푘 + 1 = ∑(−1)푘−푗 ( ) (푘 + 1)! 1 − (푘 + 1)푥 푗 푗=0

푘 1 푘 + 1 1 = + ∑(−1)푘+1−푗 ( ) (푘 + 1)! 푗 1 − 푗푥 푗=0

푘 1 1 푘 + 1 1 = [ + ∑(−1)푘+1−푗 ( ) ] (푘 + 1)! 1 − (푘 + 1)푥 푗 1 − 푗푥 푗=0

푘+1 1 푘 + 1 1 = ∑(−1)푘+1−푗 ( ) (푘 + 1)! 푗 1 − 푗푥 푗=0 which completes the proof. ∎

Stirling Numbers | 77

푛 ∞ THEOREM 5.6. For any fixed integer 푘 ≥ 0 , generating function of the sequence {{푘}} 푛=푘 is

∞ 푛 푥푘 퐺(푥) = ∑ { } 푥푛 = . 푘 (1 − 푥)(1 − 2푥) ⋯ (1 − 푘푥) 푛≥ 푘

Proof. From the lemma we have

푘 푥푘 1 푘 1 = ∑(−1)푘−푗 ( ) (1 − 푥)(1 − 2푥) ⋯ (1 − 푘푥) 푘! 푗 1 − 푗푥 푗=0 푘 ∞ 1 푘 = ∑(−1)푘−푗 ( ) ∑ 푗푛푥푛 푘! 푗 푗=0 푛=0

∞ 푘 1 푘 = ∑ ( ∑(−1)푘−푗 ( ) 푗푛) 푥푛 푘! 푗 푛=0 푗=0

1 Since ∑푘 (−1)푘−푗 (푘) 푗푛 is the closed form of {푛} we obtain the desired equality. ∎ 푘! 푗=0 푗 푘

Note that the generating function given in the theorem can also be written as

1 퐺(푥) = . ( ) 1/푥 푥 푘 + 1 ! (푘+1)

THEOREM 5.7. For any fixed integer 푘 ≥ 0 , exponential generating function of the sequence

푛 ∞ {{푘}} 푛=푘 is

∞ 푛 푥푛 (푒푥 − 1)푘 퐻(푥) = ∑ { } = . 푘 푛! 푘! 푛≥ 푘

(푒푥−1)푘 Proof. We consider the power series expansion of : 푘! 푘 (푒푥 − 1)푘 1 푘 = ∑(−1)푘−푖 ( ) 푒푖푥 푘! 푘! 푖 푖=0 푘 ∞ 1 푘 푖푛푥푛 = ∑(−1)푘−푖 ( ) ∑ 푘! 푖 푛! 푖=0 푛=0 ∞ 푘 1 푘 푥푛 = ∑ ( ∑(−1)푘−푖 ( ) 푖푛) 푘! 푖 푛! 푛=0 푖=0

1 Since ∑푘 (−1)푘−푖(푘)푖푛 = {푛} we obtain the desired equality. ∎ 푘! 푖=0 푖 푘

78 | Stirling Numbers

THEOREM 5.8. Bivariate exponential generating function for the Stirling numbers of the sec- ond kind is

∞ 푛 푘 푛 푥 푦 푥 퐹(푥, 푦) = ∑ { } = 푒푦(푒 −1). 푘 푛! 푛,푘=0

푥푛푦푘 푥 Proof. We have to show that coefficient of in power series representation of 푒푦(푒 −1) is 푛! 푛 {푘}. ∞ 푥 1 푒푦(푒 −1) = ∑ 푦푘(푒푥 − 1)푘 푘! 푘=0 ∞ 푘 1 푘 = ∑ 푦푘 ∑(−1)푘−푗 ( ) 푒푗푥 푘! 푗 푘=0 푗=0 ∞ 푘 ∞ 1 푘 푗푛푥푛 = ∑ 푦푘 ∑(−1)푘−푗 ( ) ∑ 푘! 푗 푛! 푘=0 푗=0 푛=0 ∞ ∞ 푘 1 푘 푥푛 = ∑ ∑ ( ∑(−1)푘−푗 ( ) 푗푛) 푦푘 푘! 푗 푛! 푘=0 푛=0 푗=0 ∞ 푛 푥푛 = ∑ { } 푦푘. 푘 푛! 푛,푘=0 Thus, proof is completed. ∎

S T I R L I N G N UMBERS OF THE F I R S T K IND

We denote the set of all permutations of {1, 2, ⋯ , 푛} by 푆(푛). A 휎 ∈ 푆(푛) is a bi- jective mapping whose ‘word representation’ is 휎 = 휎1 ⋯ 휎푛 where 휎푖 = 휎(푖) for 푖 = 1, … , 푛. Un- der the operation of composition 푆(푛) forms the symmetric group of order 푛. An alternative way to describe a permutation is its cycle decomposition. For every 푖, the sequence 푖, 휎(푖), 휎2(푖), … eventually terminates with 푖 again. If 푘 is the smallest positive integer such that 휎푘(푖) = 푖, we denote the cycle containing 푖 by [푖 휎(푖) 휎2(푖) ⋯ 휎푘−1(푖)]. If 휎푡(푖) = 푗, then the cycles containing 푖 and 푗 are defined to be the same. Cycle decomposition of 휎 is the list of all distinct cycles of 휎.

Example 3. Let 휎 = 936478251 ∈ 푆(9). Then 휎 is the bijection from {1,2,3,4,5,6,7,8,9} to itself which is defined as 휎(1) = 9, 휎(2) = 3, 휎(3) = 6, 휎(4) = 4, 휎(5) = 7, 휎(6) = 8, 휎(7) = 2, 휎(8) = 5, 휎(9) = 1. Observe that 휎(3) = 6, 휎(6) = 8, 휎(8) = 5, 휎(5) = 휎 휎 휎 7, 휎(7) = 2 and 휎(2) = 3. Thus, starting with 3 we have the chain 3 → 6 → 8 → 5 휎 휎 휎 → 7 → 2 → 3. The cycle containing 3 is [368572]. It is clear that the cycle containing 5 is [572368] and by definition these cycles are the same. The cycle containing 1 is [19] and the cycle containing 4 is [4]. Then cycle decomposition of 휎 is 휎 = [19][236857][4].

Stirling Numbers | 79

To represent a cycle, we may start with any element in the cycle. Order of cycles is irrelevant. Cycles of length 1 are fixed points in 휎. Cycles of length 2 are transpositions 푖 ↔ 푗. In the above example 4 is a fixed point of 휎 and and 1 ↔ 9 (휎(1) = 9, 휎(9) = 1) is a transposition.

Example 4. For the permutation 휎 of the previous example, 4 is a fixed point and [19] is a trans- position.

In the identity permutation each element is a fixed point thus, it has the most crowded cycle decomposition: 푖푑 = [1][2][3] ⋯ [푛]. On the other etreme we may have permutations whoso cycle decomposition consists of a single cycle. Such a per- mutation is called cyclic. There are (푛 − 1)! cyclic permutations of 푆(푛).

휏 휏 휏 휏 Example 5. Let 휏 = 3421 ∈ 푆(4), then 1 → 3 → 2 → 4 → 1 and the cycle containing 1 is [1324]. Since this cycle contains all of the elements, cycle decomposition of 휏 consists of a single cycle: 휏 = [1324]. All cyclic permutations of 푆(4) are

[1234] , [1243] , [1324] , [1342] , [1423] , [1432].

The number of permutations of {1,2, … , 푛} with 푚 −cycles is called a of the 푛 0 푛 first kind and is denoted by [푚]. By convention we set [0] = 1 and [0] = 0 for 푛 > 0.

As subsets {1,2,3,4} = {2,3,4,1} = {1,2,4,3}, As cycles [1,2,3,4] = [2,3,4,1] ≠ [1,2,4,3].

Example 6. Permutations and cycle decompositions of {1,2,3,4}:

1234 [1][2][3][4] 4 cycles 3124 [132] [4] 2 cycles 1243 [1][2][34] 3 cycles 3142 [1342] 1 cycle 1324 [1][23][4] 3 cycles 3214 [13] [2] [4] 3 cycles 1342 [1][234] 2 cycles 3241 [134] [2] 2 cycles 1423 [1][243] 2 cycles 3412 [1342] 1 cycle 1432 [1][42][3] 3 cycles 3421 [1324] 1 cycle 2134 [12][3][4] 3 cycles 4123 [1432] 1 cycle 2143 [12][34] 2 cycles 4132 [142] [3] 2 cycles 2314 [123][4] 2 cycles 4213 [14] [2] 2 cycles 2341 [1234] 1 cycle 4231 [14] [2] [3] 3 cycles 2413 [1243] 1 cycle 4312 [1423] 1 cycle 2431 [124] [3] 2 cycles 4321 [14] [23] 4 cycles

80 | Stirling Numbers

1 cycle [1,2,3,4] [1,2,4,3] [1,3,2,4] [1,3,4,2] [1,4,2,3] [1,4,3,2]

2 cycles [1,2,3][4] [1,3,2][4] [1,2,4][3] [1,4,2][3] [1,3,4][2] [1,4,3][2] [2,3,4][1] [2,4,3][1] [1,2][3,4] [1,3][2,4] [1,4][2,3]

3 cycles [1,2][3][4] [1,3][2][4] [1,4][2][3] [2,3][1][4] [2,4][1][3] [3,4][1][2]

4 cycles [1][2][3][4]

Then we conclude 4 4 4 4 [ ] = 6, [ ] = 11, [ ] = 6 [ ] = 1 1 2 3 4

푛 It is obvious that [1] = (푛 − 1)!, because a single cycle consisting of 푛 elements is a cyclic per- 푛 mutation of these elements and there are (푛 − 1)! such permutations. Similarly [푛] = 1, since only way of defining 푛 cycles with 푛 elements is to take each element as a cycle:

푛 푛 [ ] = (푛 − 1)! , [ ] = 1. 1 푛

If we wish to define 푛 − 1 cycles, we have to pick two arbitrary elements to form one of the cycles and all the remaining cycles will consist of a single element. Then

푛 푛 [ ] = ( ). 푛 − 1 2

THEOREM 5.9 (Basic recursion of the Stirling numbers of the first kind). For any inte- gers 푛 ≥ 2 and 1 ≤ 푚 ≤ 푛, Stirling numbers of the second kind satisfy the recurrence 푛 푛 − 1 푛 − 1 [ ] = (푛 − 1) [ ] + [ ] 푚 푚 푚 − 1 0 푛 0 with initial conditions [0] = 1 and [0] = [푛] = 0 for 푛 > 0.

Proof. Consider forming a new permutation with 푛 objects from a permutation of 푛 − 1 ob- jects by inserting an ‘푛’. There are exactly two ways in which this can be accomplished. First, we could form a singleton cycle, leaving the extra object fixed. This increases the number of cycles by 푛−1 1 and so accounts for the [푚−1] term in the recurrence. Second, we could insert the object into one of the existing cycles. Consider an arbitrary permutation of 푛 − 1 objects with 푚 cycles. To form the new permutation, we insert the new object before any of the 푛 − 1 objects already present. 푛−1 This explains the (푛 − 1)[ 푚 ]term of the recurrence. These two cases include all of the possibil- ities, so the recurrence relation follows with .

Stirling Numbers | 81

Example 7. 5 Compute [3].

4 First recall that [3] = 6 and all permuations of {퐴, 퐵, 퐶, 퐷, 퐸} with three cycles are: [퐴, 퐵][퐶][퐷] [퐴, 퐶][퐵][퐷] [퐴, 퐷][퐵][퐶] [퐵, 퐶][퐴][퐷] [퐵, 퐷][퐴][퐶] [퐶, 퐷][퐴][퐵].

We can insert ‘E’ to one of the cycles of each these permutations in 4 different ways :

[퐴, 퐵][퐶][퐷] → [퐴, 퐵, 퐸][퐶][퐷] [퐴, 퐸, 퐵][퐶][퐷] [퐴, 퐵][퐶, 퐸][퐷] [퐴, 퐵][퐶][퐷, 퐸]

[퐴, 퐶][퐶][퐷] → [퐴, 퐶, 퐸][퐶][퐷] [퐴, 퐸, 퐶][퐶][퐷] [퐴, 퐶][퐶, 퐸][퐷] [퐴, 퐶][퐶][퐷, 퐸]

[퐴, 퐷][퐵][퐶] → [퐴, 퐷, 퐸][퐵][퐶] [퐴, 퐸, 퐷][퐵][퐶] [퐴, 퐷][퐵, 퐸][퐶] [퐴, 퐷][퐵][퐶, 퐸]

[퐵, 퐶][퐴][퐷] → [퐵, 퐶, 퐸][퐴][퐷] [퐵, 퐸, 퐶][퐴][퐷] [퐵, 퐶][퐴, 퐸][퐷] [퐵, 퐶][퐴][퐷, 퐸]

[퐵, 퐷][퐴][퐶] → [퐵, 퐷, 퐸][퐴][퐶] [퐵, 퐸, 퐷][퐴][퐶] [퐵, 퐷][퐴, 퐸][퐶] [퐵, 퐷][퐴][퐶, 퐸]

[퐶, 퐷][퐴][퐵] → [퐶, 퐷, 퐸][퐴][퐵] [퐶, 퐸, 퐷][퐴][퐵] [퐶, 퐷][퐴, 퐸][퐵] [퐶, 퐷][퐴][퐵, 퐸]

To obtain the remaining permutations, we add the cycle [퐸] to each permutation of 4 {퐴, 퐵, 퐶, 퐷} with two cycles. There are [2] = 11 such permutations: [퐴, 퐵, 퐶][퐷] [퐴, 퐶, 퐵][퐷] [퐴, 퐵, 퐷][퐶] [퐴, 퐷, 퐵][퐶] [퐴, 퐶, 퐷][퐵] [퐴, 퐷, 퐶][퐵]

[퐵, 퐶, 퐷][퐴] [퐵, 퐷, 퐶][퐴] [퐴, 퐵][퐶, 퐷] [퐴, 퐶][퐵, 퐷] [퐴, 퐷][퐵, 퐶]

Thus we acquire 11 cycles of {퐴, 퐵, 퐶, 퐷, 퐸} with 3 cycles where [퐸] appears as a single cycle: [퐴, 퐵, 퐶][퐷][퐸] [퐴, 퐶, 퐵][퐷][퐸] [퐴, 퐵, 퐷][퐶][퐸] [퐴, 퐷, 퐵][퐶][퐸] [퐴, 퐶, 퐷][퐵][퐸] [퐴, 퐷, 퐶][퐵][퐸] [퐵, 퐶, 퐷][퐴][퐸] [퐵, 퐷, 퐶][퐴][퐸] [퐴, 퐵][퐶, 퐷][퐸] [퐴, 퐶][퐵, 퐷][퐸] [퐴, 퐷][퐵, 퐶][퐸]

5 4 4 Then we conclude [3] = 4[3] + [2] = 4 ⋅ 6 + 11 = 35.

THEOREM 5.10 (Basic Identities). For nonnegative integers 푛 and 푟 let 퐻푛 be the harmonic

(푟) number and 퐻푛 be generalized harmonic numbers. The following identities hold.

푛 푛 i. ∑푘=1[푘] = 푛!,

푛 ii. [2] = (푛 − 1)! 퐻푛−1,

1 iii. [푛] = (푛 − 1)! [퐻2 − 퐻(2) ], 3 2 푛−1 푛−1

1 iv. [푛] = (푛 − 1)! [퐻3 − 3퐻 퐻(2) + 2퐻(3) ], 4 3! 푛−1 푛−1 푛−1 푛−1

1 v. [ 푛 ] = (3푛 − 1)(푛), 푛−2 4 3

푛 푛 푛 vi. [푛−3] = (2)(4).

82 | Stirling Numbers

Proof. Part i. follows immediately from the definition. Parts ii., iii. and iv. can be proved by similar methods. We prove parts ii. and iii.; leave the proof of part iv. as exercise. Parts v. and vi. are proved by direct computation.

푛 푛 푛 푛 i. [푘] is the number of permutations with 푘 cycles,so the sum [1] + [2] + ⋯ + [푛] counts each permutation once and only once.

1 ii. Define the sequence {푢 } by setting 푢 = [푛]. Since [푛−1] = (푛 − 2)! for 푛 > 2, from the 푛 푛 (푛−1)! 2 1 basic recursion we write

1 푛 − 1 푢 = ((푛 − 1) [ ] + (푛 − 2)!) 푛 (푛 − 1)! 2 1 푛 − 1 1 = [ ] + . (푛 − 2)! 2 푛 − 1

1 1 As 푢 = [푛−1], we see that 푢 = 푢 + . Now 푛−1 (푛−2)! 2 푛 푛−1 푛−1

푛 푛−1 푛−1 1 ∑ 푢 = ∑ 푢 + ∑ 푘 푘 푘 푘=2 푘=1 푘=1

푛 so, 푢푛 = 퐻푛−1 and consequently [2] = (푛 − 1)! 퐻푛−1.

1 iii. Let 푢 = [푛], 푛 = 3,4, … and use the basic recursion 푛 (푛−1)! 3 푛 푛 − 1 푛 − 1 [ ] = (푛 − 1) [ ] + [ ] 3 3 2 푛 − 1 = (푛 − 1) [ ] + (푛 − 2)! 퐻 3 푛−2

for Stirling numbers of the first kind to write

1 푛 − 1 푢 = ((푛 − 1) [ ] + (푛 − 2)! 퐻 ) 푛 (푛 − 1)! 3 푛−2 1 푛 − 1 1 = [ ] + 퐻 . (푛 − 2)! 3 푛 − 1 푛−2

1 It follows that 푢 = 푢 + 퐻 . Now we consider the sum over all 푛 ≥ 3 푛 푛−1 푛−1 푛−2

푛 푛 푛 1 ∑ 푢 = ∑ 푢 + ∑ 퐻 푘 푘−1 푘 − 1 푘−2 푘=3 푘=3 푘=3 푛−1 푛−1 1 = ∑ 푢 + ∑ 퐻 푘 푘 푘−1. 푘=2 푘=2

Stirling Numbers | 83

1 Since 푢 = 0, we obtain 푢 = ∑푛−1 퐻 and 2 푛 푘=2 푘 푘−1 푛−1 1 1 푢 = ∑ (퐻 − ) 푛 푘 푘 푘 푘=2 푛−1 푛−1 1 1 = (∑ (퐻 − 1)) − (∑ − 1) 푘 푘 푘2 푘=1 푘=1 1 = ((퐻 )2 + 퐻(2) ) − 퐻(2) 2 푛−1 푛−1 푛−1 1 = ((퐻 )2 − 퐻(2) ). 2 푛−1 푛−1 v. A permutation 휎 ∈ 푆(푛) decomposes into 푛 − 2 cycles in one of two ways:

푛! - A cycle of size 3 and 푛 − 3 cycles of size 1. There are 2! (푛) = such permutations. 3 3(푛−3)

1 푛! - Two cycles of size 2 elements and 푛 − 4 cycles of size 1. There are (푛)(푛−2) = such 2 2 2 8(푛−4)! permutations.

푛! 푛! It follows that [ 푛 ] = + which simplifies into 푛−2 3(푛−3) 8(푛−4)! 푛 푛 3 [ ] = ( ) (2 + (푛 − 3)) 푛 − 2 3 4 푛 3푛 − 1 = ( ) . 3 4

vi. A permutation 휎 ∈ 푆(푛) decomposes into 푛 − 3 cycles in one of three ways:

푛 - Lengths of cycles: 4, ⏟1, 1 , … , 1 . Number of such cycles is 3! (4), 푛−4 푐푦푐푙푒푠

푛 푛−3 푛 - Lengths of cycles: 3, 2, ⏟1, 1 , … , 1 . Number of such cycles is 2! (3)( 2 ) = 4(푛 − 5)(4), 푛−5 푐푦푐푙푒푠

1 - Lengths of cycles: 2, 2,2 ⏟1, 1 , … , 1 . Number of such cycles is (푛)(푛−2) (푛−4) = 3! 2 2 2 푛−6 푐푦푐푙푒푠

(푛−4)(푛−5) (푛). 2 4

Then we have

푛 푛 [ ] = ( ) (6 + 4(푛 − 4) + (푛 − 4)(푛 − 5)/2) 푛 − 3 4

푛 푛(푛 − 1) = ( ) . 4 2

84 | Stirling Numbers

푛(푛−1) As = (푛), claim follows. ∎ 2 2

THEOREM 5.11. Bivariate exponential generating function for the Stirling numbers of the first kind is

∞ 푛 1 푦 푛 푥푛 ( ) = ∑ ∑ [ ] 푦푘 . 1 − 푥 푘 푛! 푛=0 푘=0

푛 ∞ For any fixed integer 푘 ≥ 0 , generating function of the sequence {[푘]} 푛=푘 is

∞ (ln(1 + 푧))푘 푛 푥푛 − = ∑ [ ] . 푘! 푘 푛! 푛=0

R E L A T I O N S B E T W E E N T W O K I N D S O F S T I R L I N G N UMBERS

The following inequality is a direct consequence of the definition

푛 푛 [ ] ≥ { } 푛, 푚 ≥ 0 (integer). 푚 푚

THEOREM 5.12 (Falling and rising factorial powers). For any integer 푛 ≥ 0, the following equalities hold 푥푛 = (−1)푛(−푥)푛,

푥푛 = (−1)푛(−푥)푛,

푥 ⋅ 푥푛 = 푥푛+1 + 푛푥푛.

Proof. (−푥)푛 = (−푥)(−푥 + 1) ⋯ (−푥 + 푛 − 1) = (−1)푛푥(푥 − 1) ⋯ (푥 − 푛 + 1) = (−1)푛푥푛 (−푥)푛 = (−푥)(−푥 − 1) ⋯ (−푥 − 푛 + 1) = (−1)푛푥(푥 + 1) ⋯ (푥 + 푛 − 1) = (−1)푛푥푛 푥푛+1 = 푥(푥 − 1) ⋯ (푥 − 푛 + 1)(푥 − 푛) = 푥푛(푥 − 푛)

Stirling Numbers | 85

= 푥푥푛 − 푛푥푛.

This completes the proof. ∎

THEOREM 5.13. For any integer 푛 ≥ 0, factorial powers can be written in terms of ordinary powers as follows: 푛 푛 푥푛 = ∑ [ ] (−1)푛−푘푥푘 , 푘 푘=0 푛 푛 푥푛 = ∑ [ ] 푥푘. 푘 푘=0 Proof. (Mathematical induction on 푛) For 푛 = 1 the claim holds: 푥1 = 푥(푥 − 1) = 푥2 − 푥 = 1 2 1 푛 푛 푛 푛−푘 푘 [0]푥 − [1]푥 . Now assume that 푥 = ∑푘=0[푘](−1) 푥 for some 푛 ∈ ℕ, then 푛 푛 푛 푛 푥푛+1 = 푥푛(푥 − 푛) = ∑ [ ] (−1)푛−푘푥푘+1 − ∑ 푛 [ ] (−1)푛−푘푥푘 푘 푘 푘=0 푘=0 푛+1 푛 푛 푛 = ∑ [ ] (−1)푛−푘+1푥푘 − ∑ 푛 [ ] (−1)푛−푘푥푘 푘 − 1 푘 푘=1 푘=0 푛 푛 푛 = 푥푛+1 + ∑(−1)푛−푘+1 ([ ] + 푛 [ ]) 푥푘 푘 − 1 푘 푘=1 푛+1 푛 + 1 = ∑(−1)푛−푘+1 [ ] 푥푘. 푘 푘=1 This proves the first equality. Second one can be obtained as follows

푥푛 = (−1)푛(−푥)푛 푛 푛 = (−1)푛 ∑ [ ] (−1)푛−푘(−푥)푘 푘 푘=0 푛 푛 = ∑ [ ] 푥푘. 푘 푘=0 The desired result is obtained. ∎

Example 8. 푥4 = 푥(푥 − 1)(푥 − 2)(푥 − 3) = 푥4 − 6푥3 + 11푥2 − 6푥, 푥4 = 푥(푥 + 1)(푥 + 2)(푥 + 3) = 푥4 + 6푥3 + 11푥2 + 6푥.

THEOREM 5.14. For any integer 푛 ≥ 0, ordinary powers can be written in terms of factorial powers as follows

푛 푛 푥푛 = ∑ { } 푥푘 , 푘 푘=0

86 | Stirling Numbers

푛 푛 푥푛 = ∑ { } (−1)푛−푘푥푘. 푘 푘=0 Proof. (Mathematical induction on 푛) For 푛 = 1 claim holds:

1 1 푥1 = ∑ { } 푥푘 푘=0 푘 = 푥1 = 푥.

푛 푛 푘 Now assume that 푥푛 = ∑푘=0{푘}푥 for some 푛 ∈ ℕ, then

푛 푛 푥푛+1 = 푥 ∑ { } 푥푘 푘 푘=0 푛 푛 = ∑ { } (푥푘+1 + 푘푥푘) 푘 푘=0 푛 푛 푛 푛 = ∑ { } 푥푘+1 + ∑ { } 푘푥푘 푘 푘 푘=0 푘=0 푛+1 푛 푛 푛 = ∑ { } 푥푘 + ∑ { } 푘푥푘 푘 − 1 푘 푘=1 푘=0 푛 푛 + 1 = ∑ { } 푥푘. 푘 푘=0 This proves the first equality, for the second one:

푥푛 = (−1)푛(−푥)푛

푛 푛 = ∑ { } (−1)푛(−푥)푘 푘 푘=0 푛 푛 = ∑ { } (−1)푛−푘(푥)푘. 푘 푘=0

The desired result is obtained. ∎

푛 5 Example 9. We compute ∑푥=1 푥 .

5 5 푥5 = ∑ { } 푥푘 푘 푘=0

5 5 5 5 5 5 = { } 푥0 + { } 푥1 + { } 푥2 + { } 푥3 + { } 푥4 + { } 푥5 0 1 2 3 4 5

Stirling Numbers | 87

= 푥1 + 15푥2 + 25푥3 + 10푥4 + 푥5.

푚+1 푛+1 푚+1 Example 10. 푛 푚 푛+1 푚 푥 (푛+1) Recall that ∑푥=1 푥 = ∑1 푥 훿푥 = | = . Then, 푚+1 푥=1 푚+1

푛 푛 푚 푚 ∑ 푘푚 = ∑ ∑ { } 푘푗 푗 푘=1 푘=1 푗=1

푚 푛 푚 = ∑ { } ∑ 푘푗 푗 푗=1 푘=1

푚 푚 (푛 + 1)푗+1 = ∑ { } 푗 푗 + 1 푗=1

푚 푚 (푛 + 1)푗+1 = ∑ { } 푗 푗 + 1 푗=1

푚+1 푚+1 1 푚 푗 = ∑ ∑ { } [ ] (−1)푗−푙(푛 + 1)푙 . 푗 푗 − 1 푙 푙=1 푗=푙

Then

푛 푛 ∑ 푥5 = ∑(푥1 + 15푥2 + 25푥3 + 10푥4 + 푥5) 푥=1 푥=1

1 25 1 = (푥 + 1)2 + 5(푥 + 1)3 + (푥 + 1)4 + 2(푥 + 1)5 + (푥 + 1)6 2 4 6

푥6 푥5 7푥4 푥3 푥2 = + + + + 6 5 12 3 12 1 = 푥2(푥 + 1)2(2푥2 + 2푥 + 1). 12

THEOREM 5.15. For any integers 푛, ≥ 푚 ≥ 0, the following equality holds

푛 푛 푘 ∑ { } [ ] (−1)푛−푘 = 훿푛 . 푘 푚 푚 푘=0 Proof. 푛 푛 푥푛 = ∑ { } (−1)푛−푘푥푘 푘 푘=0 푛 푘 푛 푘 = ∑ { } (−1)푛−푘 ( ∑ [ ] 푥푚) 푘 푚 푘=0 푚=0

88 | Stirling Numbers

푛 푛 푛 푘 = ∑ (∑ { } [ ] (−1)푛−푘) 푥푚 푘 푘 푚=0 푘=0 Comparing the coefficients of powers of 푥 the desired result is obtained. ∎

Using the basic in reverse direction, for the Stirling numbers of both kinds can be defined for negative arguments. In this case we have

푛 −푛 [ ] = { }. 푚 −푚

B E L L N UMBERS

Bell numbers count the number of partitions of a set. Namely, the 풏 th Bell number 퓑풏 counts the number of ways to partition a set with 푛 elements into pairwise disjoint nonempty subsets. In other words, ℬ푛 is the number of equivalence relations on a set with 푛 elements. From these def- initions it follows that

푛 푛 ℬ = ∑ { }. 푛 푘 푘=1

THEOREM 5.16 (Dobinski’s Formula). For any integer 푛 > 0, Bell number ℬ푛 can be repre- sented with the infinite sum

∞ 1 푘푛 ℬ = ∑ . 푛 푒 푘! 푘=0

Proof. Define the function 풫(푥) as follows:

∞ 푘푛 풫(푥) = 푒−푥 ∑ 푥푛. 푘! 푘=0

We have to show that ℬ푛 = 풫(1). Now we have

Stirling Numbers | 89

∞ ∞ 푥푖 푗푛 풫(푥) = (∑(−1)푖 ) ⋅ (∑ 푥푛) 푖! 푗! 푖=0 푗=0

∞ ∞ 1 = ∑ ∑(−1)푖 푗푛 푥푖+푗 푖! 푗! 푖=0 푗=0

∞ 푘 1 = ∑ (∑(−1)푘−푗 푗푛) 푥푘 (푘 − 푗)! 푗! 푘=0 푗=0

∞ 푘 1 푘 = ∑ ( ∑(−1)푘−푗 ( ) 푗푛) 푥푘 푘! 푗 푘=0 푗=0

∞ 푛 = ∑ { } 푥푘. 푘 푘=0

푛 푛 푛 푘 Since {푘} = 0 for 푘 ≥ 푛 we have 풫(푥) = ∑푘=1{푘} 푥 and consequently 풫(1) = ℬ푛. ∎

THEOREM 5.17. Exponential generating function of Bell numbers is

∞ 푥 ℬ ℬ(푥) = 푒푒 −1 = ∑ 푛 푥푛. 푛! 푛=0

푥푛 (푒푥−1)푘 Proof. Recall that ∑∞ {푛} = . Then 푛=푘 푘 푛! 푘!

∞ 푥푛 ℬ(푥) = ∑ ℬ 푛 푛! 푛=0

∞ 푛 푛 푥푛 = ∑ ∑ { } 푘 푛! 푛=0 푘=1

∞ ∞ 푛 푥푛 = ∑ ∑ { } 푘 푛! 푘=0 푛=푘

∞ (푒푥 − 1)푘 = ∑ . 푘! 푘=0

푥 But the last term we have obtained is just 푒푒 −1. ∎

THEOREM 5.18. Bell numbers satisfy the following recursive relations

푛 푛 ℬ = ∑ ( ) ℬ 푛+1 푘 푘 푘=0 and

90 | Stirling Numbers

푛 푚 푚 푛 ℬ = ∑ ∑ { } ( ) 푗푛−푘ℬ . 푛+푚 푗 푘 푘 푘=0 푗=0

Proof. We prove the first relation and leave the second as an exercise. We first compute

푒푥ℬ(푥):

∞ ∞ 푥푖 ℬ 푒푥ℬ(푥) = ∑ ⋅ ∑ 푗 푥푗 푖! 푗! 푖=0 푗=0

∞ ∞ 1 = ∑ ∑ ℬ 푥푖+푗 푖! 푗! 푗 푖=0 푗=0

∞ 푛 1 = ∑ ∑ ℬ 푥푛 (푛 − 푘)! 푘! 푘 푛=0 푘=0

∞ 푛 1 푛 = ∑ ∑ ( ) ℬ 푥푛 푛! 푘 푘 푛=0 푘=0

Derivative of ℬ(푥) is given by

∞ 푥푛−1 ℬ′(푥) = ∑ ℬ 푛 (푛 − 1)! 푛=1

∞ 푥푛 = ∑ ℬ 푛+1 푛! 푛=0

푥 푥 On the other hand ℬ(푥) = 푒푒 −1 so ℬ′(푥) = 푒푥푒푒 −1 = 푒푥ℬ(푥). Thus

∞ ∞ 푛 푥푛 1 푛 ∑ ℬ = ∑ ∑ ( ) ℬ 푥푛. 푛+1 푛! 푛! 푘 푘 푛=0 푛=0 푘=0

푥푛 Now, comparing the coefficients of leads the desired equality. ∎ 푛!

Bell Triangle

The Bell numbers can easily be calculated by the Bell triangle, - The first row consists of a single 1, - Each row starts with the last element of the previous row, - Each element is equal to the sum of elements on its left and left-top,

Stirling Numbers | 91

- Each row has one more element than the previous row,

- The last element of 푛 th row is ℬ푛.

1 1 2 2 3 5 5 7 10 15 15 20 27 37 52 52 67 87 114 151 203

We close this section by stating a double sum expression and an integral representation of Bell numbers.

푛 푘 푖푛 ℬ = ∑ ∑(−1)푘−푖 , 푛 푘! 푘=1 푗=1

푡 푛! 푒푒 ℬ푛 = ∫ 푛+1 푑푡. 2휋푖푒 훾 푡

92 | Stirling Numbers

T A B L E O F S T I R L I N G N UMBERS

푛\푘 1 2 3 4 5 6 7 8 9 10 11 12 13 1 1 2 1 1 3 1 3 1 4 1 7 6 1 5 1 15 25 10 1 6 1 31 90 65 15 1 7 1 63 301 350 140 21 1 8 1 127 966 1701 1050 266 28 1 9 1 255 3025 7770 6951 2646 462 36 1 10 1 511 9330 34105 42525 22827 5880 750 45 1 11 1 1023 28501 145750 246730 179487 63987 11880 1155 55 1 12 1 2047 86526 611501 1379400 1323652 627396 159027 22275 1705 66 1 13 1 4095 261625 2532530 7508501 9321312 5715424 1899612 359502 39325 2431 78 1 푛 Table of Stirling Numbers {푘} for 1 ≤ 푛 ≤ 13 and 1 ≤ 푘 ≤ 푛

n\k 1 2 3 4 5 6 7 8 9 10 11 1 1 2 1 1 3 2 3 1 4 6 11 6 1 5 24 50 35 10 1 6 120 274 225 85 15 1 7 720 1764 1624 735 175 21 1 8 5040 13068 13132 6769 1960 322 28 1 9 40320 109584 118124 67284 22449 4536 546 36 1 10 362880 1026576 1172700 723680 269325 63273 9450 870 45 1 11 3628800 10628640 12753576 8409500 3416930 902055 157773 18150 1320 55 1

푛 Table of Stirling Numbers [푘] for 1 ≤ 푛 ≤ 11 and 1 ≤ 푘 ≤ 푛

Stirling Numbers | 93

E XERCISES

1. In how many ways can 30 distinguishable balls be placed in four identical boxes so that

a) There is at least one ball in each box,

b) Some boxes may be empty?

2. Prove the following identities without using induction:

푛̅ 푥 푛 푛 − 1 푥푖 = ∑ ( ) , 푛! 푖=1 푖 − 1 푖!

푖 푥푛 푛 푛 − 1 푥 = ∑ ( ) . 푛! 푖=1 푖 − 1 푖!

1 3. Show that {푛} = (3푛−1 + 1) − 2푛−1 for 푛 ≥ 1 . 3 2

푛 푛 푘 푛 4. Show that ∑푘=0{푘} 푥 = 푥 .

5. Let 푢푛 be the number of ways of partitioning a set with 푛 > 0 elements into subsets of sizes not

exceeding 2. Show that 푢푛+1 = 푢푛 + 푛푢푛−1.

푛 푛 푗 푛 푛 푗 푘 6. Show that ∑푗=0 {푗} [푘] = ∑푗=0 [푗] {푘} =훿푛 .

7. Show that

푛 ( ) 푛 ( ) a) [1] = 푛 − 1 ! c) [2] = 푛 − 1 ! 퐻푛−1 ,

1 b) [ 푛 ] = (푛), d) [ 푛 ] = (3푛 − 1)(푛) . 푛−1 2 푛−2 4 3

8. For any nonnegative integer 푛 prove that the following are true:

a) ℬ푛 < 푛! ,

1 푘푛 b) ℬ = ∑푛 . 푛 푒 푘=1 푘!

9. Below figure is for 푛 = 4. Draw a figure for 푛 = 5.

94 | Stirling Numbers

The number of permutations of {1,2, … , 푛} that have 푚 −ascents is called an 푛 0 푛 and is denoted by ⟨푚⟩. By convention ⟨0⟩ = 0 and ⟨0⟩ = 1 for 푛 > 0. Example 1. The following permutation has 5 ascents: 4 10 3 9 1 5 6 2 8 7 ↗ ↘ ↗ ↘ ↗ ↗ ↘ ↗ ↘

Example 2. In the following table we see all permutations of {1,2,3,4} together with the number of ascents they contain.

1234 ↗↗↗ 3 2134 ↘↗↗ 2 3124 ↘↗↗ 2 4123 ↘↗↗ 2

1243 ↗↗↘ 2 2143 ↘↗↘ 1 3142 ↘↗↘ 1 4132 ↘↗↘ 1

1324 ↗↘↗ 2 2314 ↗↘↗ 2 3214 ↘↘↗ 1 4213 ↘↘↗ 1

1342 ↗↗↘ 2 2341 ↗↗↘ 2 3241 ↘↗↘ 1 4231 ↘↗↘ 1

1432 ↗↘↘ 1 2413 ↗↘↗ 2 3412 ↗↘↗ 2 4312 ↘↘↗ 1

1423 ↗↘↗ 2 2431 ↗↘↘ 1 3421 ↗↘↘ 1 4321 ↘↘↘ 0

4 4 4 4 It is seen that ⟨0⟩ = 1, ⟨1⟩ = 11, ⟨2⟩ = 11, ⟨3⟩ = 1.

Eulerian Numbers | 95

There cannot be any permutation of {1, … , 푛} which has 푛 ascents, therefore 푛 ⟨ ⟩ = 0, 푛 > 0. 푛

For fixed 푛, (1,2, … , 푛 − 2, 푛 − 1, 푛) has n-1 ascents and there is no other permutation with 푛 − 1 ascents, thus 푛 ⟨ ⟩ = 1, 푛 > 0. 푛 − 1

For fixed 푛, there is only one permutation without any ascents: (푛, 푛 − 1, 푛 − 2, ⋯ 2,1), then

푛 ⟨ ⟩ = 1, 푛 > 0 0

A permutation has 푘 ascents if and only if the reverse permutation has 푛 − 1 − 푘 ascents, so 푛 푛 ⟨ ⟩ = ⟨ ⟩ , 푛 > 0 푚 푛 − 푚 − 1

THEOREM 6.1 (Basic recursion of Eulerian numbers). For any integers 0 < 푛 and 0 ≤ 푚 < 푛, Eulerian numbers satisfy the recursive relation

푛 푛 − 1 푛 − 1 ⟨ ⟩ = (푚 + 1) ⟨ ⟩ + (푛 − 푚) ⟨ ⟩. 푚 푚 푚 − 1

Proof. Consider any permutation 휎1휎2 ⋯ 휎푛 of {1, 2, … , 푛} with 푘 ascents. We have 휎푖 = 푛 for some 1 ≤ 푖 ≤ 푛, and removing this 휎푖 yields a permutation 휎̃ of {1, 2, . … , 푛 − 1} with either 푘 or 푘 − 1 ascents. Every permutation of {1, 2, … , 푛} with 푘 ascents is therefore built from a unique permutation of {1, 2, … , 푛 − 1} with 푘 or 푘 − 1 ascents by inserting 푛. There are now two cases. Given a permutation of {1, 2, … , 푛 − 1} with 푘 − 1 ascents, we gain an ascent by inserting 푛 only when we do so at a descent or at the end of the permutation. There are 푛 − 푘 − 1 descents, so this produces 푛 − 푘 permutations of {1, 2, . . . , 푛} with k ascents. Similarly, given a permutation of {1, 2, … , 푛 − 1} with 푘 ascents, we want to preserve the number of ascents when inserting 푛. To do this, the insertion must happen at one of the 푘 ascents, or at the beginning of the permutation. This produces 푘 + 1 permutations of {1, 2, . . . , 푛} with 푘 ascents. Combining these two cases yields the desired recurrence. ∎

96 | Eulerian Numbers

Example 3. 5 5 6 It is given that ⟨2⟩ = 66 and ⟨3⟩ = 26, Compute ⟨3⟩.

Any permutation of {1,2,3,4,5,6} can be obtained from a unique permutation

휎1휎2휎3휎4휎5 of {1,2,3,4,5} by inserting ‘6′ in the slot between two successive terms or

by appending to one of the ends:

ퟔ 휎1휎2휎3휎4휎5 휎1ퟔ 휎2휎3휎4휎5 ⋯ 휎1휎2휎3휎4 휎5ퟔ

Let 휎1휎2휎3휎4휎5 be a permutation of {1,2,3,4,5}. Appending ‘6’ to the left end of

휎1휎2휎3휎4휎5 or inserting it in one of the ascending slots does not increase the number

of ascents. So, each permutation of {1,2,3,4,5} with 3 ascents produces 4 permuta-

( ) 푛−1 5 tions of {1,2,3,4,5,6} with 3 ascents. Contribution is 푚 + 1 ⟨ 푚 ⟩ = 4 ⋅ ⟨3⟩.

Let 휎1휎2휎3휎4휎5 be a permutation of {1,2,3,4,5}. Since appending ‘6’ to the right end of

휎1휎2휎3휎4휎5 or inserting it in one of descending slots increases the number of ascents

by one. So, each permutation of {1,2,3,4,5} with 2 ascents produces 3 permutations

( ) 푛−1 5 of {1,2,3,4,5,6} with 3 ascents. Contribution is 푛 − 푚 ⟨푚−1⟩ = 3 ⋅ ⟨2⟩.

6 5 5 Finally, ⟨3⟩ = 4⟨3⟩ + 3⟨2⟩ = 302.

THEOREM 6.2. For integers 0 < 푚 < 푛, a closed form expression for Eulerian numbers is

푛 푛 푛 + 1 ⟨ ⟩ = ∑(−1)푗 ( ) (푚 + 1 − 푗)푛. 푚 푗 푗=0

THEOREM 6.3 (Basic Identities). For any positive integer 푛 and real number 푥, the following equalities hold:

∑푛 푛 i. 푘=0⟨푘⟩ = 푛!

푛 ∑푛 푛 푥+푘 ii. 푥 = 푘=0⟨푘⟩( 푛 ) (Worpitzky’s identity)

∑푛 푚 ∑푚 푚 푛+푖+1 iii. 푘=1 푘 = 푖=1⟨ 푖 ⟩( 푚+1 ).

Eulerian Numbers | 97

푛 푛 푛 푛 Proof. i. ⟨푘⟩ is the number of permutations with 푘 ascents, so the sum ⟨0⟩ + ⟨1⟩ + ⋯ + ⟨푛−1⟩ counts each permutation once and only once. Thus, the sum of the Eulerian numbers for a fixed value of 푛 is the total number of permutations.

0 0 푥 ii. (Induction on 푛) Claim is true for 푛 = 0: 푥 = ⟨0⟩(0) = 1. Assume that equality holds for some non-negative integer 푛. Then

푛+1 푛+1 푛+1 푛 + 1 푥 + 푘 푛 푥 + 푘 푛 푥 + 푘 ∑ ⟨ ⟩ ( ) = ∑(푘 + 1) ⟨ ⟩ ( ) + ∑(푛 + 1 − 푘) ⟨ ⟩ ( ) 푘 푛 + 1 푘 푛 + 1 푘 − 1 푛 + 1 푘=0 푘=0 푘=1

푛 푛 푛 푥 + 푘 푛 푥 + 푘 + 1 = ∑(푘 + 1) ⟨ ⟩ ( ) + ∑(푛 − 푘) ⟨ ⟩ ( ) 푘 푛 + 1 푘 푛 + 1 푘=0 푘=0

푛 (푘 + 1)(푥 + 푘 − 푛) + (푛 − 푘)(푥 + 푘 + 1) 푛 푥 + 푘 = ∑ ( ) ⟨ ⟩ ( ) 푛 + 1 푘 푛 푘=0

푛 푛 푥 + 푘 = 푥 ∑ ⟨ ⟩ ( ) = 푥푛+1. 푘 푛 푘=0

푛 푘+푗 푛+푗+1 iii. Recall that ∑푘=0( 푚 ) = ( 푚+1 ).

푛 푛 푚 푚 푛 푚 푘 + 푗 푚 푘 + 푗 ∑ 푘푚 = ∑ ∑ ⟨ ⟩ ( ) = ∑ ⟨ ⟩ ∑ ( ) 푗 푚 푗 푚 푘=0 푘=1 푗=0 푗=1 푘=0

푚 푚 푛 + 푗 + 1 = ∑ ⟨ ⟩ ( ) . ∎ 푗 푚 + 1 푗=1

THEOREM 6.4. For integer 푛, the following identities are true.

푛 ⟨ ⟩ = 2푛 − 푛 − 1, 1 푛 1 ⟨ ⟩ = 3푛 − 2푛(푛+1) + 푛(푛 + 1). 2 2

푛 Proof. Define the sequence {푢푛} by setting 푢푛 = ⟨1⟩. By the basic recursion we have 푢푛 =

2푢푛−1 + 푛 − 1. Then

∞ ∞ ∞ 푛 푛 푛 ∑ 푢푛푥 = 2 ∑ 푢푛−1푥 + ∑(푛−1)푥 푛=1 푛=1 푛=1

98 | Eulerian Numbers

∞ 푥2 = 2푥 ∑ 푢 푥푛 + . 푛 (1 − 푥)2 푛=1

Rearranging the terms we have

∞ 1 ∑ 푢 푥푛 = 푛 (1 − 2푥)(1 − 푥)2 푛=1

1 1 = − 1 − 2푥 (1 − 푥)2

∞ ∞ = (∑ 2푛푥푛) − (∑(푛+1)푥푛) 푛=1 푛=1

∞ = ∑(2푛 − 푛 − 1)푥푛 푛=1 thus we obtain the first identity. The second one can be obtained similarly. ∎

The following are interesting infinite sums related with Eulerian numbers:

∞ 푥 ∑ 푘푥푘 = , (1 − 푥)2 푘=1

∞ 푥 ∑ 푘2푥푘 = (1 + 푥) , (1 − 푥)2 푘=1

∞ 푥 ∑ 푘3푥푘 = (1 + 4푥 + 푥2) , (1 − 푥)2 푘=1 and in general

∞ 푛−1 푥 푛 ∑ 푘푛푥푘 = ∑ ⟨ ⟩ 푥푗. (1 − 푥)푛+1 푗 푘=1 푗=0

THEOREM 6.5. A bivariate exponential generating function for Eulerian numbers is

∞ ∞ (푡 − 1)푒푥 푛 푥푛 푡푘 = ∑ ∑ ⟨ ⟩ . 푡푒푥 − 푒푥푡 푘 푛! 푘! 푘=0 푛=0

Eulerian Numbers | 99

T A B L E O F E ULERIAN N UMBERS

푛\푘 1 2 3 4 5 6 7 8 9 10 11 1 1 2 1 1 3 1 4 1 4 1 11 11 1 5 1 26 66 26 1 6 1 57 302 302 57 1 7 1 120 1191 2416 1191 120 1 8 1 247 4293 15619 15619 4293 247 1 9 1 502 14608 88234 156190 88234 14608 502 1 10 1 1013 47840 455192 1310354 1310354 455192 47840 1013 1 11 1 2036 152637 2203488 9738114 15724248 9738114 2203488 152637 2036 1

〈푛〉 Table of Eulerian Numbers 푘 for 1 ≤ 푛 ≤ 11 and 1 ≤ 푘 ≤ 푛

100 | Eulerian Numbers

There are several well known problems which are used to introduce derangements. One of them is ‘Old Hats Problem’:

A group of 푛 men enter a restaurant and check their hats. The hat-checker is absent minded, and upon leaving, she redistributes the hats back to the men at random. What is the probability 푃푛 that no man gets his correct hat, and how does 푃푛 behave as 푛 approaches infinity?

Let 푛 = 4 and call the men 퐴, 퐵, 퐶, 퐷. Then the ordering 퐴퐵퐶퐷 of hats means that each man gets his correct hat, whereas 퐴퐵퐷퐶 means that 퐴 and 퐵 get their own hats but those of 퐶 and 퐷 are swapped. The ordering 퐵퐶퐷퐴 means that no one gets his own hat. To find the number of all such orderings, we list all possible orderings of four hats:

ABCD ABDC ACBD ACDB ADBC ADCB

BACD BADC BCAD BCDA BDAC BDCA

CABD CADB CBAD CBDA CDAB CDBA

DABC DACB DBAC DBCA DCAB DCBA

The orderings for which no man gets his own hat are in bold typeset. There are 9 such orderings out of total 24 orderings. Thus, 푃푛 = 9/24 = 0,375. If we let 푛 = 10 or 푛 = 100 how would this probabiliy change? Would it be smaller, too smaller or larger than 0.375? To answer thes questions, since we know that the number of all orderings is 푛!, we have to find the number of orderings for which no letter is in its original position.

Random Mappings and Permutations | 101

Let 푋 = {푥1, 푥2, … , 푥푛} be an ordered set. In a permutation of elements of 푋 an element which appears in its original position is called a fixed point of the permutation. A derangement is a permutation which has no fixed points. We denote the number of derangements of 푛 objects with

풟푛. By convention 풟0 = 1.

Example 1. For 푛 = 1, there is only one permutation of {1} and this permutation has a fix point.

Thus 풟1 = 0.

For 푛 = 2, there are two permutations of {1,2}, namely 12 and 21. Since only one of

these has no fixed points, 풟2 = 1.

For 푛 = 3, the list of all permutations are ퟏퟐퟑ, ퟏ32, 21ퟑ, 231, 312, 3ퟐ1 where the

bold characters show fixed points. It follows that there are only 2 derangements.

풟3 = 2.

Denote the number of permutations of 푛 objects with 푘 fixed points with 풟푛,푘. To construct

푛 such a permutation, the fixed points can be chosen in (푘) ways and the remaining elements can be arranged in 풟푛−푘 ways to form a derangement among themselves. Then

푛 풟 = ( ) 풟 . 푛,푘 푘 푛−푘

THEOREM 7.1. For any positive integer 푛

∑ 풟푛,푘 = 푛!. 푘=0

푛 Proof. Since 풟푛,푘 is the number of permutations with 푘 fixed points, the sum ∑푖=0 풟푛,푘 counts each permutation exactly once. ∎

From the theorem it follows that

푛 푛 ∑ ( ) 풟 = 푛! 푘 푘 푘=0

102 | Derangements

In all permutations of {1, … , 푛}, the element 1 is at the first position in exactly (푛 − 1)! permu- tations. This means that 푛 appears as a fixed point in (푛 − 1)! permutations. Since this is the same for all elements of the set, the total number of fixed points in all permutations is 푛 ⋅ (푛 − 1)! = 푛!.

It follows that the average number of fixed points of all permutations of {1, … , 푛} is 1. Another way

푛 of writing the total number of fixed points in all permutations is ∑푘=0 푘풟푛,푘, then

푛 푛 ∑ 푘 ( ) 풟 = 푛!. 푘 푛−푘 푘=0

THEOREM 7.2 (Second Order Recursion for Derangements). For 푛 > 2, the number of de- rangements satisfy the second order recursion

풟푛 = (푛 − 1)(풟푛−1 + 풟푛−2).

Proof. Suppose that there are 푛 balls numbered 1,2, … , 푛 and let there be 푛 boxes also num- bered 1,2, … , 푛. We wish to put one ball to each boxes such that the number of each box is different from the number of the ball in it. Clearly, the number of such distributions is 풟푛. There are 푛 −

1 ways to put a ball in the first box. Let us assume that the first box contains the ball 푖. Now there are two possibilities, depending on whether or not box 푖 contains ball 1:

- Box 푖 does not contain the ball 1. This case is equivalent to solving the problem with 푛 − 1 boxes

푛 − 1 balls.

- Box 푖 contains the ball 1. Now the problem reduces to 푛 − 2 balls and 푛 − 2 boxes.

Then we obtain the desired recursion. ∎

THEOREM 7.3 (First Order Recursion for Derangements). For 푛 > 1, the number of derange- ments satisfy the first order recursion

푛 풟푛 = 푛풟푛−1 + (−1) .

Random Mappings and Permutations | 103

Proof. Rearrange the second order recursion as 풟푛 − 푛풟푛−1 = −(풟푛−1 − (푛 − 1)풟푛−2). Now define the sequence {푢푛} by 푢푛 = 풟푛 − 푛풟푛−1 for 푛 = 1,2, …. We observe that 푢푛 = −푢푛−1. Since

푛 푛 푢1 = 풟1 − 풟0 = −1, we conclude that 푢푛 = (−1) . Now we have 푢푛 = (−1) = 풟푛 − 푛풟푛−1. ∎

THEOREM 7.4. Exponential generating function of the number of derangements is

∞ 푥푛 푒−푥 ∑ 풟 = . 푛 푛! 1 − 푥 푛=1

Proof. Multiply both sides of the first order recursion by 푥푛 and form the sum for 푛 = 1,2, …

∞ ∞ ∞ 푥푛 푥푛 푥푛 ∑ 풟 = ∑ 풟 + ∑(−1)푛 . 푛 푛! 푛−1 (푛 − 1)! 푛! 푛=1 푛=1 푛=1

Then

∞ ∞ ∞ 푥푛 푥푛−1 (−푥)푛 ∑ 풟 − 1 = 푥 ∑ 풟 + ∑ − 1 푛 푛! 푛−1 (푛 − 1)! 푛! 푛=0 푛=1 푛=0 which means

풟(푥) = 푥풟(푥) + 푒−푥.

We obtain the result by rearranging the last equality. ∎

THEOREM 7.5. For any nonnegative integer 푛, the number of derangements of 푛 objects is

푛 (−1)푘 풟 = 푛! ∑ . 푛 푘! 푘=0

Proof. We give three different proofs.

(Principle of Inclusion-Exclusion.) Define the condition 퐶푖 to be ‘푖 is at position 푖’ for 푖 =

1, … , 푛. Then 풟푛 is the number of permutations of {1, … , 푛} for which none of the conditions 퐶푖 is satisfied. In terms of inclusion-exclusion principle 풟푛 = 푁.

For any 푖 = 1, … 푛, the number of permutations which satisfy 퐶푖 is (푛 − 1)!, then 푁1 = 푛 ⋅ (푛 − 1)!.

Analogously, the number of permutations which satisfy 푘 of the conditions is (푛 − 푘)!, then 푁푘 =

푛! (푛) ⋅ (푛 − 푘)! = . 푘 푘!

104 | Derangements

푛! It follows that 푁 = 푛! and for any 푘 = 1,2, … , 푛, 푁 = . We obtain 0 푘 푘!

풟푛 = 푁 = 푁0 − 푁1 + 푁2 − ⋯

푛 (−1)푘 = 푛! ∑ . 푘! 푘=0

(Exponential Generating Function) We consider the exponential generating function of the number of derangements

∞ 푥푛 푒−푥 ∑ 풟 = 푛 푛! 1 − 푥 푛=1

∞ ∞ (−푥)푗 = (∑ 푥푖) (∑ ) 푗! 푖=0 푗=0

∞ ∞ (−1)푗 = ∑ ∑ 푥푖+푗 푗! 푖=0 푗=0

∞ 푛 (−1)푘 = ∑ (∑ ) 푥푛 . 푘! 푛=0 푘=0

푥푛 Comparing the coefficients of we obtain the desired expression. 푛!

푛 푛 (Binomial Inversion) Since ∑푘=0(푘)풟푘 = 푛!, from binomial inversion theorem we have

푛 푛 풟 = ∑(−1)푛−푘 ( ) 푘! 푛 푘 푘=0

푛 푛! = ∑(−1)푛−푘 (푛 − 푘)! 푘=0

푛 1 = 푛! ∑(−1)푘 . 푘! 푘=0

This completes proof. ∎∎∎

Random Mappings and Permutations | 105

We return back to the ‘Old Hats Problem’. The number of orderings for which no man gets his own hat is 풟푛 and the probability 푃푛 that no man gets his correct hat is

푛 풟 1 푃 = 푛 = ∑(−1)푘 . 푛 푛! 푘! 푘=0

Now we observe that

푛 ∞ 1 1 1 lim (∑(−1)푘 ) = ∑(−1)푘 = . 푛→∞ 푘! 푘! 푒 푘=0 푘=0

Then, as 푛 → ∞, the probability converges to 1/푒 and consequentely

1 푃 ≈ . 푛 푒

1 Since the series ∑푛 (−1)푘 converges to 1/푒 very rapidly, above approximation can be used 푘=0 푘! even for small values of 푛. For comparing 1⁄푒 = 0.36787944 ⋯ to actual probability values, we give the list

푛 풟푛⁄푛! 2 0.5000 5 0.3667 10 0.3679

At the beginning of this section we have computed that 푃4 = 0.375. Now we see that as the number of men gets larger the probability that no one gets his own hat decreases very slightly.

For practical purposes, independent of 푛, we say that this probability is 1/푒.

푛! Then, The number of derangements can be approximated by . In fact for any nonnegative integer 푒 we have

푛! 풟 = [ ] 푛 푒 where [ ] is the closest integer function.

106 | Derangements

In the late 18th century, Büttner, a German schoolmaster, gave —with the intention of keeping his pupils busy for another hour— the task to sum hundred terms of an arithmetic progression to a class of little boys who, of course, had never heard of arithmetic progressions. The youngest pupil, however, wrote down the answer instantaneously and waited gloriously, with his arms folded, for the next hour while his classmates toiled: at the end it turned out that little Johann Friederich Earl Gauss had been the only one to hand in the correct answer. Young Gauss had seen instantaneously how to sum such a series analytically: the sum equals the number of terms multiplied by the average of the first and the last term. (To quote E.T.Bell: “The problem was of the following sort, 81297 + 81495 + 81693 + ... + 100899, where the step from one number to the next is the same all along (here 198), and a given number of terms (here 100) are to be added.”)

To compute the sum easily Gauss made a pair of first and last terms, that's 182196, Then multiplied by 50 pairs, to find 9109800 and there, the job is done.

In two respects this is a classical example: firstly young Gauss produced his answer about a thousand times as fast as his classmates, secondly he was the only one to produce the correct answer. So much for the effective ordering of one’s thoughts!

ퟏퟔ 1+ퟏ + ퟐ + ퟑ + ⋯ + ퟏퟔ = (ퟏퟔ + ퟏ) × ퟐ

Finite Sums | 107

Concern of this section is to introduce a collection of methods for the evaluation of a finite sum whose summands are given as a sequence, either in a functional form 푓(푘), or in subscript form 푎푘. The last part of the section is devoted to ‘Finite Calculus’ which mimics the methods of calculus for computing the finite sums.

Let {푎푛} = 푎0, 푎1, … be a sequence of real (or complex) numbers. We denote the sum 푎0 +

푎1 + ⋯ + 푎푛 by 푆푛, that is

푆푛 = 푎0 + 푎1 + ⋯ + 푎푛 = ∑ 푎푘. 푘=0

More generally, the sum 푎푚 + 푎푚+1 + ⋯ + 푎푛 for any 푚 with 0 ≤ 푚 ≤ 푛 is written as

푛 푛 ∑ 푎푘 or ∑ 푎푘. 푘=푚 푘=푚

In the above notation 푘 is called the index variable. Note that index variable is dummy, in the

푛 푛 sense that it does not make any harm replacing 푘 with any other variable: ∑푘=푚 푎푘 = ∑푗=푚 푎푗.

푚 is called the lower bound (or lower limit); 푏 is called the upper bound (or upper limit) and

푥푘, for each 푘 = 푚, … , 푛, is called a 1.

An alternative notation is ∑푘∈ 𝐴 푎푘 which means that the terms 푎푘 are summed up for all values of 푘 ∈ 퐴. For the given context, if there is no doubt about the bounds, one may write ∑푘 푎푘 or even ∑ 푎푘.

After listing some basic properties of the finite summation, we examine several methods for computing 푆푛.

108 | Finite Sums

P ROPERTIES OF S UMMATION

For any sequences {푎푛}, {푏푛}, and 휆 ∈ ℂ the following properties hold for finite sums: 푛 ∑ 휆 = 휆(푛 − 푚 + 1), 푘=푚 푛 푛 푛

∑ 휆(푎푘 + 푏푘) = 휆 ∑ 푎푘 + ∑ 푏푘 , 푘=푚 푘=푚 푘=푚 푛 ℓ 푛

∑ 푎푘 = ∑ 푎푘 + ∑ 푎푘 for any integer 푚 ≤ ℓ ≤ 푛, 푘=푚 푘=푚 푘=ℓ+1 푛 푛

∑ 푎푘 = ∑ 푎푛+푚−푘, 푘=푚 푘=푚 푛 푛−ℓ

∑ 푎푘 = ∑ 푎푘+ℓ for any integer ℓ, 푘=푚 푘=푚−ℓ 푛 푛 푛 푛 2 2 2 ∑ (푎푘 + 푏푘) = ∑ 푎푘 + ∑ 푎푘푏푘 + ∑ 푏푘, 푘=푚 푘=푚 푘=푚 푘=푚

Double Sums

Let {푎푖푗} be a two dimensional array, say

푎00 푎01 푎02 ⋯ 푎0푗 ⋯ 푎0푛

푎10 푎11 푎12 ⋯ 푎1푗 ⋯ 푎1푛

푎20 푎21 푎22 ⋯ 푎2푗 ⋯ 푎2푛 ⋮ ⋮ ⋮ ⋯ ⋮ ⋯ ⋮ .

푎푖0 푎푖1 푎푖2 ⋯ 푎푖푗 ⋯ 푎푖푛 ⋮ ⋮ ⋮ ⋯ ⋮ ⋯ ⋮

푎푚0 푎푚1 푎푚2 ⋯ 푎푚푗 ⋯ 푎푚푛

If we wish to compute the sum 푆 of all terms of this array, we can first find sum of each row, then compute the sum of row sums. Say that the sum of terms on row 푖 is 푅푖 for 푖 = 0, … , 푚, that is

푅푖 = ∑ 푎푖푗 푗=0

Finite Sums | 109

and consequently

푆 = ∑ 푅푖 푖=0

푚 푛

= ∑ (∑ 푎푖푗). 푖=0 푗=0

Dropping the braces, we write this sum as

푚 푛

∑ ∑ 푎푖푗. 푖=0 푗=0

This iterated sum is called a double sum.

To compute the sum 푆 of all terms of this array, we could first compute the sums of columns rayher than that of rows. Assume that the sum of terms on column 푗 is 퐶푗 for 푖 = 0, … , 푛, that is

퐶푗 = ∑ 푎푖푗 푖=0 and sum of all elements of the array {푎푖푗} is then,

푆 = ∑ 퐶푗 푗=0

푛 푚

= ∑ (∑ 푎푖푗) 푗=0 푖=0

푛 푚

= ∑ ∑ 푎푖푗. 푗=0 푖=0

We observe that

푚 푛 푛 푚

∑ ∑ 푎푖푗 = ∑ ∑ 푎푖푗 . 푖=0 푗=0 푗=0 푖=0

110 | Finite Sums

P ERTURBATION OF S U MMATION

푛 The sum 푆푛 can be written as 푆푛 = 푎0 + ∑푘=1 푎푘. Then by replacing the index 푘 with 푘 + 1, 푛−1 we get 푆푛 = 푎0 + ∑푘=0 푎푘+1. Finally, adding 푎푛+1 − 푎푛+1 to the sum we obtain the following perturbation of the original sum:

푛−1

푆푛 = 푎0 + ∑ 푎푘+1 + 푎푛+1 − 푎푛+1 푘=0

푛−1 ∑푘=0 푎푘+1 = 푎0 + ⏟푎⏞1 + 푎 2 + ⋯ + 푎 푛 + 푎푛 + 1 − 푎푛+1 푛 ∑푘=0 푎푘+1 or

푆푛 = 푎0 − 푎푛+1 + ∑ 푎푘+1 푘=0

If the general term 푎푘 has a suitable relation with 푎푘+1, the last summation can help us in computing 푆푛.

푛 푘 Example 1. Compute 푆푛 = ∑푘=0 푟 .

푛 푘 푛 If 푟 = 0, then 푆푛 = ∑푖=0 푟 = 0 and if 푟 = 1, then 푆푛 = ∑푖=0 1 = 푛 + 1. Now assume

0 푛+1 푘+1 푘 that 푟 ∈ ℂ − {0,1}. As 푎0 = 푟 = 1, 푎푛+1 = 푟 and 푎푘+1 = 푟 = 푟 ⋅ 푟 , perturbed sum is

푛 푛+1 푆푛 = 1 − 푟 + ∑ 푎푘+1 푘=0 푛 = 1 − 푟푛+1 + 푟 ∑ 푟푘 푘⏟= 0 푆푛

which gives

푛 1 − 푟푛+1 ∑ 푟푘 = . 1 − 푟 푘=0

Finite Sums | 111

푛 푘 Example 2. Compute 푆푛 = ∑푖=1 푘푟 where 푟 ∈ ℂ − {1} .

푛 푘 푛 푘 There is no harm in writing 푆푛 = ∑푖=0 푘푟 . If 푟 = 0, then 푆푛 = ∑푖=0 푟 = 0. Assume

푛+1 푘+1 that 푟 ≠ 0, then we have 푎0 = 0, 푎푛+1 = (푛 + 1)푟 and 푎푘+1 = (푘 + 1)푟 =

푟푘푟푘 + 푟푟푘. Then

푛 푘 푆푛 = ∑ 푘푟 푘=0

푛 푛 = −(푛 + 1)푟푛+1 + 푟 ∑ 푘푟푘 + 푟 ∑ 푟푘 푘⏟= 0 푘⏟= 0 푛+1 푆푛 1−푟 1−푟

(1 − 푟푛+1) = −(푛 + 1)푟푛+1 + 푟푆 + 푟 푛 1 − 푟

which simplifies into

푟 − (푛 + 1)푟푛+1 + 푛푟푛+2 (1 − 푟)푆 = . 푛 1 − 푟

So we obtain

푛 (푛푟 − 푛 − 1)푟푛+1 + 푟 ∑ 푘푟푘 = . (1 − 푟)2 푘=1

푛 2 Example 3. Compute 푆푛 = ∑푘=1 푘 .

2 2 2 We have 푎1 = 1, 푎푛+1 = (푛 + 1) and 푎푘+1 = (푘 + 1) = 푘 + 2푘 + 1. Thus

푛 푛 푛 2 2 푆푛 = 1 − (푛 + 1) + ∑ 푘 + 2 ∑ 푘 + ∑ 1 푘⏟= 1 푘=1 푘⏟=1 푆푛 푛

푛 2 = 1 − (푛 + 1) + 푆푛 + 2 ∑ 푘 + 푛. 푘=1

1 푛(푛+1) which results in ∑푛 푘2 = ((푛 + 1)2 − 1 − 푛) = . Direct application of the 푘=1 2 2

method did not work properly and resulted in the sum ∑ 푘 rather than ∑ 푘2. Then we

푛 3 try our chance by attempting to compute the sum 푇푛 = ∑푘=1 푘 .

Perturbed sum is

112 | Finite Sums

푛 3 3 푇푛 = 1 − (푛 + 1) + ∑(푘 + 1) 푘=1

푛 푛 푛 푛 = 1 − (푛 + 1)3 + ∑ 푘3 + 3 ∑ 푘2 + 3 ∑ 푘 + ∑ 1 푘⏟= 1 푘⏟= 1 푘⏟=1 푘⏟=1 1 푇푛 푆푛 푛(푛+1) 푛 2 3 = 1 − (푛 + 1)3 + 푇 + 3푆 + 푛(푛 + 1) + 푛. 푛 푛 2

As expected, 푇푛 is vanished and we are left with 푆푛:

3 3푆 = (푛 + 1)3 − 푛(푛 + 1) − 푛 − 1 푛 2 1 = 푛(푛 + 1)(2푛 + 1). 2 Consequently

푛 1 ∑ 푘2 = 푛(푛 + 1)(2푛 + 1). 6 푘=1

푛 Example 4. Compute 푆푛 = ∑푘=0 푘 ⋅ 푘!.

2 Since 푎0 = 0, 푎푛+1 = (푛 + 1)(푛 + 1)! and 푎푘+1 = (푘 + 1)(푘 + 1)! = (푘 + 1) 푘! =

2 푛 2 푘 푘! + 2푘푘! + 푘!, perturbed sum is 푆푛 = −(푛 + 1)(푛 + 1)! + ∑푘=1 푘 푘! + 2푆푛 +

푛 푛 2 ∑푘=1 푘!. Now, 푆푛 is not vanished, but we are faced with two sums ∑푘=1 푘 푘!

푛 and ∑푘=1 푘! , neither of which is easier than the sum we have started with. In fact,

푛 there is not a known simple closed form to express the sum 푃푛 = ∑푘=0 푘!. We can try

to compute 푃푛 hoping to obtain 푆푛. Perturbation of 푃푛 gives

푃푛 = 1 − (푘 + 1)! + ∑(푘 + 1)! 푘=1

푛 = 1 − (푘 + 1)! + ∑(푘 + 1)푘! 푘=1

= 1 − (푘 + 1)! + 푆푛 + 푃푛.

So we get

푛 ∑ 푘푘! = (푛 + 1)! − 1. 푘=0

Finite Sums | 113

Example 5. ∑푛 푛 Compute 푆푛 = 푘=0 푘(푘).

( ) 푛 ( ) 푛 We have 푎0 = 0, 푎푛+1 = 0 and 푎푘+1 = 푘 + 1 (푘+1) = 푛 − 푘 (푘). Then

푛 푛 푆 = ∑(푛 − 푘) ( ) 푛 푘 푘=0

푛 푛 = 푛 ∑ ( ) − 푆 푘 푛 푘=0

푛 = 푛2 − 푆푛.

푛−1 ∑푛 푛 푛−1 Hence 푆푛 = 푛2 . Note that 푘=0 푘(푘) = 푛2 is the total number of elements in all

subsets of a set with 푛 elements.

Example 6. ∑푛 2 푛 Compute 푆푛 = 푘=0 푘 (푘).

( )2 푛 ( ) 푛 We have 푎0 = 0, 푎푛+1 = 0 and 푎푘+1 = 푘 + 1 (푘+1) = 푛 − 푘 (푘 + 1)(푘). Then

푛 푛 푆 = ∑(푛 − 푘)(푘 + 1) ( ) 푛 푘 푘=0

푛 푛 푛 푛 푛 푛 = (푛 − 1) ∑ 푘 ( ) − ∑ 푘2 ( ) + 푛 ∑ ( ) 푘 푘 푘 푘⏟= 0 푘⏟= 0 푘⏟= 0 푛−1 푛 푛2 푆푛 2

푛−1 푛 = 푛(푛 − 1)2 + 푛2 − 푆푛

푛−1 = 푛(푛 + 1)2 − 푆푛.

∑푛 2 푛 푛−2 Hence 푆푛 = 푘=0 푘 (푘) = 푛(푛 + 1)2 .

푛 Example 7. Compute 푆푛 = ∑푘=0 sin(푘푥) where 푥 ∈ ℝ.

푛 First we define an auxiliary summation as 퐶푛 = ∑푘=0 cos(푘푥). Since 푎0 = 0, 푎푛+1 =

sin((푛 + 1)푥) and 푎푘+1 = sin((푘 + 1)푥) = cos 푥 sin(푘푥) + sin 푥 cos(푘푥) , perturbed

sum is

114 | Finite Sums

푆푛 = − sin((푛 + 1)푥) + cos 푥 푆푛 + sin 푥 퐶푛.

In a similar manner, perturbation of 퐶푛 gives

퐶푛 = 1 − cos((푛 + 1)푥) + cos 푥 퐶푛 − sin 푥 푆푛.

We obtain the system of equations

[cos 푥 − 1]푆푛 + sin 푥 퐶푛 = sin((푛 + 1)푥)

− sin 푥 푆푛 + [cos 푥 − 1]퐶푛 = cos((푛 + 1)푥) − 1 whose solution is

[cos 푥 − 1] sin((푛 + 1)푥) − (cos((푛 + 1)푥) − 1)sin (푥) 푆 = 푛 2(1 − cos 푥)

[cos 푥 − 1](cos((푛 + 1)푥) − 1) + sin((푛 + 1)푥) sin(푥) 퐶 = . 푛 2(1 − cos 푥)

Making use of trigonometric identities, solution can be expressed as

푛 + 1 푛푥 sin ( 푥) sin 2 2 푆푛 = 푥 , sin 2

푛 + 1 푛푥 cos ( 푥) sin 2 2 퐶푛 = 1 + 푥 . sin 2

Note that, using these sums, interesting trigonometric identities can be obtained such as

sin 95° sin 10° + sin 20° + sin 30° + ⋯ + sin 180° = sin 5 ° or

sin 100° sin 20° + sin 40° + sin 60° + ⋯ + sin 180° = . sin 10 °

Finite Sums | 115

C ONVERTING A S I N G L E S U M T O A D O U B L E S UM

푘 If it is possible to write the general term 푎푘 as a finite sum 푎푘 = ∑푗=0 푏푘푗, then the sum 푆푛 =

푛 푛 푘 ∑푘=0 푎푘 can be written as a double sum 푆푛 = ∑푘=0 ∑푗=0 푏푘푗. If we change the order of the dou-

푛 푛 ble sum we get 푆푛 = ∑푗=0 ∑푘=푗 푏푘푗:

푛 푘

∑ ∑ 푏푘푗 = 푏00 + (푏10 + 푏11) + (푏20 + 푏21 + 푏22) + ⋯ + (푏푛0 + 푏푛1 + ⋯ 푏푛푛) 푘=0 푗=0

= (푏00 + 푏10 + ⋯ + 푏푛0) + (푏11 + 푏21 + ⋯ + 푏푛1) + (푏22 + ⋯ + 푏푛2) ⋯ + 푏푛푛

푛 푛

= ∑ ∑ 푏푘푗. 푗=0 푘=푗

Note that, above property can be generalized as

푛 푘 푛 푛

∑ ∑ 푏푘푗 = ∑ ∑ 푏푘푗 . 푘=푎 푗=푎 푗=푎 푘=푗

푛 푛 푛 푘 It may be the case that computing ∑푗=0 ∑푘=푗 푏푘푗 is easier than computing ∑푘=0 ∑푗=0 푏푘푗.

푛 2 Example 8. Compute 푆푛 = ∑푘=1 푘 .

푘 푘 2 First note that ∑푗=1 1 = 푘 and ∑푗=1 푘 = 푘 . Then the given sum can be written as

푛 푛 푘 2 푆푛 = ∑ 푘 = ∑ ∑ 푘 푘=1 푘=1 푗⏟=1 푘2

푛 푛 = ∑ ∑ 푘 푗=1 푘=푗

푛 1 = ∑(푛(푛 + 1) − 푗(푗 − 1)) 2 푗=1

116 | Finite Sums

푛 푛 1 = [푛2(푛 + 1) − ∑ 푗2 − ∑ 푗] 2 푗=1 푗=1

1 1 1 = 푛2(푛 + 1) − 푆 − 푛(푛 + 1) 2 2 푛 4

and

1 푆 = 푛(푛 + 1)(2푛 + 1). 푛 6

푛 푘 Example 9. Compute 푆푛 = ∑푘=1 푘2 .

푛 푘 푆푛 = ∑ 푘2 푘=1

푛 푘 = ∑ ∑ 2푘 푘=1 푗=1

푛 푛 = ∑ ∑ 2푘 푗=1 푘=푗

푛 = ∑(2푛+1 − 2푗) 푗=1 = 푛2푛+1 − (2푛+1 − 2)

= (푛 − 1)2푛+1 + 2

1 1 Example 10. Compute 푆 = ∑푛 퐻 where 퐻 is the harmonic number: 퐻 = 1 + + ⋯ + . 푛 푘=1 푘 푘 푘 2 푘

푆푛 = ∑ 퐻푘 푘=1 푛 푘 1 = ∑ ∑ 푗 푘=1 푗=1 푛 푛 1 = ∑ ∑ 푗 푗=1 푘=푗 푛 (푛 + 1 − 푗) = ∑ 푗 푗=1

Finite Sums | 117

푛 푛 1 = (푛 + 1) ∑ − ∑ 1 푗 푗=1 푗=1

= (푛 + 1)퐻푛 − 푛.

푛 Example 11. Compute 푆푛 = ∑푘=1 푘 퐻푘.

푘 We replace 푘 with ∑푗=1 1:

푛 푘

푆푛 = ∑ ∑ 퐻푘 푘=1 푗=1

푛 푛

= ∑ ∑ 퐻푘 푗=1 푘=푗

= ∑ ((푛 + 1)퐻푛 − 푛 − 푗퐻푗−1 + 푗 − 1) 푗=1

푛 1 = 푛(푛 + 1)퐻 − 푛2 − ∑ 푗퐻 + 푛(푛 + 1) − 푛 푛 푗−1 2 푗=1

푛 1 푛2 푛 1 = 푛(푛 + 1) (퐻 − ) − − − ∑ 푗 (퐻 − ) 푛+1 푛 + 1 2 2 푗 푗 푗=1

1 = 푛(푛 + 1)퐻 − 푛 − 푛(1 + 푛) − 푆 + 푛 푛+1 2 푛

푛(푛 + 1) = 푛(푛 + 1)퐻 − − 푆 . 푛+1 2 푛

Then

푛 1 1 ∑ 푘 퐻 = 푛(푛 + 1) (퐻 − ). 푘 2 푛+1 2 푘=1

1 Alternatively, we could try to replace 퐻 with ∑푘 : 푘 푗=1 푗

푛 푛 푘 푘 ∑ 푘퐻 = ∑ ∑ 푘 푗 푘=1 푘=1 푗=1

푛 푛 1 = ∑ ∑ 푘 푗 푗=1 푘=푗

118 | Finite Sums

푛 1 푛(푛 + 1) 푗(푗 − 1) = ∑ ( − ) 푗 2 2 푗=1

푛 푛(푛 + 1) 1 = 퐻 − ∑(푗 − 1) 2 푛 2 푗=1

푛(푛 + 1) 푛(푛 + 1) 푛 = 퐻 − + 2 푛 4 2

푛(푛 + 1) 푛(푛 + 1) = 퐻 − 2 푛+1 4

푛(푛 + 1) 1 = (퐻 − ). 2 푛+1 2

C ONVERTING THE S U M T O A P O W E R S ERIES

푛 푘 If the function 푆: ℝ → ℝ is defined by 푆(푥) = ∑푘=0 푎푘푥 where 푎푖 ∈ ℝ , 푖 = 1, … , 푛, then

푛 ′ 푘−1 푆 (푥) = ∑ 푘푎푘푥 푘=0

푛 1 푘 = ∑ 푘푎푘푥 푥 푘=0 and

푛 ′′ 푘−2 푆 (푥) = ∑ 푘(푘 − 1)푎푘푥 푘=0

푛 1 푘 = 2 ∑ 푘(푘 − 1)푎푘푥 . 푥 푘=0

Then

∑ 푎푘 = 푆(1), 푘=0 푛 ′ ∑ 푘푎푘 = 푆 (1), 푘=0 푛 2 ′′ ′ ∑ 푘 푎푘 = 푆 (1) + 푆 (1). 푘=0

Finite Sums | 119

Example 12. ∑푛 푛 Compute 푆푛 = 푘=0(푘).

( ) ∑푛 푛 푘 ( )푛 ( ) 푛 Define 푆 푥 = 푘=0(푘)푥 = 1 + 푥 , then 푆푛 = 푆 1 = 2 .

Example 13. ∑푛 푛 Compute 푆푛 = 푘=0 푘(푘).

( ) ∑푛 푛 푘 ( )푛 ′( ) ( )푛−1 ( ) Define 푆 푥 = 푘=0(푘)푥 = 1 + 푥 , then 푆 푥 = 푛 1 + 푥 , hence 푆푛 = 푆′ 1 = 푛2푛−1.

In certain cases, expressing the general term 푎푘 as a function of 푥 and employing methods of calculus can be helpful fo computing finite sums.

푛 푘 Example 14. Compute 푆푛 = ∑푘=0 푘푟 .

푛 푘 Define 푆(푟) = ∑푘=0 푟 and differentiate 푆(푟) with respect to 푟:

푛 푑푆(푟) = ∑ 푘푟푘−1 푑푟 푘=0 푛 1 = ∑ 푘푟푘. 푟 푘=0

1−푟푛+1 On the other hand 푆(푟) = and 1−푟

푑푆(푟) 푛푟푛+1 − (푛 + 1)푟푛 + 1 = . 푑푟 (1 − 푟)2

Comparing the two expressions obtained for 푑푆(푟)/푑푟 we get

푛 푛푟푛+1 − (푛 + 1)푟푛 + 1 ∑ 푘푟푘 = 푟 . (1 − 푟)2 푘=0

F I N I T E C ALCULUS

The difference (or finite derivative) operator Δ maps a function 푓: ℝ → ℝ to the function Δ푓: ℝ → ℝ which is defined as

Δ푓(푥) = 푓(푥 + 1) − 푓(푥).

120 | Finite Sums

It is seen that Δ푝 = 0 if and only if 푝(푥) is a function which is periodic with 1, for exam- ple Δ(sin(2휋푥)) = 0. In particular, difference of a constant function is zero. It follows that Δ푓 =

Δ푔 if and only if the functions 푓 and 푔 differ by a function which is periodic with 1.

Difference of the function 푓(푥) = 푥 is (푥 + 1) − 푥 = 1, that is

Δ푥 = 1.

Since 2푥+1 − 2푥 = 2푥, difference of the function 푓(푥) = 2푥 is itself:

Δ2푥 = 2푥.

Differences of some frequently used functions are as follows

Δ푥2 = (푥 + 1)2 − 푥2 = 2푥 + 1 ,

1 1 1 1 Δ = − = . 푥 푥 + 1 푥 푥(푥 + 1)

If 푥 ∈ ℕ, then

Δ푥! = 푥 ⋅ 푥! , 푥 푥 Δ ( ) = ( ) , 푘 푘 − 1 1 Δ퐻 = , 푥 푥 + 1

Δ (∑ 푎푘) = 푎푥+1 . 푘=1

Linearity of difference operator is obvious, that is

Δ(푎푓 + 푔) = 푎Δ푓 + Δ푔 for any 푓, 푔: ℝ → ℝ and 푎 ∈ ℝ.

If the difference of 퐹 is 푓, that is, Δ퐹 = 푓, the function 퐹 is called an anti-difference of 푓. The operation which sends 푓 to an anti-difference is denoted by Σ. Thus, Σ is inverse of the opera- tor Δ. For a given function 푓, the class of all anti-differences is denoted by ∑ 푓(푥)훿푥 and it is

Finite Sums | 121

푏 called the indefinite sum of 푓. The definite sum of 푓 is defined by setting ∑푎 푓(푥)훿푥 = 퐹(푏) −

푏 퐹(푎) = 퐹|푎 where 퐹 is any antiderivative of 푓.

For any integers 푎, 푏 and 푐 such that 푎 ≤ 푏 ≤ 푐, the definite sum satisfies the following equali- ties:

푎 ∑ 푓(푥)훿푥 = 0 , 푎

푏 푎 ∑ 푓(푥)훿푥 = − ∑ 푓(푥)훿푥 , 푎 푏

푐 푏 푐 ∑ 푓(푥)훿푥 = ∑ 푓(푥)훿푥 + ∑ 푓(푥)훿푥 . 푎 푎 푏

푏 Let Δ퐹 = 푓, then the relation between the finite sum ∑푘=푎 푓(푘) and the definite

푏 sum ∑푎 푓(푥)Δ푥 is obtained as follows:

푏 ∑ 푓(푘) = 푓(푎) + 푓(푎 + 1) + 푓(푎 + 2) + ⋯ + 푓(푏 − 2) + 푓(푏 − 1) + 푓(푏) 푘=푎

= ⏟퐹( 푎 + 1 ) − 퐹 (푎 ) + ⏟퐹( 푎 + 2 ) − 퐹 ( 푎 + 1 ) + ⏟퐹( 푎 + 3 ) − 퐹 ( 푎 + 2 ) + ⋯ + 푓(푎) 푓(푎+1) 푓(푎+2)

= ⏟퐹( 푏 − 1 ) − 퐹 ( 푏 − 2 ) + ⏟퐹( 푏 ) − 퐹 (푏 − 1 ) + ⏟퐹( 푏 + 1 ) − 퐹 (푏 ) 푓(푏−2) 푓(푏−1) 푓(푏)

= 퐹(푏 + 1) − 퐹(푎)

푏+1 = ∑ 푓(푥)훿푥 푎

푛 푘 푛+1 푥 Example 15. Let 푟 be a nonzero real number, then ∑푘=0 푟 = ∑0 푟 훿푥.

We compute the difference of 푟푥: Δ푟푥 = 푟푥+1 − 푟푥 = 푟푥(푟 − 1) which implies

푟푥 that Δ ( ) = 푟푥. Then 푟−1

푛 푛+1 ∑ 푟푘 = ∑ 푟푥훿푥 0 푘=0

푟푥 푛+1 푟푛+1 − 1 = | = . 푟 − 1 0 푟 − 1

122 | Finite Sums

1 1 1 1 Example 16. Since Δ ( ) = − = − we obtain 푥 푥+1 푥 푥(푥+1)

푛 푛+1 1 1 ∑ = ∑ 훿푥 푘(푘 + 1) 푥(푥 + 1) 푘=1 0

1 푛+1 = − | 푥 0 푛 = . 푛 + 1

Example 17. Using Δ푥! = 푥 ⋅ 푥! ,

푛 푛+1 푛+1 ∑ 푘 ⋅ 푘! = ∑ 푥 ⋅ 푥! 훿푥 = 푥!|0 = (푛 + 1)! − 1. 0 푘=0

Example 18. 푥 푥 As Δ(푚+1) = (푚) , we have

푛 푘 푛+1 푥 푥 푛+1 푛 + 1 ∑ ( ) = ∑ ( ) 훿푥 = ( )| = ( ). 푚 푚 푚 푚 + 1 0 푚 + 1 푘=푚

Falling factorial powers

For 푥 ∈ ℝ and 푛 ∈ ℕ, the product ⏟푥( 푥 − 1 ) ⋯ ( 푥 − 푛 + 1 ) is called a falling factorial power 푛 factors of 푥 and it is denoted by 푥푛, that is for a positive integer 푛

푥푛 = 푥(푥 − 1) ⋯ (푥 − 푛 + 1).

Some examples are 푥1 = 푥, 푥2 = 푥2 − 푥, 12 = 0. If 푛 is a positive integer then 푛푛 = 푛! and 푛푚 = 푛!/(푛 − 푚)! for integer 푚 ≤ 푛.

By convention

푥0 = 1

Finite Sums | 123

and for negative falling factorial powers we define

1 푥−푛 = . (푥 + 1)(푥 + 2) ⋯ (푥 + 푛) Difference of 푥푛 is

Δ(푥푛) = (푥 + 1)푛 − 푥푛

= [(푥 + 1)푥(푥 − 1) ⋯ (푥 − 푛 + 2)] − [푥(푥 − 1) ⋯ (푥 − 푛 + 1)]

= 푥(푥 − 1) ⋯ (푥 − 푛 + 2)[(푥 + 1) − (푥 − 푛 + 1)]

= 푛푥푛−1.

It follows that for any integer 푎 ≠ −1

푛 1 푛 1 ∑ 푥푎훿푥 = 푥푎+1| = 푛푎+1 . 0 푎 + 1 0 푎 + 1

1 Since Δ퐻 = = 푥−1, we have ∑푛 푥−1훿푥 = 퐻 |푛 = 퐻 . We combine these two sums as 푥 (푥+1) 0 푥 0 푛

1 푎+1 푛 푛 if 푎 ≠ −1 ∑ 푥푎훿푥 = {푎 + 1 . 0 퐻푛 if 푎 = −1

In terms of finite sums we can write

푛 1 푎+1 푛+1 (푛 + 1) if 푎 ≠ −1 ∑ 푘푎 = ∑ 푥푎훿푥 = {푎 + 1 . 0 푘=0 퐻푛+1 if 푎 = −1

Some particular cases are 푛 푛+1 1 푛+1 1 ∑ 푘 = ∑ 푥1훿푥 = 푥2| = 푛(푛 + 1), 1 2 1 2 푘=1 푛 1 ∑(푘 − 1)푘 = (푛 − 1)푛(푛 + 1), 3 푘=1 푛 1 ∑(푘 − 2)(푘 − 1)푘 = (푛 − 2)(푛 − 1)푛(푛 + 1). 4 푘=1

124 | Finite Sums

푛 3 3 2 1 3 Example 19. Compute ∑푘=1 푘 . First observe that 푘 +3푘 + 푘 = 푘 . Then 푛 푛 ∑ 푘3 = ∑ 푘3 + 3푘2 + 푘1 푘=1 푘=1 1 1 = (푛 + 1)4 + (푛 + 1)3 + (푛 + 1)2. 4 2

For the product of two functions we have

Δ(푓푔)(푛) = (푓푔)(푛 + 1) − (푓푔)(푛) = 푓(푛 + 1)푔(푛 + 1) − 푓(푛)푔(푛).

To have a product rule which is analogous of the product rule for derivatives, we define a new operator, namely the shift operator 퐸 which maps a function 푓: ℝ → ℝ to the function E푓: ℝ → ℝ which is defined as E푓(푥) = 푓(푥 + 1). Using the shift operator, we can write

Δ(푓푔)(푥) = 푓(푥 + 1)푔(푥 + 1) − 푓(푥)푔(푥) + 푔(푥 + 1)푓(푥) − 푔(푥 + 1)푓(푥) = 푔(푛 + 1)(푓(푥 + 1) − 푓(푥)) + 푓(푥)(푔(푥 + 1) − 푔(푥)) = (퐸푔 ⋅ Δ푓)(푥) − (푓 ⋅ Δ푔)(푥) so that Δ(푓푔) = 퐸푓 ⋅ Δ푔 + 푓 ⋅ Δ푔 which leads to

∑ 푢Δ푣 = 푢푣 − ∑ 퐸푣 Δ푢.

Above rule is known as the summation by parts.

푛 2 Example 20. Compute ∑푘=1 푘 .

푛 2 푛+1 2 1 First write ∑푘=1 푘 = ∑1 푥 훿푥 and let 푢(푥) = 푥 and Δ푣(푥) = 푥훿푥 = 푥 훿푥 so that 1 1 Δ푢(푥) = 훿푥 and 푣(푥) = 푥2 and 퐸푣(푥) = (푥 + 1)2. Then 2 2

1 1 ∑ 푥2훿푥 = 푥2 − ∑(푥 + 1)2훿푥 2 2 1 1 = 푥 ⋅ 푥2 − (푥 + 1)3 2 6 1 = 푥(푥 + 1)(3푥 − (푥 − 1)) 6 1 = 푥(푥 + 1)(2푥 + 1). 6

Finite Sums | 125

Then

푛 푛+1 ∑ 푘2 = ∑ 푥2훿푥 1 푘=1

1 푛+1 = 푥(푥 − 1)(2푥 − 1)| 6 0

1 = 푛(푛 + 1)(2푛 + 1). 6

푛 Example 21. Compute ∑푘=1 푘퐻푘.

푛 푛+1 1 First write ∑푘=1 푘퐻푘 = ∑1 푥퐻푥 훿푥 and let 푢(푥) = 퐻푥 and Δ푣(푥) = 푥 훿푥 so that

1 1 Δ푢(푥) = 푥−1훿푥 and 푣(푥) = 푥2 and 퐸푣(푥) = (푥 + 1)2. Then 2 2

푛+1 푛+1 푛+1 1 2 1 −1 2 ∑ 푥퐻푥 훿푥 = 푥 퐻푥| − ∑ 푥 (푥 + 1) 훿푥 2 1 2 1 1

푛+1 1 1 = (푛 + 1)2퐻 − ∑ 푥1훿푥 2 푛+1 2 1

푛+1 1 −2 1 2 = (푛 + 1) 퐻푛+1 − 푥 | 2 4 1

푛+1 1 −2 1 2 = (푛 + 1) 퐻푛+1 − (푛 + 1) | 2 4 1

1 1 = (푛 + 1)−2 (퐻 − ) 2 푛+1 2

1 1 = 푛(푛 + 1) (퐻 − ). 2 푛+1 2

126 | Finite Sums

All the finite sums we computed throughout the examples in this section are listed in the fol- lowing table. The boldface numbers in the table are numbers of exercises in which the corre- sponding sum is computed. Italicized numbers refer to exercises.

Double Power Finite Perturbation Sums Series Calculus

풏 1 2. a) ∑ 풌 = 푛(푛 + 1) 2 풌=ퟎ 풏 1 3 8 20 ∑ 풌ퟐ = 푛(푛 + 1)(2푛 + 1) 6 풌=ퟎ 풏 1 2. b) 19 ∑ 풌ퟑ = 푛2(푛 + 1)2 4 풌=ퟎ 풏 푛+1 1 − 푟 1 15 ∑ 풓풌 = 1 − 푟 풌=ퟎ 풏 푛+1 (푛푟 − 푛 − 1)푟 + 푟 2 2. c) 14 ∑ 풌풓풌 = (1 − 푟)2 풌=ퟎ 풏 9 ∑ 풌ퟐ풌 = (푛 − 1)2푛+1 + 2 풌=ퟏ 풏 4 17 ∑ 풌 ⋅ 풌! = (푛 + 1)! − 1 풌=ퟎ 풏 풏 12 ∑ ( ) = 2푛 풌 풌=ퟎ 풏 풏 5 13 ∑ 풌 ( ) = 푛2푛−1 풌 풌=ퟎ 풏 풏 6 ∑ 풌ퟐ ( ) = 푛(푛 + 1)2푛−2 풌 풌=ퟎ 풏 풌 푛 + 1 1. a) 18 ∑ ( ) = ( ) 풎 푚 + 1 풌=풎 푛 + 1 푛푥 풏 sin ( 푥) sin 2 2 ∑ 퐬퐢퐧(ퟐ흅풌) = 푥 sin 풌=ퟎ 2 7 푛 + 1 푛푥 풏 cos ( 푥) sin 2 2 ∑ 퐜퐨퐬(ퟐ흅풌) = 1 + 푥 sin 풌=ퟎ 2 풏 1. b) 10 ∑ 푯풌 = (푛 + 1)퐻푛 − 푛. 풌=ퟏ 풏 1 1 1. c) 11 21 ∑ 풌 푯 == 푛(푛 + 1) (퐻 − ) 풌 2 푛+1 2 풌=ퟏ 풏 ퟏ 푛 16 ∑ = 풌(풌 + ퟏ) 푛 + 1 풌=ퟏ

Finite Sums | 127

E XERCISES

1. Compute the following sums by perturbing the sum:

∑푛 푘 a) 푆푛 = 푘=푚(푚),

푛 b) 푆푛 = ∑푘=1 퐻푘,

푛 c) ∑푘=1 푘 퐻푘 ,

푛 2 푛 d) ∑푘=1 푘 (푘).

2. Compute the following sums by converting the given sum to a double sum:

푛 a) 푆푛 = ∑푘=1 푘,

푛 3 b) 푆푛 = ∑푘=1 푘 ,

푛 푘 c) 푆푛 = ∑푘=0 푘푟 .

푛(푛+1) 3. Show that ∑푛 (−1)푘푘2 = (−1)푛 . 푘=1 2

4. Compute the following sums

∑푛 ( )푘 푛 푛 a) 푘=0 −1 (푘)푘 ,

푛 푛−푘 2 b) ∑푘=1 2 푘 ,

푘 c) ∑푛 . 푘=1 (푘+1)!

128 | Finite Sums

The coupon collector’s problem is one of the most popular topics in discrete probability,

as it is simple and useful. It is known since 1708, when the problem is first seen in the liter-

ature in ‘De Mensura Sortis’ (On the Measurement of Chance) written by A.De Moivre. In

1938 the problem appeared in ‘A Problem in Cartophily’, written by F. G. Maunsell. In 1950,

it was introduced in the book ‘An Introduction to and Its Applications’,

written by Willam Feller. From then on, the coupon collector appears in many textbooks.

The coupon collector’s problem has many applications, including cryptography, electrical

engineering and biology. In cryptography the problem is im-

portant for its relation with the random mappings. In electri-

cal engineering it is related to the cache fault problem; in biol-

ogy, the problem can be used to estimate the number of spe-

cies of animals.

C O U P O N C OLLECTOR ’ S P ROBLEM

We assume a bag which contains 푚 distinct balls. We pick a ball from the bag randomly in the manner that each ball is equally likely and the choices are independent. After replacing the picked ball to the bag, we repeat the same experiment until we see all of the balls at least once. Let 푇푚 be the random variable defined to be the number of trials required for each ball being picked at least once. We wish to compute the expected value 퐸(푇푚) of 푇푚, that is, the expected number of times to pick an object until seeing each object (ball) at least once.

Random Mappings and Permutations | 129

Example 1. Consider a football fan who wants to collect a complete set of 10 football cards. Cards are avail- able in a completely random fashion, one per package of candy, which the fan buys one package a day. How long, on the average, will it take the fan to get a complete set?

If the set of cards for 푚 = 10 is represented by a,b,c,d,e,f,g,h,i,j then a possible se- quence of cards bought on each day could be

c g h g d h a j c g f b d c a e d c j g e f a i

A frame around a term of the sequence indicates the first occurrence of the card a,…,j. In that sequence we see that the collection is completed (for the first time) at 24-th package of candy so that the fan had to buy 24 packages to complete the set of the 10 distinct cards. After buying the 8th package, there are six different cards in the collection:

c g h g d h a j.

As the example suggests, we may expect to collect the first cards very quickly with a small number of repetitions. But when we get down to the last few items in the collection, it seems to take much longer to obtain those pieces.

THEOREM B.1. From a set of 푚 distinct objects, the expected number of objects to be picked randomly, with replacement, until completing the collection is

퐸(푇푚) = 푚퐻푚.

Proof. If there is only one ball, that is if 푚 = 1, when we buy the first package, the collection will be completed, 퐸(푇1) = 1.

If there are just two balls 푎 and 푏, the first time we pick a ball, we will naturally have a new ball, say 푎. After having the first piece of the collection we find how many additional balls we are ex- pected to pick for finding the other ball. So we focus on a new experiment, namely, obtaining the ball ‘푏’ starting from that point. In the first attempt of new experiment, the resulting ball can be 푎 or 푏. The set will be completed if the first ball is a ‘푏’. Thus probability of completing the set at the first attempt is 1/2. If the first ball is an ‘푎’ (with pobability 1/2) we have to buy a second ball and probability of seeing a ‘푏’ is 1/2. So completing the collection after the second ball is 1/4. Contin- uing in this manner we see that completing the collection at 푘-th ball is 1/2푘. Then after having the first ball, the expected number of balls required to be picked for seeing ball ‘푏’ is

1 1 1 1 1 1 ⋅ + 2 ⋅ + 3 ⋅ + 4 ⋅ + ⋯ + 푘 ⋅ + ⋯. 2 4 8 16 2푘

130 | Random Mappings and Permutations

1 1 To compute this sum recall that if 푓(푥) = = ∑∞ 푥푡, then 푓′(푥) = = ∑∞ 푡푥푡−1 and 1−푥 푡=0 (1−푥)2 푡=0

푥 ∑∞ 푡푥푡 = . By substituting 푥 = 1/2 we see that above sum is equal to 2. To obtain the first 푡=1 (1−푥)2 ball we have to buy one ball, and for the second ball we are expected to buy 2 more balls. Then

퐸(푇2) = 3.

Now we return to the general case of 푚 balls. We consider the stage of the experiment when the number of distinct balls in the collection is increased to 푘. Assume that in the next 푡 − 1 tries we could not acquire a new ball and after picking the 푡-th ball we have found a new ball. Probabil-

푘푡−1 (푚−푘) ity of this event is ⋅ . Then, starting from that stage, the expected number of balls we 푚푡−1 푚 have to pick until acquiring a new ball is

∞ ∞ 푘푡−1(푚 − 푘) (푚 − 푘) 푘 푡−1 푚 ∑ 푡 ⋅ = ∑ 푡 ( ) = 푚푡 푚 푚 푚 − 푘 푡=0 푡=0

푚 After picking the first ball, we have a new ball. To see a second new ball we expect addi- 푚−1 푚 tional tries. After seeing two distinct balls, we will expectedly try more times to see the third 푚−2 푚 one. Then, to complete the entire collection, the expected number of drawings is 퐸(푇 ) = + 푚 푚−0 푚 푚 푚 1 1 1 + ⋯ + + . But this expression is 퐸(푇 ) = 푚( + + ⋯ + + 1), that is 푚−1 푚−(푚−2) 푚−(푚−1) 푚 푚 푚−1 2

퐸(푇푚) = 푚퐻푚. ∎

Example 1. We return back to the Example 1. Since 퐻10 = 2.928 ⋯ we have 퐸(푇10) = 29.28 ⋯. (Continued) This means that, the fan is expected to buy about 30 packages of candies for complet- ing the collection.

In general, after repeating the experiment for 푟 times, the number of distinct balls we have collected so far will be called the collection size and will be denoted by 퐶푟.

Now we focus on two questions.

When balls are picked for 푛 times, what is the expected number 퐸(퐶푛) of distinct balls in the collection?

When 푛 balls are picked, what is the probability Pr (퐶푛 = 푚) of having a complete collection?

THEOREM B.2. From a set of 푚 distinct balls, if n balls are picked randomly, with replacement, then the expected number of distinct balls is

푛 퐸(퐶푛) = 푚(1 − (1 − 1⁄푚) ).

Random Mappings and Permutations | 131

Proof. In an experiment of picking a ball 푛 times from the bag, call each ball which has seen at least once as a revealed ball. If we have picked a ball 푛 times, the number of all possible collections (respecting order of the balls we pick them) is 푚푛. The number of collections for which a certain ball, say the ball labeled ‘1’, has never seen is (푚 − 1)푛. Then, ‘1’ is counted as a revealed ball in exactly 푚푛 − (푚 − 1)푛 collections. Since this is the same for all 푚 balls as well, we count a total of 푚(푚푛 − (푚 − 1)푛 ) revealed balls in all possible collections. It follows that the average number of revealed balls per collection is, obtained by dividing this quantity by 푚푛. Hence we obtain 푛 푛 푛 퐸(퐶푛) = 푚(푚 − (푚 − 1) )/푚 .

Alternative proof. When we pick the (푘 + 1)-st ball, we can have a ball which is already in the collection with a probability 퐸(퐶푘)/푚 or a ball which appears for the first time with probability

1 − 퐸(퐶푘)/푚. Then

퐸(퐶 ) 퐸(퐶 ) 퐸(퐶 ) = (퐸(퐶 ) + 1) (1 − 푘 ) + 퐸(퐶 ) ⋅ 푘 푘+1 푘 푚 푘 푚 1 = (1 − ) 퐸(퐶 ) + 1. 푚 푘

Multiply both sides with 푥푘+1 and sum over 푘 = 1,2, …:

∞ ∞ ∞ 1 ∑ 퐸(퐶 )푥푘+1 = (1 − ) ∑ 퐸(퐶 )푥푘+1 + ∑ 푥푘+1 푘+1 푚 푘 푘=1 푘=1 푘=1

If we let ℱ(푥) to be the generating function of 퐸(퐶0), 퐸(퐶1), … we can write 푥 ℱ(푥) = 1 (1 − (1 − ) 푥) (1 − 푥) 푚 푚 푚 = − 1 1 − 푥 (1 − (1 − ) 푥) 푚 ∞ ∞ 1 푛 = 푚 ∑ 푥푛 − 푚 ∑ (1 − ) 푥푛 푚 푛=0 푛=0 ∞ 1 푛 = 푚 ∑ (1 − (1 − ) ) 푥푛. 푚 푛=0 푛 Now, the coefficient of 푥 gives 퐸(퐶푛). ∎

Since lim (1 − 1⁄푚)푚 = 푒−1, for large values of 푚, (1 − 1⁄푚)푚 can be approximated with 푚→∞ 푒−1. Now, writing the expected collection size given as 푚(1 − [(1 − 1⁄푚)푚]푛⁄푚), for large values of 푚 we can write the approximation

−푛⁄푚 퐸(퐶푛) ≈ 푚(1 − 푒 ).

132 | Random Mappings and Permutations

Example 1. We return back to the problem where the fan has stopped buying new packages after (Continued) he has bought 15 packages. In this case, for 푚 = 10, the expected size of his collection −1.5 is 퐸(퐶15) ≈ 10(1 − 푒 ) = 7.76 ⋯. He has expectedly completed %78 of the entire collection.

For 푚 = 푛, the expected value is

1 푛 1 퐸(퐶 ) = 푛 (1 − (1 − ) ) ≈ 푛 (1 − ) = 0.6321 푛 푛 푛 푒

THEOREM B.3. From a set of 푚 distinct balls, if 푛 times a ball is picked randomly, with replace- ment, then the probability of having 푐 ≤ 푚 distinct balls is

푐! 푛 푚 Pr(퐶 = 푐) = { } ( ). 푛 푚푛 푐 푐

푚 Proof. If the collection size is 푐, the balls in the collection can be chosen in ( 푐 ) ways. After choosing the balls, assume that we have ordered them so that it is determined which will be the first ball, which will be the second ball, and so on. But this ordering describes a partition of the

푛 ordering numbers 1,2, … , 푛, into 푐 classes. So the number of such orderings is {푐}. Finally the clas- ses can be permuted in 푐! different ways. Then, the number of ways of having a collection of size

푐! 푐 after picking 푛 packages is 푐! {푛}(푚). And we obtain Pr(퐶 = 푐) = {푛}(푚). ∎ 푐 푐 푛 푚푛 푐 푐

COROLLARY B.4. From a set of 푚 distinct balls, if 푛 ≥ 푚 balls are picked randomly, with replace- ment, then the probability of having a complete collection of 푚 distinct balls is

푚! 푛 Pr(퐶 = 푚) = { }. 푛 푚푛 푚

Proof. Just take 푐 = 푚 in Theorem 3. ∎

After computing 퐸(퐶푛), we could obtain 퐸(푇푚) alternatively as follows. It is clear that the sequence 퐸(퐶1), … , 퐸(퐶푘), … is an increasing sequence with lim 퐸(퐶푘) = 푚. This means that by 푘→∞ choosing 푘 sufficiently large, 퐸(퐶푘) can be made as closer to 푚 as we wish.

Random Mappings and Permutations | 133

Example 1. In the below table we see the number of packages bought and the corresponding ex- (Continued) pected collection size for 푚 = 10.

푛 퐸(퐶푛) 푛 퐸(퐶푛) 푛 퐸(퐶푛) 1 1.00 16 8.15 31 9.62 2 1.90 17 8.33 32 9.66 3 2.71 18 8.50 33 9.69 4 3.44 19 8.65 34 9.72 5 4.10 20 8.78 35 9.75 6 4.69 21 8.91 36 9.77 7 5.22 22 9.02 37 9.80 8 5.70 23 9.11 38 9.82 9 6.13 24 9.20 39 9.84 10 6.51 25 9.28 40 9.85 11 6.86 26 9.35 41 9.87 12 7.18 27 9.42 42 9.88 13 7.46 28 9.48 43 9.89 14 7.71 29 9.53 44 9.90 15 7.94 30 9.58 45 9.91

for 푛 ≥ 22 we have 푚 − 퐸(퐶푛) ≤ 1. If 푛 ≥ 29, then 푚 − 퐸(퐶푛) ≤ 1/2 and so on.

For any finite 푘, we can think of 퐸(푇푚) to be the smallest integer 푘 such that 퐸(퐶푘) > 푚 − 휀. Here 휀 measures how the expected value is close to 푚. Inequality 푚(1 − (1 − 1⁄푚)푘) > 푚 − 휀 ln 푚−ln 휀 1 can be written as 푘 > . If we take 휀 = 1, by the approximation ln 푚 − ln(푚 − 1) ≈ ln 푚−ln(푚−1) 푚 for large values of 푚, we get 푘 > 푚 ln 푚. We can conclude that

퐸(푇푚) ≈ 푚 ln 푚.

Example 1. We again return back to Example 1 to consider the case where the fan has stopped (Continued) buying new packages after he sees a card which has seen for the second time. Now what is the expected number of cards he has collected until seeing the first repeating card?

Now we define a new random variable 푅푚 to be the number of the balls picked until the first repeating ball.

Consider the sequence 퐸(퐶1), … , 퐸(퐶푘), … . Necessarily, 퐸(퐶1) = 1 and 퐸(퐶푘) < 푘 for = 2,3, … .

In the first few terms 퐸(퐶푘) will be quite close to 푘. As 푘 gets larger, 퐸(퐶푘) will get farther from 푘.

When the 퐸(퐶푘) < 푘 − 1 the expected image size is smaller than the balls picked. In such a case it

134 | Random Mappings and Permutations

is natural to expect repetitions of the balls. In the table above, we see that for 6 packages, expected collection size is less than 5 cards in which case a repetition is not a surprise.

In general, we can expect a repetition when the difference 푘 − 퐸(퐶푘) exceeds a certain bound, say 1/2. Let 푅푚 be the number of packages bought until the first repetition. Then we can think of

퐸(푅푚) to be the smallest integer 푘 such that 푘 − 퐸(퐶푘) > 1/2.

THEOREM B.5. From a set of 푚 distinct cards, the expected number of balls to be picked ran- domly, with replacement, until the first repetition is

퐸(푅푚) ≈ √푚.

1 Proof. After some simplifications, the inequality 푚(1 − (1 − 1⁄푚)푘) < 푘 − can be written as 2

1 푘 푘 1 1 − (1 − ) < − 푚 푚 2푚

푘 1 푘 1 푘 1 푘 1 1 − (1 − ( ) + ( ) − ( ) + ⋯ ) < − 1 푚 2 푚2 3 푚3 푚 2푚

푘(푘 − 1) 푘 1 1 − 2 ( ) + ⋯ < − 푚2 3 푚3 푚

푘2 푘 푘 3 1 − − + 풪 (( ) ) < − 푚2 푚2 푚 푚

As 푘 is quite small compared to 푚, we can asymptotically write 푘 ≥ √푚. We conclude that

퐸(푅푚) ≈ √푚. ∎

Birthday Paradox

Birthday paradox (or birthday problem) conciders the probability that, in a set of 푛 people, at least one pair to have the same birthday. The result of the problem is quite surprising and far away from the intuitive answer. For this reason, the problem is known as a paradox and is a classic of counting and probability.

The main question asks how many people are required to have a 50-50 chance that two of them will share a birthday.

In the general form, we wish to know the minimum number 푘 of selections, among 푛 different equally likely items so that the probability of at least one match has probability at least 푝0.

Random Mappings and Permutations | 135

THEOREM B.6. From a set of 푚 distinct balls, if n balls are picked randomly, with replacement, then the probability that at least two balls are the same is 푛! 푝(푛, 푘) = 1 − . (푛 − 푘)! 푛푘

Proof. Let 푝(푛, 푘) denote the probability that at least two balls are the same for the experiment of choosing 푘 balls, out of 푛 equally likely balls, allowing repetitions. We first compute the com- plementary probability 푞(푛, 푘) that all selected balls are distinct. Start with an arbitrary ball, then 푛−1 that the probability that the second ball is different is , that the third ball is different from the 푛 푛−1 푛−2 first two is ⋅ and so on, up through the 푘-th ball. Explicitly, 푛 푛

푛 푛 − 1 푛 − 2 푛 − 푘 + 1 푞(푛, 푘) = ⋅ ⋅ ⋯ 푛 푛 푛 푛 푛! = (푛 − 푘)! 푛푘 and the complementary probability is what we try to compute. ∎

For the birthday problem we have to find the smallest value of 푘 such that 365! 1 푝(365, 푘) = 1 − > . (365 − 푘)! 365푘 2

In the table below we see the values of 푝(365, 푘) for 푘 = 1, … ,60:

푘 푝(365, 푘) 푘 푝(365, 푘) 푘 푝(365, 푘) 푘 푝(365, 푘) 푘 푝(365, 푘) 푘 푝(365, 푘) 1 0,000 11 0,141 21 0,444 31 0,730 41 0,903 51 0,974 2 0,003 12 0,167 22 0,476 32 0,753 42 0,914 52 0,978 3 0,008 13 0,194 23 0,507 33 0,775 43 0,924 53 0,981 4 0,016 14 0,223 24 0,538 34 0,795 44 0,933 54 0,984 5 0,027 15 0,253 25 0,569 35 0,814 45 0,941 55 0,986 6 0,040 16 0,284 26 0,598 36 0,832 46 0,948 56 0,988 7 0,056 17 0,315 27 0,627 37 0,849 47 0,955 57 0,990 8 0,074 18 0,347 28 0,654 38 0,864 48 0,961 58 0,992 9 0,095 19 0,379 29 0,681 39 0,878 49 0,966 59 0,993 10 0,117 20 0,411 30 0,706 40 0,891 50 0,970 60 0,994

We see that the smallest value of 푘 for which 푝(365, 푘) > 1/2 is 푘 = 23. We conclude that if there are 23 people, then the probability that at least two of them have the same birthday is larger than 0.5. For 41 people the same probability is larger than 0.9 and for = 57 , by probability 0.99 at least two people in the group have the same birthday.

136 | Random Mappings and Permutations

푛! Since the formula 푝(푛, 푘) = 1 − is not practical for large values of 푛, we develop some (푛−푘)!푛푘

푚 approximations. First note that if is sufficiently small, then in the expansion 푛

푚 푚2 푚3 푒−푚/푛 = 1 − + − + ⋯ 푛 푛2 푛3

푚2 푚3 the terms , , ⋯ can be neglected and we can write 푛2 푛3

푚 푒−푚/푛 ≈ 1 − . 푛

Now write 푝(푛, 푘) in the form

푛 1 2 푘 − 1 푝(푛, 푘) = 1 − ⋅ (1 − ) ⋅ (1 − ) ⋯ (1 − ) 푛 푛 푛 푛 and use the above approximation to have

푘−1 − 푝(푛, 푘) ≈ 1 − 푒−1⁄푛푒−2⁄푛 ⋯ 푒 푛

1+2+⋯+(푘−1) − = 1 − 푒 푛

푘(푘−1) − . = 1 − 푒 2푛

Using the approximation 푒−푚/푛 = 1 − 푚/푛 once more we obtain

푘(푘 − 1) 푝(푛, 푘) ≈ 2푛

푘2 푘 = − . 2푛 2푛

As 푘 is very small, compared to 푛, we can neglect 푘/2푛 and reach to a coarser but practical approximation

푘2 푝(푛, 푘) ≈ . 2푛

Random Mappings and Permutations | 137

2 To find the smallest 푘 for which 푝(푛, 푘) > 푝0 we write 푘 > 2푛푝0 or 푘 > √2푛푝0. We conclude that, when 푛 is large enough, if at least

푘 = √2푛푝0 items are chosen (out of 푛 distinct items), then at least two of them will be the same with proba- bility at least 푝0.

R A N D O M M APPINGS

By ℱ푛,푚 we denote the collection of all functions 푓 from a finite domain 푋 of size 푛 to a finite range 푌 of size 푚. We assume the random mapping model where every function from ℱ푛,푚 is cho- sen equally likely. This model is equivalent to the model where 푓: 푋 → 푌 assigns each input 푥 ∈ 푋 independently to an image point 푦 ∈ 푌, that is Pr(푓(푥) = 푦) = 1/푚 for all 푥 ∈ 푋 and 푦 ∈ 푌. The 푛 푛 number of all functions 푋 → 푌 is 푚 , in other words |ℱ푛,푚 | = 푚 . A random mapping 푓 ∈ ℱ푛,푚 is equivalent to the experiment of buying 푛 candies to collect the set of 푚 cards. The properties we have obtained in coupon collector’s problem translates in the language of functions as follows.

Image size of a random function 푓 ∈ ℱ푛,푚, is 푘 with probability

푘! 푚 푛 Pr(|푓(푋)| = 푘) = ( ) { }. 푚푛 푘 푘

If 푛 ≥ 푚, then Probability of a random function 푓 ∈ ℱ푛,푚 to be an onto function is

푚! 푛 Pr(|푓(푋)| = 푚) = { }. 푚푛 푚

T

The expected image size of a random function 푓 ∈ ℱ푛,푚 is

1 푛 퐸(|푓(푋)| ) = 푚 (1 − (1 − ) ). 푚

From the last statement it follows that

푚 푘! 푚 푛 1 푛 ∑ 푘 ( ) { } = 푚 (1 − (1 − ) ). 푚푛 푘 푘 푚 푘=1

138 | Random Mappings and Permutations

R A N D O M P ERMUTATIONS

A random permutation of 푛-objects is a permutation which is chosen among all permutations where each of the 푛! possible permutations are equally likely. Since a random permutation is a random ordering of a set of objects, the use of them is fundamental to fields that use random- ized algorithms such as coding theory, cryptography, and simulation. A good example of a ran- dom permutation is the of a deck of cards.

There are 푛! permutations of 푛 elements. That is too many to generate them by numbering them all and choosing one at random. Random permutations are quite useful in randomized algo- rithms. So it is helpful to have efficient algorithms for generating them. An equivalent way to gen- erate a random permutation 휎 of {1, … , n} is to put 푛 balls labeled 1 to 푛 in a box and then at each step drawing a ball randomly and without replacement from the box to determine the values of 휎(1), 휎(2), … , 휎(푛) sequentally.

The statistics of random permutations, such as the cycle structure, fixed points are of funda- mental importance in the analysis of algorithms. We compute certain characteristics of random permutations.

1 THEOREM B.7. The expected number of 푘-cycles of a random permutation of 푛 objects is . 푘 Proof. Assume that that we have written down the cycle decomposition of all permutations of {1, … , 푛}. How many cycles of length 푘 are there? Fix a cycle, say [1,2, … , 푘 ], of 푘 elements and arrange the remaining 푛 − 푘 elements in all possible ways. In this way we obtain all (푛 − 푘)! per- mutations in which [1,2, … , 푘 ] appears in the cycle decomposition. Since these 푘 elements can 푛 define (푘 − 1)! cycles and the 푘 elements of the cycle can be picked in (푘) different ways, in the 푛! list of all permutations, there are (푛 − 푘)! (푛)(푘 − 1)! = cycles of length 푘. Thus, on the average 푘 푘 1 a random permutation has cycles of length 푘. ∎ 푘

COROLLARY B.8. The expected number of cycles of a random permutation of 푛 objects is 퐻푛. Proof. Follows immediately from the theorem. 푛 푛 푛 푘 푛 Alternative proof. Recall that 푥 = ∑푘=0[푘]푥 so that 푓(푥) = 푥 is the generating function of 푛 푛 푛 푛 the sequence[0], [1], [2], … , [푛]. Then the expected number of cycles is푓′(1)/푓(1). But 1 1 1 푓′(푥) = 푥푛 ( + + ⋯ + ), 푥 푥 + 1 푥 + 푘 − 1

′ then 푓 (1) = 푛! 퐻푛 and 푓(1) = 푛!. Expected number of cycles is 퐻푛. ∎

Random Mappings and Permutations | 139

COROLLARY B.9. For any positive integer 푛,

푛 푛 ∑ 푘 [ ] = 푛! 퐻 푘 푛. 푘=1

Proof. Each side of equality counts all cycles in all permutations of 푛 objects. ∎

Following theorem shows that the probability of a fixed element to be in a cycle of length 푘 does not depend on 푘.

THEOREM B.10. Probability that a fixed element of {1, … , 푛} is in a cycle of length 푘 is 1/푛.

Proof. A fixed element say ‘1’ is in a cycle of length 푘 if 휎(1), 휎2(1), … , 휎푘−1(1) are pairwise 푛−1 푛−2 distinct and they are all different from 1 , and 휎푘(1) = 1. Probability of that event is ⋅ ⋅ 푛 푛−1 푛−3 푛−푘 1 1 ⋯ ⋅ = . ∎ 푛−2 푛−푘+1 푛−푘 푛

푛+1 THEOREM B.11. The expected length of the cycle containing a fixed element is . 2

Proof. The length of the cycle containing a fixed element can take any value 1,2, … , 푛 with equal 푛+1 probabilities. The average of these lengths is . ∎ 2

THEOREM B.12. Any fixed 푚 elements of {1, … , 푛} lie in the same cycle of a random permutation, with probabilty 1/푚.

Proof. Assume that the fixed elements lie in some cycle of length 푚 + 푘, then we need 푘 more 푛−푚 elements to form the cycle, which can be chosen in ( 푘 ) ways. Then the cycle can be formed in (푚 + 푘 − 1)! ways and the remaining 푛 − 푚 − 푘 elements can be arranged in one of (푛 − 푚 − 푘)! ways. As a result, the number of permutations in which the fixed 푚 elements in the same cycle of length 푘 is

푛 − 푚 (푛 − 푚)! ( ) (푚 + 푘 − 1)! (푛 − 푚 − 푘)! = (푚 + 푘 − 1)! 푘 푘!

If we sum over 푘 = 1, … , 푛 − 푚:

푛−푚 푛−푚 (푚 + 푘 − 1)! 푚 + 푘 − 1 (푛 − 푚)! ∑ = (푛 − 푚)! (푚 − 1)! ∑ ( ) 푘! 푘 푘=0 푘=0 푛 = (푛 − 푚)! (푚 − 1)! ( ) 푛 − 푚 푛! = . 푚 Then assertion follows. ∎

140 | Random Mappings and Permutations

A cycle which contains more than half of all elements is called a long cycle.

THEOREM B.13. As 푛 gets larger, the probability of having a long cycle converges to ln 2.

푛! Proof. The number of cycles of length 푘 in all permutations is . If 푘 > 푛/2, the permutation 푘 can not have more than one cycles of length 푘. Thus, the probability of having a cycle of length 푘 > 푛/2 is 1/푘. Then summing on all values of 푘 larger than 푛/2 we see that the probability of having 1 1 a long cycle is 푛 + ⋯ + = 퐻 − 퐻푛. For large values of 푛 we use the approximation 퐻 ≈ ln 푛 + +1 푛 푛 푛 2 2

훾 which results in 퐻푛 − 퐻푛 ≈ ln 푛 − ln(푛⁄2) = ln 2. ∎ 2

1 The function is the exponential generating function of number of permutations of 푛 objects: 1−푥 1 푥푘 푥푛 = ∑∞ 푥푘 = ∑∞ 푘! so that the coefficient of is 푛!, the number of permutations of 푛 ob- 1−푥 푘=0 푘=0 푘! 푛! 1 푥푘 jects. We can write this function as = exp (− ln(1 − 푥)). But − ln(1 − 푥) = ∑∞ = ∑∞ (푘 − 1−푥 푘=1 푘 푘=1 푥푘 1)! . It is seen that − ln(1 − 푥) is the exponential generating function of number of cycles of 푘! length 푘. Then, expression

푥2 푥3 푥4 exp (−ln(1 − 푥)) = exp (푥 + + + + ⋯ ) 2 3 4 for the exponential generating function of permutations, takes the cycle structure in account. For example

푥2 푥3 푥4 푥5 exp (푥 + + + + ) 2 3 4 5 is the exponential generating function of number of permutations with longest cycle length 5.

A derangement is a permutation with no fixed points, that is with no cycles of length Example 2. 1. Then the exponential generating function of derangements is (Problème des 푥2 푥3 푥4 exp ( + + + ⋯ ) = exp (−푥 − ln (1 − 푥)) Rencontres) 2 3 4 푒−푥 = . 1 − 푥 (−1)푘 푒−푥 푒−푥 is the exponential generating function of the sequence { } And is the se- 푘! 1−푥

(−1)푘 quence of partial sums of that sequence. Then 퐷 = 푛! ∑푛 . 푛 푘=0 푘!

Random Mappings and Permutations | 141

Example 3. An involution is a permutation whose cycle decomposition consists of fixed points (Number of and 2-cycles. Then the exponential generating function of involutions is Involutions) ∞ 푘 푥2 1 푥2 exp (푥 + ) = ∑ (푥 + ) 2 푘! 2 푘=0 ∞ 푘 1 푘 1 = ∑ ∑ ( ) 푥푘+푖 푘! 푖 2푖 푘=0 푖=0 ∞ ⌊푛⁄2⌋ 1 푛 − 푘 = ∑ ( ∑ ( )) 푥푛 2푘(푛 − 푘)! 푘 푛=0 푘=0

∞ ⌊푛⁄2⌋ 1 = ∑ ( ∑ ) 푥푛. 2푘푘! (푛 − 2푘)! 푛=0 푘=0

Then number of involutions of 푛 objects is

⌊푛⁄2⌋ 푛! 1 ∑ . 2 2푘푘! (푛 − 2푘)! 푘=0

142 | Random Mappings and Permutations

The theory of rook polynomials provides a way of counting permutations with restricted positions. Classical theory was developed by Kaplansky and Riordan in 1946 and has been researched and studied quite extensively since then. In chess, a rook can attack any square in its corresponding row or column of the 8 × 8 chessboard. Rook theory focuses on the placement of non-attacking rooks in a more general situation. The rook polynomial of a board counts the number of ways of placing non-attacking rooks on the board.

For positive integers 푛 and 푚 we define an 풏 × 풎 board to be a rectangular chessboard con- sisting of 푛 rows and 푚 columns. A rook placement is an arrangement of anumber of non-attack- ing rooks on some board. Note that since rooks attack squares in their row and column, a rook placement is, in fact, choosing a number of unit squares (cells) no two of which are on the same column or on the same row.

Figure 1. Six non-attacking rooks on a 9 × 12 board.

Rook Polynomials | 143

We use ordered the pair (푖, 푗), 푖 = 1, … , 푛, 푗 = 1, … , 푚 to denote the cell that is on row 푖 and column 푗 of an 푛 × 푚 board. In the above figure, rooks are placed at the cells (2,6), (3,10), (5,7), (6,2), (7,12), (9,8).

A placement of 푛 rooks on an 푛 × 푛 square board can be associated to the permutation 휎 =

휎1휎2 ⋯ 휎푛 of {1, … , 푛}, by saying the placement has a rook on the cell (푖, 푗) of the board if and only if 휎푖 = 푗. For example, the placement of 5 non-attacking rooks on a 5 × 5 board shown in below figure is the permutation 24513.

In a similar manner, a placement of 푘 rooks on an 푛 × 푚 board corresponds to a particular arrangement of 푘 distinct objects, each of which is chosen from a set of 푛 elements. In this way, we see that any theorem about rook placements is a generalization of a theorem about permuta- tions.

We are interested in computing the number of ways of rook placements on a board. The 푘-th rook number 푟푘(퐵), counts the number of ways to place 푘 non-attacking rooks on a board 퐵. We will often denote 푟푘(퐵) as 푟푘 when 퐵 is clear for the given context. The rook polynomial of a board 퐵 is the polynomial

2 푅(퐵; 푥) = 푟0 + 푟1푥 + 푟2푥 + ⋯.

For any board, since there is only one way to place 0 rooks, we always have 푟0 = 1, no matter which board is considered.

A single rook can be placed on any cell of a board with no other rook to attack it. It follows that

푟1 is the number of unit squares of the board. The largest possible number of non-attacking rooks on an 푛 × 푚 board is equal to the smallest of 푛 and 푚, because we cannot allocate non-attacking rooks more than the number of columns or rows. Thus, 푟푘 = 0 for 푘 > min(푚, 푛). For a 1 × 1 board, 푟0 = 푟1 = 1 and 푟푘 = 0 for 푘 ≥ 2. Since we cannot allocate more than one rook on a 1 × 푛 or on an 푛 × 1 board, the rook polynomial of such a board is 1 + 푛푥.

THEOREM C.1. The number of rook placements of 푘 rooks on an 푛 × 푚 board is 푛 푚 푟 = ( ) ( ) 푘! 푘 푘 푘

Proof. Consider an 푛 × 푚 board on which we wish to allocate 푘 rooks. To place the rooks, first choose 푘 columns and 푘 rows arbitrarily. This can be 푛 푚 done in (푘)( 푘 ) ways. Each chosen row intersects the chosen columns in 푘 cells, hence for the first chosen row there are 푘 positions to place a rook. For the second one there are 푘 − 1 positions and continuing in this manner, we see that there are 푘! ways to place 푘 rooks on the chosen rows and columns. Hence we have a 푛 푚 total of (푘)( 푘 )푘! ways to place the 푘 rooks on an 푛 × 푚 board. ∎

144 | Rook Polynomials

COROLLARY C.2. Rook polynomial of an 푛 × 푚 board 퐵푚,푛 is 푛 푚 푛 푚 푅(퐵 ; 푥) = 1 + 푚푛푥 + 2 ( ) ( ) 푥2 + ⋯ + ( ) ( ) 푘! 푥푘 + ⋯. 푚,푛 2 2 푘 푘 Proof. Claim is a direct consequence of the theorem. ∎

Example 1. Some obvious rook polynomials are

푅( ; 푥) = 1 + 푛푥,

푅( ; 푥) = 1 + 4푥 + 2푥2,

푅( ; 푥) = 1 + 2푛푥 + 푛(푛 − 1)푥2,

푅 ( ; 푥) = 1 + 9푥 + 18푥2 + 6푥3,

푅 ( ; 푥) = 1 + 3푛푥 + 3푛(푛 − 1)푥2 + 푛(푛 − 1)(푛 − 2)푥3.

Now we generalize the problem in the sense that we consider boards where some of the squares are not allowed for placing a rook. For example, in the below figure we see a 2 × 4 board with 3 shaded squares which are forbidden to rook placement.

Such a subset of an 푛 × 푛 board will be called a generalized board. A generalized board can be represented as a subset of a rectangular board by shading the forbidden cells or it can be drawn as it is, neglecting the forbidden cells:

Example 2. We find the rook polynomial of the following generalized board 픅:

which can be represented as

There is only one way to place 0 rooks on the board, hence 푟0(픅) = 1:

Rook Polynomials | 145

A single rook can be placed in any cell of 픅 with no other rooks to attack it. It follows that, as for

any generalized board, 푟1 is the number of available cells. In our example 푟1(픅) = 10:

There are 34 ways to allocate 2 non-attacking rooks on the board, 푟2(픅) = 34:

The number of ways of placing 3 non-attacking rooks is 45, 푟3(픅) = 45:

Finally, the number of ways of placing 4 non-attacking rooks is 20, 푟4(픅) = 20:

For the board in this example we obtain

푟0(픅) = 1, 푟1(픅) = 10, 푟2(픅) = 34, 푟3(픅) = 45, 푟4(픅) = 20. Then, rook polynomial is

푝(픅; 푥) = 1 + 10푥 + 34푥2 + 45푥3 + 20푥4.

146 | Rook Polynomials

Equivalent Boards

To obtain the rook polynomial or rook numbers of a generalized board, it is not practical to count the ways of rook placements by explicitly considering all possible cases. In the following part, we obtain some shortcuts for obtaining rook numbers and the rook polynomial. We first list some trivial properties of rook numbers:

1. 푟0 is always 1 because there is only one way to place 0 rooks on a generalized board. 2. 푟1 is always the number of cells of the board because a single rook can be placed in any cell with no other rook to attack it.

3. Once we attain 푟푘 = 0, we will always have 푟푘+1, 푟푘+2, … = 0. 4. If the board is contained in an 푛 × 푚 square board and 푘 > min(푚, 푛), then 푟푘 = 0. How- ever, note that 푟푘 could be equal to 0 for smaller values of 푘 as well. If the number of placements of 푘 rooks on two boards are the same for all 푘 = 1,2, …, we call the boards equivalent. In other words, two boards are equivalent if and only if their rook polyno- mials are identical.

THEOREM C.3. If a generalized board can be obtained from another one by permuting the rows and columns, then the boards are equivalent. Proof. It is sufficient to prove the theorem for rectangular boards. Interchanging rows or col- umns of a rectangular board does not alter the number of ways to place k mutually non-attacking rooks. In fact, given a placement of 푘 rooks, then permuting the rows or the columns of the board results in another rook placement. Moreover, the number of distinct placements is not affected by such permutations. ∎ Converse of the above theorem is not true. As a counter example for the converse statement we can consider the following generalized boards.

These boards cannot be obtained from each other by permuting the rows or columns. However, they both have the same rook polynomial 1 + 4푥 + 2푥2, hence they are equivalent. If there are some empty rows (or empty columns) of a generalized board, by permuting the rows (or columns) of the board, we can move these empty rows to the bottom (or empty columns to the rightmost) of the board so that the generalized board is squeezed to give an equivalent board without any empty rows or columns. We return back to the board 픅 .The third and the fifth rows do not contain any cell of the gen- eralized board 픅, similarly on the third column there is no cell of the generalized board.

By squeezing these columns and rows, we obtain the following equivalent board:

Continuing on permuting the rows and columns we reach the following board:

Rook Polynomials | 147

It follows that the boards and are equivalent:

푅 ( ; 푥) = 푅 ( ; 푥)

Decomposition Rules

If a generalized board 퐵 is a disjoint union of two subboards 퐵1 and 퐵2 in which no cell of one subboard is in the same row or in the same column of any cell of the other subboard, then 퐵1 and 퐵2 are said to be disjoint. The board 퐵 given in below figure is a disjoint union of the boards 퐵1 and 퐵2.

B1

B2

The next theorem shows that if a board is composed of two disjoint sub-boards, the rook poly- nomial of the board can be calculated in terms of the rook polynomials of the sub-boards.

THEOREM C.4 (Board Decomposition). If a board 퐵 is union of two disjoint boards 퐵1 and 퐵2 then

푅(퐵; 푥) = 푅(퐵1; 푥)푅(퐵2; 푥).

Proof. Rook placements in 퐵1 does not affect rook placements in 퐵2, except in terms of the total number of rooks being placed. Assume that we wish to place 푘 rooks on board 퐵. If we place 푚 rooks on 퐵1, then 푘 − 푚 rooks must be placed on 퐵2. The number of ways of placing 푚 rooks on 퐵1 and 푘 − 푚 rooks on 퐵2 is 푟푚(퐵1)푟푘−푚(퐵2). Since 푚 can take any value 푘 = 1, … , 푚, the number of ways of placing 푘 rooks on 퐵 = 퐵1 ∪ 퐵2 is

푟푘(퐵) = 푟0(퐵1)푟푘(퐵2) + ⋯ + 푟푚(퐵1)푟푘−푚(퐵2) + ⋯ + 푟푘(퐵1)푟0(퐵2). The right hand side of the equality is in fact the coefficient of 푥푘 in the product

(푟0(퐵1) + 푟1(퐵1)푥 + ⋯ )(푟0(퐵2) + 푟1(퐵2)푥 + ⋯ ) = 푅(퐵1; 푥)푅(퐵2; 푥).

It follows that 푅(퐵; 푥) = 푅(퐵1; 푥)푅(퐵2; 푥). ∎

We have shown the board 픅 is equivalent to . Since the latter board is disjoint union of the boards and , we can write

148 | Rook Polynomials

푅 ( ; 푥) = 푅( ; 푥)푅( ; 푥).

Example 3. The staircase consisting of 푛 cells is a disjoint union of 푛 single cells. Since the rook polynomial of a single cell is 1 + 푥, for the staircase we have

푅 ( ; 푥) = (1 + 푥)푛.

Suppose that on a given board 퐵, a cell 푐 is selected and marked as a special cell. By 퐵\푐 we denote the board obtained from 퐵 by deleting the row and column that contain the cell 푐, and we let 퐵 − 푐 to denote the board obtained from 퐵 by deleting only the special cell 푐. c

퐵 퐵\푐 퐵 − 푐

THEOREM C.5 (Cell decomposition). For any cell 푐 of a board 퐵, 푅(퐵; 푥) = 푥푅(퐵\푐; 푥) + 푅(퐵 − 푐; 푥).

Proof. To find the value of 푟푘(퐵), we observe that the ways of placing 푘 non-attacking rooks on 퐵 can be divided into two classes, those that have rook in the special cell and those that do not have a rook in the special cell. The number of ways in the first class is equal to 푟푘−1(퐵\푐), and the number of ways in the second class is equal to 푟푘(퐵 − 푐 ). We have then the relation 푟푘(퐵) = 푟푘−1(퐵\푐) + 푟푘(퐵 − 푐). Correspondingly, 푅(퐵; 푥) = 푥푅(퐵\푐; 푥) + 푅(퐵 − 푐; 푥). ∎

Example 4. As an example, we compute the rook polynomials of the boards and :

푅( c ; 푥) = 푥푅( ; 푥) + 푅( c ; 푥) = 푥푅( ; 푥) + 푥푅( ; 푥) + 푅( ; 푥) = (푥 + 1)(1 + 3푥) + 푥(1 + 2푥) = 1 + 5푥 + 5푥2.

푅( c ; 푥) = 푥푅( ; 푥) + 푅( ; 푥) = 푥(1 + 2푥) + 1 + 4푥 + 2푥2 = 1 + 5푥 + 4푥2. Now we can re-calculate the rook polynomial of the board 픅:

푅(픅; 푥) = 푅 ( ; 푥) = 푅( ; 푥)푅( ; 푥) = (1 + 5푥 + 5푥2)(1 + 5푥 + 4푥2) = 1 + 10푥 + 34푥2 + 45푥3 + 20푥4.

Rook Polynomials | 149

Complementary Boards

THEOREM C.6 (Complementary Board Theorem). Let 퐵 be the complement of 퐵 in an 푛 × 푚 푘 푘 rectangular board. If 푅(퐵; 푥) = ∑ 푟푘푥 and 푅( 퐵; 푥) = ∑ 푟푘푥 are rook polynomials of 퐵 and 퐵 , respectively, then 푘 푚 − 푖 푛 − 푖 푟 = ∑(−1)푖 ( ) ( ) (푘 − 푖)! 푟 푘 푘 − 푖 푘 − 푖 푖 푖=0

where we let 푟푖 = 0 for 푖 larger than the degree of 푅(퐵; 푥). Proof. We consider all possible placements of 푘 non-attacking rooks on the 푚 × 푛 board and remove those where one or more rooks are placed on 퐵 using the Inclusion-Exclusion Principle. Assume that the 푘 rooks are labeled in our counting process, which means we will be counting

푘! 푟푘 rather than푟푘. The total number of ways to place 푘 labeled rooks on the 푛 × 푛 board is 푚 푛 2 ( 푘 )(푘)푘! . Let 퐴푖 denote the set of rook placements where the 푖-th rook is on the board 퐵. We have to remove these placements from the set of all placements. There are 푟1 ways to place the 푖- 푚−1 푛−1 2 th rook on 퐵 and ( 푘−1 )(푘−1)(푘 − 1)! ways to place the remaining 푘 − 1 rooks in the other rows 푚−1 푛−1 2 and columns. Hence there are 푟1( 푘−1 )(푘−1)(푘 − 1)! placements in 퐴푖 and there are 푘 many 퐴푖’s. 푚−2 푛−2 2 푘 Similarly, there are 푟2( 푘−2 )(푘−2)(푘 − 2)! elements in 퐴푖 ∩ 퐴푗 for 푖 ≠ 푗 and there are (2) of these double intersections, and so on. Hence, using the principle of inclusion-exclusion, the number of ways to place 푘 labeled rooks on 퐵 is 푘 푘 푚 − 푖 푛 − 푖 ∑(−1)푖 ( ) 푖! ( ) ( ) (푘 − 푖)!2 푟 푖 푘 − 푖 푘 − 푖 푖 푖=0 which can be written as

푘 푚 − 푖 푛 − 푖 ∑(−1)푖푘! ( ) ( ) (푘 − 푖)! 푟 . 푘 − 푖 푘 − 푖 푖 푖=0

To discard the effect of labeling the rooks, we divide this quantity by 푘! to achieve the result. ∎

Finding the number of placements of 푛 rooks on a board which is a subset of an 푛 × 푛 board is a quite common problem. For this particular case, the following corollary is very useful.

푘 COROLLARY C.7. Let 퐵 be a generalized board in an 푛 × 푛 rectangular board. If ∑ 푟푘푥 is the rook polynomial of 퐵, then the number of ways of placing 푛 non-attacking rooks on 퐵 is 푛 푖 푟푛 = ∑(−1) (푛 − 푖)! 푟푖. 푖=0 Proof. Just put 푘 = 푚 = 푛 in the theorem. ∎

Example 5 (Problème des Rencontres). We find the number of ways of placing on an 푛 × 푛

square board if the diagonal cells are forbidden. We have to compute 푟푛 for the generalized board 퐵 which consists of white cells of the below board. The shaded cells constitute 퐵.

150 | Rook Polynomials

Note that the board 퐵 corresponds to a permutation 휎 = 휎1휎2 ⋯ 휎푛 of the set {1, … 푛} such that

휎푖 ≠ 푖, which means a derangement. Hence 푟푛 is the number of derangements of the set {1, … 푛},

that is 푟푛 = 풟푛. Now we obtain the number derangements by means of rook numbers.

( )푛 ∑푛 푛 푖 푛 퐵 is a staircase with 푅(퐵) = 1 + 푥 = 푖=0( 푖 )푥 , hence 푟푖 = ( 푖 ). Then from the corollary it fol- lows that 푛 푖 푟푛 = ∑(−1) (푛 − 푖)! 푟푖 푖=0 푛 푛 = ∑(−1)푖 (푛 − 푖)! ( ) 푖 푖=0 푛 (−1)푖 = 푛! ∑ 푖! 푖=0 = 풟푛.

E XERCISES

1. Find the rook polynomial of the following (unshaded) board.

2. At a university, seven freshmen, 퐹1, 퐹2, … , 퐹7, enter the same academic program. The chairman wants to assign each incoming freshman a mentor from among the upperclassmen of the

program. Seven mentors 푀1, 푀2, … 푀7, but there are some scheduling confliicts. 푀1 cannot work

with 퐹1 or 퐹3, 푀2 cannot work with 퐹1 or 퐹5, 푀4 cannot work with 퐹3 or 퐹6, 푀5 cannot work with

퐹2 or 퐹7, and 푀7 cannot work with 퐹4. In how many ways can the chairman assign the mentors so that each incoming freshman has a different mentor?

3. Given a permutation 휎 = 휎1휎2 ⋯ 휎푛 of {1, … , 푛}, consider the corresponding rook placement of 푛

rooks on the 푛 × 푛 board and let 퐵 = (푏푖푗) be the matrix such that 푏푖푗 = 1 if the square (푖, 푗) of

the board is occupied by a rook and 푏푖푗 = 0 otherwise. Show that 휎 is an even permutation if and only if det(퐵) = 1.

4. Which of the following polynomials can be the rook polynomial of a board? Give reasons, including examples of appropriate boards, where possible.

a) 1 + 푥, b) (1 + 푥)푛, c) 1 + 5푥 + 6푥2, d) 1 + 5푥 + 7푥2, e) (1 + 4푥 + 2푥2)2, f) 1 + 7푥 − 6푥2 + 3푥3,

Rook Polynomials | 151

5. Let 푆푛 be the ‘staircase’ board illustrated below, consisting of 푛 rows.

Show that 푆푛 has the rook polynomial

푛 2푛 − 푘 + 1 푅(푆 ; 푥) = ∑ ( ) 푥푘. 푛 푘 푘=0 6. Let 푛 be a positive even integer and consider an 푛 × 푛 chess-board in which the squares are coloured black and white in the usual chequered fashion. In how many ways can 푛 non-attacking rooks be placed on the white squares?

7. Find the rook polynomial of the ‘staircase’ board illustrated below, consisting of 푛 rows.

8. Using the result of Problem 7, find the number of permutations 휎 = 휎1 ⋯ 휎푛 of {1, … , 푛} such that

|휎푖 − 푖| ≤ 1. 9. A club holds a weekly lottery for its 푛 members, n being a positive even integer. Upon joining the club, each member is assigned a number, based on the order in which they have joined the club (the 푖-th member to join is assigned the integer 푖). In the weekly lottery drawing, each member is assigned randomly a number from 1 to 푛, such that each number is used once and only once, and winners are determined as follows: if Member 푖 draws either 푖 or 푛 + 1 − 푖 for the week, he or she wins. In the case of multiple winners, the pot would be split among them. In how many ways can there be no winners the first week of the lottery?

10. (Triangular Boards) Consider the family 푇푛 of 2-dimensional boards called the triangle boards. A triangle board of size 푛 consists of the cells which are below the diagonal cells of a an 푛 × 푛

square board. The triangle board 푇5 of size 5 is shown below.

Show that 푛 + 1 푟 (푇 ) = { }. 푘 푛 푛 + 1 − 푘 11. (Problème des ménages.) This question concerns 푛 couples. Making use of rook polynomials, find the number of ways of seating the 푛 couples (2푛 people) around a circular table such that men and women are sitting alternately and no woman is sitting next to her own partner.

152 | Rook Polynomials

Solutions to Exercises

푛 1.a) 푛 + 1 푘 + 1 푆 = 1 − ( ) + ∑ ( ) 푛 푚 ⏟ 푚 푘=푚 푘 푘 (푚)+(푚−1)

푛 푛 푛 + 1 푘 푘 = 1 − ( ) + ∑ ( ) + ∑ ( ) 푚 푚 푚 − 1 푘⏟= 푚 푘=푚 푆푛

Thus we have

푛 푘 푛 + 1 ∑ ( ) = 1 − ( ) − 1 푚 − 1 푚 푘=푚

and replacing 푚 with 푚 + 1

푛 푘 푛 + 1 ∑ ( ) = ( ) − 1 푚 푚 + 1 푘=푚+1

which gives

푛 푘 푛 + 1 ∑ ( ) = ( ). 푚 푚 + 1 푘=푚

1.b) 푛 First define the sum 푇푛 = ∑푘=1 푘퐻푘 and perturb this sum:

푇푛 = 1 − (푛 + 1)퐻푛+1 + ∑(푘 + 1)퐻푘+1 푘=1

푛 1 = 1 − (푛 + 1)퐻 + ∑(푘 + 1) (퐻 + ) 푛+1 푘 푘 + 1 푘=1

= 1 − (푛 + 1)퐻푛+1 + ∑(푘 + 1)퐻푘 + 푛 푘=1

푛 푛

= 1 − (푛 + 1)퐻푛+1 + ∑ 푘퐻푘 + ∑ 퐻푘 + 푛 푘⏟= 1 푘⏟= 1 푇푛 푆푛

= (푛 + 1)퐻푛 + 푇푛 + 푆푛 + 푛

which simplifies as

∑ 퐻푘 = (푛 + 1)퐻푛 − 푛. 푘=1

Chapter Exercises| 153

1.c) As in the previous example, we define a new sum whose perturbation leads to the 푛 2 desired sum. Let 푈푛 = ∑푘=1 푘 퐻푘 , then

푛 2 2 푈푛 = 1 − (푛 + 1) 퐻푛+1 + ∑(푘 + 1) 퐻푘+1 푘=1 푛 1 = 1 − (푛 + 1)2퐻 + ∑(푘2 + 2푘 + 1) (퐻 + ) 푛+1 푘 푘 + 1 푘=1 푛 2 = 1 − (푛 + 1) 퐻푛+1 + 푈푛 + 2푆푛 + (푛 + 1)퐻푛 − 푛 + ∑(푘 + 1) 푘=1

푈푛 vanishes and the equation takes the form

(푛 + 1)(푛 + 2) 2푆 = (푛 + 1)2퐻 − 1 − (푛 + 1)퐻 + 푛 − + 1 푛 푛+1 푛 2 푛2 + 푛 + 2 = (푛 + 1)2퐻 − (푛 + 1)퐻 − 푛+1 푛 2 푛2 + 푛 + 2 = (푛 + 1)2퐻 − (푛 + 1)퐻 + 1 − 푛+1 푛+1 2 푛(푛 + 1) = 푛(푛 + 1)퐻 − 푛+1 2

and finally 1 1 푆 = 푛(푛 + 1) (퐻 − ). 푛 2 푛 2

푘 2.a) We can write 푘 = ∑푗=1 1 so that 푛 푛

푆푛 = ∑ ∑ 1 푘=1 푗=1

푛 푛 = ∑ ∑ 1 푗=1 푘=푗

푛 = ∑(푛 − 푗 + 1) 푗=1

푛 푛 = ∑(푛 + 1) + ∑ 푗 ⏟푗= 1 푗⏟=1 푛(푛+1) 푆푛

Which results in

1 푆 = 푛(푛 + 1). 푛 2

154 | Rook Polynomials

3 푘 2 2.b) We can write 푘 = ∑푗=1 푘 so that

푛 푘 2 푆푛 = ∑ ∑ 푘 푘=1 푗=1 푛 푛 = ∑ ∑ 푘2 푗=1 푘=푗

푛 1 = (푛2(푛 + 1)(2푛 + 1) − ∑ 푗(푗 − 1)(2푗 − 1)) 6 푗=1

푛 1 = (푛2(푛 + 1)(2푛 + 1) − ∑(2푗3 − 3푗2 + 푗)) . 6 푗=1

So we have

1 푛(푛 + 1) 8푆 = 푛2(푛 + 1)(2푛 + 1) + 푛(푛 + 1)(2푛 + 1) − 푛 2 2 푛(푛 + 1) = (2푛(2푛 + 1) + (2푛 + 1) − 1) 2 1 = 푛(푛 + 1)(4푛2 + 4푛). 2

Thus

1 푆 = 푛2(푛 + 1)2. 푛 4

푘 푘 푘 2.c) We can write 푘푟 = ∑푗=1 푟 so that

푛 푘 푘 푆푛 = ∑ ∑ 푟 푘=1 푗=1 푛 푛 = ∑ ∑ 푟푘 푗=1 푘=푗 푛 1 = ∑(푟푗 − 푟푛+1) 1 − 푟 푗=1 푟 (푛 + 1)푟푛 − 1 − 푛푟푛+1 = ( ) 1 − 푟 푟 − 1 푛푟푛+1 − (푛 + 1)푟푛 + 1 = 푟 . (1 − 푟)2

Chapter Exercises| 155