1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Taylor's Formula Question?

  1. Aug 13, 2010 #1
    Hello, I know how to rederive & prove Taylor's Formula as being a simple application
    of Integration By Parts to ∫f'(x) dx = f(b) - f(a) leading to

    f(b) = f(a) + f'(a)(b - a) + ½f''(a)(b - a)² + ... + Rⁿ

    and that we can approximate f(x) by setting a = 0 & b = x

    f(x) = f(0) + f'(0)x + ½f''(0)x² + ... + Rⁿ

    and I understand that Rⁿ lies between the lower & upper bound, i.e.
    ∃ c ∈ (a,b) : f ⁿ (c)(b - a)ⁿ/n! = Rⁿ
    & f ⁿ (c)(b - a)ⁿ/n! = Rⁿ

    but I'm confused on how to apply all of this.

    For example, f(x) = sinx

    okay, I can create the taylor polynomial

    sinx = x - x³/3! + x^5/5! - ... + Rⁿ

    and the question is compute sin(0.1) to 3 decimals.

    Well
    a = 0,
    x = 0 + 0.1 = 0.1

    If I compute it to 3 decimals I get

    sin(0.1) = (0.1) - (0.1)³/3! + (0.1)^5/5! = 0.099...

    Would this be the 3 decimals? Like, this is not correct at all compared to my calculator's answer for sin(0.1).
    the way the book has done it has me really confused.
    When I add the error on I get no significant change,
    I'm confused as to what the point of the formula is here.

    I used my calculator for this btw (isn't this equation supposed to do away with calculators? ) ?

    Now, my book has done something very different & I don't understand.
    (Serge Lang: A First Course in Calculus - page 309)

    Lang ignores calculating the Rⁿ term, and hasn't shown me how to get it yet, but
    uses the sin/cosine natural upper bound of 1, so Rⁿ ≤ Mⁿ|xⁿ|/n!
    where Mⁿ = 1 as an upper bound.

    (As a side note, this comes from the proof that ∃ c ∈ (a,b) : f ⁿ (c)(b - a)ⁿ/n!
    where he's chosen f ⁿ (v)(b - a)ⁿ/n! = Mⁿ = 1, i.e. v being the maximum,
    is the logic correct or am I missing something? He's just squeezing in Rⁿ underneath)


    With this he just calculates
    Rⁿ ≤ Mⁿ|xⁿ|/n! -----------> Rⁿ ≤ 1|(0.1)³|/3!
    Rⁿ ≤ (0.001)/6

    Now, he says that "such accuracy would put us in the required range of accuracy.
    Hence we can just use the first term of Taylor's formula."

    sin(0.1) = 0.100 ± (0.001)/6

    I have no idea how or why he just did all that, non whatsoever...

    I don't understand how I could get an incorrect answer by using the x/3! & x/5!
    because the added values are supposed to give a better approximation, not a
    worse one

    Edit: Thinking about it I can use linear approximation:

    f(x) = f(x₀) + f'(x₀)(x - x₀)
    f(x) = sin(0) + cos(0)(x - 0)
    f(x) = x
    sin(0.1) = 0.100

    and then use the error function thing but it seems to come out of nowhere, i.e. I made it up &
    while it's good to have that backup I'm trying to learn how to get this thing right :p

    Another Edit: I think I got it

    sin(0.1) = sin(0) + cos(0)•(0.1) - sin(0)•(0.1)² /2 - cos(0)•(0.1)³/6 = 0 + 0.1 - 0 - (0.001)/6

    Now, 0.001/6 would be around the third decimal place & that's what the question asked for.

    I think that's right, please let me know as it seems correct :D
     
    Last edited: Aug 13, 2010
  2. jcsd
  3. Aug 13, 2010 #2

    benorin

    User Avatar
    Homework Helper

    Your calculator is in degree mode, switch it to radians (or Rad as it often is on calculators,) my calculator gives

    [tex]\sin (0.1)\appox 0.001745328366[/tex] in degree mode​

    and

    [tex]\sin (0.1)\appox 0.99833416647[/tex] in radian mode​

    also, your calculation of sin(0.1) = (0.1) - (0.1)³/3! + (0.1)^5/5! = 0.099...

    is, well

    [tex]\sin (0.1)\appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.99833416667[/tex]​

    accurate to ten decimal places! A bit too accurate. The first step in the solution to this problem is part that you didn't understand in the book: The proper value of n is what you want to know firs. Beginning with the formula

    [tex]R_{n}(x)\leq M_{n} \frac{x^n}{n!}[/tex]​

    where [itex]R_{n}(x)[/itex] is the remainder term after calculating n terms of the Taylor series, and [itex]\left| f^{(n)}(x)\right| \leq M_{n}[/itex]. To determine the value of n from the formula (how many terms to calculate in the series to achieve the desired 3 decimal place accuracy) use the bounds of the nth derivative of the function, namely

    [tex]\left| \frac{d^n}{dx^n}\sin x \right| \leq 1 =: M[/tex]​

    and the required accuracy, which is 3 decimal places so we want [itex]R_{n}(0.1)< 0.001,[/itex] hence we require that

    [tex]0.001\leq 1\cdot \frac{(0.1)^n}{n!}[/tex]​

    work out the values of the right-hand side for n=1,2, and 3 to see that n=3 is the proper value, now compute the value of the third Taylor polynomial at x=0,1 to get the estimate


    [tex]\sin (0.1)\appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.99833416667[/tex]​

    the first equation we solved tells us that even though we at ten place accuracy, no lesser amount of terms would give the desired accuracy.
     
  4. Aug 14, 2010 #3
    Hey thanks for taking the time to write such an in-depth reply but I'm still a little confused.

    I've rewritten out all of my knowledge on this topic to make sure I'm not confused, the
    rest of this post will just be the proofs & I'll post another post straight after with my confusion.

    Using the Fundamental Theorem of Calculus:

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ f(b) \ - \ f(a) [/itex]

    We'll rewrite this in integration by part form:

    [itex] u \ = \ f'(t) \ , \ du \ = \ f''(t) dt \ ,\ dv \ = \ dt \ , \ v \ = \ - (b - t) [/itex]

    (The "v" term includes the minus due to a chain rule differentiation removing it anyway! Very sneaky thing that confused me for a few minutes but I like it! :D).

    [itex] \int_{a}^{b} u dv \ = \ u v |^b_a \ - \ \int_{a}^{b} v du [/itex]

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ - f'(t)(b \ - \ t) |^b_a \ - \ \int_{a}^{b} - f''(t)(b \ - \ a)dt [/itex]

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ + \ \int_{a}^{b} f''(t)(b \ - \ a)dt [/itex]

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ - \ f''(t)\frac{(b \ - \ a)^2}{2} |^b_a \ - \ \int_{a}^{b} - f'''(t)\frac{(b \ - \ a)^2}{2}dt [/itex]

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt [/itex]

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt [/itex]

    Okay, before I go on I'd like to qualify that the left hand side can be
    rewritten as

    [itex] \int_{a}^{b} f ' (t)\,dt \ = \ f(b) \ - \ f(a) [/itex]

    so that the above becomes

    [itex] \ f(b) \ - \ f(a) \ = \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt [/itex]

    or better yet:

    [itex] \ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + \ \int_{a}^{b} f'''(t)\frac{(b \ - \ a)^2}{2}dt [/itex]

    Okay, well you'd keep going with the right hand term until you've
    calculated the (n - 1) term & then you want the "n"th term

    [itex] \ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + ... \ + \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt [/itex]

    [itex] \ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + ... \ - \ \ f^n (t) \frac{(b \ - \ t)}{(n )!}^{(n)} |^b_a \ - \ \ f^{(n + 1)}(t) dt \frac{(b \ - \ t)}{(n )!}^{(n)} [/itex]

    [itex] \ f(b) \ = \ f(a) \ + \ \ f'(a)(b \ - \ a) \ + \ f''(a)\frac{(b \ - \ a)^2}{2} \ + ... \ + \ f^n (a) \frac{(b \ - \ a)}{(n )!}^{(n)} \ + \ \int_{a}^{b} \ f^{(n + 1)}(t) \frac{(b \ - \ t)}{(n )!}^{(n)} dt [/itex]

    Alright, I think all of that is right. My old calculus book gave some
    horrendous proof that I don't think anyone would bother memorizing
    but this one just falls out of combining I.B.P. with the F.T.C.

    As for the proof that

    [itex] \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt \ = \ \frac{f^n(c)}{n!}(b \ - \ a)^n[/itex]

    [itex] f^n(u) \ = \ m \ \le \ M \ = \ f^n(v) \ [/itex]

    These are constants and we'll squeeze the integral in between them


    [itex] m \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ dt \ \le \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt \ \le \ M \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ dt[/itex]

    [itex] m \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} dt \ \le \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} \ f^n (t) dt \ \le \ M \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} dt[/itex]

    [itex] \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} f^n (u) dt \ \le \ R_n \ \le \ \int_{a}^{b} \frac{(b \ - \ t)}{(n \ - \ 1)!}^{(n - 1)} f^n (v) dt[/itex]

    [itex] \frac{(b \ - \ a)}{n!}^{n} f^n (u) \ \le \ R_n \ \le \ \frac{(b \ - \ a)}{n!}^{n} f^n (v) [/itex]

    So, by the Intermediate Value Theorem ∃ c ∈ (a,b) : [itex] \frac{f^n(c)}{n!}(b \ - \ a)^n[/itex]

    I'm wondering, is there a way to find this "c" numerically because
    neither of the two books I've looked in give you a way to find this?
     
    Last edited: Aug 14, 2010
  5. Aug 14, 2010 #4
    I hope you see how easy & intuitive all of this is, well as for the rest of the
    way the chapter goes it's quite confusing.

    There's a theorem that says

    If ∃ [itex] M_n [/itex] : [itex] | f^n(x) | \ \le \ M_n[/itex] then

    [itex] | \frac{f^n(c)}{n!}(b \ - \ a)^n | \le \ \frac{M_n|b - a|^n}{n!}[/itex]

    I don't even know what this means, I think it means that if there is a
    number such that the "n"th derivative is less than this number then
    it's less than the right hand side.

    Furthermore, I don't know how to use this in practice :(
    The following bits of the chapter all rely on this specific concept & I
    can't advance until I get it.

    Example, compute sin(0.1) to three decimals.

    sin(0.1) ≈ sin(0) + cos(0)•(0.1) - sin(0)•(0.1)²/2 - cos(0)•(0.1)³/6 + sin(0)•(0.1)⁴/24 + cos(0)•(0.1)⁵/120 - sin(0)•(0.1)^6/6! - ...

    sin(0.1) ≈ 0 + 0.1 - 0 - (0.1)³/6 + 0 + (0.1)⁵/120 - 0 - ...

    sin(0.1) ≈ 0 + 0.1 - 0 - (0.1)³/6 + 0 + (0.1)⁵/120 - 0 - ...

    sin(0.1) ≈ 0 + 0.1 - 0 - 0.001/6 + 0 + 0.00001/120 - 0 - ...

    sin(0.1) ≈ 0.1 - 0.001/6 + 0.00001/120 - ...

    That would give you accuracy to 3 decimal places but I don't see
    how the "error" function thing even fits in here or is needed?
    If you know, how would I find "c" in this particular example?

    Oh, and you've written

    [tex]
    \sin (0.1)\appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.9983341666 7
    [/tex]

    at the end of your post, but I see you forgot a space in the \sin (0.1)\appox 0.1 term :tongue:

    [tex]
    \sin (0.1) \appox 0.1 - \frac{(0.1)^3}{3!}+\frac{(0.1)^5}{5!}=0.9983341666 7
    [/tex]

    I was confused just until right now where I clicked on it & quoted it :tongue2: NVM!
     
  6. Aug 14, 2010 #5
    Alright, I think I've got it but there's still a lot of questions...

    If you look at the proof in the second post I have a [itex]M_n[/itex] term.
    That represents the maximum value on the interval & I think the
    formula is saying that you take the maximum possible value of the
    "n"th derivative on the interval you're evaluating and you can safely
    assume that to be an upper bound.

    Because it's a trigonometric function we have a bound of 1 so we
    can safely set [itex]M_n \ = \ 1[/itex]

    Now, if I am to use the error term in the specific example I gave
    I need to find a value of "n" so that I come out with 3 decimal
    places of error. 3 seems like a good term! This is kind of a trial-&-error
    aspect of the whole process right?

    Anyway, if I do this then I'm fine for my example but I have a further
    question, how are you supposed to deal with this in general?

    If you have a strange polynomial function with lots of curves in
    the interval how do you find as suitable [itex]M_n[/itex] ?
    Do you just use the normal calculus process of finding max & min
    on this seperate term?

    Is it not just a hell of a lot easier to determine the "c" term & use that?
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook