Skip to main content

CLP-2 Integral Calculus

Section 3.6 Taylor Series

Subsection 3.6.1 Extending Taylor Polynomials

Recall
 1 
Please review your notes from last term if this material is feeling a little unfamiliar.
that Taylor polynomials provide a hierarchy of approximations to a given function f(x) near a given point a. Typically, the quality of these approximations improves as we move up the hierarchy.
  • The crudest approximation is the constant approximation f(x)f(a).
  • Then comes the linear, or tangent line, approximation f(x)f(a)+f(a)(xa).
  • Then comes the quadratic approximation
    f(x)f(a)+f(a)(xa)+12f(a)(xa)2
  • In general, the Taylor polynomial of degree n, for the function f(x), about the expansion point a, is the polynomial, Tn(x), determined by the requirements that f(k)(a)=Tn(k)(a) for all 0kn. That is, f and Tn have the same derivatives at a, up to order n. Explicitly,
    f(x)Tn(x)=f(a)+f(a)(xa)+12f(a)(xa)2++1n!f(n)(a)(xa)n=k=0n1k!f(k)(a)(xa)k
These are, of course, approximations — often very good approximations near x=a — but still just approximations. One might hope that if we let the degree, n, of the approximation go to infinity then the error in the approximation might go to zero. If that is the case then the “infinite” Taylor polynomial would be an exact representation of the function. Let’s see how this might work.
Fix a real number a and suppose that all derivatives of the function f(x) exist. Then, we saw in (3.4.33) of the CLP-1 text that, for any natural number n,
where Tn(x) is the Taylor polynomial of degree n for the function f(x) expanded about a, and En(x)=f(x)Tn(x) is the error in the approximation f(x)Tn(x). The Taylor polynomial
 2 
Did you take a quick look at your notes?
is given by the formula
while the error satisfies
 3 
This is probably the most commonly used formula for the error. But there is another fairly commonly used formula. It, and some less commonly used formulae, are given in the next (optional) subsection “More about the Taylor Remainder”.
Note that we typically do not know the value of c in the formula for the error. Instead we use the bounds on c to find bounds on f(n+1)(c) and so bound the error
 4 
The discussion here is only supposed to jog your memory. If it is feeling insufficiently jogged, then please look at your notes from last term.
.
In order for our Taylor polynomial to be an exact representation of the function f(x) we need the error En(x) to be zero. This will not happen when n is finite unless f(x) is a polynomial. However it can happen in the limit as n, and in that case we can write f(x) as the limit
f(x)=limnTn(x)=limnk=0n1k!f(k)(a)(xa)k
This is really a limit of partial sums, and so we can write
f(x)=k=01k!f(k)(a)(xa)k
which is a power series representation of the function. Let us formalise this in a definition.

Definition 3.6.4. Taylor series.

The Taylor series for the function f(x) expanded around a is the power series
n=01n!f(n)(a)(xa)n
When a=0 it is also called the Maclaurin series of f(x). If limnEn(x)=0, then
f(x)=n=01n!f(n)(a)(xa)n
Demonstrating that, for a given function, limnEn(x)=0 can be difficult, but for many of the standard functions you are used to dealing with, it turns out to be pretty easy. Let’s compute a few Taylor series and see how we do it.

Example 3.6.5. Exponential Series.

Find the Maclaurin series for f(x)=ex.
Solution: Just as was the case for computing Taylor polynomials, we need to compute the derivatives of the function at the particular choice of a. Since we are asked for a Maclaurin series, a=0. So now we just need to find f(k)(0) for all integers k0.
We know that ddxex=ex and so
ex=f(x)=f(x)=f(x)==f(k)(x)=which gives1=f(0)=f(0)=f(0)==f(k)(0)=.
Equations 3.6.1 and 3.6.2 then give us
ex=f(x)=1+x+x22!++xnn!+En(x)
We shall see, in the optional Example 3.6.8 below, that, for any fixed x, limnEn(x)=0. Consequently, for all x,
ex=limn[1+x+12x2+13!x3++1n!xn]=n=01n!xn
We have now seen power series representations for the functions
11x1(1x)2log(1+x)arctan(x)ex.
We do not think that you, the reader, will be terribly surprised to see that we develop series for sine and cosine next.

Example 3.6.6. Sine and Cosine Series.

The trigonometric functions sinx and cosx also have widely used Maclaurin series expansions (i.e. Taylor series expansions about a=0). To find them, we first compute all derivatives at general x.
f(x)=sinxf(x)=cosxf(x)=sinxf(3)(x)=cosxf(4)(x)=sinxg(x)=cosxg(x)=sinxg(x)=cosxg(3)(x)=sinxg(4)(x)=cosx
Now set x=a=0.
f(x)=sinxf(0)=0f(0)=1f(0)=0f(3)(0)=1f(4)(0)=0g(x)=cosxg(0)=1g(0)=0g(0)=1g(3)(0)=0g(4)(0)=1
For sinx, all even numbered derivatives (at x=0) are zero, while the odd numbered derivatives alternate between 1 and 1. Very similarly, for cosx, all odd numbered derivatives (at x=0) are zero, while the even numbered derivatives alternate between 1 and 1. So, the Taylor polynomials that best approximate sinx and cosx near x=a=0 are
sinxx13!x3+15!x5cosx112!x2+14!x4
We shall see, in the optional Example 3.6.10 below, that, for both sinx and cosx, we have limnEn(x)=0 so that
f(x)=limn[f(0)+f(0)x++1n!f(n)(0)xn]g(x)=limn[g(0)+g(0)x++1n!g(n)(0)xn]
Reviewing the patterns we found in the derivatives, we conclude that, for all x,
sinx=x13!x3+15!x5=n=0(1)n1(2n+1)!x2n+1cosx=112!x2+14!x4=n=0(1)n1(2n)!x2n
and, in particular, both of the series on the right hand sides converge for all x.
We could also test for convergence of the series using the ratio test. Computing the ratios of successive terms in these two series gives us
|An+1An|=|x|2n+3/(2n+3)!|x|2n+1/(2n+1)!=|x|2(2n+3)(2n+2)|An+1An|=|x|2n+2/(2n+2)!|x|2n/(2n)!=|x|2(2n+2)(2n+1)
for sine and cosine respectively. Hence as n these ratios go to zero and consequently both series are convergent for all x. (This is very similar to what was observed in Example 3.5.5.)
We have developed power series representations for a number of important functions
 5 
The reader might ask whether or not we will give the series for other trigonometric functions or their inverses. While the tangent function has a perfectly well defined series, its coefficients are not as simple as those of the series we have seen — they form a sequence of numbers known (perhaps unsurprisingly) as the “tangent numbers”. They, and the related Bernoulli numbers, have many interesting properties, links to which the interested reader can find with their favourite search engine. The Maclaurin series for inverse sine is arcsin(x)=n=04n2n+1(2n)!(n!)2x2n+1 which is quite tidy, but proving it is beyond the scope of the course.
. Here is a theorem that summarizes them.
Notice that the series for sine and cosine sum to something that looks very similar to the series for ex:
sin(x)+cos(x)=(x13!x3+15!x5)+(112!x2+14!x4)=1+x12!x213!x3+14!x4+15!x5ex=1+x+12!x2+13!x3+14!x4+15!x5+
So both series have coefficients with the same absolute value (namely 1n!), but there are differences in sign
 6 
Warning: antique sign–sine pun. No doubt the reader first saw it many years syne.
. This is not a coincidence and we direct the interested reader to the optional Section 3.6.3 where will show how these series are linked through 1.

Example 3.6.8. Optional — Why n=01n!xn is ex.

We have already seen, in Example 3.6.5, that
ex=1+x+x22!++xnn!+En(x)
By (3.6.3)
En(x)=1(n+1)!ecxn+1
for some (unknown) c between 0 and x. Fix any real number x. We’ll now show that En(x) converges to zero as n.
To do this we need get bound the size of ec, and to do this, consider what happens if x is positive or negative.
  • If x<0 then xc0 and hence exece0=1.
  • On the other hand, if x0 then 0cx and so 1=e0ecex.
In either case we have that 0ec1+ex. Because of this the error term
|En(x)|=|ec(n+1)!xn+1|[ex+1]|x|n+1(n+1)!
We claim that this upper bound, and hence the error En(x), quickly shrinks to zero as n.
Call the upper bound (except for the factor ex+1, which is independent of n) en(x)=|x|n+1(n+1)!. To show that this shrinks to zero as n, let’s write it as follows.
en(x)=|x|n+1(n+1)!=|x|1|x|2|x|3|x|n|x||n+1|n+1 factors

Now let k be an integer bigger than |x|. We can split the product

en(x)=(|x|1|x|2|x|3|x|k)k factors(|x|k+1|x||n+1|)(|x|1|x|2|x|3|x|k)=Q(x)(|x|k+1)n+1k=Q(x)(|x|k+1)n+1k
Since k does not depend not n (though it does depend on x), the function Q(x) does not change as we increase n. Additionally, we know that |x|<k+1 and so |x|k+1<1. Hence as we let n the above bound must go to zero.
Alternatively, compare en(x) and en+1(x).
en+1(x)en(x)=[|x|n+2(n+2)![|x|n+1(n+1)!=|x|n+2
When n is bigger than, for example 2|x|, we have en+1(x)en(x)<12. That is, increasing the index on en(x) by one decreases the size of en(x) by a factor of at least two. As a result en(x) must tend to zero as n.
Consequently, for all x, limnEn(x)=0, as claimed, and we really have
ex=limn[1+x+12x2+13!x3++1n!xn]=n=01n!xn
There is another way to prove that the series n=0xnn! converges to the function ex. Rather than looking at how the error term En(x) behaves as n, we can show that the series satisfies the same simple differential equation
 7 
Recall, you studied that differential equation in the section on separable differential equations (Theorem 2.4.4 in Section 2.4) as well as wayyyy back in the section on exponential growth and decay in differential calculus.
and the same initial condition as the function.

Example 3.6.9. Optional — Another approach to showing that n=01n!xn is ex.

We already know from Example 3.5.5, that the series n=01n!xn converges to some function f(x) for all values of x . All that remains to do is to show that f(x) is really ex. We will do this by showing that f(x) and ex satisfy the same differential equation with the same initial conditions
 8 
Recall that when we solve of a separable differential equation our general solution will have an arbitrary constant in it. That constant cannot be determined from the differential equation alone and we need some extra data to find it. This extra information is often information about the system at its beginning (for example when position or time is zero) — hence “initial conditions”. Of course the reader is already familiar with this because it was covered back in Section 2.4.
. We know that y=ex satisfies
dydx=yandy(0)=1
and by Theorem 2.4.4 (with a=1, b=0 and y(0)=1), this is the only solution. So it suffices to show that f(x)=n=0xnn! satisfies
dfdx=f(x)andf(0)=1.
  • By Theorem 3.5.13,
    dfdx=ddx{n=01n!xn}=n=1nn!xn1=n=11(n1)!xn1=1n=1+xn=2+x22!n=3+x33!n=4+=f(x)
  • When we substitute x=0 into the series we get (see the discussion after Definition 3.5.1)
    f(0)=1+01!+02!+=1.
Hence f(x) solves the same initial value problem and we must have f(x)=ex.
We can show that the error terms in Maclaurin polynomials for sine and cosine go to zero as n using very much the same approach as in Example 3.6.8.

Example 3.6.10. Optional — Why n=0(1)n(2n+1)!x2n+1=sinx and n=0(1)n(2n)!x2n=cosx.

Let f(x) be either sinx or cosx. We know that every derivative of f(x) will be one of ±sin(x) or ±cos(x). Consequently, when we compute the error term using equation 3.6.3 we always have |f(n+1)(c)|1 and hence
|En(x)||x|n+1(n+1)!.
In Example 3.6.5, we showed that |x|n+1(n+1)!0 as n — so all the hard work is already done. Since the error term shrinks to zero for both f(x)=sinx and f(x)=cosx, and
f(x)=limn[f(0)+f(0)x++1n!f(n)(0)xn]
as required.

Subsubsection 3.6.1 Optional — More about the Taylor Remainder

In this section, we fix a real number a and a natural number n, suppose that all derivatives of the function f(x) exist, and we study the error
En(a,x)=f(x)Tn(a,x)where Tn(a,x)=f(a)+f(a)(xa)++1n!f(n)(a)(xa)n
made when we approximate f(x) by the Taylor polynomial Tn(a,x) of degree n for the function f(x), expanded about a. We have already seen, in (3.6.3), one formula, probably the most commonly used formula, for En(a,x). In the next theorem, we repeat that formula and give a second, commonly used, formula. After an example, we give a second theorem that contains some less commonly used formulae.
Notice that the integral form of the error is explicit - we could, in principle, compute it exactly. (Of course if we could do that, we probably wouldn’t need to use a Taylor expansion to approximate f.) This contrasts with the Lagrange form which is an ‘existential’ statement - it tells us that ‘c’ exists, but not how to compute it.

Proof.

  1. We will give two proofs. The first is shorter and simpler, but uses some trickery. The second is longer, but is more straightforward. It uses a technique called mathematical induction.
    Proof 1: We are going to use a little trickery to get a simple proof. We simply view x as being fixed and study the dependence of En(a,x) on a. To emphasise that that is what we are doing, we define
    S(t)=f(x)f(t)f(t)(xt)12f(t)(xt)2()1n!f(n)(t)(xt)n
    and observe that En(a,x)=S(a).
    So, by the fundamental theorem of calculus (Theorem 1.3.1), the function S(t) is determined by its derivative, S(t), and its value at a single point. Finding a value of S(t) for one value of t is easy. Substitute t=x into () to yield S(x)=0. To find S(t), apply ddt to both sides of (). Recalling that x is just a constant parameter,
    S(t)=0f(t)[f(t)(xt)f(t)][12f(3)(t)(xt)2f(t)(xt)][1n!f(n+1)(t)(xt)n1(n1)!f(n)(t)(xt)n1]=1n!f(n+1)(t)(xt)n
    So, by the fundamental theorem of calculus, S(x)=S(a)+axS(t)dt and
    En(a,x)=[S(x)S(a)]=axS(t)dt=ax1n!f(n+1)(t)(xt)ndt
    Proof 2: The proof that we have just given was short, but also very tricky --- almost noone could create that proof without big hints. Here is another much less tricky, but also commonly used, proof.
    • First consider the case n=0. When n=0,
      E0(a,x)=f(x)T0(a,x)=f(x)f(a)
      The fundamental theorem of calculus gives
      f(x)f(a)=axf(t)dt
      so that
      E0(a,x)=axf(t)dt
      That is exactly the n=0 case of part (a).
    • Next fix any integer n0 and suppose that we already know that
      En(a,x)=ax1n!f(n+1)(t)(xt)ndt
      Apply integration by parts (Theorem 1.7.2) to this integral with
      u(t)=f(n+1)(t)dv=1n!(xt)ndt,v(t)=1(n+1)!(xt)n+1
      Since v(x)=0, integration by parts gives
      En(a,x)=u(x)v(x)u(a)v(a)axv(t)u(t)dt=1(n+1)!f(n+1)(a)(xa)n+1()+ax1(n+1)!f(n+2)(t)(xt)n+1dt
      Now, we defined
      En(a,x)=f(x)f(a)f(a)(xa)12f(a)(xa)21n!f(n)(a)(xa)n
      so
      En+1(a,x)=En(a,x)1(n+1)!f(n+1)(a)(xa)n+1
      This formula expresses En+1(a,x) in terms of En(a,x). That’s called a reduction formula. Combining the reduction formula with () gives
      En+1(a,x)=ax1(n+1)!f(n+2)(t)(xt)n+1dt
    • Let’s pause to summarise what we have learned in the last two bullets. Use the notation P(n) to stand for the statement “En(a,x)=ax1n!f(n+1)(t)(xt)ndt”. To prove part (a) of the theorem, we need to prove that the statement P(n) is true for all integers n0. In the first bullet, we showed that the statement P(0) is true. In the second bullet, we showed that if, for some integer n0, the statement P(n) is true, then the statement P(n+1) is also true. Consequently,
      • P(0) is true by the first bullet and then
      • P(1) is true by the second bullet with n=0 and then
      • P(2) is true by the second bullet with n=1 and then
      • P(3) is true by the second bullet with n=2
      • and so on, for ever and ever.
      That tells us that P(n) is true for all integers n0, which is exactly part (a) of the theorem. This proof technique is called mathematical induction
       9 
      While the use of the ideas of induction goes back over 2000 years, the first recorded rigorous use of induction appeared in the work of Levi ben Gershon (1288–1344, better known as Gersonides). The first explicit formulation of mathematical induction was given by the French mathematician Blaise Pascal in 1665.
      .
  2. We have already seen one proof in the optional Section 3.4.9 of the CLP-1 text. We will see two more proofs here.
    Proof 1: We apply the generalised mean value theorem, which is Theorem 3.4.38 in the CLP-1 text. It says that
    (GMVT)F(b)F(a)G(b)G(a)=F(c)G(c)
    for some c strictly between
     10 
    In Theorem 3.4.38 in the CLP-1 text, we assumed, for simplicity, that a<b. To get (GVMT) when b<a simply exchange a and b in Theorem 3.4.38.
    a and b. We apply (GMVT) with b=x, F(t)=S(t) and G(t)=(xt)n+1. This gives
    En(a,x)=[S(x)S(a)]=S(c)G(c)[G(x)G(a)]=1n!f(n+1)(c)(xc)n(n+1)(xc)n [0(xa)n+1]=1(n+1)!f(n+1)(c)(xa)n+1
    Don’t forget, when computing G(c), that G is a function of t with x just a fixed parameter.
    Proof 2: We apply Theorem 2.2.10 (the mean value theorem for weighted integrals). If a<x, we use the weight function w(t)=1n!(xt)n, which is strictly positive for all a<t<x. By part (a) this gives
    En(a,x)=ax1n!f(n+1)(t)(xt)ndt=f(n+1)(c)ax1n!(xt)ndtfor some a<c<x=f(n+1)(c)[1n!(xt)n+1n+1]ax=1(n+1)!f(n+1)(c)(xa)n+1
    If x<a, we instead use the weight function w(t)=1n!(tx)n, which is strictly positive for all x<t<a. This gives
    En(a,x)=ax1n!f(n+1)(t)(xt)ndt=(1)nxa1n!f(n+1)(t)(tx)ndt=(1)n+1f(n+1)(c)xa1n!(tx)ndtfor some x<c<a=(1)n+1f(n+1)(c)[1n!(tx)n+1n+1]xa=1(n+1)!f(n+1)(c)(1)n+1(ax)n+1=1(n+1)!f(n+1)(c)(xa)n+1
Theorem  3.6.11 has provided us with two formulae for the Taylor remainder En(a,x). The formula of part (b), En(a,x)=1(n+1)!f(n+1)(c)(xa)n+1, is probably the easiest to use, and the most commonly used, formula for En(a,x). The formula of part (a), En(a,x)=ax1n!f(n+1)(t)(xt)ndt, while a bit harder to apply, gives a bit better bound than that of part (b) (in the proof of Theorem 3.6.11 we showed that part (b) follows from part (a)). Here is an example in which we use both parts.

Example 3.6.12.

In Theorem 3.6.7 we stated that
(S1)log(1+x)=n=0(1)nxn+1n+1=xx22+x33x44+
for all 1<x1. But, so far, we have not justified this statement. We do so now, using (both parts of) Theorem 3.6.11. We start by setting f(x)=log(1+x) and finding the Taylor polynomials Tn(0,x), and the corresponding errors En(0,x), for f(x).
f(x)=log(1+x)f(0)=log1=0f(x)=11+xf(0)=1f(x)=1(1+x)2f(0)=1 f(x)=2(1+x)3f(0)=2f(4)(x)=2×3(1+x)4f(4)(0)=3! f(5)(x)=2×3×4(1+x)5f(5)(0)=4!       f(n)(x)=(1)n+1(n1)!(1+x)nf(n)(0)=(1)n+1(n1)!
So the Taylor polynomial of degree n for the function f(x)=log(1+x), expanded about a=0, is
Tn(0,x)=f(0)+f(0)x++1n!f(n)(0)xn=x12x2+13x314x4+15x5++(1)n+1nxn
Theorem 3.6.11 gives us two formulae for the error En(0,x)=f(x)Tn(0,x) made when we approximate f(x) by Tn(0,x). Part (a) of the theorem gives
(Ea)En(0,x)=0x1n!f(n+1)(t)(xt)ndt=(1)n0x(xt)n(1+t)n+1dt
and part (b) gives
(Eb)En(0,x)=1(n+1)!f(n+1)(c)xn+1=(1)n1n+1xn+1(1+c)n+1
for some (unknown) c between 0 and x. The statement (S1), that we wish to prove, is equivalent to the statement
(S2)limnEn(0,x)=0for all 1<x1
and we will now show that (S2) is true.
The case x=0:
This case is trivial, since, when x=0, En(0,x)=0 for all n.
The case 0<x1:
This case is relatively easy to deal with using (Eb). In this case 0<x1, so that the c of (Eb) must be positive and
|En(0,x)|=1n+1xn+1(1+c)n+11n+11n+1(1+0)n+1=1n+1
converges to zero as n.
The case 1<x<0:
When 1<x<0 is close to 1, (Eb) is not sufficient to show that (S2) is true. To see this, let’s consider the example x=0.8. All we know about the c of (Eb) is that it has to be between 0 and 0.8. For example, (Eb) certainly allows c to be 0.6 and then
|(1)n1n+1xn+1(1+c)n+1|x=0.8c=0.6=1n+10.8n+1(10.6)n+1=1n+12n+1
goes to + as n.
Note that, while this does tell us that (Eb) is not sufficient to prove (S2), when x is close to 1, it does not also tell us that limn|En(0,0.8)|=+ (which would imply that (S2) is false) — c could equally well be 0.2 and then
|(1)n1n+1xn+1(1+c)n+1|x=0.8c=0.2=1n+10.8n+1(10.2)n+1=1n+1
goes to 0 as n.
We’ll now use (Ea) (which has the advantage of not containing any unknown free parameter c) to verify (S2) when 1<x<0. Rewrite the right hand side of (Ea)
(1)n0x(xt)n(1+t)n+1dt=x0(tx)n(1+t)n+1dt=0xsn(1+x+s)n+1ds s=tx,ds=dt
The exact evaluation of this integral is very messy and not very illuminating. Instead, we bound it. Note that, for 1+x>0,
dds(s1+x+s)=dds(1+x+s(1+x)1+x+s)=dds(11+x1+x+s)=1+x(1+x+s)2>0
so that s1+x+s increases as s increases. Consequently, the biggest value that s1+x+s takes on the domain of integration 0sx=|x| is
s1+x+s|s=x=x=|x|
and the integrand
0sn[1+x+s]n+1=(s1+x+s)n11+x+s|x|n1+x+s
Consequently,
|En(0,x)|=|(1)n0x(xt)n(1+t)n+1dt|=0xsn[1+x+s]n+1ds|x|n0x11+x+sds=|x|n[log(1+x+s)]s=0s=x=|x|n[log(1+x)]
converges to zero as n for each fixed 1<x<0.
So we have verified (S2), as desired.
As we said above, Theorem 3.6.11 gave the two most commonly used formulae for the Taylor remainder. Here are some less commonly used, but occasionally useful, formulae.

Proof.

As in the proof of Theorem 3.6.11, we define
S(t)=f(x)f(t)f(t)(xt)12f(t)(xt)21n!f(n)(t)(xt)n
and observe that En(a,x)=S(a) and S(x)=0 and S(t)=1n!f(n+1)(t)(xt)n.
  1. Recall that the generalised mean-value theorem, which is Theorem 3.4.38 in the CLP-1 text, says that
    (GMVT)F(b)F(a)G(b)G(a)=F(c)G(c)
    for some c strictly between a and b. We apply this theorem with b=x and F(t)=S(t). This gives
    En(a,x)=[S(x)S(a)]=S(c)G(c)[G(x)G(a)]=1n!f(n+1)(c)(xc)nG(c) [G(x)G(a)]=1n!f(n+1)(c)G(x)G(a)G(c)(xc)n
  2. Apply part (a) with G(x)=x. This gives
    En(a,x)=1n!f(n+1)(c)xa1(xc)n=1n!f(n+1)(c)(xc)n(xa)
    for some c strictly between a and b.

Example 3.6.14. Example 3.6.12, continued.

In Example 3.6.12 we verified that
(S1)log(1+x)=n=0(1)nxn+1n+1=xx22+x33x44+
for all 1<x1. There we used the Lagrange form,
En(a,x)=1(n+1)!f(n+1)(c)(xa)n+1
for the Taylor remainder to verify (S1) when 0x1, but we also saw that it is not possible to use the Lagrange form to verify (S1) when x is close to 1. We instead used the integral form
En(a,x)=ax1n!f(n+1)(t)(xt)ndt
We will now use the Cauchy form (part (b) of Theorem 3.6.13)
En(a,x)=1n!f(n+1)(c)(xc)n(xa)
to verify
(S2)limnEn(0,x)=0
when 1<x<0. We have already noted that (S2) is equivalent to (S1).
Write f(x)=log(1+x). We saw in Example 3.6.12 that
f(n+1)(x)=(1)nn!(1+x)n+1
So, in this example, the Cauchy form is
En(0,x)=(1)n(xc)nx(1+c)n+1
for some x<c<0. When 1<x<c<0,
  • c and x are negative and 1+x, 1+c and cx are (strictly) positive so that
    c(1+x)<0c<cxcx<xxc=|x|(1+c)|xc1+c|=cx1+c<|x|
    so that |xc1+c|n<|x|n and
  • the distance from 1 to c, namely c(1)=1+c is greater than the distance from 1 to x, namely x(1)=1+x, so that 11+c<11+x.
So, for 1<x<c<0,
|En(0,x)|=|xc1+c|n|x|1+c<|x|n+11+c<|x|n+11+x
goes to zero as n.

Subsection 3.6.2 Computing with Taylor Series

Taylor series have a great many applications. (Hence their place in this course.) One of the most immediate of these is that they give us an alternate way of computing many functions. For example, the first definition we see for the sine and cosine functions is in terms of triangles. Those definitions, however, do not lend themselves to computing sine and cosine except at very special angles. Armed with power series representations, however, we can compute them to very high precision at any angle. To illustrate this, consider the computation of π — a problem that dates back to the Babylonians.

Example 3.6.15. Computing the number π.

There are numerous methods for computing π to any desired degree of accuracy
 12 
The computation of π has a very, very long history and your favourite search engine will turn up many sites that explore the topic. For a more comprehensive history one can turn to books such as “A history of Pi” by Petr Beckmann and “The joy of π” by David Blatner.
. Many of them use the Maclaurin expansion
arctanx=n=0(1)nx2n+12n+1
of Theorem 3.6.7. Since arctan(1)=π4, the series gives us a very pretty formula for π:
π4=arctan1=n=0(1)n2n+1π=4(113+1517+)
Unfortunately, this series is not very useful for computing π because it converges so slowly. If we approximate the series by its Nth partial sum, then the alternating series test (Theorem 3.3.14) tells us that the error is bounded by the first term we drop. To guarantee that we have 2 decimal digits of π correct, we need to sum about the first 200 terms!
A much better way to compute π using this series is to take advantage of the fact that tanπ6=13:
π=6arctan(13)=6n=0(1)n12n+1 1(3)2n+1=23n=0(1)n12n+1 13n=23(113×3+15×917×27+19×81111×243+)
Again, this is an alternating series and so (via Theorem 3.3.14) the error we introduce by truncating it is bounded by the first term dropped. For example, if we keep ten terms, stopping at n=9, we get π=3.141591 (to 6 decimal places) with an error between zero and
2321×310<3×106
In 1699, the English astronomer/mathematician Abraham Sharp (1653–1742) used 150 terms of this series to compute 72 digits of π — by hand!
This is just one of very many ways to compute π. Another one, which still uses the Maclaurin expansion of arctanx, but is much more efficient, is
π=16arctan154arctan1239
This formula was used by John Machin in 1706 to compute π to 100 decimal digits — again, by hand.
Power series also give us access to new functions which might not be easily expressed in terms of the functions we have been introduced to so far. The following is a good example of this.

Example 3.6.16. Error function.

The error function
erf(x)=2π0xet2dt
is used in computing “bell curve” probabilities. The indefinite integral of the integrand et2 cannot be expressed in terms of standard functions. But we can still evaluate the integral to within any desired degree of accuracy by using the Taylor expansion of the exponential. Start with the Maclaurin series for ex:
ex=n=01n!xn

and then substitute x=t2 into this:

et2=n=0(1)nn!t2n
We can then apply Theorem 3.5.13 to integrate term-by-term:
erf(x)=2π0x[n=0(t2)nn!]dt=2πn=0(1)nx2n+1(2n+1)n!
For example, for the bell curve, the probability of being within one standard deviation of the mean
 13 
If you don’t know what this means (forgive the pun) don’t worry, because it is not part of the course. Standard deviation is a way of quantifying variation within a population.
, is
erf(12)=2πn=0(1)n(12)2n+1(2n+1)n!=22πn=0(1)n1(2n+1)2nn!=2π(113×2+15×22×217×23×3!+19×24×4!)
This is yet another alternating series. If we keep five terms, stopping at n=4, we get 0.68271 (to 5 decimal places) with, by Theorem 3.3.14 again, an error between zero and the first dropped term, which is minus
2π 111×25×5!<2×105

Example 3.6.17. Two nice series.

Evaluate
n=1(1)n1n3nandn=11n3n
Solution. There are not very many series that can be easily evaluated exactly. But occasionally one encounters a series that can be evaluated simply by realizing that it is exactly one of the series in Theorem 3.6.7, just with a specific value of x. The left hand given series is
n=1(1)n1n 13n=1312 132+13 13314 134+
The series in Theorem 3.6.7 that this most closely resembles is
log(1+x)=xx22+x33x44
Indeed
n=1(1)n1n 13n=1312 132+13 13314 134+=[xx22+x33x44]x=13=[log(1+x)]x=13=log43
The right hand series above differs from the left hand series above only that the signs of the left hand series alternate while those of the right hand series do not. We can flip every second sign in a power series just by using a negative x.
[log(1+x)]x=13=[xx22+x33x44]x=13=1312 13213 13314 134+
which is exactly minus the desired right hand series. So
n=11n3n=[log(1+x)]x=13=log23=log32

Example 3.6.18. Finding a derivative from a series.

Let f(x)=sin(2x3). Find f(15)(0), the fifteenth derivative of f at x=0.
Solution: This is a bit of a trick question. We could of course use the product and chain rules to directly apply fifteen derivatives and then set x=0, but that would be extremely tedious
 14 
We could get a computer algebra system to do it for us without much difficulty — but we wouldn’t learn much in the process. The point of this example is to illustrate that one can do more than just represent a function with Taylor series. More on this in the next section.
. There is a much more efficient approach that exploits two pieces of knowledge that we have.
  • From equation 3.6.2, we see that the coefficient of (xa)n in the Taylor series of f(x) with expansion point a is exactly 1n!f(n)(a). So f(n)(a) is exactly n! times the coefficient of (xa)n in the Taylor series of f(x) with expansion point a.
  • We know, or at least can easily find, the Taylor series for sin(2x3).
Let’s apply that strategy.
  • First, we know that, for all y,
    siny=y13!y3+15!y5
  • Just substituting y=2x3, we have
    sin(2x3)=2x313!(2x3)3+15!(2x3)5=2x383!x9+255!x15
  • So the coefficient of x15 in the Taylor series of f(x)=sin(2x3) with expansion point a=0 is 255!
and we have
f(15)(0)=15!×255!=348,713,164,800

Example 3.6.19. Optional — Computing the number e.

Back in Example 3.6.8, we saw that
ex=1+x+x22!++xnn!+1(n+1)!ecxn+1
for some (unknown) c between 0 and x. This can be used to approximate the number e, with any desired degree of accuracy. Setting x=1 in this equation gives
e=1+1+12!++1n!+1(n+1)!ec
for some c between 0 and 1. Even though we don’t know c exactly, we can bound that term quite readily. We do know that ec in an increasing function
 15 
Check the derivative!
of c, and so 1=e0ece1=e. Thus we know that
1(n+1)!e(1+1+12!++1n!)e(n+1)!
So we have a lower bound on the error, but our upper bound involves the e — precisely the quantity we are trying to get a handle on.
But all is not lost. Let’s look a little more closely at the right-hand inequality when n=1:
e(1+1)e2move the e's to one sidee22and clean it upe4.
Now this is a pretty crude bound
 16 
The authors hope that by now we all “know” that e is between 2 and 3, but maybe we don’t know how to prove it.
but it isn’t hard to improve. Try this again with n=2:
e(1+1+12)e6move e's to one side5e652e3.
Better. Now we can rewrite our bound:
1(n+1)!e(1+1+12!++1n!)e(n+1)!3(n+1)!
If we set n=4 in this we get
1120=15!e(1+1+12+16+124)3120
So the error is between 1120 and 3120=140 — this approximation isn’t guaranteed to give us the first 2 decimal places. If we ramp n up to 9 however, we get
110!e(1+1+12++19!)310!
Since 10!=3628800, the upper bound on the error is 33628800<33000000=106, and we can approximate e by
1+1+ 12!+  13! +14!+15!+16!+17!+18!+19!=1+1+0.5+0.16˙+0.0416˙+0.0083˙+0.00138˙+0.0001984+0.0000248+0.0000028=2.718282
and it is correct to six decimal places.

Subsection 3.6.3 Optional — Linking ex with trigonometric functions

Let us return to the observation that we made earlier about the Maclaurin series for sine, cosine and the exponential functions:
cosx+sinx=1+x12!x213!x3+14!x4+15!x5ex=1+x+12!x2+13!x3+14!x4+15!x5+
We see that these series are identical except for the differences in the signs of the coefficients. Let us try to make them look even more alike by introducing extra constants A,B and q into the equations. Consider
Acosx+Bsinx=A+BxA2!x2B3!x3+A4!x4+B5!x5eqx=1+qx+q22!x2+q33!x3+q44!x4+q55!x5+
Let’s try to choose A, B and q so that these to expressions are equal. To do so we must make sure that the coefficients of the various powers of x agree. Looking just at the coefficients of x0 and x1, we see that we need
A=1andB=q
Substituting this into our expansions gives
cosx+qsinx=1+qx12!x2q3!x3+14!x4+q5!x5eqx=1+qx+q22!x2+q33!x3+q44!x4+q55!x5+
Now the coefficients of x0 and x1 agree, but the coefficient of x2 tells us that we need q to be a number so that q2=1, or
q=1
We know that no such real number q exists. But for the moment let us see what happens if we just assume
 17 
We do not wish to give a primer on imaginary and complex numbers here. The interested reader can start by looking at Appendix B.
that we can find q so that q2=1. Then we will have that
q3=qq4=1q5=q
so that the series for cosx+qsinx and eqx are identical. That is
eqx=cosx+qsinx
If we now write this with the more usual notation q=1=i we arrive at what is now known as Euler’s formula
Euler’s proof of this formula (in 1740) was based on Maclaurin expansions (much like our explanation above). Euler’s formula
 18 
It is worth mentioning here that history of this topic is perhaps a little rough on Roger Cotes (1682–1716) who was one of the strongest mathematicians of his time and a collaborator of Newton. Cotes published a paper on logarithms in 1714 in which he states ix=log(cosx+isinx). (after translating his results into more modern notation). He proved this result by computing in two different ways the surface area of an ellipse rotated about one axis and equating the results. Unfortunately Cotes died only 2 years later at the age of 33. Upon hearing of his death Newton is supposed to have said “If he had lived, we might have known something.” The reader might think this a rather weak statement, however coming from Newton it was high praise.
is widely regarded as one of the most important and beautiful in all of mathematics.
Of course having established Euler’s formula one can find slicker demonstrations. For example, let
f(x)=eix(cosx+isinx)
Differentiating (with product and chain rules and the fact that i2=1) gives us
f(x)=ieix(cosx+isinx)+eix(sinx+icosx)=0
Since the derivative is zero, the function f(x) must be a constant. Setting x=0 tells us that
f(0)=e0(cos0+isin0)=1.
Hence f(x)=1 for all x. Rearranging then arrives at
eix=cosx+isinx
as required.
Substituting x=π into Euler’s formula we get Euler’s identity
eiπ=1
which is more often stated
which links the 5 most important constants in mathematics, 1,0,π,e and 1.

Subsection 3.6.4 Evaluating Limits using Taylor Expansions

Taylor polynomials provide a good way to understand the behaviour of a function near a specified point and so are useful for evaluating complicated limits. Here are some examples.

Example 3.6.22. A simple limit from a Taylor expansion.

In this example, we’ll start with a relatively simple limit, namely
limx0sinxx
The first thing to notice about this limit is that, as x tends to zero, both the numerator, sinx, and the denominator, x, tend to 0. So we may not evaluate the limit of the ratio by simply dividing the limits of the numerator and denominator. To find the limit, or show that it does not exist, we are going to have to exhibit a cancellation between the numerator and the denominator. Let’s start by taking a closer look at the numerator. By Example 3.6.6,
sinx=x13!x3+15!x5
Consequently
 19 
We are hiding some mathematics behind this “consequently”. What we are really using our knowledge of Taylor polynomials to write f(x)=sin(x)=x13!x3+15!x5+E5(x) where E5(x)=f(6)(c)6!x6 and c is between 0 and x. We are effectively hiding “E5(x)” inside the “”. Now we can divide both sides by x (assuming x0): sin(x)x=113!x2+15!x4+E5(x)x. and everything is fine provided the term E5(x)x stays well behaved.
sinxx=113!x2+15!x4
Every term in this series, except for the very first term, is proportional to a strictly positive power of x. Consequently, as x tends to zero, all terms in this series, except for the very first term, tend to zero. In fact the sum of all terms, starting with the second term, also tends to zero. That is,
limx0[13!x2+15!x4]=0
We won’t justify that statement here, but it will be justified in the following (optional) subsection. So
limx0sinxx=limx0[113!x2+15!x4]=1+limx0[13!x2+15!x4]=1
The limit in the previous example can also be evaluated relatively easily using l’Hôpital’s rule
 20 
Many of you learned about l’Hôptial’s rule in school and all of you should have seen it last term in your differential calculus course.
. While the following limit can also, in principal, be evaluated using l’Hôpital’s rule, it is much more efficient to use Taylor series
 21 
It takes 3 applications of l’Hôpital’s rule and some careful cleaning up of the intermediate expressions. Oof!
.

Example 3.6.23. A not so easy limit made easier.

In this example we evaluate
limx0arctanxxsinxx
Once again, the first thing to notice about this limit is that, as x tends to zero, the numerator tends to arctan00, which is 0, and the denominator tends to sin00, which is also 0. So we may not evaluate the limit of the ratio by simply dividing the limits of the numerator and denominator. Again, to find the limit, or show that it does not exist, we are going to have to exhibit a cancellation between the numerator and the denominator. To get a more detailed understanding of the behaviour of the numerator and denominator near x=0, we find their Taylor expansions. By Example 3.5.21,
arctanx=xx33+x55
so the numerator
arctanxx=x33+x55
By Example 3.6.6,
sinx=x13!x3+15!x5
so the denominator
sinxx=13!x3+15!x5
and the ratio
arctanxxsinxx=x33+x5513!x3+15!x5
Notice that every term in both the numerator and the denominator contains a common factor of x3, which we can cancel out.
arctanxxsinxx=13+x2513!+15!x2
As x tends to zero,
  • the numerator tends to 13, which is not 0, and
  • the denominator tends to 13!=16, which is also not 0.
so we may now legitimately evaluate the limit of the ratio by simply dividing the limits of the numerator and denominator.
limx0arctanxxsinxx=limx013+x2513!+15!x2=limx0[13+x25]limx0[13!+15!x2]=1313!=2

Subsection 3.6.5 Optional — The Big O Notation

In Example 3.6.22 we used, without justification
 22 
Though there were a few comments in a footnote.
, that, as x tends to zero, not only does every term in
sinxx1=13!x2+15!x4=n=1(1)n1(2n+1)!x2n
converge to zero, but in fact the sum of all infinitely many terms also converges to zero. We did something similar twice in Example 3.6.23; once in computing the limit of the numerator and once in computing the limit of the denominator.
We’ll now develop some machinery that provides the justification. We start by recalling, from equation 3.6.1, that if, for some natural number n, the function f(x) has n+1 derivatives near the point a, then
f(x)=Tn(x)+En(x)
where
Tn(x)=f(a)+f(a)(xa)++1n!f(n)(a)(xa)n
is the Taylor polynomial of degree n for the function f(x) and expansion point a and
En(x)=f(x)Tn(x)=1(n+1)!f(n+1)(c)(xa)n+1
is the error introduced when we approximate f(x) by the polynomial Tn(x). Here c is some unknown number between a and x. As c is not known, we do not know exactly what the error En(x) is. But that is usually not a problem.
In the present context
 23 
It is worth pointing out that our Taylor series must be expanded about the point to which we are limiting — i.e. a. To work out a limit as xa we need Taylor series expanded about a and not some other point.
we are interested in taking the limit as xa. So we are only interested in x-values that are very close to a, and because c lies between x and a, c is also very close to a. Now, as long as f(n+1)(x) is continuous at a, as xa, f(n+1)(c) must approach f(n+1)(a) which is some finite value. This, in turn, means that there must be constants M,D>0 such that |f(n+1)(c)|M for all c’s within a distance D of a. If so, there is another constant C (namely M(n+1)!) such that
|En(x)|C|xa|n+1whenever |xa|D
There is some notation for this behaviour.

Definition 3.6.24. Big O.

Let a and m be real numbers. We say that the function “g(x) is of order |xa|m near a” and we write g(x)=O(|xa|m) if there exist constants
 24 
To be precise, C and D do not depend on x, though they may, and usually do, depend on m.
C,D>0 such that
(✶)|g(x)|C|xa|mwhenever |xa|D
Whenever O(|xa|m) appears in an algebraic expression, it just stands for some (unknown) function g(x) that obeys (✶). This is called “big O” notation.
How should we parse the big O notation when we see it? Consider the following
g(x)=O(|x3|2)
First of all, we know from the definition that the notation only tells us something about g(x) for x near the point a. The equation above contains “O(|x3|2)” which tells us something about what the function looks like when x is close to 3. Further, because it is “|x3|” squared, it says that the graph of the function lies below a parabola y=C(x3)2 and above a parabola y=C(x3)2 near x=3. The notation doesn’t tell us anything more than this — we don’t know, for example, that the graph of g(x) is concave up or concave down. It also tells us that Taylor expansion of g(x) around x=3 does not contain any constant or linear term — the first nonzero term in the expansion is of degree at least two. For example, all of the following functions are O(|x3|2).
5(x3)2+6(x3)3,7(x3)28(x3)4,(x3)3,(x3)52
In the next few examples we will rewrite a few of the Taylor polynomials that we know using this big O notation.

Example 3.6.25. Sine and the big O.

Let f(x)=sinx and a=0. Then
f(x)=sinxf(x)=cosxf(x)=sinxf(3)(x)=cosxf(0)=0f(0)=1f(0)=0f(3)(0)=1f(4)(x)=sinxf(4)(0)=0
and the pattern repeats. So every derivative is plus or minus either sine or cosine and, as we saw in previous examples, this makes analysing the error term for the sine and cosine series quite straightforward. In particular, |f(n+1)(c)|1 for all real numbers c and all natural numbers n. So the Taylor polynomial of, for example, degree 3 and its error term are
sinx=x13!x3+cosc5!x5=x13!x3+O(|x|5)
under Definition 3.6.24, with C=15! and any D>0. Similarly, for any natural number n,
When we studied the error in the expansion of the exponential function (way back in optional Example 3.6.8), we had to go to some length to understand the behaviour of the error term well enough to prove convergence for all numbers x. However, in the big O notation, we are free to assume that x is close to 0. Furthermore we do not need to derive an explicit bound on the size of the coefficient C. This makes it quite a bit easier to verify that the big O notation is correct.

Example 3.6.27. Exponential and the big O.

Let n be any natural number. Since ddxex=ex, we know that dkdxk{ex}=ex for every integer k0. Thus
ex=1+x+x22!+x33!++xnn!+ec(n+1)!xn+1
for some c between 0 and x. If, for example, |x|1, then |ec|e, so that the error term
|ec(n+1)!xn+1|C|x|n+1 with C=e(n+1)! whenever |x|1
So, under Definition 3.6.24, with C=e(n+1)! and D=1,
You can see that, because we only have to consider x’s that are close to the expansion point (in this example, 0) it is relatively easy to derive the bounds that are required to justify the use of the big O notation.

Example 3.6.29. Logarithms and the big O.

Let f(x)=log(1+x) and a=0. Then
f(x)=11+xf(x)=1(1+x)2f(3)(x)=2(1+x)3f(0)=1f(0)=1f(3)(0)=2f(4)(x)=2×3(1+x)4f(5)(x)=2×3×4(1+x)5f(4)(0)=3!f(5)(0)=4!
We can see a pattern for f(n)(x) forming here — f(n)(x) is a sign times a ratio with
  • the sign being + when n is odd and being when n is even. So the sign is (1)n1.
  • The denominator is (1+x)n.
  • The numerator
     25 
    Remember that n!=1×2×3××n, and that we use the convention 0!=1.
    is the product 2×3×4××(n1)=(n1)!.
Thus
 26 
It is not too hard to make this rigorous using the principle of mathematical induction. The interested reader should do a little search-engine-ing. Induction is a very standard technique for proving statements of the form “For every natural number n,…”. For example For every natural number nk=1nk=n(n+1)2, or For every natural number ndndxn{log(1+x)}=(1)n1(n1)!(1+x)n. It was also used by Polya (1887–1985) to give a very convincing (but subtly (and deliberately) flawed) proof that all horses have the same colour.
, for any natural number n,
f(n)(x)=(1)n1(n1)!(1+x)nwhich means that1n!f(n)(0)xn=(1)n1(n1)!n!xn=(1)n1xnn
so
log(1+x)=xx22+x33+(1)n1xnn+En(x)
with
En(x)=1(n+1)!f(n+1)(c)(xa)n+1=1n+1(1)n(1+c)n+1xn+1
If we choose, for example D=12, then
 27 
Since |c|12, 12c12. If we now add 1 to every term we get 121+c32 and so |1+c|12. You can also do this with the triangle inequality which tells us that for any x,y we know that |x+y||x|+|y|. Actually, you want the reverse triangle inequality (which is a simple corollary of the triangle inequality) which says that for any x,y we have |x+y|||x||y||.
for any x obeying |x|D=12, we have |c|12 and |1+c|12 so that
|En(x)|1(n+1)(1/2)n+1|x|n+1=O(|x|n+1)
under Definition 3.6.24, with C=2n+1n+1 and D=12. Thus we may write

Remark 3.6.31.

The big O notation has a few properties that are useful in computations and taking limits. All follow immediately from Definition 3.6.24.
  1. If p>0, then
    limx0O(|x|p)=0
  2. For any real numbers p and q,
    O(|x|p) O(|x|q)=O(|x|p+q)
    (This is just because C|x|p×C|x|q=(CC)|x|p+q.) In particular,
    axmO(|x|p)=O(|x|p+m)
    for any constant a and any integer m.
  3. For any real numbers p and q,
    O(|x|p)+O(|x|q)=O(|x|min{p,q})
    (For example, if p=2 and q=5, then C|x|2+C|x|5=(C+C|x|3)|x|2(C+C)|x|2 whenever |x|1.)
  4. For any real numbers p and q with p>q, any function which is O(|x|p) is also O(|x|q) because C|x|p=C|x|pq|x|qC|x|q whenever |x|1.
  5. All of the above observations also hold for more general expressions with |x| replaced by |xa|, i.e. for O(|xa|p). The only difference being in (a) where we must take the limit as xa instead of x0.

Subsection 3.6.6 Optional — Evaluating Limits Using Taylor Expansions — More Examples

Example 3.6.32. Example 3.6.22 revisited.

In this example, we’ll return to the limit
limx0sinxx
of Example 3.6.22 and treat it more carefully. By Example 3.6.25,
sinx=x13!x3+O(|x|5)
That is, for small x, sinx is the same as x13!x3, up to an error that is bounded by some constant times |x|5. So, dividing by x, sinxx is the same as 113!x2, up to an error that is bounded by some constant times x4 — see Remark 3.6.31(b). That is
sinxx=113!x2+O(x4)
But any function that is bounded by some constant times x4 (for all x smaller than some constant D>0) necessarily tends to 0 as x0 — see Remark 3.6.31(a). . Thus
limx0sinxx=limx0[113!x2+O(x4)]=limx0[113!x2]=1
Reviewing the above computation, we see that we did a little more work than we had to. It wasn’t necessary to keep track of the 13!x3 contribution to sinx so carefully. We could have just said that
sinx=x+O(|x|3)
so that
limx0sinxx=limx0x+O(|x|3)x=limx0[1+O(x2)]=1
We’ll spend a little time in the later, more complicated, examples learning how to choose the number of terms we keep in our Taylor expansions so as to make our computations as efficient as possible.

Example 3.6.33. Practicing using Taylor polynomials for limits.

In this example, we’ll use the Taylor polynomial of Example 3.6.29 to evaluate limx0log(1+x)x and limx0(1+x)a/x. The Taylor expansion of equation 3.6.30 with n=1 tells us that
log(1+x)=x+O(|x|2)
That is, for small x, log(1+x) is the same as x, up to an error that is bounded by some constant times x2. So, dividing by x, 1xlog(1+x) is the same as 1, up to an error that is bounded by some constant times |x|. That is
1xlog(1+x)=1+O(|x|)
But any function that is bounded by some constant times |x|, for all x smaller than some constant D>0, necessarily tends to 0 as x0. Thus
limx0log(1+x)x=limx0x+O(|x|2)x=limx0[1+O(|x|)]=1
We can now use this limit to evaluate
limx0(1+x)a/x.
Now, we could either evaluate the limit of the logarithm of this expression, or we can carefully rewrite the expression as e(something). Let us do the latter.
limx0(1+x)a/x=limx0eaxlog(1+x)=limx0eax[x+O(|x|2)]=limx0ea+O(|x|)=ea
Here we have used that if F(x)=O(|x|2) then axF(x)=O(x) — see Remark 3.6.31(b). We have also used that the exponential is continuous — as x tends to zero, the exponent of ea+O(|x|) tends to a so that ea+O(|x|) tends to ea — see Remark 3.6.31(a).

Example 3.6.34. A difficult limit.

In this example, we’ll evaluate
 28 
Use of l’Hôpital’s rule here could be characterised as a “courageous decision”. The interested reader should search-engine their way to Sir Humphrey Appleby and “Yes Minister” to better understand this reference (and the workings of government in the Westminster system). Discretion being the better part of valour, we’ll stop and think a little before limiting (ha) our choices.
the harder limit
limx0cosx1+12xsinx[log(1+x)]4
The first thing to notice about this limit is that, as x tends to zero, the numerator
cosx1+12xsinxcos01+120sin0=0
and the denominator
[log(1+x)]4[log(1+0)]4=0
too. So both the numerator and denominator tend to zero and we may not simply evaluate the limit of the ratio by taking the limits of the numerator and denominator and dividing.
To find the limit, or show that it does not exist, we are going to have to exhibit a cancellation between the numerator and the denominator. To develop a strategy for evaluating this limit, let’s do a “little scratch work”, starting by taking a closer look at the denominator. By Example 3.6.29,
log(1+x)=x+O(x2)
This tells us that log(1+x) looks a lot like x for very small x. So the denominator [x+O(x2)]4 looks a lot like x4 for very small x. Now, what about the numerator?
  • If the numerator looks like some constant times xp with p>4, for very small x, then the ratio will look like the constant times xpx4=xp4 and, as p4>0, will tend to 0 as x tends to zero.
  • If the numerator looks like some constant times xp with p<4, for very small x, then the ratio will look like the constant times xpx4=xp4 and will, as p4<0, tend to infinity, and in particular diverge, as x tends to zero.
  • If the numerator looks like Cx4, for very small x, then the ratio will look like Cx4x4=C and will tend to C as x tends to zero.
The moral of the above “scratch work” is that we need to know the behaviour of the numerator, for small x, up to order x4. Any contributions of order xp with p>4 may be put into error terms O(|x|p).
Now we are ready to evaluate the limit. Because the expressions are a little involved, we will simplify the numerator and denominator separately and then put things together. Using the expansions we developed in Example 3.6.25, the numerator,
cosx1+12xsinx=(112!x2+14!x4+O(|x|6))= 1+x2(x13!x3+O(|x|5))expand=(124112)x4+O(|x|6)+x2O(|x|5)

Then by Remark 3.6.31(b)

=124x4+O(|x|6)+O(|x|6)

and now by Remark3.6.31(c)

=124x4+O(|x|6)
Similarly, using the expansion that we developed in Example 3.6.29,
[log(1+x)]4=[x+O(|x|2)]4=[x+xO(|x|)]4by Remark 3.6.31(b)=x4[1+O(|x|)]4
Now put these together and take the limit as x0:
limx0cosx1+12xsinx[log(1+x)]4=limx0124x4+O(|x|6)x4[1+O(|x|)]4=limx0124x4+x4O(|x|2)x4[1+O(|x|)]4by Remark 3.6.31(b)=limx0124+O(|x|2)[1+O(|x|)]4=124by Remark 3.6.31(a).
The next two limits have much the same flavour as those above — expand the numerator and denominator to high enough order, do some cancellations and then take the limit. We have increased the difficulty a little by introducing “expansions of expansions”.

Example 3.6.35. Another difficult limit.

In this example we’ll evaluate another harder limit, namely
limx0log(sinxx)x2
The first thing to notice about this limit is that, as x tends to zero, the denominator x2 tends to 0. So, yet again, to find the limit, we are going to have to show that the numerator also tends to 0 and we are going to have to exhibit a cancellation between the numerator and the denominator.
Because the denominator is x2 any terms in the numerator, log(sinxx) that are of order x3 or higher will contribute terms in the ratio log(sinxx)x2 that are of order x or higher. Those terms in the ratio will converge to zero as x0. The moral of this discussion is that we need to compute logsinxx to order x2 with errors of order x3. Now we saw, in Example 3.6.32, that
sinxx=113!x2+O(x4)
We also saw, in equation 3.6.30 with n=1, that
log(1+X)=X+O(X2)
Substituting
 29 
In our derivation of log(1+X)=X+O(X2) in Example 3.6.29, we required only that |X|12. So we are free to substitute X=13!x2+O(x4) for any x that is small enough that |13!x2+O(x4)|<12.
X=13!x2+O(x4), and using that X2=O(x4) (by Remark 3.6.31(b,c)), we have that the numerator
log(sinxx)=log(1+X)=X+O(X2)=13!x2+O(x4)
and the limit
limx0log(sinxx)x2=limx013!x2+O(x4)x2=limx0[13!+O(x2)]=13!=16

Example 3.6.36. Yet another difficult limit.

Evaluate
limx0ex2cosxlog(1+x)sinx
Solution: Step 1: Find the limit of the denominator.
limx0[log(1+x)sinx]=log(1+0)sin0=0
This tells us that we can’t evaluate the limit just by finding the limits of the numerator and denominator separately and then dividing.
Step 2: Determine the leading order behaviour of the denominator near x=0. By equations 3.6.30 and 3.6.26,
log(1+x)=x12x2+13x3sinx=x13!x3+15!x5
Taking the difference of these expansions gives
log(1+x)sinx=12x2+(13+13!)x3+
This tells us that, for x near zero, the denominator is x22 (that’s the leading order term) plus contributions that are of order x3 and smaller. That is
log(1+x)sinx=x22+O(|x|3)
Step 3: Determine the behaviour of the numerator near x=0 to order x2 with errors of order x3 and smaller (just like the denominator). By equation 3.6.28
eX=1+X+O(X2)
Substituting X=x2
ex2=1+x2+O(x4)cosx=112x2+O(x4)
by equation 3.6.26. Subtracting, the numerator
ex2cosx=32x2+O(x4)
Step 4: Evaluate the limit.
limx0ex2cosxlog(1+x)sinx=limx032x2+O(x4)x22+O(|x|3)=limx032+O(x2)12+O(|x|)=3212=3

Exercises 3.6.8 Exercises

Exercises — Stage 1 .

1.
Below is a graph of y=f(x), along with the constant approximation, linear approximation, and quadratic approximation centred at a=2. Which is which?
2.
Suppose T(x) is the Taylor series for f(x)=arctan3(ex+7) centred at a=5. What is T(5)?
3.
Below are a list of common functions, and their Taylor series representations. Match the function to the Taylor series and give the radius of convergence of the series.
function series
A. 11x I. n=0(1)nxn+1n+1
B. log(1+x) II. n=0(1)nx2n+1(2n+1)!
C. arctanx III. n=0(1)nx2n(2n)!
D. ex IV. n=0(1)nx2n+12n+1
E. sinx V. n=0xn
F. cosx VI. n=0xnn!
4.
  1. Suppose f(x)=n=0n2(n!+1)(x3)n for all real x. What is f(20)(3) (the twentieth derivative of f(x) at x=3)?
  2. Suppose g(x)=n=0n2(n!+1)(x3)2n for all real x. What is g(20)(3)?
  3. If h(x)=arctan(5x2)x2, what is h(20)(0)? What is h(22)(0)?

Exercises — Stage 2 .

In Questions 5 through 8, you will create Taylor series from scratch. In practice, it is often preferable to modify an existing series, rather than creating a new one, but you should understand both ways.
5.
Using the definition of a Taylor series, find the Taylor series for f(x)=log(x) centred at x=1.
6.
Find the Taylor series for f(x)=sinx centred at a=π.
7.
Using the definition of a Taylor series, find the Taylor series for g(x)=1x centred at x=10. What is the interval of convergence of the resulting series?
8.
Using the definition of a Taylor series, find the Taylor series for h(x)=e3x centred at x=a, where a is some constant. What is the radius of convergence of the resulting series?

Exercise Group.

In Questions 9 through 16, practice creating new Taylor series by modifying known Taylor series, rather than creating your series from scratch.
9. (✳).
Find the Maclaurin series for f(x)=12x1.
10. (✳).
Let n=0bnxn be the Maclaurin series for f(x)=3x+112x1,
i.e. n=0bnxn=3x+112x1.
Find bn.
11. (✳).
Find the coefficient c5 of the fifth degree term in the Maclaurin series n=0cnxn for e3x.
12. (✳).
Express the Taylor series of the function
f(x)=log(1+2x)
about x=0 in summation notation.
13. (✳).
The first two terms in the Maclaurin series for x2sin(x3) are ax5+bx11 , where a and b are constants. Find the values of a and b.
14. (✳).
Give the first two nonzero terms in the Maclaurin series for ex21xdx.
15. (✳).
Find the Maclaurin series for x4arctan(2x)dx.
16. (✳).
Suppose that dfdx=x1+3x3 and f(0)=1. Find the Maclaurin series for f(x).

Exercise Group.

In past chapters, we were only able to exactly evaluate very specific types of series: geometric and telescoping. In Questions 17 through 25, we expand our range by relating given series to Taylor series.
17. (✳).
The Maclaurin series for arctanx is given by
arctanx=n=0(1)nx2n+12n+1
which has radius of convergence equal to 1. Use this fact to compute the exact value of the series below:
n=0(1)n(2n+1)3n
18. (✳).
Evaluate n=0(1)nn!.
19. (✳).
Evaluate k=01ekk!.
20. (✳).
Evaluate the sum of the convergent series k=11πkk!.
21. (✳).
Evaluate n=1(1)n1n2n.
22. (✳).
Evaluate n=1n+2n!en.
23.
Evaluate n=12nn, or show that it diverges.
24.
Evaluate
n=0(1)n(2n+1)!(π4)2n+1(1+22n+1)
or show that it diverges.
25. (✳).
(a) Show that the power series n=0x2n(2n)! converges absolutely for all real numbers x.
(b) Evaluate n=01(2n)!.
26.
  1. Using the fact that arctan(1)=π4, how many terms of the Taylor series for arctangent would you have to add up to approximate π with an error of at most 4×105?
  2. Example 3.6.15 mentions the formula
    π=16arctan154arctan1239
    Using the Taylor series for arctangent, how many terms would you have to add up to approximate π with an error of at most 4×105?
  3. Assume without proof the following:
    arctan12+arctan13=arctan(3+2231)
    Using the Taylor series for arctangent, how many terms would you have to add up to approximate π with an error of at most 4×105?
27.
Suppose you wanted to approximate the number log(1.5) as a rational number using the Taylor expansion of log(1+x). How many terms would you need to add to get 10 decimal places of accuracy? (That is, an absolute error less than 5×1011.)
28.
Suppose you wanted to approximate the number e as a rational number using the Maclaurin expansion of ex. How many terms would you need to add to get 10 decimal places of accuracy? (That is, an absolute error less than 5×1011.)
You may assume without proof that 2<e<3.
29.
Suppose you wanted to approximate the number log(0.9) as a rational number using the Taylor expansion of log(1x). Which partial sum should you use to get 10 decimal places of accuracy? (That is, an absolute error less than 5×1011.)
30.
Define the hyperbolic sine function as
sinhx=exex2.
Suppose you wanted to approximate the number sinh(b) using the Maclaurin series of sinhx, where b is some number in (2,1). Which partial sum should you use to guarantee 10 decimal places of accuracy? (That is, an absolute error less than 5×1011.)
You may assume without proof that 2<e<3.
31.
Let f(x) be a function with
f(n)(x)=(n1)!2[(1x)n+(1)n1(1+x)n]
for all n1.
Give reasonable bounds (both upper and lower) on the error involved in approximating f(13) using the partial sum S6 of the Taylor series for f(x) centred at a=12.
Remark: One function with this quality is the inverse hyperbolic tangent function
 30 
Of course it is! Actually, hyperbolic tangent is tanh(x)=exexex+ex, and inverse hyperbolic tangent is its functional inverse.
.

Exercises — Stage 3 .

32. (✳).
Use series to evaluate limx01cosx1+xex.
33. (✳).
Evaluate limx0sinxx+x36x5.
34.
Evaluate limx0(1+x+x2)2/x using a Taylor series for the natural logarithm.
36.
Evaluate the series n=0(n+1)(n+2)7n or show that it diverges.
37.
Write the series f(x)=n=0(1)nx2n+4(2n+1)(2n+2) as a combination of familiar functions.
38.
  1. Find the Maclaurin series for f(x)=(1x)1/2. What is its radius of convergence?
  2. Manipulate the series you just found to find the Maclaurin series for g(x)=arcsinx. What is its radius of convergence?
39. (✳).
Find the Taylor series for f(x)=log(x) centred at a=2. Find the interval of convergence for this series.
40. (✳).
Let I(x)=0x11+t4 dt.
  1. Find the Maclaurin series for I(x).
  2. Approximate I(1/2) to within ±0.0001.
  3. Is your approximation in (b) larger or smaller than the true value of I(1/2)? Explain.
41. (✳).
Using a Maclaurin series, the number a=1/51/7+1/18 is found to be an approximation for I=01x4ex2dx. Give the best upper bound you can for |Ia|.
42. (✳).
Find an interval of length 0.0002 or less that contains the number
I=012x2ex2 dx
43. (✳).
Let I(x)=0xet1tdt.
  1. Find the Maclaurin series for I(x).
  2. Approximate I(1) to within ±0.01.
  3. Explain why your answer to part (b) has the desired accuracy.
44. (✳).
The function Σ(x) is defined by Σ(x)=0xsinttdt.
  1. Find the Maclaurin series for Σ(x).
  2. It can be shown that Σ(x) has an absolute maximum which occurs at its smallest positive critical point (see the graph of Σ(x) below). Find this critical point.
  3. Use the previous information to find the maximum value of Σ(x) to within ±0.01.
45. (✳).
Let I(x)=0xcost1t2dt.
  1. Find the Maclaurin series for I(x).
  2. Use this series to approximate I(1) to within ±0.01
  3. Is your estimate in (b) greater than I(1)? Explain.
46. (✳).
Let I(x)=0xcost+tsint1t2dt
  1. Find the Maclaurin series for I(x).
  2. Use this series to approximate I(1) to within ±0.001
  3. Is your estimate in (b) greater than or less than I(1)?
47. (✳).
Define f(x)=0x1ett dt.
  1. Show that the Maclaurin series for f(x) is n=1(1)n1nn!xn.
  2. Use the ratio test to determine the values of x for which the Maclaurin series n=1(1)n1nn!xn converges.
48. (✳).
Show that 01x3ex1dx13.
49. (✳).
Let cosh(x)=ex+ex2.
  1. Find the power series expansion of cosh(x) about x0=0 and determine its interval of convergence.
  2. Show that 323cosh(2)323+0.1.
  3. Show that cosh(t)e12t2 for all t.
50.
The law of the instrument says “If you have a hammer then everything looks like a nail” — it is really a description of the “tendency of jobs to be adapted to tools rather than adapting tools to jobs”
 31 
Quote from Silvan Tomkins’s Computer Simulation of Personality: Frontier of Psychological Theory. See also Birmingham screwdrivers.
. Anyway, this is a long way of saying that just because we know how to compute things using Taylor series doesn’t mean we should neglect other techniques.
  1. Using Newton’s method, approximate the constant 23 as a root of the function g(x)=x32. Using a calculator, make your estimation accurate to within 0.01.
  2. You may assume without proof that
    x3=1+16(x1)+n=2(1)n1(2)(5)(8)(3n4)3nn!(x1)n.
    for all real numbers x. Using the fact that this is an alternating series, how many terms would you have to add for the partial sum to estimate 23 with an error less than 0.01?
51.
Let f(x)=arctan(x3). Write f(10)(15) as a sum of rational numbers with an error less than 106 using the Maclaurin series for arctangent.
52.
Consider the following function:
f(x)={e1/x2x00x=0
  1. Sketch y=f(x).
  2. Assume (without proof) that f(n)(0)=0 for all whole numbers n. Find the Maclaurin series for f(x).
  3. Where does the Maclaurin series for f(x) converge?
  4. For which values of x is f(x) equal to its Maclaurin series?
53.
Suppose f(x) is an odd function, and f(x)=n=0f(n)(0)n!xn. Simplify n=0f(2n)(0)(2n)!x2n.