< Return to Video

Visualizing Taylor Series Approximations

  • 0:01 - 0:03
    I've talked a lot
    about using polynomials
  • 0:03 - 0:06
    to approximate functions, but
    what I want to do in this video
  • 0:06 - 0:08
    is actually show you that
    the approximation is actually
  • 0:08 - 0:09
    happening.
  • 0:09 - 0:12
    So right over here-- and I'm
    using WolframAlpha for this.
  • 0:12 - 0:13
    It's a very cool website.
  • 0:13 - 0:15
    You can do all sorts of crazy
    mathematical things on it.
  • 0:15 - 0:21
    So WolframAlpha.com-- I got this
    copied and pasted from them.
  • 0:21 - 0:24
    I met Steven Wolfram at a
    conference not too long ago.
  • 0:24 - 0:24
    He said yes, you
    should definitely
  • 0:24 - 0:26
    use WolframAlpha in your videos.
  • 0:26 - 0:26
    And I said, great.
  • 0:26 - 0:27
    I will.
  • 0:27 - 0:29
    And so that's what
    I'm doing right here.
  • 0:29 - 0:30
    And it's super useful,
    because what it does
  • 0:30 - 0:32
    is-- and we could
    have calculated
  • 0:32 - 0:33
    a lot of this on
    our own, or even
  • 0:33 - 0:34
    done it on a graphic calculator.
  • 0:34 - 0:37
    But you usually can do it just
    with one step on WolframAlpha--
  • 0:37 - 0:44
    is see how well we can
    approximate sine of x using--
  • 0:44 - 0:46
    you could call it a
    Maclaurin series expansion,
  • 0:46 - 0:49
    or you could call it a
    Taylor series expansion--
  • 0:49 - 0:52
    at x is equal to 0 using
    more and more terms.
  • 0:52 - 0:54
    And having a good
    feel for the fact
  • 0:54 - 0:59
    that the more terms we add, the
    better it hugs the sine curve.
  • 0:59 - 1:03
    So this over here in
    orange is sine of x.
  • 1:03 - 1:07
    That should hopefully look
    fairly familiar to you.
  • 1:07 - 1:08
    And in previous
    videos, we figured out
  • 1:08 - 1:12
    what that Maclaurin
    expansion for sine of x is.
  • 1:12 - 1:15
    And WolframAlpha does
    it for us as well.
  • 1:15 - 1:17
    They actually calculate
    the factorials.
  • 1:17 - 1:22
    3 factorial is 6, 5 factorial
    is 120, so on and so forth.
  • 1:22 - 1:23
    But what's interesting
    here is you
  • 1:23 - 1:26
    can pick how many of
    the approximations
  • 1:26 - 1:27
    you want to graph.
  • 1:27 - 1:30
    And so what they did
    is if you want just one
  • 1:30 - 1:32
    term of the
    approximation-- so if we
  • 1:32 - 1:33
    didn't have this whole thing.
  • 1:33 - 1:37
    If we just said that our
    polynomial is equal to x,
  • 1:37 - 1:38
    what does that look like?
  • 1:38 - 1:40
    Well, that's going to be
    this graph right over here.
  • 1:40 - 1:42
    They tell us which
    term-- how many terms we
  • 1:42 - 1:45
    used by how many dots there are
    right over here, which I think
  • 1:45 - 1:47
    is pretty clever.
  • 1:47 - 1:53
    So this right here, that is the
    function p of x is equal to x.
  • 1:53 - 1:54
    And so it's a very
    rough approximation,
  • 1:54 - 1:56
    although for sine of x,
    it doesn't do a bad job.
  • 1:56 - 2:00
    It hugs the sine curve
    right over there.
  • 2:00 - 2:04
    And then it starts to veer
    away from the sine curve again.
  • 2:04 - 2:05
    You add another term.
  • 2:05 - 2:09
    So if you have the x minus
    x to the third over 6.
  • 2:09 - 2:13
    So now you have two
    terms in the expansion.
  • 2:13 - 2:17
    Or I guess we should say we
    were up to the third-order term,
  • 2:17 - 2:19
    because that's how their
    numbering the dots.
  • 2:19 - 2:21
    Because they're not talking
    about the number of terms.
  • 2:21 - 2:23
    They're talking about
    the order of the terms.
  • 2:23 - 2:25
    So they have one
    dot here, because we
  • 2:25 - 2:28
    have only one first-degree term.
  • 2:28 - 2:30
    When we have two
    terms here, since we--
  • 2:30 - 2:32
    when you do the
    expansion for sine of x,
  • 2:32 - 2:34
    it doesn't have a
    second-degree term.
  • 2:34 - 2:40
    We now have a third-degree
    polynomial approximation.
  • 2:40 - 2:41
    And so let's look
    at the third-degree.
  • 2:41 - 2:43
    We should look for three dots.
  • 2:43 - 2:44
    That's this curve
    right over here.
  • 2:44 - 2:47
    So if you just have
    that first term,
  • 2:47 - 2:48
    you just get that straight line.
  • 2:48 - 2:52
    You add the negative x to
    the third over 6 to that x.
  • 2:52 - 2:57
    You now get a curve
    that looks like this.
  • 2:57 - 3:01
    And notice it starts hugging
    sine a little bit earlier.
  • 3:01 - 3:03
    And it keeps hugging
    it a little bit later.
  • 3:03 - 3:05
    So once again, just
    adding that second term
  • 3:05 - 3:07
    does a pretty good job.
  • 3:07 - 3:09
    It hugs the sine
    curve pretty well,
  • 3:09 - 3:11
    especially around
    smaller numbers.
  • 3:11 - 3:13
    You add another term.
  • 3:13 - 3:18
    And now we're at an order five
    polynomial, right over here.
  • 3:18 - 3:23
    So x minus x to the third over
    6 plus x to the fifth over 120.
  • 3:23 - 3:25
    So let's look for the five dots.
  • 3:25 - 3:27
    So that's this one right over
    here-- one, two, three, four,
  • 3:27 - 3:28
    five.
  • 3:28 - 3:30
    So that's this curve
    right over here.
  • 3:30 - 3:34
    And notice it begins hugging
    the line a little bit earlier
  • 3:34 - 3:36
    than the magenta
    version, and it keeps
  • 3:36 - 3:38
    hugging it a little bit longer.
  • 3:44 - 3:46
    Then it flips back up like this.
  • 3:46 - 3:47
    So it hugged it a
    little bit longer.
  • 3:47 - 3:50
    And you can see I'll keep going.
  • 3:50 - 3:52
    If you have all these
    first four terms,
  • 3:52 - 3:56
    it gives us a seventh
    degree polynomial.
  • 3:56 - 3:58
    So let's look for the
    seven dots over here.
  • 3:58 - 3:59
    So they come in just like this.
  • 4:02 - 4:06
    And then once again, it hugs the
    curve sooner than when we just
  • 4:06 - 4:07
    had the first three terms.
  • 4:07 - 4:13
    And it keeps hugging the
    curve all the way until here.
  • 4:13 - 4:14
    And then the last one.
  • 4:14 - 4:16
    If you have all of these
    terms up to x to the ninth,
  • 4:16 - 4:17
    it does it even more.
  • 4:17 - 4:18
    You start here.
  • 4:18 - 4:20
    It hugs the curve
    longer than the others.
  • 4:20 - 4:21
    And goes out.
  • 4:21 - 4:22
    And if you think about
    it, it makes sense,
  • 4:22 - 4:26
    because what's happening here is
    each successive term that we're
  • 4:26 - 4:29
    adding to the expansion,
    they have a higher degree
  • 4:29 - 4:35
    of x over a much, much,
    much, much larger number.
  • 4:35 - 4:38
    So for small x
    value-- so when you're
  • 4:38 - 4:41
    close to the origin
    for small x values,
  • 4:41 - 4:44
    this denominator is
    going to overpower
  • 4:44 - 4:46
    the numerator, especially
    when you're below 1.
  • 4:46 - 4:48
    Because when you
    take something that
  • 4:48 - 4:50
    has absolute value
    less than 1 to a power,
  • 4:50 - 4:52
    you're actually
    shrinking it down.
  • 4:52 - 4:54
    So when you're
    close to the origin,
  • 4:54 - 4:56
    these latter terms
    don't matter much.
  • 4:56 - 4:59
    So you're kind of
    not losing some
  • 4:59 - 5:01
    of the precision of some
    of the earlier terms.
  • 5:01 - 5:03
    When these tweaking
    terms come in,
  • 5:03 - 5:06
    these come in when
    the numerator can
  • 5:06 - 5:09
    start to overpower
    the denominator.
  • 5:09 - 5:15
    So this last term, it starts
    to become relevant out here,
  • 5:15 - 5:20
    where all of a sudden x to the
    ninth can overpower 362,880.
  • 5:20 - 5:22
    And the same thing
    on the negative side.
  • 5:22 - 5:24
    So hopefully this
    gives you a sense.
  • 5:24 - 5:27
    We only have one, two,
    three, four, five terms here.
  • 5:27 - 5:28
    Imagine what would
    happen if we had
  • 5:28 - 5:31
    an infinite number of terms.
  • 5:31 - 5:32
    I think you get a
    pretty good sense
  • 5:32 - 5:37
    that it would kind of hug the
    sine curve out to infinity.
  • 5:37 - 5:39
    So hopefully that makes you feel
    a little bit better about this.
  • 5:39 - 5:42
    And for fun, you
    might want to go type
  • 5:42 - 5:44
    in-- you can type in
    Taylor expansion at 0
  • 5:44 - 5:47
    and sine of x, or Maclaurin
    expansion or Maclaurin
  • 5:47 - 5:50
    series for sine of x,
    cosine of x, e to the x,
  • 5:50 - 5:52
    at WolframAlpha.com.
  • 5:52 - 5:55
    And try it out for a bunch
    of different functions.
  • 5:55 - 5:58
    And you can keep adding
    or taking away terms
  • 5:58 - 6:01
    to see how well
    it hugs the curve.
Title:
Visualizing Taylor Series Approximations
Description:

more » « less
Video Language:
English
Team:
Khan Academy
Duration:
06:01

English subtitles

Revisions Compare revisions