The Topsy-Turvy World of Continued Fractions [online]



Similar documents
Stanford Math Circle: Sunday, May 9, 2010 Square-Triangular Numbers, Pell s Equation, and Continued Fractions

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

Continued Fractions and the Euclidean Algorithm

The Method of Partial Fractions Math 121 Calculus II Spring 2015

1 Lecture: Integration of rational functions by decomposition

Session 7 Fractions and Decimals

0.8 Rational Expressions and Equations

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

Zeros of a Polynomial Function

Core Maths C1. Revision Notes

Vieta s Formulas and the Identity Theorem

5.1 Radical Notation and Rational Exponents

1.7 Graphs of Functions

Continued Fractions. Darren C. Collins

Math Workshop October 2010 Fractions and Repeating Decimals

Math 4310 Handout - Quotient Vector Spaces

3. Mathematical Induction

8 Divisibility and prime numbers

Partial Fractions. Combining fractions over a common denominator is a familiar operation from algebra:

CONTINUED FRACTIONS AND FACTORING. Niels Lauritzen

Exponents and Radicals

Answer Key for California State Standards: Algebra I

PYTHAGOREAN TRIPLES KEITH CONRAD

MATH Fundamental Mathematics IV

CHAPTER 5 Round-off errors

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Integrals of Rational Functions

Inner Product Spaces

Chapter 11 Number Theory

6 EXTENDING ALGEBRA. 6.0 Introduction. 6.1 The cubic equation. Objectives

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

Equations, Inequalities & Partial Fractions

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

Lies My Calculator and Computer Told Me

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

SOLVING EQUATIONS WITH RADICALS AND EXPONENTS 9.5. section ( )( ). The Odd-Root Property

1.6 The Order of Operations

SECTION 10-2 Mathematical Induction

MATH10040 Chapter 2: Prime and relatively prime numbers

Factoring Polynomials

Review of Fundamental Mathematics

Creating, Solving, and Graphing Systems of Linear Equations and Linear Inequalities

Math 0980 Chapter Objectives. Chapter 1: Introduction to Algebra: The Integers.

Section 1.3 P 1 = 1 2. = P n = 1 P 3 = Continuing in this fashion, it should seem reasonable that, for any n = 1, 2, 3,..., =

This is a square root. The number under the radical is 9. (An asterisk * means multiply.)

Solving Rational Equations

Year 9 set 1 Mathematics notes, to accompany the 9H book.

Math 181 Handout 16. Rich Schwartz. March 9, 2010

Notes on Factoring. MA 206 Kurt Bryan

Polynomial and Rational Functions

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

MATH 289 PROBLEM SET 4: NUMBER THEORY

Real Roots of Univariate Polynomials with Real Coefficients

a 1 x + a 0 =0. (3) ax 2 + bx + c =0. (4)

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Algebra Practice Problems for Precalculus and Calculus

Differentiation and Integration

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: b + 90c = c + 10b

To give it a definition, an implicit function of x and y is simply any relationship that takes the form:

Lectures 5-6: Taylor Series

Chapter 7 - Roots, Radicals, and Complex Numbers

POLYNOMIAL FUNCTIONS

Grade Level Year Total Points Core Points % At Standard %

Constrained optimization.

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

Our Primitive Roots. Chris Lyons

Week 13 Trigonometric Form of Complex Numbers

1 Solving LPs: The Simplex Algorithm of George Dantzig

SECTION 0.6: POLYNOMIAL, RATIONAL, AND ALGEBRAIC EXPRESSIONS

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

CALCULATIONS & STATISTICS

9.2 Summation Notation

Partial Fractions. (x 1)(x 2 + 1)

Representation of functions as power series

6.4 Normal Distribution

CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e.

Overview. Essential Questions. Precalculus, Quarter 4, Unit 4.5 Build Arithmetic and Geometric Sequences and Series

1.2. Successive Differences

47 Numerator Denominator

SYSTEMS OF PYTHAGOREAN TRIPLES. Acknowledgements. I would like to thank Professor Laura Schueller for advising and guiding me

CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

8 Primes and Modular Arithmetic

Solution to Exercise 2.2. Both m and n are divisible by d, som = dk and n = dk. Thus m ± n = dk ± dk = d(k ± k ),som + n and m n are divisible by d.

Linear and quadratic Taylor polynomials for functions of several variables.

Pigeonhole Principle Solutions

Unit 7 The Number System: Multiplying and Dividing Integers

Definition 8.1 Two inequalities are equivalent if they have the same solution set. Add or Subtract the same value on both sides of the inequality.

A.2. Exponents and Radicals. Integer Exponents. What you should learn. Exponential Notation. Why you should learn it. Properties of Exponents

Math 55: Discrete Mathematics

Partial Fractions. p(x) q(x)

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system

God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886)

4. How many integers between 2004 and 4002 are perfect squares?

Ummmm! Definitely interested. She took the pen and pad out of my hand and constructed a third one for herself:

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule.

is identically equal to x 2 +3x +2

Notes on Determinant

Transcription:

Chapter 47 The Topsy-Turvy World of Continued Fractions [online] The other night, from cares exempt, I slept and what d you think I dreamt? I dreamt that somehow I had come, To dwell in Topsy-Turveydom! Where babies, much to their surprise, Are born astonishingly wise; With every Science on their lips, And Art at all their fingertips For, as their nurses dandle them, They crow binomial theorem, With views (it seems absurd to us), On differential calculus But though a babe, as I have said, Is born with learning in his head, He must forget it, if he can, Before he calls himself a man WS Gilbert, My Dream, 870 (one of the Bab Ballads) The famous number π has a never-ending, never-repeating decimal expansion π = 345965358979338466433 If we are willing to sacrifice accuracy for brevity, we might say that π = 3 + a little bit more The little bit more is a number between 0 and We take Gilbert s advice and turn that little bit more topsy-turvy Turning the small number 0459 upside

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 4 down, we obtain the reciprocal of a number that is larger than Thus π = 3 + 045965358979338466433 = 3 + 045965358979338466433 = 3 + 7065330593045769793005 = 3 + 7 + 0065330593045769793005 = 3 + 7 + a little bit more Notice that if we ignore the little bit more in this last equation, we find that π is approximately equal to 3+ 7, that is, to 7 You may have learned in high school that 7 is a fairly good approximation to π Let s repeat the process We take the little bit more in the last equation and turn it topsy-turvy, 0065330593045769793005 = = 0065330593045769793005 59965944066857988893060 Now we substitute this into the earlier formula, which gives a double-decker fraction, π = 3 + 7 + 5 + 09965944066857988893060 The bottom level of this fraction is 599659, which is very close to 6 If we replace it with 6, we get a rational number that is quite close to π, 3 + 7 + 6 = 355 3 = 345990353983008849557 The fraction 355 3 agrees with π to six decimal places Continuing on our merry way, we compute 09965944066857988893060 = 0034730337603464468

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 4 to get the triple-decker fraction and then π = 3 +, 7 + 5 + + 00034730337603464468 00034730337603464468 = to add yet another layer to our fraction, 96345904395473785777 π = 3 + 7 + 5 + + 9 + 06345904395473785777 Now let s see what happens if we round that last denominator to 93 We get the rational number 3 + 7 + 5 + + 93 = 04348 335 = 345965394044708759 So the fraction 04348 335 agrees with the value of π to nine decimal places Just how accurate is nine decimal places? Suppose that we are given that the distance from Earth to the Sun is approximately 45,000,000 kilometers and that we want to calculate the length of Earth s orbit using the formula Circumference = π Radius Then the error in the circumference if you use 04348 335 instead of π will amount to a little under 00 meters So, unless you ve managed to measure the distance to the Sun to within a fraction of a kilometer, it s fine to use the approximation π 04348 335 These multistory, topsy-turvy fractions have a name They are called All right, all right, you caught me, Earth s orbit is an ellipse, not a circle So we re really calculating the circumference of an invisible circle whose radius is approximately 45,000,000 kilometers

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 43 Continued Fractions We can form the continued fraction for any number by repeatedly flipping and separating off the whole integer part The first few steps in the computation of the continued fraction for the cube root of are given in full in Figure 47 In a similar fashion, we compute the continued fraction of, = + + + + + and the continued fraction of e = 7888 (the base of the natural logarithms), e = + + + + + 4 + + + 6 + + + 8 + Continued fractions are visually striking as they slide down to the right, but writing them as fractions takes a lot of ink and a lot of space There must be a more convenient way to describe a continued fraction All the numerators are s, so all we need to do is list the denominators We write [a 0, a, a, a 3, a 4, ]

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 44 3 = 599 = + 38473 = + 3 + 8089 = + 3 + + 5549736 = + 3 + + 5 + 89053 = + 3 + + 5 + + 09 = + 3 + + 5 + + + 45649 Figure 47: The Continued Fraction Expansion of 3

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 45 as shorthand for the continued fraction a 0 + a + a + a 3 + a 4 + a 5 + a 6 + Using this new notation, our earlier continued fractions expansions (extended a bit further) can be written succinctly as π = [3, 7, 5,, 9,,,,,, 3,, 4,,,,, ], 3 = [, 3,, 5,,, 4,,, 8,, 4,, 0,,, 4,,, 3,, ], = [,,,,,,,,,,,,,,,,,,,,, ], e = [,,,,, 4,,, 6,,, 8,,, 0,,,,,, 4, ] Now that we ve looked at several examples of continued fractions, it s time to work out some of the general theory If a number α has a continued fraction expansion α = [a 0, a, a, a 3, ], then we have seen that cutting off after a few terms gives a rational number that is quite close to α The n th convergent to α is the rational number p n q n = [a 0, a,, a n ] = a 0 + a + a + + a n obtained by using the terms up to a n For example, the first few convergents to

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 46 = [,,,,, ] are p 0 q 0 =, p q = + = 3, p = + q + = + 5 = 7 5, p 3 q 3 = + + = + + 5 = + 5 = 7 + A longer list of convergents to is given in Table 47 n 0 3 4 5 6 7 8 9 0 p n q n 3 7 5 7 4 9 99 70 39 69 577 408 393 985 3363 378 89 574 Table 47: Convergents to Staring at the list of convergents to is not particularly enlightening, but it would certainly be useful to figure out how successive convergents are generated from the earlier ones It is easier to spot the pattern if we look at [a 0, a, a, a 3, ] using symbols, rather than looking at any particular example p 0 = a 0 q 0, p = a a 0 +, q a p = a a a 0 + a + a 0, q a a + p 3 = a 3a a a 0 + a 3 a + a 3 a 0 + a a 0 + q 3 a 3 a a + a 3 + a Let s concentrate for the moment on the numerators p 0, p, p, Table 47 gives the values of p 0, p, p, p 3, p 4, p 5 At first glance, the formulas in Table 47 look horrible, but you might notice that p 0 appears at the tail end of p, that p appears at the tail end of p 3, that p

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 47 n p n p 0 a 0 p a a 0 + p a a a 0 + a + a 0 p 3 a 3 a a a 0 + a 3 a + a 3 a 0 + a a 0 + p 4 a 4 a 3 a a a 0 + a 4 a 3 a + a 4 a 3 a 0 + a 4 a a 0 + a a a 0 + a 4 + a + a 0 p 5 a 5 a 4 a 3 a a a 0 + a 5 a 4 a 3 a + a 5 a 4 a 3 a 0 + a 5 a 4 a a 0 + a 5 a a a 0 +a 3 a a a 0 + a 5 a 4 + a 5 a + a 3 a + a 5 a 0 + a 3 a 0 + a a 0 + Table 47: Numerator of the Continued Fraction [a 0, a,, a n ] appears at the tail end of p 4, and that p 3 appears in the tail end of p 5 In other words, it seems that p n is equal to p n plus some other stuff Here s a list of the other stuff for the first few values of n: p p 0 = a a a 0 + a = a (a a 0 + ) p 3 p = a 3 a a a 0 + a 3 a + a 3 a 0 = a 3 (a a a 0 + a + a 0 ) p 4 p = a 4 a 3 a a a 0 + a 4 a 3 a + a 4 a 3 a 0 + a 4 a a 0 + a 4 = a 4 (a 3 a a a 0 + a 3 a + a 3 a 0 + a a 0 + ) Looking back at Table 47, it seems that the other stuff for p n p n is simply a n multiplied by the quantity p n We can describe this observation by the formula p n = a n p n + p n This is an example of a recursion formula, because it gives the successive values of p 0, p, p, recursively in terms of the previous values It is very similar to the recursion formula for the Fibonacci numbers that we investigated in Chapter 39 Of course, this recursion formula needs two initial values to get started, p 0 = a 0 and p = a a 0 + A similar investigation of the denominators q 0, q, q, reveals an analogous recursion In fact, if you make a table for q 0, q, q, similar to Table 47, you Indeed, if all the a n s are equal to, then the sequence of p n s is precisely the Fibonacci sequence You can study the connection between continued fractions and Fibonacci numbers by doing Exercise 478

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 48 will find that q 0, q, q, seem to obey exactly the same recursion formula as the one obeyed by p 0, p, p,, but q 0, q, q, use different starting values for q 0 and q We summarize our investigations in the following important theorem Theorem 47 (Continued Fraction Recursion Formula) Let p n q n = [a 0, a,, a n ] = a 0 + a + a + + a n where we treat a 0, a, a, as variables, rather than as specific numbers Then the numerators p 0, p, p, are given by the recursion formula p 0 = a 0, p = a a 0 +, and p n = a n p n + p n for n, and the denominators q 0, q, q, are given by the recursion formula q 0 =, q = a, and q n = a n q n + q n for n, Proof When a sequence is defined by a recursive formula, it is often easiest to use induction to prove facts about the sequence To get our induction started, we need to check that p 0 q 0 = [a 0 ] and p q = [a 0, a ] We are given that p 0 = a 0 and q 0 =, so p 0 /q 0 = a 0, which verifies the first equation Similarly, we are given that p = a a 0 + and q = a, so [a 0, a ] = a 0 + a = a a 0 + a = p q, which verifies the second equation Now we assume that the theorem is true when n = N and use that assumption to prove that it is also true when n = N + A key observation is that the continued fraction [a 0, a, a,, a N, a N+ ] can be written as a continued fraction with one less term by combining the last two terms, 3 [ [a 0, a, a,, a N, a N+ ] = a 0, a, a,, a N + ] a N+ 3 Don t let the complicated last term confuse you If you think about writing everything out as a fraction, you ll see immediately that both sides are equal Try it for N = and for N = 3 if it s still not clear,

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 49 To simplify the notation, let s use different letters for the terms in the continued fraction on the right, say [b 0, b,, b N ] with b 0 = a 0, b = a,, b N = a N, and b N = a N + a N+ Notice that [b 0, b,, b N ] is a continued fraction with one fewer term than the continued fraction [a 0, a,, a N+ ], so our induction hypothesis says that the theorem is true for [b 0, b,, b N ] To avoid confusion, we use capital letters P n /Q n for the convergents of [b 0, b,, b N ] Then the induction hypothesis tells us that the P n s and the Q n s satisfy the recursion formulas P n = b n P n +P n and Q n = b n Q n +Q n for all n N Therefore [b 0, b,, b N ] = P N Q N = b NP N + P N b N Q N + Q N How are the convergents for [a 0, a,, a N+ ] and [b 0, b,, b N ] related? We know that b n = a n for all 0 n N, so the n th convergents are the same for all 0 n N This means that we can make the following substitutions into the formula ( ): P N = p N, P N = p N, Q N = q N, Q N = q N Since we also know that we find that [b 0, b,, b N ] = [a 0, a,, a N+ ] and b N = a N + a N+, ( ) [a 0, a,, a N+ ] = b NP N + P N b N Q N + Q ( N a N + ) p N + p N a = ( N+ a N + ) q N + q N a N+ = a N+(a N p N + p N ) + p N a N+ (a N q N + q N ) + q N ( )

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 40 The induction hypothesis applied to the continued fraction [a 0, a,, a N ] tells us that its convergents satisfy p N = a N p N + p N and q N = a N q N + q N, which allows us to simplify the formula ( ) to read [a 0, a,, a N+ ] = a N+p N + p N a N+ q N + q N But by definition, the (N + ) st convergent is [a 0, a,, a N+ ] = p N+ q N+ Comparing these two expressions for [a 0, a,, a N+ ], we see that p N+ = a N+ p N + p N and q N+ = a N+ q N + q N (We are using the fact that both fractions are already written in lowest terms) We have now shown that if the recursion relations are true for n = N they are also true for n = N + This completes our induction proof that they are true for all values of n We expect that the convergents to a number such as should get closer and closer to, so it might be interesting to see how close the convergents are to one another: p 0 p = q 0 q 3 = p p = 3 q q 7 5 = 0 p p 3 = 7 q q 3 5 7 = 60 p 3 p 4 = 7 q 3 q 4 4 9 = 348 p 4 p 5 = 4 q 4 q 5 9 99 70 = 030 p 5 p 6 = 99 q 5 q 6 70 39 69 = 830 The Difference Between Successive Convergents of The difference between successive convergents does indeed seem to be getting smaller and smaller, but an even more interesting pattern has emerged It seems

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 4 that all the numerators are equal to and that the values alternate between positive and negative Let s try another example, say the continued fraction expansion of π We find that p 0 p = 3 q 0 q 7 = 7 p p = q q 7 333 06 = 74 p p 3 = 333 q q 3 06 355 3 = 978 p 3 p 4 = 355 q 3 q 4 3 03993 330 = 374056 p 4 p 5 = 03993 q 4 q 5 330 04348 335 = 09948930 p 5 p 6 = 04348 q 5 q 6 335 0834 6637 = 07955 The Difference Between Successive Convergents of π The exact same pattern has appeared So let s buckle down and prove a theorem Theorem 47 (Difference of Successive Convergents Theorem) As usual, let p 0, p, p, be the convergents to the continued fraction [a 0, a, a, ] Then q 0 q q p n q n p n q n = ( ) n for all n =,, 3, Equivalently, dividing both sides by q n q n, p n q n p n q n = ( )n q n q n for all n =,, 3, Proof This theorem is quite easy to prove using induction and the Continued Fraction Recursion Formula (Theorem 47) First we check that it is true for n = : p 0 q p q 0 = a 0 a (a a 0 + ) = This gets our induction started Now we assume that the theorem is true for n = N, and we need to prove that

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 4 it is true for n = N + We compute p N q N+ p N+ q N = p N (a N+ q N + q N ) (a N+ p N + p N ) q N using the Continued Fraction Recursion Theorem, = p N q N p N q N since the a N+ p N q N terms cancel, = (p N q N p N q N ) = ( ) N from the induction hypothesis with n = N, = ( ) N+ We have now shown that the desired formula is true for n = and that if it is true for n = N, then it is also true for n = N + Therefore, by induction it is true for all values of n, which completes the proof of the theorem Exercises 47 (a) Compute the first ten terms in the continued fractions of 3 and 5 (b) Do the terms in the continued fraction of 3 appear to follow a repetitive pattern? If so, prove that they really do repeat (c) Do the terms in the continued fraction of 5 appear to follow a repetitive pattern? If so, prove that they really do repeat 47 The continued fraction of π is [,,,,, 47,, 8,,,,,,, 8, 3,, 0, 5,, 3,,,,, 3, 5,,,, ] (a) Fill in the three initial missing entries (b) Do you see any sort of pattern in the continued fraction of π? (c) Use the first fiveterms in the continued fraction to find a rational number that is close to π How close do you come? (d) Same question as (c), but use the first six terms 473 The continued fraction of + 3 is [,,, 5, 7,,, 4,, 38, 43,, 3,,,,,,, 4,, 4, 5,, 5,, 7, ] (a) Fill in the three initial missing entries (b) Do you see any sort of pattern in the continued fraction of + 3? (c) For each n =,, 3,, 7, compute the n th convergent to + 3 p n q n = [a 0, a,, a n ]

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 43 (d) The fractions that you computed in (b) should give more and more accurate approximations to + 3 Verify this by making a table of values p n + 3 = 0some power for n =,, 3,, 7 474 Let p n /q n be the n th convergent to α For each of the following values of α, make a table listing the value of the quantity q n q n p n q n α for n =,, 3,, N (The continued fraction expansions of, 3, and π are listed on page 45, so you can use that information to compute the associated convergents) (a) α = up to N = 8 (b) α = 3 up to N = 7 (c) α = π up to N = 5 (d) Your data from (a) suggest that not only is p n q n bounded, but it actually approaches a limit as n Try to guess what that limit equals, and then prove that your guess is correct (e) Recall that Dirichlet s Diophantine Approximation Theorem (Theorem 33) says that for any irrational number α, there are infinitely many pairs of positive integers x and y satisfying x yα < /y (47) Your data from (a), (b), and (c) suggest that if p n /q n is a convergent to α then (p n, q n ) provides a solution to the inequality (47) Prove that this is true 475 Suppose that we use the recursion for p n backwards in order to define p n for negative values of n What are the values of p and p? Same question for q and q 476 The Continued Fraction Recursion Formula (Theorem 47) gives a procedure for generating two lists of numbers p 0, p, p, p 3, and q 0, q, q, q 3, from two initial values a 0 and a The fraction p n /q n is then the n th convergent to some number α Prove that the fraction p n /q n is already in lowest terms; that is, prove that gcd(p n, q n ) = [Hint Use the Difference of Successive Convergents Theorem (Theorem 47)] 477 We proved that successive convergents p n /q n and p n /q n satisfy p n q n p n q n = ( ) n In this exercise you will figure out what happens if instead we take every other convergent (a) Compute the quantity p n q n p n q n ( ) for the convergents of the partial fraction = [,,,,, ] Do this for n =, 3,, 6

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 44 (b) Compute the quantity ( ) for n =, 3,, 6 for the convergents of the partial fraction π = [3, 7, 5,, 9,,,,, ] (c) Using your results from (a) and (b) (and any other data that you want to collect), make a conjecture for the value of the quantity ( ) for a general continued fraction [a 0, a, a, ] (d) Prove that your conjecture in (c) is correct [Hint The Continued Fraction Recursion Formula may be useful] 478 The simplest continued fraction is the continued fraction [,,, ] consisting entirely of s (a) Compute the first 0 convergents of [,,, ] (b) Do you recognize the numbers appearing in the numerators and denominators of the fractions that you computed in (a)? (If not, look back at Chapter 39) (c) What is the exact value of the limit p n lim n q n of the convergents for the continued fraction [,,, ]? 479 In Table 47 we listed the numerator p n of the continued fraction [a 0, a,, a n ] for the first few values of n (a) How are the numerators of [a, b] and [b, a] related to one another? (b) How are the numerators of [a, b, c] and [c, b, a] related to one another? (c) More generally, how do the numerators of [a 0, a, a,, a n, a n ] and [a n, a n,, a, a, a 0 ] seem to be related to one another? (d) Prove that your conjecture in (c) is correct 470 Write a program that takes as input a decimal number A and an integer n and returns the following values: (a) the first n + terms [a 0, a,, a n ] of the continued fraction of A; (b) the n th convergent p n /q n of A, as a fraction; (c) the difference between A and p n /q n, as a decimal 47 Use your program from Exercise 470 to make a table of (at least) the first 0 terms of the continued fraction expansion of D for D 30 What sort of pattern(s) can you find? (You can check your output by comparing with Table 48 in the next chapter) 47 Same question as Exercise 47, but with cube roots In other words, make a table of (at least) the first 0 terms of the continued fraction expansion of 3 D for each value of D satisfying D 0 Do you see any patterns?

[Chap 47] The Topsy-Turvy World of Continued Fractions [online] 45 473 (Advanced Calculus Exercise) Let a 0, a, a, a 3, be a sequence of real numbers satisfying a i Then, for each n = 0,,, 3,, we can compute the real number u n = [a 0, a, a,, a n ] = a 0 + a + a + + a n Prove that the limit lim n u n exists [Hint Use Theorems 47 and 47 to prove that the sequence u, u, u 3, is a Cauchy sequence]

Chapter 48 Continued Fractions, Square Roots, and Pell s Equation [online] The continued fraction for, [,,,,,,,,,,,,,,,,,,,,, ], certainly appears to be quite repetitive Let s see if we can prove that the continued fraction of really does consist of the number followed entirely by s Since = 44, the first step in the continued fraction algorithm is to write Next we simplify the denominator, = = + ( ) = + /( ) Substituting this back in above yields + + = = + + + = + The number + is between and 3, so we write it as + = + ( ) = + /( )

[Chap 48] Continued Fractions and Pell s Equation [online] 47 But we already checked that /( ) is equal to +, so we find that + = + + ( ) and hence that = + + = + + + Now we can use the formula ( ) again to obtain and yet again to obtain = + + + = + + +, + + + Continuing to employ the formula ( ), we find that the continued fraction of does indeed consist of a single followed entirely by s Emboldened by our success with, can we find other numbers whose continued fractions are similarly repetitive (or, to employ proper mathematical terminology, whose continued fractions are periodic)? If you have done Exercise 47, which asks you to compute the continued fraction of D for D =, 3, 4,, 0, you found some examples Collecting further data of this sort, Table 48 lists the continued fractions for p for each prime p less than 40 Let s turn the question on its head and ask what we can deduce about a continued fraction that happens to be repetitive We start with a simple example Suppose that the number A has as its continued fraction A = [a, b, b, b, b, b, b, b, ] Table 48 includes several numbers of this sort, including, 5, and 37 We can write A in the form A = a + [b, b, b, b, b, ],

[Chap 48] Continued Fractions and Pell s Equation [online] 48 D Continued fraction of D Period [,,,,,,,,,,,,,,,,,,, ] 3 [,,,,,,,,,,,,,,,,,, ] 5 [, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ] 7 [,,,, 4,,,, 4,,,, 4,,,, 4,, ] 4 [3, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, ] 3 [3,,,,, 6,,,,, 6,,,,, 6,,, ] 5 7 [4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ] 9 [4,,, 3,,, 8,,, 3,,, 8,,, 3,,, 8, ] 6 3 [4,, 3,, 8,, 3,, 8,, 3,, 8,, 3,, 8,, ] 4 9 [5,,,,, 0,,,,, 0,,,,, 0,,,, ] 5 3 [5,,, 3, 5, 3,,, 0,,, 3, 5, 3,,, 0,,, ] 8 37 [6,,,,,,,,,,,, ] Table 48: Continued Fractions of Square Roots so we really need to determine the value of the continued fraction B = [b, b, b, b, b, b, b, b, ] Just as we did for A, we can pull off the first entry of B and write B as B = b + [b, b, b, b, b, ] But lo and behold, the denominator [b, b, b, b, ] is simply B itself, so we find that B = b + B Now we can multiply through by B to get B = bb + and then use the quadratic formula to solve for B, B = b + b + 4 (Note that we use the plus sign, since we need B to be positive) Finally, we

[Chap 48] Continued Fractions and Pell s Equation [online] 49 compute the value of A, A = a + B = a + b + b + 4 = a + b + b + 4 = a b b + 4 = a b b + + 4 ( b ) b + 4 b b + 4 We summarize our calculations, including two very interesting special cases Proposition 48 For any positive integers a and b, we have the continued fraction formula a b b + + 4 = [a, b, b, b, b, b, b, b, ] In particular, taking a = b gives the formula b + b + 4 = [b, b, b, b, b, b, b, ] and taking b = a gives the formula a + = [a, a, a, a, a, a, a, a, ] What happens if we have a continued fraction that repeats in a more complicated fashion? Let s do an example to try to gain some insight Suppose that A has the continued fraction A = [,, 3, 4, 5, 4, 5, 4, 5, 4, 5, ], where the subsequent terms continue to alternate 4 and 5 The first thing to do is to pull off the nonrepetitive part, A = + + 3 + [4, 5, 4, 5, 4, 5, 4, 5, ] So now we need to figure out the value of the purely periodic continued fraction B = [4, 5, 4, 5, 4, 5, 4, 5, 4, 5, ]

[Chap 48] Continued Fractions and Pell s Equation [online] 430 (A continued fraction is called purely periodic if it repeats from the very beginning) We can write B as B = 4 + 5 + [4, 5, 4, 5, 4, 5, 4, 5, 4, 5, ] As in our earlier example, we recognize that the bottommost denominator is equal to B, so we have shown that B = 4 + 5 + B Now we simplify this complicated fraction to get an equation for B, B = 4 + 5 + B = 4 + 5B + B = 4 + B 5B + = B + 4 5B + Cross-multiplying by 5B +, moving everything to one side, and doing a little bit of algebra, we find the equation 5B 0B 4 = 0, and then the good old quadratic formula yields B = 0 + 400 + 80 0 = 0 + 30 5 Next we find the value of A by substituting the value of B into our earlier formula

[Chap 48] Continued Fractions and Pell s Equation [online] 43 and using elementary algebra to repeatedly flip, combine, and simplify A = + + = + 3 + + 3 + B 0 + 30 5 = + = + + + 5 3 + 0 + 30 35 + 6 30 0 + 30 = + + 0 + 30 35 + 6 30 = + 80 + 4 30 35 + 6 30 = + 35 + 6 30 80 + 4 30 5 + 0 30 = 80 + 4 30 Finally, we rationalize the denominator of A by multiplying the numerator and denominator by 80 4 30, ( A = 5 + 0 30 80 + 4 30 80 4 ) 30 80 4 = 800 0 30 = 80 30 30 50 5 If you have done Exercise 470, try running your program with the input 80 30 5 = 43330774085670489 and check that you indeed get the continued fraction [,, 3, 4, 5, 4, 5, 4, 5, ] A continued fraction is called periodic if it looks like [a, a,, a } {{ } l, b, b,, b m, b } {{ }, b,, b m, b } {{ }, b,, b m, ] } {{ } initial part periodic part periodic part periodic part In other words, it is periodic if, after some initial terms, it consists of a finite list of terms that are repeated over and over again The number of repeated terms m is called the period For example, = [,,,, ] has period and 3 =

[Chap 48] Continued Fractions and Pell s Equation [online] 43 [4,, 3,, 8,, 3,, 8, ] has period 4 Other examples are given in Table 48 A convenient notation, which makes the periodicity more visible, is to place a bar over the repeating part to indicate that it repeats indefinitely For example = [, ], 3 = [4,, 3,, 8 ], 80 30 5 = [,, 3, 4, 5 ] Similarly, a general periodic continued fraction is written as [a, a,, a l, b, b,, b m ] The examples that we have done suggest that the following theorem might be true We prove the first part and leave the second part as a (challenging) exercise Theorem 48 (Periodic Continued Fraction Theorem) (a) Suppose that the number A has a periodic continued fraction A = [a, a,, a l, b, b,, b m ] Then A is equal to a number of the form A = r + s D t with r, s, t, D integers and D > 0 (b) Let r, s, t, D be integers with D > 0 Then the number has a periodic continued fraction r + s D t Proof (a) Let s start with the purely periodic continued fraction B = [ b, b,, b m ] If we write out the first m steps, we find that B = b + b + = b + b + + b m + [ b, b,, b m ] + b m + B

[Chap 48] Continued Fractions and Pell s Equation [online] 433 We now simplify the right-hand side by repeatedly combining terms and flipping fractions, where we treat B as a variable and the quantities b,, b m as numbers After much algebra, our equation eventually simplifies to B = ub + v wb + z, where u, v, w, z are certain integers that depend on b, b,, b m Furthermore, it is clear that u, v, w, z are all positive numbers, since b, b, are positive To illustrate this procedure, we do the case m = B = b + b + B = b + b B + B ( ) B = b + b B + = (b b + )B + b b B + Returning to the general case, we cross-multiply equation ( ) and move everything to one side, which gives the equation Now the quadratic formula yields so B has the form B = i + j D k wb + (z u)b v = 0 B = (z u) + (z u) + 4vw, w with i, j, k, D integers and D > 0 Returning to our original number A = [a, a,, a l, b, b,, b m ], we can write A as A = a + a + + a l + B = a + a + + a l + i + j D Again we repeatedly flip, combine, and simplify, which eventually yields an expression for A of the form A = e + f D g + h, where e, f, g, h, D are integers and D > 0 D k

[Chap 48] Continued Fractions and Pell s Equation [online] 434 Finally, we multiply both numerator and denominator by g h D This rationalizes the denominator and expresses A as a number of the form A = r + s D, where r, s, t, D are integers and D > 0 t We have completed the proof of part (a) of the Periodic Continued Fraction Theorem (Theorem 48) The proof of part (b) is left to you as (challenging) Exercise 480 The Continued Fraction of D and Pell s Equation The convergents to a continued fraction form a list of rational numbers that get closer and closer to the original number For example, the number 7 has continued fraction 7 = [8,,,, 7,,,, 6 ] and its first few convergents are 7, 4 5, 59 7, 455 54, 54 6, 483 76, 3480 43, 5763 6784, 7806 398, 9775 34746 If p/q is a convergent to D, then p q D, so p q D Multiplying by q, this means that we would expect p to be fairly close to Dq Table 48 lists the values of the differences p Dq for the first few convergents to 7 Among the many striking features of the data in Table 48, we pick out the seemingly mundane appearance of the number in the final column This occurs on the seventh row and reflects that fact that 3480 7 43 = Thus the convergent 3480/43 to the number 7 provides a solution (3480, 43) to the Pell equation x 7y = This suggests a connection between the convergents to D and Pell s equation x Dy =

[Chap 48] Continued Fractions and Pell s Equation [online] 435 p q p 7q 7 5 4 5 59 7 455 54 54 6 5 483 76 7 3480 43 5763 6784 7 7806 398 5 9775 34746 Table 48: Convergents p/q to 7 In Chapters 3 and 34 we carefully and completely proved that Pell s equation x Dy = always has a solution But if you look back at Chapter 34, you will see that our proof does not provide an efficient way to actually find a solution It would thus be very useful if the convergents to D could be used to efficiently compute a solution to Pell s equation The continued fraction of 7, 7 = [8,,,, 7,,,, 6 ], has period 8, and the convergent that gives the solution to Pell s equation is [8,,,, 7,,, ] = 3480 43 A brief examination of Table 48 shows that the continued fractions of square roots D have many special features Here are some further examples with moderately large periods 73 = [8,,, 5, 5,,, 6 ], Period = 7 89 = [9,, 3, 3,, 8 ], Period = 5 97 = [9,, 5,,,,,,, 5,, 8 ], Period = Exercise 489 describes various special properties of the continued fraction for D, but before you look at that exercise, you should try to discover some for yourself

[Chap 48] Continued Fractions and Pell s Equation [online] 436 For D = 7, the convergent that solved Pell s equation was the one obtained by removing the overline and dropping the last entry Let s try doing the same for D = 73, D = 89, and D = 97 The results are shown in Table 483 D [a, b, b,, b m ] = p q p Dq 3480 7 [8,,,, 7,,, ] = 43 068 73 [8,,, 5, 5,, ] = 5 80 79 [8,, 7, ] = 9 5604 97 [9,, 5,,,,,,, 5, ] = 569 3480 7 43 = 068 73 5 = 80 79 9 = 5604 97 569 = Table 483: Convergents to D and Pell s Equation This looks very promising We did not get solutions to Pell s equation in all cases, but we found either a solution to Pell s equation p Dq = or a solution to the similar equation p Dq = Furthermore, we obtain a plus sign when the period of D is even and a minus sign when the period of D is odd We summarize our observations in the following wonderful theorem Theorem 483 Let D be a positive integer that is not a perfect square Write the continued fraction of D as D = [a, b, b,, b m, b m ] and let p q = [a, b, b,, b m ] Then (p, q) is the smallest solution in positive integers to the equation p Dq = ( ) m We do not give the proof of Theorem 483, since it is time to wrap up our discussion of continued fractions and move on to other topics If you are interested in reading the proof, you will find it in Chapter 4 of Davenport s The Higher Arithmetic and in many other number theory textbooks Instead, we conclude with one final observation and one Brobdingnagian example The Learning of this People [the Brobdingnags] is very defective, consisting only in Morality, History, Poetry, and Mathematicks, wherein they must be allowed to excel (Gulliver s Travels, Chapter II:7, Jonathan Swift)

[Chap 48] Continued Fractions and Pell s Equation [online] 437 Our observation has to do with the problem of solving x Dy = when Theorem 483 happens to give a solution to x Dy = In other words, what can we do when D = [a, b, b,, b m, b m ] and m is odd? The answer is provided by our earlier work Recall that Pell s Equation Theorem (Theorem 3) says that if (x, y ) is the smallest solution to x Dy = in positive integers, then every other solution (x k, y k ) can be computed from the smallest solution via the formula x k + y k D = (x + y D ) k, k =,, 3, ( ) The following computation shows why this formula works: ( x k Dy k = ) ( ) x k + y k D x k y k D ) k ) k = (x + y D (x y D = (x Dy ) k = since we have assumed that x Dy = Suppose instead that (x, y ) is a solution to x Dy = and that we compute (x k, y k ) using formula ( ) Then we get x k Dy k = (x Dy ) k = ( ) k So if k is even, then we get a solution to Pell s equation x Dy = Do you see how this solves our problem? Suppose that m is odd in Theorem 483, so (p, q) satisfies p Dq = Then we simply compute the square (p + q D) = (p + q D) + pq D to find the desired solution (p + q D, pq) to x Dy = This finally gives us an efficient way to solve Pell s equation in all cases, and in fact one can show that it provides a method for finding the smallest solution Theorem 484 (Continued Fractions and Pell s Equation Theorem) Write the continued fraction of D as p D = [a, b, b,, b m, b m ] and let q = [a, b, b,, b m ] Then the smallest solution in positive integers to Pell s equation { x Dy (p, q) if m is even, = is given by (x, y ) = (p + q D, pq) if m is odd

[Chap 48] Continued Fractions and Pell s Equation [online] 438 All other solutions are given by the formula x k + y k D = (x + y D ) k, k =,, 3, We conclude our exploration of the world of continued fractions by solving the seemingly innocuous Pell equation x 33y = The continued fraction of 33 is 33 = [7,,, 4,,,, 3,,, 3,,,, 4,,, 34 ] Following the procedure laid out by Theorem 484, we discard the last number in the periodic part, which in this case is the number 34, and compute the fraction 686368 770685 = [7,,, 4,,,, 3,,, 3,,,, 4,, ] The period m is equal to 7, so the pair (p, q) = (686368, 770685) gives a solution to 686368 33 770685 = To find the smallest solution to Pell s equation, Theorem 484 tells us to compute p + q D = 686368 + 770685 33 = 38808934849 pq = 686368 770685 = 893805856460 Thus the smallest solution 3 to x 33y = is (x, y) = (38808934849, 893805856460) And if we desire the next smallest solution, we simply square and read off the answer 38808934849 + 893805856460 33 (x, y) = (075045096943804756550560, 74856755987405647787683680) 3 As noted in Chapter 3, this is the solution found by Brouncker in 657 Now you know how someone could find such a large solution back in the days before computers!

[Chap 48] Continued Fractions and Pell s Equation [online] 439 Exercises 48 Find the value of each of the following periodic continued fractions Express your answer in the form r+s D t, where r, s, t, D are integers, just as we did in the text when we computed the value of [,, 3, 4, 5 ] to be 80 30 5 (a) [,, 3 ] = [,, 3,,, 3,,, 3,,, 3, ] (b) [,,, 3 ] = [,,, 3,, 3,, 3,, 3,, 3,, 3,, ] (c) [,,, 3, ] = [,,, 3,, 3,, 3,, 3,, 3,, ] (d) [3,, ] = [3,,,,,,,,,,,,,, ] (e) [, 3, 5 ] = [, 3, 5,, 3, 5,, 3, 5,, 3, 5,, 3, 5, ] (f) [,,, 3, 4 ] = [,,, 3, 4,, 3, 4,, 3, 4,, 3, 4, ] 48 For each of the following numbers, find their (periodic) continued fraction What is the period? (a) 6 3 (b) + 93 (c) 3 + 5 7 (d) + 5 3 483 During the proof of the Periodic Continued Fraction Theorem (Theorem 48), we simplified the continued fraction [b, b, B] and found that it equals (b b + )B + b b B + (a) Do a similar calculation for [b, b, b 3, B] and write it as [b, b, b 3, B] = ub + v wb + z, where u, v, w, z are given by formulas that involve b, b, and b 3 (b) Repeat (a) for [b, b, b 3, b 4, B] (c) Look at your answers in (a) and (b) Do the expressions for u, v, w, z look familiar? [Hint Compare them to the fractions [b, b ], [b, b, b 3 ], and [b, b, b 3, b 4 ] These are convergents to [b, b, b 3, ] Also look at Table 47] (d) More generally, when the continued fraction [b, b,, b m, B] is simplified as [b, b, b 3,, b m, B] = u mb + v m w m B + z m, explain how the numbers u m, v m, w m, z m can be described in terms of the convergents [b, b, b 3,, b m ] and [b, b, b 3,, b m ] Prove that your description is correct 484 Proposition 48 describes the number with continued fraction expansion [a, b ] (a) Do a similar computation to find the number whose continued fraction expansion is [a, b, c ]

[Chap 48] Continued Fractions and Pell s Equation [online] 440 (b) If you let b = c in your formula, do you get the same result as described in Proposition 48? [If your answer is No, then you made a mistake in (a)!] (c) For which values of a, b, c does the number in (a) have the form s D t for integers s, t, D? (d) For which values of a, b, c is the number in (a) equal to the square root D of some integer D? 485 Theorem 483 tells us that if the continued fraction of D has odd period we can find a solution to x Dy = (a) Among the numbers D 0 with D not a perfect square, which D have odd period and which have even period? Do you see a pattern? (b) Same question for p for primes p 40 (See Table 48) (c) Write down infinitely many positive integers D such that D has odd period For each of your D values, give a solution to the equation x Dy = [Hint Look at Proposition 48] (d) Write down infinitely many positive integers D so that D has even period [Hint Use your solution to Exercise 484(d)] 486 (a) Write a program that takes as input a positive integer D and returns as output a list of numbers [a, b,, b m ] so that the continued fraction expansion of D is [a, b,, b m ] Use your program to print a table of continued fractions of D for all nonsquare D between and 50 (b) Generalize (a) by writing a program that takes as input integers r, s, t, D with t > 0 and D > 0 and returns as output a list of numbers [a,, a l, b,, b m ] satisfying r + s D t = [a,, a l, b,, b m ] Use your program to print a table of continued fractions of (3 + D)/5 for all nonsquare D between and 50 487 (a) Write a program that takes as input a list [b,, b m ] and returns the value of the purely periodic continued fraction [ b, b,, b m ] The output should be in the form (r, s, t, D), where the value of the continued fraction is (r + s D)/t (b) Use your program from (a) to compute the values of each of the following continued fractions: [ ], [, ], [,, 3 ], [,, 3, 4 ], [,, 3, 4, 5 ], [,, 3, 4, 5, 6 ] (c) Extend your program in (a) to handle periodic continued fractions that are not purely periodic In other words, take as input two lists [a,, a l ] and [b,, b m ] and return the value of [a,, a l, b, b,, b m ] (d) Use your program from (c) to compute the values of each of the following continued fractions: [6, 5, 4, 3,, ], [6, 5, 4, 3,, ], [6, 5, 4,,, 3 ], [6, 5,,, 3, 4 ], [6,,, 3, 4, 5 ]

[Chap 48] Continued Fractions and Pell s Equation [online] 44 488 Write a program to solve Pell s equation x Dy = using the method of continued fractions If it turns out that there is a solution to x Dy =, list a solution to this equation also (a) Use your program to solve Pell s equation for all nonsquare values of D between and 0 Check your answers against Table 3 (page 49) (b) Use your program to extend the table by solving Pell s equation for all nonsquare values of D between 76 and 99 489 (hard problem) Let D be a positive integer that is not a perfect square (a) Prove that the continued fraction of D is periodic (b) More precisely, prove that the continued fraction of D looks like D = [a, b, b,, b m ] (c) Prove that b m = a (d) Prove that the list of numbers b, b,, b m is symmetric; that is, it s the same left to right as it is right to left 480 (hard problem) Let r, s, t, D be integers with D > 0 and t 0 and let A = r + s D t Prove that the continued fraction of A is periodic [This is part (b) of the Periodic Continued Fraction Theorem (Theorem 48)]

Chapter 49 Generating Functions [online] Aptitude tests, intelligence tests, and those ubiquitous grade school math worksheets teem with questions such as: What is the next number in the sequence 3, 7, 8, 3, 36, 37, 38, 39, 4, 43, 47, 49, 50, 5, 5, 53, 56, 58, 6, 6, 77, 78,? Number theory abounds with interesting sequences We ve seen lots of them in our excursions, including for example Natural Numbers 0,,, 3, 4, 5, 6, Square Numbers 0,, 4, 9, 6, 5, 36, Fibonacci Numbers 0,,,, 3, 5, 8, 3,, We have also seen that sequences can be described in various ways, for example by a formula such as s n = n or by a recursion such as F n = F n + F n Both of these methods of describing a sequence are useful, but since a sequence consists of an infinitely long list of numbers, it would be nice to have a way of bundling the entire sequence into a single package We will build these containers out of power series This problem is for baseball fans The answer is given at the end of the chapter For this chapter, it is convenient to start these interesting sequences with 0, rather than with

[Chap 49] Generating Functions [online] 443 For example, we can package the sequence 0,,, 3, of natural numbers into the power series 0 + x + x + 3x 3 + 4x 4 + 5x 5 +, and we can package the sequence 0,,,, 3, 5, 8, of Fibonacci numbers into the power series In general, any sequence 0 + x + x + x 3 + 3x 4 + 5x 5 + 8x 6 + can be packaged into a power series a 0, a, a, a 3, a 4, a 5, A(x) = a 0 + a x + a x + a 3 x 3 + a 4 x 4 + a 5 x 5 + that is called the generating function for the sequence a 0, a, a, a 3, What good are generating functions, other than providing a moderately inconvenient way to list the terms of a sequence? The answer lies in that powerful word function A generating function A(x) is a function of the variable x; that is, we can substitute in a value for x and (if we re lucky) get back a value for A(x) We say if we re lucky because, as you know if you have studied calculus, a power series need not converge for every value of x To illustrate these ideas, we start with the seemingly uninteresting sequence,,,,,,,,, consisting of all ones 3 Its generating function, which we call G(x), is G(x) = + x + x + x 3 + x 4 + x 5 + The ratio test 4 from calculus says that this series converges provided that > ρ = lim x n+ n x n = x 3 If intelligence tests asked for the next term in sequences like this one, we could all have an IQ of 00! 4 Recall that the ratio test says that a series b 0 + b + b + converges if the limiting ratio ρ = lim n b n+/b n satisfies ρ <

[Chap 49] Generating Functions [online] 444 You ve undoubtedly already recognized that G(x) is the geometric series and you probably also remember its value, but in case you ve forgotten, here is the elegant method used to evaluate the geometric series xg(x) = x( + x + x + x 3 + x 4 + x 5 + ) = x + x + x 3 + x 4 + x 5 + x 6 + = ( + x + x + x 3 + x 4 + x 5 + x 6 + ) = G(x) Thus xg(x) = G(x), and we can solve this equation for G(x) to obtain the formula G(x) = x This proves the following formula Geometric Series Formula + x + x + x 3 + x 4 + x 5 + = x valid for x < The sequence,,,, is rather dull, so let s move on to the sequence of natural numbers 0,,, 3, whose generating function is N(x) = x + x + 3x 3 + 4x 4 + 5x 5 + 6x 6 + The ratio test tells us that N(x) converges provided that > ρ = lim (n + )x n+ n nx n = x We would like to find a simple formula for N(x), similar to the formula we found for G(x) The way we do this is to start with the Geometric Series Formula + x + x + x 3 + x 4 + x 5 + = x and use a little bit of calculus If we differentiate both sides of this formula, we get } 0 + + x + 3x {{ + 4x 3 + 5x 4 + } = d ( ) = dx x ( x) When multiplied by x, this becomes N(x) Multiplying both sides of this equation by x gives us the formula N(x) = x + x + 3x 3 + 4x 4 + 5x 5 + 6x 6 + = x ( x)

[Chap 49] Generating Functions [online] 445 If we differentiate again and multiply both sides by x, we get a formula for the generating function S(x) = x + 4x + 9x 3 + 6x 4 + 5x 5 + 36x 6 + for the sequence of squares 0,, 4, 9, 6, 5, Thus x dn(x) = x d dx dx (x + x + 3x 3 + 4x 4 + ) = x d ( ) x dx ( x) S(x) = x + 4x + 9x 3 + 6x 4 + 5x 5 + = x + x ( x) 3 We now turn to the Fibonacci sequence 0,,,, 3, 5, 8, and its generating function F (x) = F x + F x + F 3 x 3 + F 4 x 4 + F 5 x 5 + F 6 x 6 + = x + x + x 3 + 3x 4 + 5x 5 + 8x 6 + 3x 7 + How can we find a simple expression for F (x)? The differentiation trick we used earlier doesn t seem to help, so instead we make use of the recursive formula F n = F n + F n Thus we can replace F 3 with F + F, and we can replace F 4 with F 3 + F, and so on, which means we can write F (x) as F (x) = F x + F x + F 3 x 3 + F 4 x 4 + F 5 x 5 + = F x + F x + (F + F )x 3 + (F 3 + F )x 4 + (F 4 + F 3 )x 5 + Ignoring the first two terms for the moment, we regroup the other terms in the following manner: Group these terms together (F + F )x 3 + (F 3 + F )x 4 + (F 4 + F 3 )x 5 + (F 5 + F 4 )x 6 + Group these terms together This gives the formula F (x) = F x + F x + { F x 3 + F x 4 + F 3 x 5 + F 4 x 6 + } + { F x 3 + F 3 x 4 + F 4 x 5 + F 5 x 6 + }

[Chap 49] Generating Functions [online] 446 Now observe that the series between the first set of braces is almost equal to the generating function F (x) with which we started; more precisely, it is equal to x F (x) Similarly, the series between the second set of braces is equal to xf (x) except that it is missing the initial F x term In other words, F (x) = F x + F x + {F x 3 + F x 4 + } + {F x 3 + F 3 x 4 + } = F x + F x + x {F x + F x + } + x{f } {{ } x + F 3 x 3 + } } {{ } equals F (x) equals F (x) F x If we use the values F = and F =, this gives us the formula F (x) = x + x + x F (x) + x ( F (x) x ) = x + x F (x) + xf (x) This gives us an equation that we can solve for F (x) to obtain the following beautiful formula Fibonacci Generating Function Formula x + x + x 3 + 3x 4 + 5x 5 + 8x 6 + = x x x We can use the formula for the Fibonacci generating function together with the method of partial fractions that you learned in calculus to rederive Binet s formula for the n th Fibonacci number (Theorem 39) The first step is to use the quadratic formula to find the roots of the polynomial x x The roots are ± 5, which are the reciprocals of the two numbers 5 α = + 5 This lets us factor the polynomial as and β = 5 x x = ( αx)( βx) The idea of partial fractions is to take the function into the sum of two pieces x x x = A αx + B βx, x and split it up x x 5 Notice how the Golden Ratio (page 330) has suddenly appeared! This should not be surprising, since we saw in Chapter 39 that the Fibonacci sequence and the Golden Ratio are intimately related to one another

[Chap 49] Generating Functions [online] 447 where we need to find the correct values for A and B To do this, we clear denominators by multiplying both sides by x x to get x = A( βx) + B( αx) [Remember that x x = ( αx)( βx)] Rearranging this relation yields x = (A + B) (Aβ + Bα)x We re looking for values of A and B that make the polynomial x on the left equal to the polynomial on the right, so we must choose A and B to satisfy 0 = A + B = Aβ Bα It is easy to solve these two equations for the unknown quantities A and B (remember that α and β are particular numbers) We find that A = α β and B = β α, and using the values α = ( + 5)/ and β = ( 5)/ gives A = 5 and B = 5 To recapitulate, we have found the partial fraction decomposition x x x = ( ) ( ) 5 αx 5 βx This may not seem like progress, but it is, because we have replaced the complicated function x/( x x ) with the sum of two simpler expressions If this were a calculus textbook, I would now ask you to compute the indefinite integral x dx and you would use the partial fraction formula to compute x x x x x dx = 5 dx αx 5 dx βx = 5 α log αx + 5 β log βx + C However, our subject is not calculus, it is number theory, so we instead observe that the two pieces of the partial fraction decomposition can be expanded using the

[Chap 49] Generating Functions [online] 448 geometric series as αx = + αx + (αx) + (αx) 3 + (αx) 4 +, βx = + βx + (βx) + (βx) 3 + (βx) 4 + This lets us write the function x/( x x ) as a power series x x x = ( ) ( ) 5 αx 5 βx = α β 5 x + α β 5 x + α3 β 3 5 x 3 + But we know that x/( x x ) is the generating function for the Fibonacci sequence, x x x = F x + F x + F 3 x 3 + F 4 x 4 + F 5 x 5 + F 6 x 6 +, so matching the two series for x/( x x ), we find that F = α β 5, F = α β 5, F 3 = α3 β 3 5, Substituting the values of α and β, we again obtain Binet s formula (Theorem 39) for the n th Fibonacci number Binet s Formula {( F n = + 5 5 ) n ( 5 ) n } The two numbers appearing in the Binet s Formula are approximately equal to α = + 5 68034 and β = 5 068034 Notice that β <, so if we raise β to a large power, it becomes very small In particular, ( F n = Closest integer to + ) n 5 5 For example, (04473 ) (6803 ) n F 0 55003636 and F 5 7504999997334, which are indeed extremely close to the correct values F 0 = 55 and F 5 = 7505

[Chap 49] Generating Functions [online] 449 Exercises 49 (a) Find a simple formula for the generating function E(x) for the sequence of even numbers 0,, 4, 6, 8, (b) Find a simple formula for the generating function J(x) for the sequence of odd numbers, 3, 5, 7, 9, (c) What does E(x ) + xj(x ) equal? Why? 49 Find a simple formula for the generating function of the sequence of numbers a, a + m, a + m, a + 3m, a + 4m, (If 0 a < m, then this is the sequence of nonnegative numbers that are congruent to a modulo m) 493 (a) Find a simple formula for the generating function of the sequence whose n th term is n 3, that is, the sequence 0,, 8, 7, 64, (b) Repeat (a) for the generating function of the sequence 0,, 6, 8, 56, (This is the sequence whose n th term is n 4 ) (c) If you have access to a computer that does symbolic differentiation or if you enjoy length calculations with paper and pencil, find the generating function for the sequence whose n th term is n 5 (d) Repeat (c) for the sequence whose n th term is n 6 494 Let G(x) = + x + x + x 3 + be the generating function of the sequence,,, (a) Compute the first five coefficients of the power series G(x) (b) Prove that the power series G(x) G(x) is equal to some other power series that we studied in this chapter 495 Let T (x) = x + 3x + 6x 3 + 0x 4 + be the generating function for the sequence 0,, 3, 6, 0, of triangular numbers Find a simple expression for T (x) 496 This question investigates the generating functions of certain sequences whose terms are binomial coefficients (see Chapter 38) (a) Find a simple expression for the generating function of the sequence whose n th term is ( n ) (b) Same question for the sequence whose n th term is ( n ) (c) Same question for the sequence whose n th term is ( n 3) (d) For a fixed number k, make a conjecture giving a simple expression for the generating function of the sequence whose n th term is ( n k) (e) Prove that your conjecture in (d) is correct 497 Let k 0 be an integer and let D k (x) be the generating function of the sequence 0 k, k, k, 3 k, 4 k, In this chapter we computed D 0 (x) = x, D x (x) = ( x), D (x) = x + x ( x) 3,

[Chap 49] Generating Functions [online] 450 and in Exercise 493 you computed further examples These computations suggest that D k (x) looks like D k (x) = P k(x) ( x) k+ for some polynomial P k (x) (a) Prove that there is a polynomial P k (x) such that D k (x) can be written in the form P k (x)/( x) k+ [Hint Use induction on k] (b) Make a list of values of P k (0) for k = 0,,, and make a conjecture Prove that your conjecture is correct (c) Same as (b) for the values of P k () (d) Repeat (b) and (c) for the values of the derivative P k (0) and P k () (e) What other patterns can you find in the P k (x) polynomials? 498 Let ϕ be Euler s phi function (see Chapter ), and let p be a prime number Find a simple formula for the generating function of the sequence ϕ(), ϕ(p), ϕ(p ), ϕ(p 3 ), 499 The Lucas sequence is the sequence of numbers L n given by the rules L =, L = 3, and L n = L n + L n (a) Write down the first 0 terms of the Lucas sequence (b) Find a simple formula for the generating function of the Lucas sequence (c) Use the partial fraction method to find a simple formula for L n, similar to Binet s Formula for the Fibonacci number F n 490 Write down the first few terms in each of the following recursively defined sequences, and then find a simple formula for the generating function (a) a =, a =, and a n = 5a n 6a n for n = 3, 4, 5, (b) b =, b = 3, and b n = b n b n for n = 3, 4, 5, (c) c =, c =, c 3 =, and c n = 4c n + c n 30c n 3 for n = 4, 5, 6, 49 Use generating functions and the partial fraction method to find a simple formula for the n th term of each of the following sequences similar to the formula we found in the text for the n th term of the Fibonacci sequence (Note that these are the same sequences as in the previous exercise) Be sure to check your answer for the first few values of n (a) a =, a =, and a n = 5a n 6a n for n = 3, 4, 5, (b) b =, b = 3, and b n = b n b n for n = 3, 4, 5, [Hint You may need to use complex numbers!] (c) c =, c =, c 3 =, and c n = 4c n + c n 30c n 3 for n = 4, 5, 6, 49 (a) Fix an integer k 0, and let H(x) be the generating function of the sequence whose n th term is h n = n k Use the ratio test to find the interval of convergence of the generating function H(x) (b) Use the ratio test to find the interval of convergence of the generating function F (x) of the Fibonacci sequence 0,,,, 3, 5,

[Chap 49] Generating Functions [online] 45 493 Sequences a 0, a, a, a 3, are also sometimes packaged in an exponential generating function x a 0 + a! + a x! + a x 3 3 3! + a x 4 4 4! + a x 5 5 5! + (a) What is the exponential generating function for the sequence,,,,? [Hint Your answer explains why the word exponential is used in the name of this type of generating function] (b) What is the exponential generating function for the sequence 0,,, 3, of natural numbers? 494 Let f(x) be the exponential generating function of the Fibonacci sequence x f(x) = F 0 + F! + F x! + F x 3 3 3! + F x 4 4 4! + F x 5 5 5! + (a) Find a simple relation satisfied by f(x) and its derivatives f (x) and f (x) (b) Find a simple formula for f(x) 495 Fix an integer N and create a sequence of numbers a 0, a, a, in the following way: a 0 = 0 + 0 + 3 0 + + N 0 a = + + 3 + + N a = + + 3 + + N a 3 = 3 + 3 + 3 3 + + N 3 Compute the exponential generating function of this sequence (We will study these power sums further in Chapter 50) Solution to Sequence on page 44 The next five terms in the sequence 3, 7, 8, 3, 36, 37, 38, 39, 4, 43, 47, 49, 50, 5, 5, 53, 56, 58, 6, 6, 77, 78 given at the beginning of this chapter are 96, 98, 99, 00, and 09, as is obvious to those who know that the New York Yankees won the World Series in the years 93, 97, 98,, 977, 978, 996, 998, 999, 000, and 009 Those who are not Yankee fans might prefer to complete the shorter sequence 03,, 5, 6, 8, [Hint There is a gap of 86 years before the next entry]

Chapter 50 Sums of Powers [online] The n th triangular number T n = + + 3 + 4 + + n is the sum of the first n natural numbers In Chapter we used geometry to find a simple formula for T n, n(n + ) T n = This formula was extremely useful in Chapter 3, where we described all numbers that are simultaneously triangular and square The reason that the formula for T n is so helpful is that it expresses a sum of n numbers as a simple polynomial in the variable n To say this another way, let F (X) be the polynomial Then the sum F (X) = X + X + + 3 + 4 + + n, which at first glance requires us to add n numbers, can be computed very simply as the value F (n) Now suppose that rather than adding the first n integers, we instead add the first n squares, R n = + 4 + 9 + 6 + + n We make a short table of the first few values and look for patterns n 3 4 5 6 7 8 9 0 R n 5 4 30 55 9 40 04 85 385

[Chap 50] Sums of Powers [online] 453 The numbers R, R, R 3, are increasing fairly rapidly, but they don t seem to obey any simple pattern It isn t easy to see how we might get our hands on these numbers We use a tool called the method of telescoping sums To illustrate this technique, we first look at the following easier problem Suppose we want to compute the value of the sum S n = + 3 + 3 4 + 4 5 + + (n ) n For this sum, if we compute the first few values, it s easy to see the pattern: n 3 4 5 6 7 8 9 0 S n 3 3 4 4 5 So we guess that S n is probably equal to n n, but how can we prove that this is true? The key is to observe that the first few terms of the sum can be written as = and 5 6 3 = 3 6 7 7 8 8 9 9 0 and and so on More generally, the i th term of the sum is equal to Hence the sum S n is equal to i (i + ) = i i + 3 4 = 3 4 S n = = ( ) + + 3 ( ) 3 + + 3 4 ( 3 ) 4 + + + + (n ) n ( n ) n Now look what happens when we add the terms on this last line We start with Next we get followed by +, so these two terms cancel Then we get 3, which is followed by + 3, so these two terms also cancel Notice how the sum telescopes (imagine how the tubes of a telescope fold into one another), with only the first term and the last term remaining at the end This proves the formula S n = n = n n Now we return to the problem of computing the sum of squares R n = + + 3 + + n

[Chap 50] Sums of Powers [online] 454 For reasons that will become apparent in a moment, we look at the following telescoping sum involving cubes: (n + ) 3 = 3 + ( 3 3 ) + (3 3 3 ) + + ( (n + ) 3 n 3) Using summation notation, we can write this as (n + ) 3 = + n ( (i + ) 3 i 3) i= Next we expand the expression (i+) 3 using the binomial formula (Theorem 38) (i + ) 3 = i 3 + 3i + 3i + Substituting this into the telescoping sum gives (notice that the i 3 terms cancel) (n + ) 3 = + n (3i + 3i + ) Now we split the sum into three pieces and add each piece individually, (n + ) 3 = + 3 i= n i + 3 i= n i + i= = + 3R n + 3T n + n n But we already know that T n = n i= i is equal to (n + n)/, so we can solve for R n, R n = (n + )3 n 3 = n3 + 3n + n 3 = n3 + 3n + n 6 T n n + n That was a lot of algebra, but we are amply rewarded for our efforts by the beautiful formula i= + + 3 + + n = n3 + 3n + n 6 Notice how nifty this formula is If we want to compute the value of + + 3 + 4 + + 9999 + 0000,

[Chap 50] Sums of Powers [online] 455 we could add 0000 terms, but using the formula for R n, we only need to compute R 0000 = 00003 + 3 0000 + 0000 6 = 333,383,335,000 Now take a deep breath, because we next tackle the problem of adding sums of k th powers for higher values of k We write F k (n) = k + k + 3 k + + n k for the sum of the first n numbers, each raised to the k th power The telescoping sum method that worked so well computing sums of squares works just as well for higher powers We begin with the telescoping sum (n + ) k = k + ( k k ) + (3 k k ) + + ( (n + ) k n k), which, using summation notation, becomes n (n + ) k ( = + (i + ) k i k) Just as before, we expand (i + ) k using the binomial formula (Theorem 38), (i + ) k = i= k j=0 ( ) k i j j The last term (ie, the j = k term) is i k, so it cancels the i k in the telescoping sum, leaving n k ( ) k (n + ) k = + i j j i= j=0 Now switch the order of the two sums, and lo and behold, we find the power sums F 0 (n), F (n),, F k (n) appearing, k ( ) n k (n + ) k = + i j = + j i= j=0 k j=0 ( ) k F j (n) j What good is a formula like this, which seems to involve all sorts of quantities that we don t know? The answer is that it relates each of F 0 (n), F (n), F (n), with the previous ones To make this clearer, we pull off the last term in the sum, that is, the term with j = k, and we move all the other terms to the other side, ( ) k F k (n) = (n + ) k k k j=0 ( ) k F j (n) j

[Chap 50] Sums of Powers [online] 456 Now ( k k ) = k, so dividing by k gives the recursive formula F k (n) = (n + )k k k k ( ) k F j (n) j We call this a recursive formula for the F k s, because it expresses each F k in terms of the previous ones It is thus similar in some ways to the recursive formula used to describe the Fibonacci sequence (Chapter 39), although this formula is obviously much more complicated than the Fibonacci formula Let s use the recursive formula to find a new power-sum formula Taking k = 4 in the recursive formula gives F 3 (n) = (n + )4 4 4 {( ) 4 F 0 (n) + 0 We already know from our earlier work that F (n) = T n = n + n and while the value of F 0 (n) is clearly equal to j=0 ( ) 4 F (n) + ( ) } 4 F (n) F (n) = R n = n3 + 3n + n, 6 F 0 (n) = 0 + 0 + + n 0 = } + + {{ + } = n n terms Substituting in these values for F 0 (n), F (n), and F (n) yields F 3 (n) = (n + )4 {( ) ( ) 4 4 F 0 (n) + F (n) + 4 4 0 Thus ( ) } 4 F (n) = n4 + 4n 3 + 6n + 4n + 4 { n + 4 n + n + 6 n3 + 3n } + n 4 6 = n4 + n 3 + n 4 F 3 (n) = 3 + 3 + 3 3 + + n 3 = n4 + n 3 + n 4 For example, 3 + 3 + 3 3 + 4 3 + + 0000 3 = 00004 + 0000 3 + 0000 4 =,500,500,05,000,000

[Chap 50] Sums of Powers [online] 457 The recursive formula for power sums is very beautiful, so we record our discovery in the form of a theorem Theorem 50 (Sum of Powers Theorem) Let k 0 be an integer There is a polynomial F k (X) of degree k + such that F k (n) = k + k + 3 k + + n k for every value of n =,, 3, These polynomials can be computed using the recurrence formula F k (X) = (X + )k k ( ) k F i (X) k k i Proof We proved above that the power sums can be computed by the recurrence formula It is also clear from the recurrence formula that the power sums are polynomials, since each successive power sum is simply the polynomial (X+)k k adding to some multiples of the previous power sums All that remains is to prove that F k (X) has degree k + We use induction To start the induction, we observe that F 0 (X) = X has the correct degree Now suppose that we know that F k (X) has degree k + for k = 0,,,, m In other words, suppose we ve finished the proof for all values of k less than m We use the recurrence formula with k = m + to compute F m (X) = (X + )m+ m + The first part looks like (X + ) m+ m + m + i=0 m i=0 ( m + = m + Xm+ + i ) F i (X) On the other hand, by the induction hypothesis we know that F i (X) has degree i + for each i = 0,,, m, so the polynomials in the sum have degree at most m This proves that the X m+ coming from the first part isn t canceled by any of the other terms, so F m (X) has degree m + This completes our induction proof We ve computed the power-sum polynomials F (X) = ( X + X ), F (X) = 6( X 3 + 3X + X ), F 3 (X) = 4( X 4 + X 3 + X )

[Chap 50] Sums of Powers [online] 458 Now it s your turn to compute the next few power-sum polynomials, so turn to Exercise 50 and use the recursive formula to compute F 4 (X) and F 5 (X) Be sure to check your answers Lest you feel that I ve done the easy computations and you ve been stuck with the hard ones, here are the next few power-sum polynomials F 6 (X) = ( 6X 7 + X 6 + X 5 7X 3 + X ) 4 F 7 (X) = ( 3X 8 + X 7 + 4X 6 7X 4 + X ) 4 F 8 (X) = ( 0X 9 + 45X 8 + 60X 7 4X 5 + 0X 3 3X ) 90 F 9 (X) = ( X 0 + 0X 9 + 5X 8 4X 6 + 0X 4 3X ) 0 F 0 (X) = ( 6X + 33X 0 + 55X 9 66X 7 + 66X 5 33X 3 + 5X ) 66 You can use this list to look for patterns and to test conjectures Three-Dimensional Number Shapes In our work on number theory and geometry, we have studied various sorts of number shapes, such as triangular numbers and square numbers (Chapters and 3) and even pentagonal numbers (Exercise 34) Triangles, squares, and pentagons are plane figures; that is, they lie on a flat surface We, on the other hand, live in three-dimensional space, so it s about time we looked at three-dimensional number shapes We ll build pyramids with triangular bases, as illustrated in Figure 50 +3 4 3 +6 0 3 6 +0 0 Figure 50: The Tetrahedral Numbers T = 4, T 3 = 0, and T 4 = 0 The fancy mathematical term for this sort of solid shape is a tetrahedron We define the n th Tetrahedral Number to be the number of dots in a tetrahedron with

[Chap 50] Sums of Powers [online] 459 n layers, and we let Looking at Figure 50, we see that T n = the n th Tetrahedral Number T =, T = 4, T 3 = 0, and T 4 = 0 The pictures illustrate how tetrahedral numbers are formed, T =, T = 4 = + 3, T 3 = 0 = + 3 + 6, T 4 = 0 = + 3 + 6 + 0 To form the fifth tetrahedral number, we need to add another triangle onto the bottom of the previous tetrahedron In other words, we need to add the next triangular number to the previous tetrahedral number If this isn t clear, notice how T 4 is formed by adding the first four triangular numbers:, 3, 6, and 0 So to get T 5, we take T 4 and add on the fifth triangular number T 5 = 5 to get T 5 = T 4 + T 5 = ( + 3 + 6 + 0) + 5 = 35 In general, the n th tetrahedral number is equal to the sum of the first n triangular numbers, T n = T + T + T 3 + + T n We know that the n th triangular number T n is given by T n = n + n, so we can find a formula for T n by adding T n = n T j = j= n j= j + j = n j + j= n j j= To finish the calculation, we use our power-sum formulas, in particular our formula for the sum of the first n squares, to compute T n = ( n 3 + 3n + n 6 ) + ( n ) + n = n3 + 3n + n 6

[Chap 50] Sums of Powers [online] 460 It is interesting to observe that the tetrahedral polynomial factors as T n = n(n + )(n + ) 6 Thus the n th triangular number and the n th tetrahedral number can be expressed using binomial coefficients ( ) ( ) n + n + T n = and T n = 3 In other words, the n th two-dimensional pyramid (triangle) has ( ) n+ dots, and the n th three-dimensional pyramid (tetrahedron) has ( ) n+ 3 dots How many dots do you think it takes to fill up a four-dimensional pyramid? Exercises 50 In the text we used a telescoping sum to prove that the quantity S n = 3 + 3 4 + 4 5 + + n (n ) n is equal to n Use induction to give a different proof of this formula + 50 (a) Use the recursive formula to compute the polynomial F 4 (X) Be sure to check your answer by computing F 4 (), F 4 (), and F 4 (3) and verifying that they equal, + 4 = 7, and + 4 + 3 4 = 98, respectively (b) Find the polynomial F 5 (X) and check your answer as in (a) 503 (a) Prove that the leading coefficient of F k (X) is k+ In other words, prove that F k (X) looks like F k (X) = k + Xk+ + ax k + bx k + (b) Try to find a similar formula for the next coefficient (ie, the coefficient of X k ) in the polynomial F k (X) (c) Find a formula for the coefficient of X k in the polynomial F k (X) 504 (a) What is the value of F k (0)? (b) What is the value of F k ( )? (c) If p is a prime number and if p k, prove that k + k + + (p ) k 0 (mod p) What is the value when p divides k? (d) What is the value of F k ( /)? More precisely, try to find a large collection of k s for which you can guess (and prove correct) the value of F k ( /)

[Chap 50] Sums of Powers [online] 46 505 Prove the remarkable fact that ( + + 3 + + n) = 3 + 3 + 3 3 + + n 3 506 The coefficients of the polynomial F k (X) are rational numbers We would like to multiply by some integer to clear all the denominators For example, F (X) = X + X and F (X) = 3 X3 + X + 6 X, so F (X) and 6 F (X) have coefficients that are integers (a) Prove that (k + )! F k (X) has integer coefficients (b) It is clear from the examples in this chapter that (k + )! is usually much larger than necessary for clearing the denominators of the coefficients of F k (X) Can you find any sort of patterns in the actual denominator? 507 A pyramid with a square base of side n requires F (n) dots, so F (n) is the n th Square Pyramid Number In Chapter 3 we found infinitely many numbers that are both triangular and square Search for numbers that are both tetrahedral and square pyramid numbers Do you think there are finitely many, or infinitely many, such numbers? 508 (a) Find a simple expression for the sum T + T + T 3 + + T n of the first n tetrahedral numbers (b) Express your answer in (a) as a single binomial coefficient (c) Try to understand and explain the following statement: The number T +T + + T n is the number of dots needed to form a pyramid shape in four-dimensional space 509 The n th triangular number T n equals the binomial coefficient ( ) n+, and the n th tetrahedral number T n equals the binomial coefficient ( ) n+ 3 This means that the formula T n = T + T + + T n can be written using binomial coefficients as ( ) + ( ) 3 + ( ) 4 ( ) ( n + n + + + = 3 (a) Illustrate this formula for n = 5 by taking Pascal s Triangle (see Chapter 38), circling the numbers ( ( ), 3 ( ),, 6 ( ), and putting a box around their sum 7 3) (b) Write the formula + + 3 + + n = T n using binomial coefficients and illustrate your formula for n = 5 using Pascal s Triangle as in (a) [Hint ( n ) = n] (c) Generalize these formulas to write a sum of binomial coefficients ( ) ( r r, r+ ) r, in terms of a binomial coefficient (d) Prove that your formula in (c) is correct )

[Chap 50] Sums of Powers [online] 46 500 This exercise and the next one give an explicit formula for the sum of k th powers that was studied in this chapter Stirling numbers (of the second kind) are defined to be the integers S(k, j) that make the following polynomial equation true: x k = k S(k, j)x(x )(x ) (x j + ) j=0 For example, taking k = gives Similarly, taking k = gives x = S(, 0) + S(, )x, so S(, 0) = 0 and S(, ) = x = S(, 0) + S(, )x + S(, )x(x + ) = S(, 0) + (S(, ) + S(, ))x + S(, )x, so S(, 0) = 0 and S(, ) = and S(, ) = (a) Compute the value of S(3, j) for j = 0,,, 3 and S(4, j) for j = 0,,, 3, 4 (b) Prove that the Stirling numbers satisfy the recurrence S(k, j) = S(k, j ) + js(k, j) (c) Prove that the Stirling numbers are given by the following formula: S(k, j) = j! j ( ) j ( ) j i i k i 50 Prove that the sum of k th powers is given by the following explicit formula using the Stirling numbers S(k, j) defined in the previous exercise k + k + + n k = k j=0 i=0 S(k, j) (n + )n(n )(n ) (n j + ) j + 50 (For students who know calculus) Let P 0 (x) be the polynomial Next let P 0 (x) = + x + x + x 3 + + x n P (x) = d ( xp0 (x) ), and P (x) = d ( xp (x) ), and so on dx dx (a) What does P k (x) look like? What is the value of P k ()? [Hint The answer has something to do with the material in this chapter]

[Chap 50] Sums of Powers [online] 463 (b) The polynomial P 0 (x) is the geometric sum that we used in Chapter 4 Recall that the formula for the geometric sum is P 0 (x) = (x n )/(x ), at least provided that x Compute the limit x n lim x x and check that it gives the same value as P 0 () [Hint Use L Hôpital s rule] (c) Find a formula for P (x) by differentiating, P (x) = d ( ) x xn dx x (d) Compute the limit of your formula in (c) as x Explain why this gives a new proof for the value of + + + n (e) Starting with your formula in (c), repeat (c) and (d) to find a formula for P (x) and for the limit of P (x) as x (f) Starting with your formula in (e), repeat (c) and (d) to find a formula for P 3 (x) and for the limit of P 3 (x) as x 503 Fix an integer k 0 and let F k (n) = k + k + + n k be the sum of powers studied in this chapter Let A(x) = generating function of the sequence F k (0), F k (), F k (), F k (3), = F k ()x + F k ()x + F k (3)x 3 +, B(x) = generating function of the sequence 0 k, k, k, 3 k, = x + k x + 3 k x 3 + 4 k x 4 + Find a simple formula relating A(x) and B(x)

Appendix A Factorization of Small Composite Integers [online] The following table gives the factorization of small composite integers that are not divisible by, 3, or 5 To use this table, first divide your number by powers of, 3, and 5 until no such factors remain; then look it up in the table 49 = 7 77 = 7 9 = 7 3 9 = 7 7 = 33 = 7 9 43 = 3 6 = 7 3 69 = 3 87 = 7 03 = 7 9 09 = 9 7 = 7 3 = 3 7 47 = 3 9 53 = 3 59 = 7 37 87 = 7 4 89 = 7 99 = 3 3 30 = 7 43 39 = 9 33 = 7 9 39 = 7 47 34 = 3 343 = 7 3 36 = 9 37 = 7 53 377 = 3 9 39 = 7 3 403 = 3 3 407 = 37 43 = 7 59 47 = 7 6 437 = 9 3 45 = 4 469 = 7 67 473 = 43 48 = 3 37 493 = 7 9 497 = 7 7 5 = 7 73 57 = 47 57 = 7 3 59 = 3 533 = 3 4 539 = 7 55 = 9 9 553 = 7 79 559 = 3 43 58 = 7 83 583 = 53 589 = 9 3 6 = 3 47 63 = 7 89 69 = 7 37 637 = 7 3 649 = 59 667 = 3 9 67 = 6 679 = 7 97 689 = 3 53 697 = 7 4 703 = 9 37 707 = 7 0 73 = 3 3 7 = 7 03 73 = 7 43 737 = 67 749 = 7 07 763 = 7 09 767 = 3 59 779 = 9 4 78 = 7 79 = 7 3 793 = 3 6 799 = 7 47 803 = 73 87 = 9 43 833 = 7 7 84 = 9 847 = 7 85 = 3 37 869 = 79 87 = 3 67 889 = 7 7 893 = 9 47 899 = 9 3 90 = 7 53 93 = 83 97 = 7 3 93 = 3 7 93 = 7 9 943 = 3 4 949 = 3 73 959 = 7 37

[App A] Factorization of Small Composite Integers [online] 465 96 = 3 973 = 7 39 979 = 89 989 = 3 43 00 = 7 3 003 = 7 59 007 = 9 53 07 = 3 79 037 = 7 6 043 = 7 49 057 = 7 5 067 = 97 073 = 9 37 079 = 3 83 08 = 3 47 099 = 7 57 = 0 = 9 59 7 = 7 3 33 = 03 39 = 7 67 4 = 7 63 47 = 3 37 57 = 3 89 59 = 9 6 69 = 7 67 77 = 07 83 = 7 3 89 = 9 4 99 = 09 07 = 7 7 = 7 73 9 = 3 53 4 = 7 73 43 = 3 47 = 9 43 53 = 7 79 6 = 3 97 67 = 7 8 7 = 3 4 73 = 9 67 309 = 7 7 33 = 3 0 33 = 3 333 = 3 43 337 = 7 9 339 = 3 03 343 = 7 79 349 = 9 7 35 = 7 93 357 = 3 59 363 = 9 47 369 = 37 379 = 7 97 387 = 9 73 39 = 3 07 393 = 7 99 397 = 7 403 = 3 6 4 = 7 83 47 = 3 09 4 = 7 9 44 = 3 457 = 3 47 463 = 7 9 469 = 3 3 477 = 7 50 = 9 79 507 = 37 53 = 7 89 57 = 37 4 59 = 7 3 59 = 39 537 = 9 53 54 = 3 67 547 = 7 3 7 56 = 7 3 573 = 3 577 = 9 83 589 = 7 7 59 = 37 43 603 = 7 9 63 = 7 33 633 = 3 7 639 = 49 643 = 3 53 649 = 7 97 65 = 3 7 66 = 5 673 = 7 39 679 = 3 73 68 = 4 687 = 7 4 69 = 9 89 703 = 3 3 7 = 9 59 77 = 7 0 77 = 57 79 = 7 3 9 739 = 37 47 75 = 7 03 757 = 7 5 763 = 4 43 769 = 9 6 77 = 7 3 78 = 3 37 793 = 63 799 = 7 57 807 = 3 39 83 = 7 37 87 = 3 79 89 = 7 07 89 = 3 59 837 = 67 84 = 7 63 843 = 9 97 849 = 43 853 = 7 09 859 = 3 883 = 7 69 89 = 3 6 897 = 7 7 903 = 73 909 = 3 83 99 = 9 0 9 = 7 3 97 = 4 47 937 = 3 49 939 = 7 77 943 = 9 67 957 = 9 03 96 = 37 53 963 = 3 5 967 = 7 8 969 = 79 98 = 7 83 99 = 8 009 = 7 4 0 = 43 47 03 = 7 7 033 = 9 07 04 = 3 57 047 = 3 89 05 = 7 93 057 = 7 059 = 9 7 07 = 9 09 077 = 3 67 093 = 7 3 3 0 = 9 07 = 7 43 7 = 9 73 9 = 3 63 3 = 93 47 = 9 3 49 = 7 307 59 = 7 7 67 = 97 7 = 3 67 73 = 4 53 77 = 7 3 83 = 37 59 89 = 99 9 = 7 33 97 = 3 3 0 = 3 7 09 = 47 9 = 7 37 7 = 7 3 3 = 3 97 33 = 7 9 49 = 3 73 57 = 37 6 6 = 7 7 9 63 = 3 73 79 = 43 53 9 = 9 79 99 = 9 303 = 7 47 37 = 7 33

Appendix B A List of Primes [online] 3 5 7 3 7 9 3 9 3 37 4 43 47 53 59 6 67 7 73 79 83 89 97 0 03 07 09 3 7 3 37 39 49 5 57 63 67 73 79 8 9 93 97 99 3 7 9 33 39 4 5 57 63 69 7 77 8 83 93 307 3 33 37 33 337 347 349 353 359 367 373 379 383 389 397 40 409 49 4 43 433 439 443 449 457 46 463 467 479 487 49 499 503 509 5 53 54 547 557 563 569 57 577 587 593 599 60 607 63 67 69 63 64 643 647 653 659 66 673 677 683 69 70 709 79 77 733 739 743 75 757 76 769 773 787 797 809 8 8 83 87 89 839 853 857 859 863 877 88 883 887 907 9 99 99 937 94 947 953 967 97 977 983 99 997 009 03 09 0 03 033 039 049 05 06 063 069 087 09 093 097 03 09 7 3 9 5 53 63 7 8 87 93 0 3 7 3 9 3 37 49 59 77 79 83 89 9 97 30 303 307 39 3 37 36 367 373 38 399 409 43 47 49 433 439 447 45 453 459 47 48 483 487 489 493 499 5 53 53 543 549 553 559 567 57 579 583 597 60 607 609 63 69 6 67 637 657 663 667 669 693 697 699 709 7 73 733 74 747 753 759 777 783 787 789 80 8 83 83 847 86 867 87 873 877 879 889 90 907 93 93 933 949 95 973 979 987

[App B] A List of Primes [online] 467 993 997 999 003 0 07 07 09 039 053 063 069 08 083 087 089 099 3 9 3 37 4 43 53 6 79 03 07 3 37 39 43 5 67 69 73 8 87 93 97 309 3 333 339 34 347 35 357 37 377 38 383 389 393 399 4 47 43 437 44 447 459 467 473 477 503 5 53 539 543 549 55 557 579 59 593 609 67 6 633 647 657 659 663 67 677 683 687 689 693 699 707 7 73 79 79 73 74 749 753 767 777 789 79 797 80 803 89 833 837 843 85 857 86 879 887 897 903 909 97 97 939 953 957 963 969 97 999 300 30 309 303 3037 304 3049 306 3067 3079 3083 3089 309 39 3 337 363 367 369 38 387 39 303 309 37 3 39 35 353 357 359 37 399 330 3307 333 339 333 339 333 3343 3347 3359 336 337 3373 3389 339 3407 343 3433 3449 3457 346 3463 3467 3469 349 3499 35 357 357 359 3533 3539 354 3547 3557 3559 357 358 3583 3593 3607 363 367 363 363 3637 3643 3659 367 3673 3677 369 3697 370 3709 379 377 3733 3739 376 3767 3769 3779 3793 3797 3803 38 383 3833 3847 385 3853 3863 3877 388 3889 3907 39 397 399 393 399 393 3943 3947 3967 3989 400 4003 4007 403 409 40 407 4049 405 4057 4073 4079 409 4093 4099 4 47 49 433 439 453 457 459 477 40 4 47 49 49 43 44 443 453 459 46 47 473 483 489 497 437 4337 4339 4349 4357 4363 4373 439 4397 4409 44 443 444 4447 445 4457 4463 448 4483 4493 4507 453 457 459 453 4547 4549 456 4567 4583 459 4597 4603 46 4637 4639 4643 4649 465 4657 4663 4673 4679 469 4703 47 473 479 4733 475 4759 4783 4787 4789 4793 4799 480 483 487 483 486 487 4877 4889 4903 4909 499 493 4933 4937 4943 495 4957 4967 4969 4973 4987 4993 4999 5003 5009 50 50 503 5039 505 5059 5077 508 5087 5099 50 507 53 59 547 553 567 57 579 589 597 509 57 53 533 537 56 573 579 58 597 5303 5309 533 5333 5347 535 538 5387 5393 5399 5407 543 547 549 543 5437 544 5443 5449 547 5477 5479 5483 550 5503 5507 559 55 557 553 5557 5563 5569 5573 558 559 563 5639 564 5647 565 5653 5657 5659 5669 5683 5689 5693