Solutions to Chapter 1: Sums and their manipulation
Section 1.1: The notation for sums and products
Exercise 1.1-1. The first sum is . The second sum has its upper limit below its lower limit , so it is the empty sum, . The product is the empty product, .
Exercise 1.1-2. Rule 3 of the algebra of brackets gives , and rule 1 turns the last product into . So the sum is with the sum of the odd , the sum of the multiples of up to , and the sum of the odd multiples of up to . The odd numbers are fifteen numbers with sum (the arithmetic sum of Section 2.2 gives ; a direct addition also gives ). Next and . The sum is . A direct sum by computer gives too.
Exercise 1.1-3. Expand the square and use rule 4: . By rule 3, , so the expression is . This is when exactly one of , is true and when both or neither are true. A check of the four cases gives the same result: , , and .
Exercise 1.1-4. A divisor of lies between and , so . The bracket is for , and the sum is .
Exercise 1.1-5. The bracket is only for , so has finite support. The reflection maps this range onto itself and changes into , so the sum of the satisfies and . The family has for all , so its support is infinite and is not a sum with finite support; as an infinite sum it has the value , by the example in Section 1.1. The family is for , so it has finite support. Its values for are , , and , and .
Exercise 1.1-6. Use induction on the size of the finite set where is true. If is empty, the left side is the empty product and the right side is . Otherwise take . By the proposition on disjoint relations, . The induction hypothesis makes the first factor , and the rule gives . For and : , the result is . For this is .
Exercise 1.1-7. Fix with . The inner sum has at most one nonzero term, the term with , and this is in the range exactly when . So the inner sum is for , and the outer sum is . In the second sum, fix . The term is unless , and is in the range, so the inner sum is . The outer sum is . In matrix language, the second sum is with the identity matrix .
Exercise 1.1-8. For the sum is empty and the right side is . The step from to adds to the left side, and , which is the right side for . As the sum tends to . The negative part is , which tends to . So .
Exercise 1.1-9. For the terms and cancel, and . The range is symmetric, so its sum is . The definition of the infinite sum asks for the limit of . This sequence is not bounded. For each , , since each of the terms is at least . So , by adding the blocks . So has no finite limit, and has no value. The symmetric partial sums hide this; the definition with two separate limits detects it. Mathlib's tsum agrees: the family is not Summable.
Section 1.2: The laws of sums
Exercise 1.2-1. For , . This is with . The theorem on the telescoping sum, with the range , gives . For both sides are ; for the sum is .
Exercise 1.2-2. The numerator is , so the term is . By the theorem on the sum of two families and the first example of the section, the sum is . For the sum is , and agrees.
Exercise 1.2-3. Let . Then
The telescoping sum gives . For both sides are .
Exercise 1.2-4. Let . The reflection gives , by the hypothesis. Add the two forms of with the theorem on the sum of two families: , by the distributive law. Divide by . For this gives , the arithmetic sum of Section 2.2.
Exercise 1.2-5. Factor and . Let . Then , so the factor is . By the laws for products the product splits into two products. The first is , since the numerators are and the denominators are . The second telescopes to . So the product is
For this is , and indeed . As the product tends to , since .
Exercise 1.2-6. Write for , and so on. Let be " or ". The theorem on the change of the domain for and gives . For and it gives . The relation " and " is "( and ) or ( and )", and the theorem for these two relations, whose conjunction is " and and ", gives . Substitute the last two equations into the first. A second proof uses brackets: by rules 1 and 2, and the expansion of the product, with rule 1, gives the seven terms.
Exercise 1.2-7. For each integer , . By the sum of two families and the distributive law, the left side is . In the second sum the change of variable maps the range onto the even in , so that sum is , and twice it is . The left side is . Since by the proposition on disjoint relations, this is . For both sides are .
Exercise 1.2-8. Here and , so . This differs from unless . For the general rule, write ; the sum has the one term , which satisfies since maps into that set. Then
by the interchange of the order and the distributive law. When is a bijection, for all and the rule is the theorem on the change of variable. In the example, .
Exercise 1.2-9. The corollary on the interchange in a triangle, read from right to left with , gives . The inner sum counts the pairs , which the example on pairs below the diagonal in Section 1.3 counts as . So the sum is . For the sum is , which agrees.
Exercise 1.2-10. Let for . Then , and the recursive definition of the sum with limits gives . Let be a second function with for , and let . Then for all , and induction on gives for all . So and differ by the constant . With the sum becomes a telescoping sum: . Chapter 3 calls an indefinite sum of .
Exercise 1.2-11. With ,
So . In the same way has , and . For the sums are and , and the formulas give and . Chapter 3 explains the pattern with rising and falling powers.
Section 1.3: Multiple sums
Exercise 1.3-1. Here and , so the second formula of the theorem on the square of a sum gives . The six terms are .
Exercise 1.3-2. Let . The exchange of the names and , with the interchange of the order, gives . So . For , . So each of the terms is at least , and . Equality holds exactly when all are equal. The inequality says that the arithmetic mean of the times the arithmetic mean of the is at least .
Exercise 1.3-3. For , , since the bracket product is exactly for . So
by the interchange of the order and the distributive law. The reflection turns the last sum into . For the four values of are , with sum .
Exercise 1.3-4. The map with is a bijection from the pairs with onto the pairs with and ; the inverse is . The change of variable gives . For the value is . Chapter 6 shows that the value is in general; for this is .
Exercise 1.3-5. The bijection of the proposition on the two forms of a partition maps , , , and . In each case . By the proposition on the number of solutions, the number of all lists of nonnegative integers with sum is . A listing by computer gives too.
Exercise 1.3-6. The domain is the set of pairs with and . Fix and solve for . The conditions are , and . Since , is nonnegative. The set of is , and it is nonempty exactly when , that is, when . So is , is , and
The general change of the order applies, since both bracket products are . A check by computer with random numbers for confirms the identity.
Exercise 1.3-7. Fix . The row has the two nonzero terms and , so its sum is , and the outer sum over is . Fix . For the column has the one nonzero term , since is not allowed. For the column has and , with sum . So the outer sum over is . The theorem on the interchange of the order assumes a finite domain; here infinitely many terms are nonzero, and the sum of the absolute values is infinite. P5 proves that the interchange is valid when is finite.
Exercise 1.3-8. By the distributive law, with . The exchange of the names and shows that this sum equals with . The family is symmetric and . The proposition on symmetric sums gives . This proves the identity. The right side is a sum of squares of real numbers, so it is at least , and , the inequality of Cauchy. Equality holds exactly when for all , that is, when the two lists are proportional.
Exercise 1.3-9. Since , the left side is . The change of the order in the example on divisors, with the term in place of , gives . For the left side is and the right side is .
Exercise 1.3-10. For a partition of let be its number of parts equal to . Then , since . The total is
The inner sum counts the partitions of with at least parts equal to . Removing parts equal to maps them one to one onto the partitions of ; the inverse adds parts equal to . So the inner sum is . For the partitions , , , and have parts equal to , and . A check by computer for agrees.
Exercise 1.3-11. Expand , a sum over all ordered triples. Split the triples into three classes. The triples with all three indices equal give . The triples with exactly two equal indices fall into three patterns, , and . Each pattern gives , the sum over all pairs minus the diagonal. The triples with three different indices map onto the sets with , and each set comes from triples, so by Exercise 1.2-8 they give , where . So , and . For this gives , which is right.
Solutions to Chapter 2: The perturbation method and recurrences
Section 2.1: Sums and recurrences
Exercise 2.1-1. The recurrence is the first example of the repertoire method with , and . There , and . So . Check: and .
Exercise 2.1-2. The solution is . The sequence solves the recurrence for , so . The constant sequence needs , so it solves the recurrence for , and , so . The sequence needs and , that is, . So it solves the recurrence for , and . So . Check: , and , , .
Exercise 2.1-3. Here , and . The summation factor gives . The geometric sum gives . So . Check: and .
Exercise 2.1-4. Divide by : . So , , and , a telescoping product. The summation factor gives
Check: , and the rule gives ; , and the rule gives .
Exercise 2.1-5. The solution of the recurrence is the product , the product of the odd numbers up to ; this is the summation factor theorem with . Split the product into the even and the odd factors with the change of the domain of Section 1.2: . Divide by . Check: .
Exercise 2.1-6. By the theorem on the termial, , and . The first identity shows that an integer is a triangular number exactly when is an odd square, since gives . The second says that two consecutive triangles make a square.
Exercise 2.1-7. Multiply by : . For subtract the same equation for : . So , and . For the rule gives , so the same equation holds. The proposition on sums gives . Check: .
Exercise 2.1-8. Here , and . So . The example with halves of Section 2.2 gives , and the term is . So . This is of the second example of the repertoire method, as it must be, since the recurrence is the case , of that example.
Exercise 2.1-9. By the reflection of Section 1.2, . Multiply the two forms with the law for products: . For each ,
So each factor is at most , all factors are positive, and . Both sides are positive, so the square root gives the claim. Equality holds only for : for the factor with is , and .
Exercise 2.1-10. The theorem on linearity extends to four parameters with the same proof: . The sequence solves the recurrence for , so . The sequence solves it for , so . The sequence needs , so it solves it for , and . The sequence needs , so it solves it for , and . So
The sum solves the recurrence for , so it equals .
Section 2.2: The perturbation method
Exercise 2.2-1. The geometric sum with and gives . Check: .
Exercise 2.2-2. The theorem on with gives and the numerator . So the sum is . Check: for the sum is , and .
Exercise 2.2-3. The theorem on with gives and the numerator . Check: for the sum is , and .
Exercise 2.2-4. Let , and . Since , the perturbation identity gives
So . Multiply by and insert the closed forms of and :
Collect powers of . The terms and have coefficients and . The term has coefficient . The term has . The term has . So the right side is , as claimed. Check: for and the sum is , and the formula gives .
Exercise 2.2-5. Expand and use the sum of two families with the sums of squares and of :
And . Check: .
Exercise 2.2-6. With the proposition gives , where . Insert , , and . Since , every term has the factor , and
Finally , so . Check: , and .
Exercise 2.2-7. For both sides are . Assume . Then , and the claim for is . The left side is , by the recurrence of the termial and by exercise 2.1-6.
Exercise 2.2-8. For , , so the theorem on gives the partial sums
It is enough to prove , since then both and tend to . For this is clear. Otherwise write with . For the binomial theorem gives , so . So the partial sums tend to . Since the terms with negative index are , this limit is the infinite sum of Section 1.1.
Exercise 2.2-9. Let . Since , the perturbation identity gives , which holds for every . Now let . Since , the perturbation identity gives
So . Check: , and .
Exercise 2.2-10. By the distributive law, . Split the square by the value , with the change of the domain of Section 1.2. The pairs with are , the pairs with and the pairs with . Their products add up to
So .
Section 2.3: Linear recurrences with constant coefficients
Exercise 2.3-1. Here , with and . The theorem gives and . So . Check: .
Exercise 2.3-2. Here , with the double root . The theorem gives and , so . Check: .
Exercise 2.3-3. The roots are and , with . The theorem gives and . Since and , both are , and . For the second claim, the sequence for satisfies the Fibonacci rule for , as a sum of two shifted solutions. Its first values are and . By uniqueness, applied to the sequences that start at index , for all .
Exercise 2.3-4. The sequence satisfies , since . Its initial values are . So by uniqueness, and . The number counts the additions that the program does: a call with does no addition, and a call with does one addition plus those of its two calls. This agrees with the proposition on calls: the calls with are the internal nodes of a binary tree with nodes, so their number is .
Exercise 2.3-5. The Fibonacci rule gives for . The telescoping sum of Section 1.2 gives .
Exercise 2.3-6. Here . Since , try a constant : gives . By the proposition on particular and homogeneous parts, satisfies the homogeneous rule, with . The theorem on two distinct roots with , gives and . So . Check: and ; and .
Exercise 2.3-7. For , . If , then with ,
The proof uses only , which also holds for . Subtract the two identities: , which is Binet's formula for ; for both sides are . Finally , to three decimals.
Exercise 2.3-8. Here , with the roots and , and . The theorem on two distinct roots holds for complex roots with the same proof, and gives , . So . Write . Then , and . Check: and ; and .
Exercise 2.3-9. By exercise 2.3-3 and ,
So for even . Prove by induction on . For , . If , then , since is even. Check: and .
Exercise 2.3-10. Let for . Use the rule for and for :
So by induction, and . For the Fibonacci numbers and , so .
Solutions to Chapter 3: Finite calculus
Section 3.1: Differences, falling powers and definite sums
Exercise 3.1-1. By the definitions, and . Next, . Last, . As a check of the proposition on falling and rising powers, .
Exercise 3.1-2. Since , the definition gives . The difference operator commutes with a shift of the variable: if , then . With and , this gives . Directly, , which agrees. The formula holds for .
Exercise 3.1-3. Here , so the sum is . Since , the function is an indefinite sum of , and the fundamental theorem gives . For and : , and .
Exercise 3.1-4. The condition says , that is , for every integer . Induction upward gives for , and the relation with induction downward gives . So with . Conversely, for every constant . In the same way, says , and the solutions are exactly the functions .
Exercise 3.1-5. By the definition, . The factor for is , and for the factor is . So the product is . The product of the odd numbers below is divided by the product of the even numbers . So
Check: gives , and gives .
Exercise 3.1-6. Apply the law with the exponents and : . By the assumption, and . So . The law of exponents leaves no other choice for the negative falling powers.
Exercise 3.1-7. By the proposition on falling and rising powers, . Put :
since . Check : and .
Exercise 3.1-8. For , . Put , so . The corollary on sums of falling powers with and gives
Check : , and .
Exercise 3.1-9. For the exponent is not , and the corollary on sums of falling powers gives
As the last fraction tends to , because its denominator is at least . The terms of the series are positive, so the series converges, and its sum is . For this is , as in the second example of the Examples part.
Exercise 3.1-10. The two products and share the factors , whose product is . So . For the sum, let , so . A sum of backward differences telescopes: . Since , the product has the factor , so and . For this is .
Exercise 3.1-11. Let . Then , so for every real : has period . For the example take , which has , and . Then , and is not constant. On the integers the two functions agree, as part 4 of the rules of the difference operator requires.
Exercise 3.1-12. Pascal's rule (the corollary on the difference of a binomial coefficient, at ) gives . Let , so . Then
The sum over telescopes to . Check , : .
Section 3.2: Summation by parts and the harmonic numbers
Exercise 3.2-1. Take and , so and . The first form of the product rule gives . Check at : and .
Exercise 3.2-2. Write for the values at and for the values at . Then . Add and subtract in the numerator: . The denominator is .
Exercise 3.2-3. The theorem on the sum of with gives . Check : and .
Exercise 3.2-4. With the theorem gives
Since , the limit is , which is also at . Check : and .
Exercise 3.2-5. Take and , with , so and . Summation by parts gives
The second example of the Examples part gives , and . The terms with cancel, and the sum is . Check : and .
Exercise 3.2-6. Let be the sum. Take and , so by the theorem on the discrete logarithm, and . Summation by parts gives
So . Check : , and .
Exercise 3.2-7. First find . Take and , so . Here , and . So
by the theorem on the sum of harmonic numbers. Add and drop the term : . Check : , and .
Exercise 3.2-8. Since , the theorem on the sum of with gives
Check : , and .
Exercise 3.2-9. For , with . Use summation by parts on with :
Now and , so the sum is . Check : , and . As the sum tends to , by the two given limits.
Exercise 3.2-10. Take and , so and . Summation by parts gives
since (the term is ), which is by the corollary on sums over the upper index. Check , : , and .
Exercise 3.2-11. Put , so . Summation by parts with on , plus the last term, gives
(Check by expanding: the coefficient of each on the right is for and for , as on the left.) Each , and . So the absolute value is at most .
Exercise 3.3-1. The table of for has the rows ; then ; then ; then ; then ; then . The left edge is , and Newton's formula gives . Divide by the factorials: . The fourth row is , as the theorem on the th difference says.
Exercise 3.3-2. By Exercise 1 and the corollary on sums of falling powers,
Take out . What is left is . Expand: the constant term is , the coefficient of is , the coefficient of is , and that of is . So the sum is . Check : , and .
Exercise 3.3-3. The table is ; then ; then ; then . Since has degree at most , the row is constant, so its next entry is . Then the next entries of the rows above are , then , then . So . Newton's formula with the left edge gives
Check: .
Exercise 3.3-4. Let . The theorem on the difference of a falling power, applied times, gives , valid for . The theorem on powers of the difference operator gives . Compare and multiply by :
Check , : and .
Exercise 3.3-5. Since and is linear, induction gives . The theorem on powers of the difference operator at gives . This is the binomial theorem for .
Exercise 3.3-6. By Newton's formula, . Each is an integer, since it uses only with . It remains to show that is an integer for each integer and . For it counts the subsets of size of a set of elements (Chapter 6 proves this; it also follows from Pascal's rule by induction on ). For , the proposition on falling and rising powers gives , so with . So is an integer. The polynomial has degree , takes the integer values at , and its coefficients are not integers.
Exercise 3.3-7. The number depends only on , by the theorem on powers of the difference operator. For these are the values , so . Newton's formula gives . So , by the binomial theorem (the fourth example of the Examples part with ). The example in the text is the case .
Exercise 3.3-8. The left side is for . Expand . So has degree less than , because . Apply and the theorem on the th difference of a polynomial: the part of degree less than goes to , and , which is at . So . Check : , and .
Exercise 3.3-9. Let and on . By the corollary on the difference of a binomial coefficient, , which is at for . So , and for . Also because has degree at most , so on . Now show by downward induction on that on for . The function has difference , so it is constant on by part 4 of the rules of the difference operator, and the constant is . For this says on all of .
Exercise 3.3-10. By the lemma on the basis of falling powers, with . By the corollary on sums of falling powers, . Each is a polynomial of degree with the factor , so is a polynomial with constant term . Its degree is , and only the term has degree , with leading coefficient . For the sum is , with the convention .
Exercise 3.3-11. By the theorem on the discrete logarithm, for integers . Then more differences give . At , with , this is . Newton's formula holds for every function on the nonnegative integers, so
Check : .
Solutions to Chapter 4: Floors, ceilings, logarithms and mod
Section 4.1: Powers and logarithms
Exercise 4.1-1. . . , because . , because .
Exercise 4.1-2. Since and , the base is positive and not . Let . Then by the law , so . For example .
Exercise 4.1-3. Since , . Suppose with integers . Then , and the th power gives . The left side is even and the right side is odd, which is impossible. So is irrational.
Exercise 4.1-4. . With , the exponent lies between and . Both bounds are below , and is increasing, so is larger. The quotient is about .
Exercise 4.1-5. , with an error below . By Theorem P2.4.21, has digits. Also and , so the leading digit is and the number starts with .
Exercise 4.1-6. By Theorem P2.4.21, . Square: . So has binary digits if , and digits otherwise. Examples: has , and has digits; has , and has digits. The first case happens exactly when , that is when .
Exercise 4.1-7. Since , . Square : , bit , . Then , bit , . Then , bit . Then , bit , . So , and the four bits give . The true value is , which is .
Exercise 4.1-8. For , , so with . For the binomial theorem gives , since all terms are nonnegative. So and , which tends to . So .
Exercise 4.1-9. . Since , . The true values are and .
Section 4.2: Floors and ceilings
Exercise 4.2-1. and . Since , .
Exercise 4.2-2. By part 5 of Theorem P2.4.30, . So the sum is , by part 6.
Exercise 4.2-3. Write and with . By part 4 of Theorem P2.4.30, , and gives . For the ceiling apply this to and : , which is or this number minus . Examples: gives and ; gives and .
Exercise 4.2-4. Write with and . Then and . Here when and when .
Exercise 4.2-5. Block holds the bytes with , that is with . By part 1 of Theorem P2.4.30 this says . The bytes of the file lie in the blocks to , and each block in between holds at least one byte, since the map increases by at most at each step. So the file needs blocks, which is by Theorem P2.4.34.
Exercise 4.2-6. Both claims are false. (a) For : , but . (b) For : , but . Theorem P2.4.31 pairs the floor outside with the floor inside, and the ceiling with the ceiling. A mixed pair can cross an integer value of : in (a) the inner ceiling moves up to the square .
Exercise 4.2-7. The squares in are with . The cubes are with . A number is both a square and a cube exactly when it is a sixth power, and the sixth powers in range are , and . By inclusion and exclusion the answer is .
Exercise 4.2-8. Let be an integer. By part 3 of Theorem P2.4.30, holds if and only if , if and only if , that is . Again by part 3, holds if and only if , that is . So the integers in question are . Their number is , which is at least because . Check: , : , , , so two values of ; and .
Exercise 4.2-9. Apply part 2 of Theorem P2.4.35 with to the real number : .
Exercise 4.2-10. First let and . Then , so , with equality if and only if , that is . Now let , and let with , so . Then , so , with equality if and only if , that is . The solutions are the in and the negative integers.
Section 4.3: The mod operation
Exercise 4.3-1. . . . . .
Exercise 4.3-2. . . . The last value also follows from Exercise 10: .
Exercise 4.3-3. Let . By the definition, . By Exercise 4.2-2 the bracket is , so the sum is .
Exercise 4.3-4. By the definition with the divisor , . Multiply by : .
Exercise 4.3-5. For both sides are . Let . Then and with integers and , and and are integers by Theorem P2.4.52. So , and the bracket is an integer. Part 3 of Theorem P2.4.46 gives equal remainders. For real numbers the bracket need not be an integer: with , and , , but .
Exercise 4.3-6. By Theorem P2.4.50 with , . So . Check: .
Exercise 4.3-7. If , then by Theorem P2.4.45. If , then , so and . In the algorithm of Euclid this means that each number at least halves after two steps.
Exercise 4.3-8. If is an integer, then and are integers, and all three values of the sawtooth function are . Let not be an integer. Then is not an integer, and Exercise 3 with gives . So . Also is not an integer and by part 1 of Theorem P2.4.46, so .
Exercise 4.3-9. By the definition and part 5 of Theorem P2.4.30, .
Exercise 4.3-10. Theorem P2.4.50 with , applied to the numbers and , gives . The law holds for all , also , where both sides are .
Section 4.4: Sums of floors
Exercise 4.4-1. The parts are for : . Since , two parts are , and .
Exercise 4.4-2. Hermite's identity with and (here on the left is the given integer) gives . The left side is the term . Choose with . For the term is , since . The sum for telescopes to . Check : .
Exercise 4.4-3. By part 6 of Theorem P2.4.30, , and is an integer exactly when is a perfect square. So the difference of the two sums is the number of in that are not squares. The squares in are with , that is by part 3; there are of them. So the difference is . Check : the sum of the ceilings is , and .
Exercise 4.4-4. Follow the proof of Theorem P2.4.63. For , is the number of integers with . Change the order of summation: the sum is . The count is for , that is for by Theorem P2.4.35, and otherwise. So the sum is , by the sum of cubes in Theorem P2.3.54. Check , : the terms are , with the sum , and .
Exercise 4.4-5. Here , , and . Theorem P2.4.65 gives . Term by term, for is , with the sum .
Exercise 4.4-6. Write and with , as in the proof of Theorem P2.4.65. Then if and only if , if and only if , by the fact from Chapter 5 used in that proof. The multiples of in are , and there are of them. For the claim says that all numbers are multiples of , which agrees with .
Exercise 4.4-7. By Theorem P2.4.36, is the number of multiples of among . So , since each divisor of is at most . For : , and are , with the sum .
Exercise 4.4-8. By part 5 of Theorem P2.4.30, . Apply Theorem P2.4.65 to and ; the greatest common divisor of and is . The sum is
Check , , : the terms are , with the sum , and the formula gives .
Exercise 4.4-9. Write . This is Theorem P2.4.65 with the modulus , the multiplier and the real number . Since is odd, , and the sum is . Check , : .
Exercise 4.4-10. Let and , so and . Theorem P2.4.63 gives . Expand , and . Then
The terms in , and cancel. For , , so the first bracket lies in and the first term has absolute value at most . The function has , so on it rises from to and falls to ; so . Together, . Check : and , so , within the bound .
Solutions to Chapter 5: Divisibility, primes, gcd and congruences
Section 5.1: Divisibility and the greatest common divisor
Exercise 5.1-1. The pairs are , then since , then since , then since . The algorithm stops after three passes with . Check: and , and the common part is .
Exercise 5.1-2. Divide by : . By the step of Euclid, . (The step uses the remainder, and is the remainder when ; for the same identity holds by rule (iii) of the rules of divisibility.) So the gcd is when is odd and when is even. Check: gives , and gives .
Exercise 5.1-3. The rows are and at the start. Then gives ; gives ; gives . So with and . Check: . The last row gives and .
Exercise 5.1-4. For both sides are . Let and . The number divides and . By Bézout, , so . Each common divisor of and divides this combination, that is . So is a common divisor that each common divisor divides. When and are not both , it is positive, and by rule (iv) it is the largest common divisor. When both sides are .
A second proof uses Euclid's algorithm: the run on is the run on with every number multiplied by , since for (the distributive law of Section 4.3).
Exercise 5.1-5. Use the exponents of Section 5.2. Fix a prime and let , , be the exponents of in , , . The exponent of in is . The least of the three pairwise sums leaves out the largest of , , , so it equals . Hence the exponent of in is , the exponent of in . Since this holds for each , the two numbers are equal.
For the example take , , . Then and , with product , but . The formula gives .
Exercise 5.1-6. An amount is with . So it is a multiple of , and the question is which have the form . The values and do. The values and do not: leaves an odd that is not , and gives . Each even is . Each odd is . So can be each nonnegative integer except and , and the machine takes exactly the multiples of except and . From to these are : all multiples of in the range except and .
Exercise 5.1-7. Number the rows of the run , with , , and . Row is row minus times row , where . The output is .
First, the signs alternate and the sizes grow. The column starts , , . By induction on , has the sign for , and for , since and have the same sign (or one of them is ). So . The column starts , , , and in the same way .
Second, the last row. The number is for , and each pass changes its sign, since and . So , and . Now . Divide by : , with . So by the corollary on cancelling a coprime factor. Write . Then . The integer divides both and , which are coprime, so . Hence and .
Together, and . The run on in Section 5.1 shows the last row and the output . A check by machine of all pairs with found no exception.
Section 5.2: Primes and factorization
Exercise 5.2-1. , and both factors are prime (no prime up to divides either). For , trial division by the primes finds the first divisor at : . Both factors are prime, since no prime up to divides .
Exercise 5.2-2. . For each prime , divides , so and . Trial division gives , and is prime (it has no prime divisor up to ). Both factors exceed , as they must. So is not prime, and the proof of the infinity of primes does not claim that it is.
Exercise 5.2-3. Complete the square:
The first factor is , and the second is larger than the first for . So both factors exceed , and is composite. For example gives , and gives .
Exercise 5.2-4. By Legendre's formula:
The number of zeros at the end is . Check of by digits: has three digits, and .
Exercise 5.2-5. Since , the power divides exactly when and . Here has seven digits, so . And
So the number of zeros is . A direct computation of confirms it.
Exercise 5.2-6. The digit form of Legendre's formula with gives . The value is exactly when , that is when has a single digit in binary. So the answer is the powers of : .
Exercise 5.2-7. By Legendre's formula,
For each real , is or : write with , and the value is . So each term of the sum is or . A term with is . So is at most the number of with , and then . Check: , and each prime power is at most .
Exercise 5.2-8. Pair each positive divisor of with . The pairing is a map of the set of divisors to itself, and applying it twice gives back. A divisor is paired with itself exactly when , that is . So the divisors that are not paired with themselves come in pairs of two, and the number of divisors is odd if and only if there is a with . A second proof: the number of divisors is , which is odd exactly when each is even.
Section 5.3: Congruences
Exercise 5.3-1. , so holds. , so holds as well. (The second one is also Fermat's theorem of Section 5.4 with .)
Exercise 5.3-2. Since is prime, is odd and . Write . The factors are consecutive even numbers, so one of them is a multiple of and the other a multiple of ; hence . Of the three consecutive numbers , , , one is a multiple of , and it is not ; hence . Since , Law D gives .
Exercise 5.3-3. The rows for , are , , then with , with , with . So , and . The inverse is . Check: .
Exercise 5.3-4. Here , and , so there are solutions modulo . Divide by (Law C): . The inverse of modulo is , since . So . The solutions modulo are
Check one: .
Exercise 5.3-5. Solve one congruence at a time. From , . Modulo : , so . The inverse of modulo is , since . So , and . Write . Modulo : . So gives the least positive solution . Check: .
Exercise 5.3-6. Write with blocks . Since , Law A gives , and so . The same congruence holds modulo each divisor , , of . For the blocks are , , , and . Then . So is modulo , modulo and modulo . A direct division confirms all three.
Exercise 5.3-7. If , then , and Euclid's lemma gives or . So . (For the two values coincide.)
For , Law D says that holds exactly when it holds modulo , and , that is when modulo each of them. That gives choices of signs, and by the Chinese remainder theorem each choice gives one class modulo . The eight solutions are
For example , and , and . The solutions come in pairs and .
Exercise 5.3-8. The two congruences say and , that is is a common multiple of and . By the theorem of Section 5.1 on the gcd times the lcm, the common multiples of and are exactly the multiples of . So the two congruences hold together if and only if . When , , which is Law D.
Section 5.4: The theorems of Fermat, Euler and Wilson
Exercise 5.4-1. , so . , so . , so .
Exercise 5.4-2. By Fermat, . Since , . Modulo , a shorter cycle exists: . Since , .
Exercise 5.4-3. Euler's theorem with would do. A shorter cycle exists: and . Since , . The last two digits are .
Exercise 5.4-4. Let . Then is coprime to each of , and . Fermat gives , and . The exponent is a multiple of , and : . So modulo each of the three primes. The primes are pairwise coprime, so Law D, applied twice, gives . A composite number with this property is called a Carmichael number. A machine check of all with confirms the result.
Exercise 5.4-5. Let and . Then divides by the product formula, so and . Also forces , so only and can appear squared.
If , write with (since ); then . No has : the value is for and even for . So .
If , then with , so and . If and , then with and built from and : , and . Otherwise . With , gives , , . With , is a power of ; with , is not . So the answer is . The cases cover each , since the primes and their exponents are limited as above. A search by machine up to finds the same six values.
Exercise 5.4-6. Wilson gives . Also . So . For : , and . So . The inverse of modulo is , so . A direct computation of gives .
Exercise 5.4-7. , a product of distinct primes. For each of these primes , divides . If , Fermat gives , so and . If , both sides are . So for each of the five primes. They are pairwise coprime, and Law D gives . A check of all from to confirms it.
Exercise 5.4-8. For the sum is . Let . The map sends the numbers with to themselves, since . No such is fixed: would mean and . So the numbers fall into pairs , each with sum . The total is . Check: for the numbers are with sum .
Solutions to Chapter 6: Binomial coefficients
Section 6.1: Permutations and factorials
Exercise 6.1-1. An award without repeats is a -arrangement of the people, so there are awards. If one person may get several prizes, each prize goes to any of the people independently, and there are awards. The difference, , counts the awards in which some person gets at least two prizes.
Exercise 6.1-2. A word of four different letters is a -arrangement of the letters. There are such words.
Exercise 6.1-3. By the recurrence, . So for each , and the sum telescopes:
Check for : . For the sum is .
Exercise 6.1-4. The values and for show that first holds at . If for some , then , since . So the inequality holds for all . For base : , but , and the smaller cases fail too ( for ). The same step works with the factor . So holds exactly for .
Exercise 6.1-5. Split the factors of into even and odd ones:
The even factors are , with product . Divide by : , a multiple of , and the quotient by is the product of the first odd numbers. For : .
Exercise 6.1-6. Let be the set of permutations in which comes before , and the set in which comes before . Each permutation is in exactly one of and . The map that swaps the entries and sends to and to , and it is its own inverse. So , and . For this gives , which a direct enumeration confirms.
Exercise 6.1-7. The theorem gives . Take of both sides; the logarithm is increasing, so . For the second part, the upper bound shows that while , which holds for all . The lower bound shows that when , which holds for . So the answer lies between and . A direct computation in that range gives and . The least is .
Section 6.2: Combinations and the definition of the binomial coefficient
Exercise 6.2-1. and , as symmetry predicts. . .
Exercise 6.2-2. Choose the suit in ways, then of its cards in ways. That gives hands. (This count includes the hands whose five cards are also consecutive in rank.)
Exercise 6.2-3. By the factorial form,
The ratio is greater than when , that is ; it equals when ; and it is less than when . So the row increases strictly up to and then decreases strictly, with one tie between and when is odd. The largest entry is , which equals . Row has its largest entry ; row has the two largest entries .
Exercise 6.2-4. A path through is a path from to followed by a path from to . The first part has steps, of them up, so there are choices. The second part goes right and up, again choices. The product is , which is less than half of all paths.
Exercise 6.2-5. . Multiply out: and , so the product is , and
At : . At : . At : , which agrees with .
Exercise 6.2-6. For , , and . A product of real numbers is if and only if one factor is . The factor is if and only if , for . So if and only if . For the set is empty, and indeed for all .
Exercise 6.2-7. Write a -subset as . It has no two consecutive numbers if and only if for each . Put . Then , so the condition becomes . Also and . So the map sends the subsets with no consecutive numbers to the -subsets of . The inverse is , and it maps each -subset of to a subset of with gaps at least . So the map is a bijection, and the count is . For and it is ; a direct enumeration of the subsets of size confirms this.
Section 6.3: The basic identities
Exercise 6.3-1. By absorption, for all . So . The direct sum is . In general for ; this is Nat.sum_range_mul_choose in Mathlib.
Exercise 6.3-2. Upper summation with and gives . Check: .
Exercise 6.3-3. Put and in the binomial theorem with :
The coefficients are , , , and . Check at : .
Exercise 6.3-4. The values at give , then , so , then , so . Both sides are polynomials of degree in that agree at , so they are equal:
Sum over with upper summation:
For this is . The right side simplifies to .
Exercise 6.3-5. By absorption, . So
by the row sums with . For the value is . For it is : the sum is .
Exercise 6.3-6. By eq. 1.2.6(18) with and , the sum is . Directly: .
Exercise 6.3-7. By trinomial revision, . Sum over ; the factor does not depend on , and by the row sums. So the sum is . By counting: the left side counts pairs (committee, subcommittee of size ). Choose the subcommittee first, in ways. Each of the other people is either in the committee or not, independently: ways. For and : .
Exercise 6.3-8. From the definition, . With the negation theorem, .
Section 6.4: Binomial coefficients with real arguments
Exercise 6.4-1. From the definition, and . The theorem gives and .
Exercise 6.4-2. By the theorem on a negative integer upper index, and . So, for ,
with the triangular numbers as sizes of the coefficients.
Exercise 6.4-3. With : , , , , and . So
Exercise 6.4-4. With the terms are , , , and . The first four terms give ; the true value is , so the error is about . To prove that the error is less than : for the sign of is , so the terms alternate. Also , so the sizes decrease to . For an alternating series with decreasing terms, the remainder after a term has the sign of the next term and is smaller in size than that next term. Since the binomial series converges to , the error of the four term sum is less than , and the estimate is too large.
Exercise 6.4-5. For the binomial series converges absolutely to (P5). The product of two absolutely convergent series is the series of the Cauchy products of their coefficients (P5). So
A power series that converges on an interval about determines its coefficients, and the coefficients of are , which are . So the inner sum is . Check for : . The identity is a special case of the Vandermonde convolution of Chapter 7. In Mathlib the formal version is PowerSeries.binomialSeries_add.
Exercise 6.4-6. By the theorem on a half-integer upper index, . Absorption twice gives and (eq. 1.2.6(8) with ). So , and the quotient is . For the values are . They are the Catalan numbers, which TAOCP meets in Section 2.3.4.4 as the numbers of binary trees.
Exercise 6.4-7. If , the value is . Let . If , the value is the number of -subsets of an -set by Section 6.2 (it is for ), so it is an integer. If , the negation theorem gives . Here is a natural number, so is again a count of subsets, and is an integer. A consequence: for integers and , the product of consecutive integers is divisible by .
Solutions to Chapter 7: Binomial identities
Section 7.1: Vandermonde's convolution
Exercise 7.1-1. The terms with are , and . All other terms are zero. The sum is , and Vandermonde's convolution with , and gives .
Exercise 7.1-2. Symmetry gives for the integer and every integer . So
by Vandermonde's convolution with and , and . For a real , use the symmetry on the factor with the integer upper index : , again by the convolution. The symmetry may not be used on , because need not be a nonnegative integer.
Exercise 7.1-3. Absorption gives for every integer . So , and Exercise 2 with , after the shift , gives
For the terms are and the formula gives . For the terms are and the formula gives .
Exercise 7.1-4. Section 6.4 gives for every integer ; for the right side is . So
since . Sum over and use the convolution with : the left side becomes . So the sum in the exercise is . It is for , for and for every . For the two terms are .
Exercise 7.1-5. With and the left side has the one term , and the right side is . In the proof, and the right side counts the sets and . For the element of rank is , and . This value lies outside the range of the sum. So the step that fails is the claim , which needs : the set is not counted on the left.
Exercise 7.1-6. Put . Then , and , so the sum is
The negated form of Vandermonde's convolution with , and the lower index gives .
Exercise 7.1-7. Group the terms by . For a fixed the inner sum is by Vandermonde's convolution. Then the outer sum is by the convolution again. Each triple with appears once, as the term with and the given . All sums are finite, because a term is zero unless , and are nonnegative.
Exercise 7.1-8. Take . It is not the zero polynomial, and for every . The polynomial argument needs infinite sets and ; here is finite, so the lemma does not apply. In its proof, the step in one variable fails: a nonzero polynomial in can have the two roots and . For Vandermonde's convolution, the counting proof gives the identity at all pairs of nonnegative integers, and the difference of the two sides is a polynomial in and . If only one variable ran over an infinite set and the other over a finite set, then a factor such as could hide in the difference, as in , and the identity would not follow for all real .
Section 7.2: Orthogonality and binomial inversion
Exercise 7.2-1. The theorem on derangements gives
The recurrence of Exercise 2 gives , , , , and .
Exercise 7.2-2. Split off the last term of the sum in the theorem on derangements:
Exercise 7.2-3. Let be a derangement of , and let be the element with . Then , so there are choices for . Fix . If , then swaps and and is a derangement of the other elements; there are such . If , define on by and for . Then is a permutation of without fixed points, since . Conversely, every derangement of comes from exactly one such : put and , and for the other . So there are such . In total . Check: .
Exercise 7.2-4. Binomial inversion gives , which is at by the difference formula. So , , , , and for by the theorem on the difference of a polynomial. So . For : . For : .
Exercise 7.2-5. The theorem on the difference of a polynomial with and gives . Since , the first sum is . The polynomial has degree , so of it is zero, and the second sum is .
Exercise 7.2-6. The function is a polynomial in of degree at most , and the coefficient of is . The theorem on the difference of a polynomial gives . Multiply by , and use : the sum in the exercise is . The value does not depend on .
Exercise 7.2-7. A permutation with exactly fixed points is fixed by its set of fixed points, with choices, and by its action on the other elements, which must be a derangement of them, with choices. So there are of them. Absorption gives , so with
where the second sum is by the theorem on derangements and the symmetry . The left side is the total number of fixed points over all permutations. So the average number of fixed points of a permutation is for every .
Exercise 7.2-8. The series gives , so by the theorem on derangements
The terms in the parentheses have alternating signs and strictly decrease in absolute value to . So the value in the parentheses lies strictly between and its first term , because the pairs of consecutive terms after the first one have negative sums. So . For the bound is at most , so the integer is the integer nearest to . For the bound is , and indeed while is nearer to .
Section 7.3: Abel's identity and convolutions
Exercise 7.3-1. The definition with gives . So and . Then , because of the factor .
Exercise 7.3-2. For the three terms of the left side are for , for , and for . Their sum is .
Exercise 7.3-3. The sequences have length , with terms equal to and terms equal to . The partial sums rise at each term , so only the partial sums at the terms can fail. If the th term is at position , then the partial sum there is , and it is positive exactly when . So the first is at a position , or , and the second is at position . The good sequences are
There are exactly of them, and .
Exercise 7.3-4. The shift has the partial sums , so it is good. The shift starts with , so it is not good. So exactly shift is good, but the sum is . The cycle lemma needs for each , and here . In the proof, the step uses steps of size at most ; with a step the partial sums skip the values and on the way up.
Exercise 7.3-5. With and Abel's identity becomes
where the term with is , which is for . For the terms with are , and . The sum is .
Exercise 7.3-6. Take and in the convolution of and . Then by the second example after the definition, , and . So
For the left side is , and .
Exercise 7.3-7. For , . For the definition of has the factor , so . So . The convolution of with gives . So the sequences and are inverse under convolution.
Exercise 7.3-8. Let be a balanced sequence, and let be the sequence followed by . The partial sums of are plus the partial sums of , together with the first partial sum . So has positive partial sums exactly when has nonnegative partial sums. Conversely, a good sequence starts with , since its first partial sum is positive, and the rest of is balanced. So the balanced sequences of length correspond one to one with the good sequences of length with terms and terms . These are the good sequences with , and , and their number is .
Exercise 7.3-9. The convolution of with and gives
where the closed form is the factorial form of for . The first values are , , and . For the left side is , and .
Section 7.4: Multinomials, partial sums and q-binomials
Exercise 7.4-1. COMMITTEE has letters: C, O, I once each, and M, T, E twice each. By the theorem on words with given letters the number of words is
Exercise 7.4-2. The multinomial theorem with , and gives the term . Here , so the coefficient is .
Exercise 7.4-3. Put in the multinomial theorem. The left side is , and the right side is the sum of all with . A count gives the same result: both sides count the words of length over an alphabet of letters, the right side sorted by the number of times each letter occurs.
Exercise 7.4-4. Count the words of length with letters by their last letter. If the last letter is , then , and the first letters form a word with letters and letters for . There are such words. Sum over the with . The algebra gives the same: , and the add up to .
Exercise 7.4-5. Negation of the upper index gives . Use induction on . For both sides are . For the step it is enough to show that the difference of the right sides for and is the term , that is,
Let . If , the left side is . If , the left side is . In both cases the identity holds. The values for are .
Exercise 7.4-6. The theorem with a linear factor with gives
The corollary on half of an odd row gives . Add to both sides:
For the sum is , and the formula gives . For the sum is , and the formula gives .
Exercise 7.4-7. The first -Pascal rule gives . Here and , so
At the coefficients add up to .
Exercise 7.4-8. By the theorem on subset sums, the coefficient of in is the number of -element subsets of with the sum . The map is a one to one map of the -element subsets onto themselves, and it sends a sum to . With the new sum is . So the coefficients of and of are equal. The largest sum is , so the degree of is , and the equality of these coefficients is the identity . The definition gives a direct check: , and the exponents in the numerator minus those in the denominator add up to , while the signs above and below cancel.
Exercise 7.4-9. First way: the theorem of Section 7.4 with and gives
Second way: and . So the term with index is , and the corollary on the sum of squares of a row in Section 7.1 gives .
Solutions to Chapter 8: Stirling numbers and Eulerian numbers
Section 8.1: Stirling numbers of the second kind
Exercise 8.1-1. The row is . The recurrence gives , , , , , and . So the row is , with the sum .
Exercise 8.1-2. The explicit formula with gives . For the last term is , so . For this is , as in the table.
Exercise 8.1-3. An assignment of the people to the rooms is a function from the set of people to the set of rooms, and no room stays empty exactly when the function is onto. By the explicit formula there are such functions. The formula gives the same number directly.
Exercise 8.1-4. Sort the partitions of by the block that contains . The set is a subset of ; let be the number of elements outside it, so it has elements, with choices. The other blocks form an arbitrary partition of the remaining elements, with choices. So . Starting from the recurrence gives , , , , and . These are also the row sums of the table.
Exercise 8.1-5. The row gives . Sum over and use :
For the right side is , and the left side is .
Exercise 8.1-6. A partition of into blocks has the sum of over its blocks equal to . So its blocks with more than one element have one of the following size patterns: one block of ; one block of and one of ; three blocks of . All other blocks have one element. Let be the number of elements in the large blocks, so , or . Choose these elements in ways. There is way to make one block of from elements, ways to split elements into blocks of and , and ways to split elements into three pairs. So . For this is .
Exercise 8.1-7. Put in the theorem on powers in falling powers. The falling power is , so .
Section 8.2: Stirling numbers of the first kind
Exercise 8.2-1. The row is . The recurrence gives , , , , , and . The sum is , as it must be.
Exercise 8.2-2. A permutation of with cycles has the sum of (length ) over its cycles equal to . So its cycles of length at least are one cycle of length , or a cycle of length and one of length , or three cycles of length . Let be the number of elements that they move, so , or , with choices of these elements. On given elements there are cycles of length . On given elements there are ways to make a -cycle and a -cycle, since a set of elements carries cycles. On given elements there are ways to make three -cycles. All other elements are fixed points. So . For this is , and the table gives .
Exercise 8.2-3. Put in . The left side is .
Exercise 8.2-4. Put in the same identity. The left side is , which has the factor when . So for . For the sum is , and for it is . So for the permutations with an even number of cycles and those with an odd number are equally many.
Exercise 8.2-5. The cycle lengths add up to , and there are cycles. So the type is or . For choose the elements of the long cycle in ways, and make a cycle on them in ways: permutations. For choose the fixed point in ways and split the other elements into two pairs in ways: permutations. The total is .
Exercise 8.2-6. The coefficient of in is . This is the coefficient of in , that is, the sum of the products over the pairs in . Each such product is . So
For : and , so the right side is , and . For and both sides are .
Exercise 8.2-7. Put in . The left side is .
Section 8.3: Inversion and identities
Exercise 8.3-1. The second relation with and is . The terms with are , and ; the others are zero. The sum is .
Exercise 8.3-2. By Stirling inversion with , the condition holds exactly for the one sequence . This sum is at , which is for and and for , because of the factor . So is the only solution. Check: for every .
Exercise 8.3-3. The second sum along a column with and is
Exercise 8.3-4. For the left side is . A term with has the lower index in the first factor, so it is . For and the factor is or . For the second factor is , since . Only remains, with the value . The right side is . The dual form with and works the same way, since and .
Exercise 8.3-5. By the definition of the extended numbers, and . The recurrence of the first kind at and says . Here and , so the right side is , which agrees.
Exercise 8.3-6. The first sum along a column with gives . The term with is , and for . So
Exercise 8.3-7. Expand in powers by Section 8.2, and each power in falling powers by Section 8.1:
For the closed form, let . Then , and Vandermonde's convolution with and gives
where the last step uses the symmetry of , which is valid because . So . A polynomial has only one expansion in falling powers, so . For the values for are , , and .
Section 8.4: Eulerian numbers
Exercise 8.4-1. The row is . The recurrence gives for , for , for , for , for and for . The sum is .
Exercise 8.4-2. A permutation with exactly one ascent is a decreasing list followed by another decreasing list, with an ascent between them. The permutations are
In each of them the ascent is at one place: for example has the ascent and the descents and .
Exercise 8.4-3. The explicit formula with gives . A count gives the same result. For each subset of , write the elements of in decreasing order and then the other elements in decreasing order. This gives lists, and each list has at most one ascent, at the join. A permutation with exactly one ascent comes from exactly one , the set of entries before the ascent. The decreasing permutation comes from the sets with . So .
Exercise 8.4-4. The row is , so the corollary gives
For this is .
Exercise 8.4-5. The runs end exactly at the descents and at the last entry, so a permutation with runs has descents. The map of the proof of symmetry turns descents into ascents, so the number of permutations with descents equals the number with ascents, which is .
Exercise 8.4-6. By the symmetry, . Add the two forms: . So the sum is , and the mean number of ascents is . Another way: each of the places is an ascent in exactly half of the permutations, since the swap of the two entries at that place changes an ascent there into a descent.
Exercise 8.4-7. The values for are , , , and . The second identity with and is
This chapter has a full solution of each exercise of the volume, one file per chapter. Exercise of Section is called Exercise -. Try an exercise for some time before you read its solution. Each solution gives the steps that a reader at the level of the rating needs, and many of them end with a check by small cases.