Welcome to the video on the Taylor Theorem and

Taylor polynomials.

And we've actually already touched on this.

When we did the videos on approximating functions with

polynomials, we used Maclaurin series, which is actually a

special case of the Taylor polynomial or the

Taylor Theorem.

And we just pick, we approximate the function

around x equals 0 when we did the Maclaurin series.

But in general, you could approximate a function

around any value.

And if you do it around something other than 0, it's

kind of the more general case, and we're dealing

with the Taylor polynomial.

So what is that?

Let me just write the definition down, and then we'll

do a couple of examples, and then we'll graph it to

get the intuition.

So a Taylor polynomial says that if I have a differentiable

function f of x, and I want to approximate it with a

polynomial at c, so at some value of x equals c, I want to

approximate this function.

So let me just draw a quick and dirty one, and we'll actually

draw an accurate one later.

So let's say that that's my axes, this is my

function f of x.

So I could pick some value c, some value x is equal to

c, maybe it's right there.

So that's c.

And I would want to approximate it, I would want to create a

polynomial that can approximate the function around this point.

And the Taylor Theorem tells us that the Taylor polynomial to

approximate this is, and then I'll give you the intuition

for it in a second.

p of x.

And this looks really complicated, but when you

do some examples, you'll see it's not so bad.

p of x is equal to f of c plus f prime of c times x minus c

plus f prime prime of c over, they say 2 factorial, which is

just 2, but OK, I'll write 2 factorial.

They do that so that you see the pattern that emerges.

This is over 1 factorial, really, and this is over

0 factorial, really.

Times x minus c squared plus, I'm already running out of

space, f the third derivative, I think at this point people

just write a 3 in parentheses, of the function evaluated at c

over 3 factorial times x minus c to the third, and you could

just keep adding terms.

You could go on like this for infinity.

But let me give you the intuition of what this is.

Let me just show you, just to hit the point home.

Then you could plus the fourth derivative of the function

evaluated at c times over 4 factorial times x minus

c to the fourth.

Now what's the intuition?

So first of all, what happens to this polynomial at c?

So what's p of c?

p of c is equal to-- if p of c, everywhere where you see an x

here, you have to put a c, right?

So this term would be c minus c, so that would go to

zero, or it would be 0.

This term would be c minus c, it would be 0.

This term would be c minus c, so it would be 0.

This term would be c minus c, 0.

And all you'd be left with is this f of c.

So great.

We already know that, at least at the value of c, the

polynomial is equal to the function.

So it's going to intersect this line.

Right?

And actually, if we just had a Taylor polynomial with just

that first term, what would it look like?

Well, it would just be a horizontal line right there.

So it would be a pretty bad approximation.

But, what does this second term do us?

Because we know that if we just evaluated c.

All these other terms just drop out.

So what do they do for us?

Well, the second term actually ensures that the derivative of

this polynomial, evaluated at c, is equal to the derivative

of this function, evaluated at c.

What do I mean there?

Well, what's p prime of x?

p prime of x is equal to, well, this is just a constant term.

It might look like a function, but it's a function evaluated

at c, so it's just a constant term.

And so, that's 0.

And then, what is this?

What's the derivative of this?

Well, we could use, this is a constant term, and the

derivative of this is just 1.

So you could almost just view this as f prime of c times x,

minus f prime of c times c which is a constant, whatever.

So the derivative of this expression is f of c, and then

plus the derivative of this expression, and that's

equal to what?

2 times 2 divided by 2 factorial, which is just 1.

So it's f prime prime of c, times x minus c, and

then plus, let's see.

3 over 3 factorial, so that's 3 over 6, we'll just have

a 2 in the denominator.

f prime prime prime of c over, what was it, 2

times x minus c squared--

And you don't have to worry about all of this.

And then, we could just keep going.

But I wanted just to show you one thing.

What is t prime at c?

t prime at c.

What is the derivative of this polynomial when

you evaluate it at c?

Well, when you put c into this derivative function, all these

other terms are going to drop off, and you're just

left with this one.

Right?

Because this x minus c-- sorry, just had some walnuts.

I should have some water with it.

If you put the c here, they drop out.

So the derivative of this function evaluated at c,

is equal to f prime of c.

So as you can see, what's neat about this Taylor polynomial

is, it's equal to the function at c, its derivative is equal

to the function at c, the second derivative is equal

to the function at c.

And every term you add to the Taylor polynomial actually

makes it so that that term, derivative, of the polynomial

evaluated at c, is equal to the function.

Hope I didn't confuse you.

The big picture is, the whole thinking behind, I guess, what

Taylor thought of, was, wow.

If this function is infinitely differentiable, meaning that I

can take the first, second, third, fourth, you know, all

the way to infinity derivative of this function, I could

construct a polynomial like this, and i can just keep going

by adding more and more terms, so that this polynomial's, you

know, zeroth derivative, which is means the function, the 0,

first, second, third, fourth, all of this polynomial's

derivatives are going to be equal to the function.

At least around that point.

And actually, we'll see that there's actually a whole class

of functions, that the Taylor polynomial, if you were to take

the infinite series, is actually equal to that

function at all points.

But anyway.

And actually, I talk a little bit about that when I prove

that e to the i pi is equal to negative 1, which to me was the

most amazing result in mathematics.

Whatever, whatever.

This might have been a little confusing for you, so let's

do a particular example.

The particulars are always the more fun.

I think when you see me do an example, you'll see

that it's not so bad.

I'm even going to erase this fourth term.

So let's approximate, I don't know, cosine of x.

So let's say that f of x is equal to, let me do

it in a different color.

We want to approximate f of x is equal to cosine of access.

And let's pick some arbitrary number.

Let's not pick some number that works well with

trigonometric functions.

Let's pick around, let's say c is equal to 2.

No, 1.

So we're going to approximate cosine of x around 1.

So what is the Taylor approximation, or the

Taylor polynomial?

Well, we could just chug through this one.

p of x, I'll do it in yellow.

p of x is equal to f of c.

So the function evaluated at c is just cosine of 1, right?

plus s prime of c.

Well, what is the derivative of cosine of x?

It's minus sine of x, right?

Minus sine of x, and we want to evaluate it at c.

So it's minus sine of 1, right? c is one, that's

we're approximating around.

Times x minus c.

And then, plus the second derivative of x.

So what's the second derivative?

What's going to be the derivative of minus sine,

which is minus cosine of x?

So it's minus cosine.

But we're evaluating it at c, so there's actually going

to be a number, right?

So c is 1.

Cosine of 1.

Over 2, right?

2 factorial is just 2.

Times x minus 1 squared, oh, sorry, this should

be a one, right?

I said, c is equal to 1.

Times x minus 1 squared.

Let's keep going.

Plus the third derivative, plus, what's the third

derivative of cosine?

Well, it's the derivative of minus cosine, so

that's plus sign.

So plus sine evaluated at 1.

Sine of 1.

Divided by 3 factorial, so that's 6 over 6 times

x minus 3 to third.

Sorry, my brain is really, I ate too many walnuts.

Undo, edit, undo. x minus 1 to the third, right?

And then, let's do one more term, just for fun.

So then we're going to take the fourth derivative, which is the

derivative of the third derivative, so the third

derivative was positive sine, so now we're going

to be plus cosine.

Plus cosine evaluated at 1 over 4 factorial--

what's 4 factorial?

It's 3 factorial times 4.

So over 24.

Times x minus 1 to the fourth.

And we could just keep going.

The fifth derivative over 5 evaluated at 1, over 5

factorial times x minus 1 to the fifth, and just keep

adding, but then it will take us forever, et

cetera, et cetera.

So, what does this thing look like?

And what I'm going to do, is I'm going to show you how

this polynomial develops as we add terms.

So let's see.

I have this graphing calculator that I-- so this thing I

got from, just to give them credit, it's my.hrw.com.

And this is the graph of cosine of x.

So just the first term here.

Cosine of 1.

If we were to just to graph the first term of this polynomial,

what does it look like?

So I'll just type in cosine of 1, and graph it.

So there you go.

Just the first term of the polynomial.

If all of these terms weren't here, the polynomial would

just be a constant, right?

Cosine of one.

And it's a pretty bad approximation, but at least

it equals the function at this point.

So it gives a something.

But let's add some terms.

Let's add the second term to it.

So what was the second term?

It was sine of 1 minus sine of 1 times x minus 1.

Let me add that.

Graph it.

There you go.

So this is neat.

So when you just added 2 terms, what did we say?

The polynomial will be equal to the function at x equals 1.

And now the slope is also equal to the function.

The slope of the polynomial is also equal to the slope of the

function at x is equal to 1.

So this is a better approximation.

At least if we stay pretty close to our chosen c, it's

a decent approximation for the function.

Obviously, if we get far away, out here, this is a horrible

approximation for the function.

But let's keep adding terms.

As you can see, I just want to show you that I'm just

typing in the actual terms.

So let me type in the next term.

just so you believe that I'm doing it.

So the next term, we'll have to see it.

Let me type it in.

So the next term is minus cosine of 1 divided by 2

times x minus 1 squared.

And let me graph it.

OK.

So now, just to show you, I just typed in the second

term, and now let's look at the graph.

Now this is neat, right?

So the first term got us a horizontal line that just

intersected the point at cosine of 1, and it was a really

bad approximation.

Then the second term made sure that at least the first

derivative was the same.

And so then we, the line was just essentially the tangent

line, we only had 2 terms.

Now the third term makes sure that the second derivative of

our polynomial at x equals 1 is equal to the second derivative

of the polynomial of the function.

And notice that this green graph is concave

downwards, right?

Which means that, and so is the function at 1.

So this is this is pretty neat.

We're getting a little bit, so it's kind of approximating

the curve here.

It's getting a little bit better.

Remember when we went out far to the left?

Starting to approximate the function better around here.

It's closer, at least.

Right?

The last time, the line just went up, and here it was a

really bad approximation.

But let's add another term.

Let's add our third term.

Our third term, I can see it, it's right there.

So plus sine of 1 divided by 6 times x minus 1

to the third power.

Just to show you, I just typed it in, right there.

Let me graph it.

That is neat.

Just with three terms on our polynomial, well, actually,

that's the fourth term, officially.

But the first term was essentially-- well,

you get the point.

But we're already starting to approximate this

pretty well, right?

Now the third derivative of the polynomial is equal to the

third derivative of the function at the point x is

equal to 1, and we haven't even studied third derivatives.

That's kind of like the concativity of the

derivative, or whatever.

But as we can see, it approximates the

function even better.

Obviously, though, when we go further away, it starts

to break down again.

But pretty close.

If all you saw is from here to here, it would be

hard to tell them apart.

Let's add that last term we calculated.

And this should be pretty neat.

Let's see.

The last term.

Plus cosine sign of 1 divided by 24.

And notice, every term, the scaling factor, right?

Here's 1, then 1/2, then 1/6, 1/24-- it becomes

a smaller impact on it.

And it only starts to matter as you move really, really far

away from your chosen c.

In this case 1, right.

The further out you go, when you're close to your

point that you've picked.

these other terms don't matter much, right?

Because you're doing 1/24, and then 1 over 5 factorial,

et cetera et cetera.

But as you get further and further away, these terms

become more significant, right?

As x gets further and further away from 1, and then that's

where these start to play in, and you see that in

the approximation.

Anyway, let me graph it.

So cosine of 1 divided by 24 times x minus 1 to the fourth.

Let me graph it.

Even neater!

And if you have some spare time, you might just want to

keep adding terms to this.

So that's all the Taylor polynomial is.

And I realize, this is probably one of longest

videos I've done.

I'm pushing 17 minutes.

It's a little confusing at first, because it gives you

this huge formula, and they give you the c, and you're

like, what is that c, and how do I take the derivative?

But when you actually try to chug through it, you just

have to realize, oh.

All this is, is saying, we are constructing a polynomial that,

at some point c that we've picked, this polynomial's

zeroth, first, second, third, fourth, fifth, and so on-th

derivative is going to be equal to our function.

And actually, if we did 10 terms, or if we did all of the

derivatives, these would start to actually equal each other.

So hopefully that didn't confuse you.

I know when you see the formula at first, it can be kind of

daunting, and especially, sometimes it's even more

daunting when someone even explains it to you.

But hopefully that gave you some intuition.

If it didn't, ignore this video.

See you soon.