Taylor Series

advertisement
Math 251
Fall 2009
J. Gerlach
Taylor Series
Recall that the Taylor polynomial pn (x) of a function f centered at a
is given by
pn (x)
= c0 + c1 (x − a) + c2 (x − a)2 + c3 (x − a)3 + · · · + cn (x − a)n
f (n) (a)
f 00 (a)
(x − a)2 + · · · +
(x − a)n
= f (a) + f 0 (a)(x − a) +
2
n!
(1)
where the relation between coefficients and and derivatives is given by
ck =
f (k) (a)
k!
(2)
The difference between the function and its approximation (the approximation error) is given by
f (n+1) (c)
(x − a)n+1
f (x) − pn (x) = Rn (x) =
(n + 1)!
(3)
where c is between a and x. If we take n → ∞ we arrive at the Taylor
series
∞
X
f (k) (a)
P (x) =
(x − a)k
k!
k=0
A Taylor series for which a = 0 is also called a Maclaurin series. What
follows is a list of very important examples.
1. The exponential function f (x) = ex with a = 0.
Since all derivatives are again ex , it follows that f (k) (0) = e0 = 1 for
all k, and the Taylor polynomial takes the form
pn (x) = 1 + x +
1
x2 x3
xn
+
+ ··· +
2
6
n!
Figure 1: Third and sixth order approximation of ex at x = 0
Graphs of ex along with p3 (x) and p6 (x) are given below.
If we let n → ∞, we obtain the Taylor series
P (x) =
∞
X
k=0
xk
k!
Two questions arise naturally: For which x does the series converge,
and does it converge to ex ?
To answer the first question, we apply the ratio test and find that
|xn+1 /(n + 1)!|
|x|n+1 n!
|x|
=
=
→0 < 1
n
n
|x /n!|
(n + 1)! |x|
n+1
for all x. Thus the series converges for all x. In order to answer the
second question, we need to look at the remainder, and we obtain
ec
|x|n+1
(n + 1)!
Rn (x) =
Here x is held fixed, c is somewhere between 0 and x, and n tends to
infinity. Factorials usually win, and we get
lim Rn (x) = 0
n→∞
for all x. Thus the series converges to ex for all x and we have the
formula
∞
X
xk
x2 x3 x4
ex =
= 1+x+
+
+
+ ···
(4)
2
6
24
k=0 k!
(the series converges and its value is ex for any choice of x). This result
has an abundance of consequences. Here are a few of them:
2
(a) e =
∞
X
k=0
1
k!
and
∞
X
1
(−1)k
=
e
k!
k=0
∞
X
xk
x x 2 x3
x4
e −1
=
= 1+ +
+
+
+ ···
(b)
x
2
6
24 120
k=0 (k + 1)!
x
(c) e
−x2
=
∞
X
k=0
(−1)k x2k
x4 x6 x8
= 1 − x2 +
−
+
− ···
k!
2
6
24
2
(d) If f (x) = e−x then f (9) (0) = 0, and so are all odd order derivatives
at x = 0, since there are no odd exponents in the power series.
We can also identify the even order derivatives at x = 0. For
instance, in order to find f (12) (0) we look at the coefficient of x12 ,
which is c12 = 6!1 . Formula (2) implies that f (12) (0) = 12!c12 =
7 · 8 · 9 · 10 · 11 · 12 = 665280.
!
Z 1
Z 1
4
6
8
x
x
x
2
e−x dx =
1 − x2 +
(e)
−
+
− · · · dx
2
6
24
0
0
!#1
x5
x6
x3
+
−
+ ···
=
x−
3
5 · 2! 7 · 3!
0
1
1
1
1
= 1− +
−
+
− ···
3 10 42 216
= 0.7468241330.
2. Sine and cosine with a = 0.
We begin with the expansion of f (x) = sin x. The derivatives are
± sin x and ± cos x and at x = 0 we obtain either 0 = ± sin 0 or ±1 =
± cos 0. More specifically, all even derivatives drop out
0 = f (0) = f 00 (0) = f (4) (0) = f (6) (0) = · · ·
and for the odd derivatives we obtain
f 0 (0) = 1
f 000 (0) = −1
f (5) (0) = 1
...
Using (2) it follows that
1
1
c0 = 0, c1 = 1, c2 = 0, c3 = − , c4 = 0, c5 = , . . .
3!
5!
and the Taylor polynomial becomes
p2n+1 (x) = x −
x3
x5
x7
x2n+1
+
−
+ · · · + (−1)n
6
120 5040
(2n + 1)!
3
Note that p2n+1 (x) = p2n+2 (x), since the next derivative is zero. For
instance,
x3
= p4 (x)
p3 (x) = x −
6
Figure 2: Fifth and eleventh order approximation of sin x at x = 0
With n → ∞ the Taylor series for the sine becomes
P (x) =
∞
X
(−1)k
k=0
x2k+1
(2k + 1)!
The ratio test shows that the series converges for all x:
|x|2n+3 /(2n + 3)!
|x|2
=
→ 0
|x|2n+1 /(2n + 1)!
(2n + 3)(2n + 2)
and inspection of the remainder yields
|Rn (x)| =
|f (n+1) (c)| n+1
|x|n+1
|x|
≤
→ 0
(n + 1)!
(n + 1)!
with n → ∞. The estimate |f (n+1) (c)| ≤ 1 holds, since all derivatives
of the sine are ± sin x or ± cos x, and these functions are bounded by
1 in absolute value. As a result we have the formula
sin x =
∞
X
(−1)k
k=0
which is valid for for all real numbers x.
4
x2k+1
(2k + 1)!
The series for the cosine we obtain by termwise differentiation.
sin x = x −
x2n+1
x3
x5
x7
+
−
+ · · · + (−1)n
+ ···
6
120 5040
(2n + 1)!
implies that
cos x = 1 −
x2n
x6
x2 x4
+
−
+ · · · + (−1)n
+ ···
2
24 720
(2n)!
or more formally
cos x =
∞
X
(−1)k
k=0
x2k
(2k)!
The original series and the differentiated series always have the same
radius of convergence, and we conclude that the above formula holds
for all x.
Figure 3: The cosine and its 18th order approximation
Let’s look at two applications.
(a) Find the Maclaurin series for f (x) = sin2 x.
Since
1 − cos 2x
sin2 x =
2
it follows that
2
sin x =
1 − (1 −
4x2
2
+
16x4
24
−
64x6
720
+ · · ·)
2
4
6
x
2x
x8
+
−
+ ···
= x2 −
3
45
315
∞
X
22k−1 x2k
=
(−1)k+1
(2k)!
k=1
5
Figure 4: f (x) = sin2 x and its 20th order approximation
(b) Find the Maclaurin series for the integral sine, which is defined as
Si(x) =
Z x
0
The series for
sin t
t
p(t) = 1 −
sin t
dt
t
is
t2
t4
t6
t2n
+
−
+ · · · + (−1)n
+ ···
6
120 5040
(2n + 1)!
and termwise integration results in
Si(x) = x−
x 3 x5
x7
x2n+1
+
−
+· · ·+(−1)n
+· · ·
18 600 35280
(2n + 1)(2n + 1)!
Figure 5: Si(x) and its 15th order approximation
6
3. Derivations from the geometric series.
We know that the formula
∞
X
1
=
rk
1−r
k=0
holds for all −1 < r < 1. Interval of convergence and remainder computations are not necessary. We can manipulate this series to obtain
all kinds of new and useful expansions.
(a) f (x) = 1/x
Here we proceed as follows
∞
X
1
1
1
(−1)k (x − 1)k
=
=
=
x
1+x−1
1 − (−(x − 1))
k=0
= 1 − (x − 1) + (x − 1)2 − (x − 1)3 + (x − 1)4 − · · ·
with r = −(x − 1). The expansion is valid for 0 < x < 2. This
strategy can be expanded for expansions at other points. For
instance, if a = 5 the following will work
k
∞
1 X
1
1
1
1
k x−5
=
(−1)
=
=
x
5+x−5
5 1 − (− x−5
5 k=0
5
)
5
=
∞
X
k=0
=
(−1)k
(x − 5)k
5k+1
1 x − 5 (x − 5)2 (x − 5)3
−
+
−
+ ···
5
25
125
625
(b) f (x) = x12
This expansion can be found by differentiating the series for g(x) =
1
.
x
1
d 1
= −
2
x
dx x
i
d h
= −
1 − (x − 1) + (x − 1)2 − (x − 1)3 + (x − 1)4 − · · ·
dx
= 1 − 2(x − 1) + 3(x − 1)2 − 4(x − 1)3 + 5(x − 1)4 − 6(x − 1)5 + · · ·
=
∞
X
(−1)k (k + 1) (x − 1)k
k=0
7
1
x
with a = 5 and its third order approximation
1
x2
with a = 1 and its sixth order approximation
Figure 6: f (x) =
Figure 7: f (x) =
(c) f (x) = ln x.
Here we integrate the series for g(x) = x1 .
Z x
Z x
1
1 − (t − 1) + (t − 1)2 − · · · dt
ln x =
dt =
t
1
1
(x − 1)2 (x − 1)3 (x − 1)4 (x − 1)5
= x−1−
+
−
+
− ···
2
3
4
5
∞
X
(x − 1)k
=
(−1)k+1
k
k=1
This expansion is valid for 0 < x < 2. But the series also converges
at x = 2 (alternating harmonic series), and we need to call on a
theorem (Abel’s Theorem) to argue that the value of the series
equals ln 2.
8
With a change of variable we can also write
ln(x + 1) =
∞
X
x2 x3 x4
= x−
+
−
+ ···
k
2
3
4
k+1 x
(−1)
k=1
k
which holds for −1 < x < 1.
Figure 8: f (x) = ln(x + 1) and its fifth order approximation
(d) f (x) = arctan x
We integrate the series for g(x) =
1
.
1+x2
∞
X
1
1
=
=
(−1)k x2k
2
2
1+x
1 − (−x )
k=0
= 1 − x2 + x4 − x 6 + x8 − · · ·
with r = −x2 . The expansion is valid for −1 < x < 1. Upon
integration it follows that
Z x
1
arctan x =
dt =
1 − t2 + t4 − t6 + · · · dt
1 + t2
0
0
x3 x5 x7 x9 x11
= x−
+
−
+
−
+ ···
3
5
7
9
11
∞
X
x2k+1
=
(−1)k
(2k + 1)
k=0
Z x
If we substitute x = 11 we get
π
1 1 1 1
1
= arctan 1 = 1 − + − + −
+ ···
4
3 5 7 9 11
1
Abel’s Theorem applies, since the series expansion is only valid for x < 1.
9
Figure 9: f (x) = arctan x and its 11th order approximation
The series converges (alternating series test), but the convergence
is very slow and this method is not practical to compute π4 , or π
for that matter.
10
Download