calc_notes_new_4_OH

67
4 Taylor Polynomials. 4.1 Motivation Our aim is develop a method for approximating a (differen- tiable) function f (x) using polynomials. We know from High School that we can draw a tangent line to a curve at a point, and that near that point, the tangent line is a good approximation to the function. Can we extend this idea of a tangent line to a polynomial of 1

description

d

Transcript of calc_notes_new_4_OH

  • 4 Taylor Polynomials.

    4.1 Motivation

    Our aim is develop a method for approximating a (differen-tiable) function f (x) using polynomials.

    We know from High School that we can draw a tangent lineto a curve at a point, and that near that point, the tangent lineis a good approximation to the function.

    Can we extend this idea of a tangent line to a polynomial of1

  • higher degree?

    4.2 Taylor Polynomials

    The linearization of a differentiable function f at a point a isthe polynomial of degree one

    P1(x) := f (a) + f(a)(x a).

    This is simply the equation of the tangent line to f (x) at x = a.Near x = a, this gives a reasonable approximation to the func-

    tion, indeed at x = a it is exactly equal to the function, that is,P1(a) = f (a).

    In order to generalise this, we write

    Pn(x) = b0 + b1(x a) + b2(x a)2 + .... + bn(x a)n

    2

  • and ask that Pn(a) = f (a), P n(a) = f (a), P n (a) = f (a), ... andso on.

    This gives,

    Hence, we have

    DefinitionSuppose f is a function which can be differentiated n times at

    the point x = a.

    3

  • The Taylor Polynomial of order n for f at x = a is given by

    Pn(x) = f (a) + f(a)(x a) + f

    (a)2!

    (x a)2 + f(a)3!

    (x a)3 + ...

    +f (n)(a)

    n!(x a)n.

    (Note: We use the term order rather than degree here, sincef (n)(a) might be equal to 0 and so the polynomial may haveorder n but not degree n.)

    Example: Find the Taylor polynomials for f (x) = ex up to order3 about x = 0.

    4

  • Notice in the graphs that near x = 0, the polynomials givea good a approximation to ex, but once we move away fromx = 0 they dont.

    Example: Compute the Taylor polynomial of order 2n for thefunction f (x) = cosx about x = 0.

    Example: Compute the Taylor polynomial of order 2n + 1 forthe function f (x) = sinx about x = pi2 .

    5

  • 4.3 The Error Term.

    We have seen graphically that near x = a the Taylor polynomialis close to the function. We will now begin to investigate moreprecisely what this means. When we approximate, there is anerror involved, which we can try to measure. Hence, we try towrite

    f (x) = Pn(x) +Rn+1(x),

    where Rn+1(x) is the error term when we approximate f (x) byPn(x).

    Notice that the error will depend on both the order of the Tay-lor polynomial - the more terms, the better the approximation -and also on the value of x we are approximating at - the closerx is to a, the better the approximation.

    6

  • The following remarkable theorem, gives a relatively simpleformula for the remainder. The details of the how this theoremis proven are contained in the detailed lecture notes.

    Theorem 4.1. (Taylors Theorem.)Suppose that f has n + 1 continuous derivatives on some open in-

    terval I which contains a. Then for each x I ,

    f (x) = f (a)+f (a)(xa)+f(a)2!

    (xa)2+...+f(n)(a)

    n!(xa)n+Rn+1(x),

    where Rn+1(x) =f (n+1)(c)(n+1)!

    (x a)n+1 and c is some real numberbetween a and x.

    In essence this says that we can approximate a (smooth) func-tion by its Taylor polynomial and with an error term, Rn+1(x)

    7

  • given byf (n+1)(c)

    (n + 1)!(x a)n+1.

    There are other formulae for the remainder term. The onequoted above is sometimes referred to as Lagranges form of theremainder.

    The number c may appear a bit mysterious. The proof ofthis result uses the Mean Value Theorem (indeed this Theoremcan be seen as a generalisation of the MVT, as you can see byputting n = 1.) In a given problem is it very hard to determineexactly what the c is - we dont in general know exactly whatc is but we do know where it is, and this enables us to get anidea of how big the error can be in a given approximation.

    Example: Estimate the error of approximating f (x) = ex withp2(x) = 1 + x + x

    2/2 over the interval x (0.5, 0.5).

    8

  • Example: Calculate e with an error of less than 105.

    9

  • 4.4 Classifying Stationary Points.

    At school you learnt the 2ndderivative test for classifying sta-tionary points of functions. We now can prove a second 2ndderivative test by employing Taylors theorem!Theorem 4.2. Let f have continuous 1st and 2ndorder derivativeson an interval I and suppose that f (a) = 0 for some a I .

    (i) If f 0 on I then f has a local max at a.(ii) If f 0 on I then f has a local min at a.

    Proof. We prove this by approximating f by its third order poly-nomial with remainder term:

    f (x) = f (a) + f (a)(x a) + f(c)2

    (x a)2, for all x I ;with c between a and x. Now since f (a) = 0, we have

    f (x) = f (a) +f (c)2

    (x a)210

  • This will have maximum or minimum according as f (c) 0or 0. Example: y = x4 at x = 0

    The following more general theorem is also useful for moremax/min classification.

    Theorem 4.3. Suppose f is n times differentiable at a with

    0 = f (a) = f (a) = = f (k1)(a).In addition, if f (k)(a) 6= 0, with k n then:

    (i) If k is even and f (k)(a) > 0 then f has a local min at a.(ii) If k is even and f (k)(a) < 0 then f has a local max at a(iii) If k is odd then f has an inflection point at a.

    11

  • Example: f (x) = x7 10x6+40x5 80x4+80x3 32x2 10 hasa stationary point at x = 2. Classify it.

    12

  • 4.5 MAPLE.To obtain the Taylor polynomial of ex of order 4 we use thefollowing command:T1:=taylor(exp(x), x = 0, 5);

    1 + x +1

    2x2 +

    1

    6x3 +

    1

    24x4 +O(x5)

    We can remove the O(x5) and convert into a properpolynomial by using:convert(T1,polynom);

    1 + x +1

    2x2 +

    1

    6x3 +

    1

    24x4.

    13

  • 5 Sequences.

    We have now seen that an nth order polynomial can approx-imate a (smooth) function and that the larger the value of n,the better the approximation, provided we keep to the same xvalue.

    These ideas raise interesting and difficult questions when weask what happens as n becomes large. To deal with these, wewill step back a little and look firstly at sequences of real num-bers and then infinite series of real numbers and finally returnto Taylor, Maclaurin and Power Series.

    14

  • 5.1 Sequences of Real Numbers.

    Definition: A sequence is simply a function whose domainis (a subset of ) the natural numbers with co-domain the realnumbers.

    Ex: an = 5n

    n!

    Given a sequence of numbers, one of the questions we wishto answer, is, do the terms get closer to some finite number aswe go further and further along the sequence? That is, does

    15

  • limn an exist?

    For example, the terms of the sequence an =n grows without

    bound and so we say that this sequence diverges.

    On the other hand, the terms in the sequence an =1

    nbecome

    smaller and smaller and so we say that this sequence convergesto 0.

    Similarly, the the terms in the sequence an = (1)n+11n

    , al-though oscillating, have magnitude that becomes smaller andsmaller and so we say that this sequence converges to 0 also.

    Finally, the terms in the sequence an = sinn oscillate, but their

    16

  • magnitude does not approach any limit as n increases. We saythat this sequence is boundedly divergent.

    Given a sequence of numbers, one of the questions we wishto answer, is, do the terms get closer to some finite number aswe go further and further along the sequence? That is, doeslimn an exist?

    17

  • 5.2 Geometric Interpretation of Limits.

    Example: Consider the sequence an =n

    n + 1

    If we draw little band around the line through 1, we see thateventually the crosses move into the band and stay there for-ever. That is, no matter how small we make the band, there is

    18

  • an integer N such that if we take any term further along thesequence, then it is in the band, i.e. its distance from 1 is lessthan the width of the band. The value of N will depend on thewidth of the band, the smaller the width, the largerN will haveto be.

    19

  • We can formalise this simple idea by saying that

    limn an = L

    if and only if: Given some positive real number , we can findan integer N , such that |an L| < , whenever n > N .

    In words: Provided n is large enough, (i.e. n > N ), the termsof the sequence are inside the epsilon band around L, i.e. |anL| < .

    Note that we are not necessarily looking for the smallest valueof N , and in practise this might be very hard to find, we onlywant a value of N that works.

    20

  • Ex. Prove formally that limn

    1

    n= 0

    Ex.Prove formally that limn

    (1)n(n + 1)2

    = 0

    21

  • Ex. Prove formally that limn

    3n2 1n2 + 2

    = 3

    A similar geometric interpretation exists for sequences that di-verge to .

    22

  • 5.3 Rules for Limits.

    Although the above definition of limit essentially captures thenotion, it is not very practical to use. Instead, we want somebasic rules which help us to build up more complicated limitsfrom simpler ones.

    The following rules are often refered to as the algebra of limits .

    Suppose an L and bn l as n , where L and ` arefinite real numbers, then

    Rule 1. an bn L `.

    Rule 2. anbn L`.

    23

  • Rule 3. anbn L` , provided bn 6= 0 for any n and ` 6= 0.

    Rule 4. Suppose f : R R is a function and suppose thatlimx f (x) exists.

    Let an = f (n), where n is an integer, than

    limn an = limx f (x).

    Rule 5. Suppose f is a continuous function, and that an belongsto the domain of f for each n, then f (an) f (a).

    Examples:

    24

  • 1. limn

    4n2 3n + 22n2 + 6n + 1

    2. limn sin(

    pi

    2 1n)

    3. limnn sin

    1

    n=

    The following limits are standard and will be used in later work.

    25

  • 4. limn

    lnn

    n= for > 0.

    5. limnn

    1n =

    6. limnx

    1n = for x > 0.

    7. limnx

    n = for |x| < 1.

    Observe that Rule 4 enables us to use LHopitals rule, for ex-ample,

    limn

    (1 +

    1

    n

    )n

    26

  • 5.3.1 The Pinching Theorem for Sequences.

    You have already seen the Pinching Theorem for functions. Thestory is very similar for sequences.

    Theorem 5.1. Suppose that {an}, {bn}, {cn} are sequences such thatfor all sufficiently large n we have

    an bn cn.Then if, lim

    n an = limn cn = L, we have limn bn exists and equalsL.

    Example: Discuss the limit an =n!

    nn.

    27

  • 6 Infinite Series.

    A series is simply the sum of the terms of a sequence. For aninfinite series we define

    k=j

    ak = limN

    Nk=j

    ak,

    provided this limit exists. If it exists, then we say that the seriesk=j

    ak converges. Otherwise, we say that the series diverges.

    We can think of this sum then, as the limit of a sequence of

    partial sums, sn =nk=j

    ak.

    Does the process make sense?28

  • Example: Discuss the seriesn=1

    1

    2nand

    n=1

    1

    n

    29

  • 6.1 The nth term test for divergence.

    Note the following important result:

    Theorem 6.1. Consider the infinite seriesk=j

    ak. If ak 6 0, as k

    , then the series diverges.

    That is, a necessary condition fork=j

    ak to converge is that

    ak 0 as k .

    Note also that the converse is NOT necessarily true. We saw

    in the above example that 1

    ndoes NOT converge, despite

    30

  • the fact that 1n does go to 0 as n goes to infinity.

    Ex: The seriesn=1

    n

    2n + 3

    6.2 Geometric Series.

    At this stage there is only one kind of infinite series you havemet and that is the infinite geometric series,

    31

  • 6.3 Telescoping Series

    Another type of infinite series which we can deal with is theso-called telescoping series.

    Ex. Find the sumn=1

    1

    n2 + n.

    32

  • In general, series are very difficult to sum, and so it is not prac-tical to try to find a formula for the partial sums in closed form.

    For example, although it is true thatn=1

    1

    n2=pi2

    6this is quite

    difficult to show.

    Instead, we are interested in the question, Does a given se-ries converge?, and NOT What does it converge to? We willdevelop some tests to examine the convergence of series.

    I will use the notation

    an forn=j

    an to represent the infi-

    nite series starting at some finite value j.

    33

  • 6.4 Integral Test

    We can sometimes decide the convergence of an infinite series,by looking at a corresponding improper integral. Suppose f (x)is a positive decreasing function on [1,), and an = f (n) when-ever n is an integer.

    By comparing areas we see that the total area of the under-approximation is

    n=2

    an 1

    f (x) dx

    and the total area of the over-approximation isn=1

    an 1

    f (x) dx.

    Thus, we see that34

  • if 1

    f (x) dx converges then

    an converges

    if 1

    f (x) dx diverges then

    an diverges.

    Ex: Check thatn=1

    1

    ndiverges and that

    n=1

    1

    n2converges.

    35

  • Ex. Show thatn=2

    1

    n log ndiverges.

    36

  • 6.5 pseries:Consider the series

    (p) =

    n=1

    1

    np.

    Using the integral test we see that this series converges if p > 1and diverges if p 1.

    Proof:

    37

  • The integral test uses an area to bound a series. In some casesone can bound a series by another series and hence make sen-sible conclusions regarding convergence.

    6.6 Comparison Test:

    Theorem 6.2. Suppose 0 an bn. That is, suppose the sequenceof numbers an is squeezed between 0 and bn. Then

    if

    bn converges, so does

    an

    and

    if

    an diverges, so does

    bn.

    38

  • When making comparisons, we generally compare with the pseries mentioned above.

    You will not be expected in this course to use this test. Thefollowing test will be particularly useful when we return to theoriginal problem of taking more and more terms in a Taylor se-ries.

    6.7 The Ratio Test:

    This test was developed by DAlembert, a French Mathemati-cian who lived during the seventeen hundreds.

    Theorem 6.3. Suppose we have a sequence an of positive terms, and

    39

  • suppose an+1an L as n.

    Then

    an converges if L < 1, diverges if L > 1.

    If L = 1 then the test fails.

    Proof. When L > 1 we do not have an 0 as n so theseries diverges. For L < 1, if

    an+1an

    L, for all sufficiently

    large n, so we can show by induction that an Lna0 andn

    Ln

    converges, since it is a GP with L < 1 and so by the comparisontest, the original series converges. This can be generalised togive a full proof and is covered in the notes.

    40

  • We generally use the ratio test when exponentials and factori-als are involved.

    Ex.k=1

    k2

    2k

    Ex.k=0

    1

    k!

    41

  • Ex.k=1

    k!

    2k

    6.8 Alternating Series:

    We have seen that the seriesk=1

    1

    ndiverges to infinity, i.e. the

    series1 +

    1

    2+1

    3+ ....

    42

  • is unbounded. Consider now, what happens if we look at theseries

    1 12+1

    3 1

    4+ ....

    This series, does, in fact, converge (surprisingly to log 2 (!)).

    Such a series is called an alternating series. More specifically,if an is a sequence of positive numbers then

    (1)kak

    is called an alternating series.

    To examine the convergence of an alternating series, we beginby considering the corresponding non-alternating series

    ak

    43

  • which we analyse using the techniques described above.

    If this series converges then the alternating series, being boundedby it, will also converge.

    We say in this case that the alternating series converges ab-solutely. The meaning of this term will be explained later.As we saw in the example above, it is possible for the alter-nating series to converge even though the corresponding non-alternating series does not. If the non-alternating series doesnot converge we use the following test, called Leibniz Test.

    44

  • 6.9 Leibniz Test:

    The following test was developed by Leibniz, a German con-temporary of Newton, who discovered the Calculus indepen-dently at about the same time.

    Theorem 6.4. Suppose that an is a sequence of positive real numbers,and

    i) a1 > a2 > a3 > ...,

    i.e. an > an+1 for all n, and

    ii) limn an = 0

    then the alternating series

    (1)nan converges (conditionally).Note that condition (i) says that the terms are monotonicallydecreasing. Note also that this ONLY works for an alternating

    45

  • series.

    Ex.k=1

    (1)kk2

    Ex.k=2

    (1)kk log k

    46

  • 6.10 Conditionally Convergent Series:

    We will now look at a remarkable difference between abso-lutely and conditionally convergent series.

    Returning to our series:

    47

  • Thus, by playing around with the order of the terms we gethalf the sum.

    Such bizarre behaviour is typical of conditionally convergentseries. In fact, any conditionally convergent series can be madeto sum to anything you please, and indeed can even be made todiverge. By conditionally convergent we mean that the serieswill converge if we add the terms up in the standard order. Tobriefly illustrate why this happens, suppose we wish to makethe above series add up to 10. We take enough positive termsof the series to get just beyond 10, to do this MAPLE tells mewe need about 108 terms. Now take some of the negative terms,in fact 12 will do. This brings the sum back to about 9.69209.Now add some more positive terms to bring to the sum backover 10 and then use some negative terms to bring it back to

    48

  • below 10 and so on. It is a little harder to show that the par-tial sums do tend to 10 by this process, but nonetheless this canbe done in a very precise way and furthermore the idea cancan generalised to show that any conditionally convergent al-ternating series can be made to sum to anything.

    49

  • 6.11 MAPLE Notes:

    The following commands are relevant to the material ofthis section.

    >sum(f,k=m..n);is used to compute the sum of f (k) as k goes from m to

    n.

    > sum(k2,k=1..4);30

    > sum(k2,k=1..n);

    1

    3(n + 1)3 1

    2(n + 1)2 +

    1

    6n +

    1

    6> sum(1/k2, k=1..infinity);

    pi2

    650

  • 7 Taylor Series.

    We return now to the problem we started with. That is, givena Taylor polynomial for a (smooth) function f , can we makesense of letting the number of terms go to infinity?

    Assuming, for the moment that the series converges, we makethe following definition:

    51

  • Definition: Suppose f has derivatives of all orders, then theseries

    f (a) + f (a)(x a) + f(a)2

    (x a)2 + ... + f(k)(a)

    k!(x a)k + ...

    =

    k=0

    f (k)(a)

    k!(x a)k

    is called the Taylor Series for f about x = a. (This is alsoknown as the Taylor Expansion of f about x = a.)

    In the case when a = 0, the simpler

    f (0) + f (0)x + f(0)2

    x2 + ... +f (k)(0)

    k!xk + ... =

    k=0

    f (k)(0)

    k!xk

    is called the Maclaurin Series for f (x). (Colin Maclaurin wasprofessor of Mathematics at Edinburgh about the time of New-

    52

  • ton.)

    Example. Find the Maclaurin series for sinx.

    Example. Find the Taylor series for cosx about x = pi2 .

    53

  • Example. The function f (x) = log x does not have a Maclau-rin series. Find its Taylor series about x = 1

    (Comment: An ancient formula for computing the square root(approximately) for a given number is

    a2 + x a + x2a. This

    is simply the Maclaurin series for f (x) =a2 + x.)

    54

  • 7.1 Convergence of Taylor Series

    Two important questions arise. Firstly, exactly where does theTaylor series of a function converge? And secondly, if it does,can we be sure that the series converges back to the functionwe started with?

    A proper answer to the first of these questions requires a knowl-edge of Complex Analysis and is beyond the scope of the course.

    To answer the second question, we take the Taylor polynomial,Pn(x) and as before, write

    Rn(x) = f (x) Pn(x),for the remainder. We can then state:

    55

  • Theorem 7.1. Suppose that f has derivatives of all orders at a and xlies in the domain of f . If, for each fixed x, lim

    nRn+1(x) = 0 then fis represented by its Taylor series, i.e.

    f (x) =

    k=0

    f (k)(a)(x a)kk!

    56

  • Example: Prove that the Taylor series for ex converges to ex

    everywhere.

    7.2 Common Maclaurin Series

    Here are some examples of how these series can be used.

    57

  • Example: Use Maclaurin series to find:

    limx0

    cosx 1 + x22x4

    .

    Example: Use Maclaurin series to find an approximiation to: 10

    sin(x2) dx.

    58

  • 7.3 Power Series

    The Maclaurin and Taylor series we have been studying above,have the following general form:

    n=1

    anxn or

    n=1

    an(x a)n.

    Series of this form, which are basically polynomials of infinitedegree, are called Power Series. They play a very importantrole in the applications of Mathematics, since there is a methodof solving certain types of differential equations, (which cannotbe solved by other methods), using power series.

    We can analyse these, using the ratio test, to find where theyconverge and this gives us a partial answer to the question ofwhere Taylor Series converge.

    59

  • Example: Apply the ratio test ton=1

    nxn

    2nto find the interval

    of convergence.

    Notice that since the ratio test gives NO information when thelimit is 1, this method will ensure convergence on an open in-terval but give no information of what is happening at the end-points. To deal with these, further analysis is required. This

    60

  • will not be covered in this course.Ex. Find the interval of convergence for the power series

    k=0

    (x 3)k3k + 2

    61

  • 7.3.1 Radius of Convergence

    We see that power series converge on intervals. Half the lengthof such an interval is called the radius of convergence. (Thename comes from the fact that these series actually convergeinside discs in the complex plane, where the interval of conver-gence in the real plane is simply a diameter.)

    7.4 Manipulation of Power Series

    Given two power series in powers of (x a), f (x) =k=0

    ak(x

    a)k and

    62

  • g(x) =

    k=0

    bk(x a)k, in which both converge for x in somecommon interval of convergence, then we can add, subtract ormultiply these two series and the resulting series will also con-verge in that interval.

    More importantly,

    If f (x) =k=0

    ak(x a)k for |x a| < R then

    i) f is continuous and differentiable for |x a| < R and

    f (x) =k=0

    kak(x a)k1;

    63

  • ii) f is integrable on |x a| < R and a primitive for f is

    F (x) =

    k=0

    akk + 1

    (x a)k+1.

    Example: Show how to get the Maclaurin series for cosx fromthat for sinx.

    64

  • Example. Consider the power seriesk=0

    xk.

    65

  • Example. Find the power series for xex.

    Example. Write down the first 4 terms of the power series forex

    1x and state where the series is valid.

    66

  • Note that one can construct infinite series (NOT power series)in which the above results are NOT true.

    Example. Here is an example of a function defined in termsof a series which is continuous everywhere but differentiable

    nowhere. f (x) =n=1

    (1

    2)n sin(4nx).

    67