Math 133 Taylor Series Stewart §11.
10
Series representation of a function. The main purpose of series is to write a
given complicated quantity as an infinite sum of simple terms; and since the terms
get smaller and smaller, we can approximate the original quantity by taking only the
first few terms of the series. In this section, we finally develop the tool that lets us do
this in most cases: a way to write any reasonable function as an explicit power series.
This will allow us to compute outputs of the function by plugging into the series.
Our functions must behave decently near the center point of thePdesired power
series. We say f (x) is analytic at x = a if it is possible to write f (x) = ∞ n=0 cn (x−a)
n
for some coefficients cn , with positive radius of convergence. In practice, any formula
involving standard functions and operations defines an analytic function, provided
the formula gives real number values in a small interval around√x = a. For example
1
x−a is not analytic at x = a, because it gives ±∞ at x = a; and x−a is not analytic
at x = a because for x slightly smaller than a, it gives the square root of a negative
number.∗
Taylor Series Theorem: Let f (x) be a function which is analytic at x = a.
Then we can write f (x) as the following power series, called the Taylor
series of f (x) at x = a:
f 00 (a) f 000 (a) f 0000 (a)
f (x) = f (a)+f 0 (a) (x−a)+ (x−a)2 + (x−a)3 + (x−a)4 +· · · ,
2! 3! 4!
valid for x within a radius of convergence |x−a| < R with R > 0, or
convergent for all x.
If we write the nth derivative of f (x) as f (n) (x), this becomes:
∞
X f (n) (a)
f (x) = cn (x−a)n with coefficients cn = .
n!
n=0
warning: The coefficients are constants with no x, so c1 = f 0 (a), not f 0 (x).
Proof. By hypothesis f (x) is analytic, so f (x) = ∞ n
P
n=0 cn (x−a) Pfor some cn ; we
will derive the desired formula for these coefficients. Since f (a) = ∞ n
n=0 cn (a−a) =
c0 + c1 (0)
P+ c2 (02 ) + · · · , we get c0 = f (a). Next, by the Theorem in §11.9, we have
0 ∞ n−1 , so f 0 (a) = c + 2c (0) + 3c (02 ) + · · · , and c = f 0 (a).
f (x) = n=0 ncP n (x−a) 1 2 3 1
∞
Next, f 00 (x) = n=0 n(n−1)cn (x−a)
n−2 , so f 00 (a) = (2)(1)c and c = 1 f 00 (a).
2 2 2
Continuing, we get:
∞
X
f (N ) (x) = n(n−1) · · · (n−N +1) cn (x−a)n−N .
n=1
∗
The function 3 x−a is also not analytic near x = a, ever though it gives real number values.
The problem is that it has a vertical tangent at x = a, so it is not differentiable.
The terms for n = 0, 1, . . . , N −1 are all zero because of the factors n(n−1) · · · (n−N +
1), so the first non-zero term is for n = N . Plugging in x = a gives: f (N ) (a) =
N (N −1) · · · (1)cN , and cN = N1 ! f (N ) (a) as desired. Q.E.D.
(n)
Once we have a power series for f (x) with known coefficients cn = f n!(a) , we can
approximate f (x) by taking a finite partial sum of the series up to some cutoff term
N . This partial sum is called a Taylor polynomial, denoted TN (x):
N
X f (N ) (a)
f (x) ≈ TN (x) = cn (x−a)n = f (a) + f 0 (a)(x−a) + · · · + (x−a)N .
N!
n=0
Note that T1 (x) = f (a) + f 0 (a)(x − a) is just the linear approximation near x = a,
whose graph is the tangent line (Calculus I §2.9). We can improve this approximation
of f (x) in two ways:
• Take more terms, increasing N .
• Take the center a close to x, giving small (x−a) and tiny (x−a)n .
A Taylor series centered at a = 0 is specially named a Maclaurin series.
Example: sine function. To find Taylor series for a function f (x), we must de-
termine f (n) (a). This is easiest for a function which satisfies a simple differential
equation relating the derivatives to the original function. For example, f (x) = sin(x)
satisfies f 00 (x) = −f (x), so coefficients of the Maclaurin series (center a = 0) are:
n 0 1 2 3 4 5 6 7
f (n) (x) sin(x) cos(x) − sin(x) − cos(x) sin(x) cos(x) − sin(x) − cos(x)
f (n) (0) 0 1 0 −1 0 1 0 −1
f (n) (0)
cn = n! 0 1 0 − 3!1 0 1
5! 0 − 7!1
That is:
∞
x3 x5 x7 X x2n+1
sin(x) = x − + − + ··· = (−1)n .
3! 5! 7! (2n+1)!
n=0
To find the domain of convergence, we apply the Ratio Test (11.6/I):
an+1 x2(n+1)+1 x2n+1
L = lim = lim
an n→∞ (2(n+1)+1)! (2n+1)!
n→∞
|x|2n+3 (2n+1)! |x|2
= lim · = lim = 0
n→∞ |x|2n+1 (2n+3)! n→∞ (2n+2)(2n+3)
for any fixed x 6= 0. Since L = 0 < 1 regardless of x, the series converges for all x.
This formula for sin(x) astonishes because the right side is a simple algebraic
series having no apparent relation to trigonometry. We can try to understand and
check the series by graphically comparing sin(x) with its first few Taylor polynomial
approximations:
• The Taylor polynomial T1 (x) = x (in red) is just the linear approximation or
tangent line of y = sin(x) at the center point x = 0. The curve and line are
close (to within a couple of decimal places) near the point of tangency and up
to about |x| ≤ 0.5. Once they veer apart, the approximation is useless.
3
• The next Taylor polynomial T3 (x) = x − x3! = x − 16 x3 (in green) matches
y = sin(x) in its first three derivatives at x = 0, and stays close to the original
curve up to about |x| ≤ 1.5 .
3 5
• The next T5 (x) = x − x3! + x5! = x − 16 x3 + 120
1 5
x is even closer to f (x) for even
larger x. Taking enough terms in the Taylor series will give a good approxima-
tion for any x, since the series converges everywhere.
problem: Compute sin(10◦ ). A geometric method would be to construct a right
triangle with a 10◦ angle, and measure the opposite side divided by the hypotenuse;
but this would only work for a couple of decimal places of accuracy. Of course, a
calculator can produce many decimal places, but how does it know? By Taylor series!
As always when doing calculus on trig functions, we must first convert to radians
(see end of §2.5): 10◦ = 360
2π π
(10) = 18 π
. Here |x| = 18 ≈ 16 is small, so the Maclaurin
series centered at 0 should converge quickly, giving very accurate approximations:
π π π π 3
sin( 18 ) ≈ T3 ( 18 ) = 18 − 61 ( 18 ) ≈ 0.1736468 .
It turns out this is correct to 5 decimal places (underlined), using only two non-
zero terms of the Taylor series and a good estimate for π. We could verify this by
taking more terms and seeing that these 5 digits do not change; or by the Remainder
Estimates below.
√
Example: √ square roots. We compute 2 to 5 decimal places.† First, we must
√
consider 2 to be an output of the function f (x) = x at x = 2. Next, we must
choose the center a for its Taylor series.
√
• a = 0 does not work because x is not analytic at x = 0. Indeed, if there
√
were a convergent√Taylor series x = c0 + c1 x + c2 x2 + · · · , we could plug in
x = −0.1 to get: −0.1 = c0 + c1 (−0.1) + c2 (−0.1)2 + · · · , a real value for the
square root of a negative number!
• a = 1 is too far from x = 2: it turns out |x−a| = |2−1| = 1 is beyond the radius
of convergence of the Taylor series.
since writing the Taylor series requires us to know f (n) (2),
• a = 2 is useless, √
including f (2) = 2, the same number we are trying to compute.
• A useful choice of a requires: a > 0 so that the Taylor series exists; a is close
√
to x = 2, making |x−a| small so the series converges quickly; and f (a) = a
is easy to compute so we can find the coefficients. A value satisfying all three
conditions is: a = 94 .
Now we have:
n 0 1 2 3 4
f (n) (x) x1/2 1
2 x−1/2 − 1·1
2·2 x
−3/2 1·1·3
2·2·2 x−5/2 − 2·2·2·2
1·1·3·5 −7/2
x
f (n) ( 94 ) 3
2
1
3
2
− 27 4
81
40
− 729
f (n) ( 94 ) 3 1 1 2 5
cn = n! 2 3 − 27 243 − 2187
Hence:
√ 3 9 2 9 3 9 4
x = 2 + 13 (x− 49 ) − 1
27 (x− 4 ) + 2
243 (x− 4 ) − 5
2187 (x− 4 ) + ···
∞
2n−1
(−1)n−1 (2n−3)!!
X
= 3
2 + 13 (x− 94 ) + n! 32n−1
(x− 49 )n ,
n=2
where we use the odd factorial notation (2n−3)!! = (1)(3)(5) · · · (2n−3). For x = 2,
we have x− 49 = − 14 , so:
√ 3
2 = 2 + 13 (− 14 ) − 1 1 2 2 1 3
27 (− 4 ) + 243 (− 4 ) − 5 1 4
2187 (− 4 ) + ··· ,
3 1 1 1 1 2 1 5 1
≈ 2 − 3 4 − 27 42 − 243 43 − 2187 44 ≈ 1.4142143 ,
which is correct to 5 decimal places (underlined).
†
We saw another very good algorithm for this in Calculus I §3.8: Newton’s Method, in which we
found approximate solutions to equations like x2 − 2 = 0 by repeatedly taking a linear approximation
to f (x) = x2 − 2. However, Newton’s Method does not help to compute values of sin(x).
Common Taylor series
∞
1 X
• = xn for |x| < 1 (Geometric Series).
1−x
n=0
∞
X xn
• ln(1+x) = (−1)n−1 for |x| < 1.
n
n=1
∞
X p(p−1) · · · (p−n+1)
• (1+x)p = xn for |x| < 1 (Binomial Series).
n!
n=0
∞
X xn
• exp(x) = for all x.
n!
n=0
∞
X x2n+1
• sin(x) = (−1)n for all x.
(2n+1)!
n=0
∞
X x2n
• cos(x) = (−1)n for all x.
(2n)!
n=0
Extra Topic: Irrationality of e. In §11.2, we saw that repeating decimals represent
rational numbers (fractions), and every fraction can be written by long division as
a repeating decimal. Thus, the non-repeating infinite decimals are the real numbers
which cannot be written as fractions: they √ are irrational. However, it is diffficult to
prove that any given number (such as π or 2) is irrational.
We can use our series to prove the irrationality of the constant e = 2.7182818284590 · · · .
To prove the negative proposition that e is not equal to any possible fraction ab , we
use the method of contradiction: that is, we assume that there were some fraction
with e = ab , and use this to deduce an impossible statement, which will show that
the original assumption e = ab is also impossible.
Thus, using the Taylor series definition for e, we assume the possibility:
1 1 1 def a
1+ + + + ··· = e = .
1! 2! 3! b
It is easy to show 2 < e < 3, so e is not a whole number, and would have denominator
b > 1. Consider the bth order Taylor approximation:
∞
1 1 1 1 X 1
1+ + + + · · · + + Rb = e, Rb = .
1! 2! 3! b! n!
n=b+1
1
We multiply by b! to clear denominators up to the b! term:
b! b! b! a
b! + + + · · · + + b!Rb = b! e = b! = (b−1)! a .
1! 2! b! b
b! b!
The terms b! , 1! , 2! , . . . , b!
b! on the left are whole numbers, and (b−1)! a on the right is
a whole number, so the remainder b!Rb must also be a whole number. But it must
also be very small, as we can see from a simple geometric series comparison:‡
∞
P b! 1 1 1
b!Rb = n! = b+1 + (b+1)(b+2) + (b+1)(b+2)(b+3) + ···
n=b+1
1 1 1
< b+1 + (b+1)2
+ (b+1)3
+ ···
1 1 1 b+1 1
= b+1 1− 1 = b+1 b+1−1 = b < 1.
b+1
Thus, the same positive number b!Rb would be both a whole number and less than
1, which is impossible. Thus the original assumption e = ab is also impossible.
‡
We do not need the powerful Lagrange remainder formula here.