yego.me
💡 Stop wasting time. Read Youtube instead of watch. Download Chrome Extension

Quadratic approximation example


9m read
·Nov 11, 2024

When we last left off in the riveting saga of quadratic approximations of multivariable functions, we were approximating a two-variable function f of x, y, and we ended up with this pretty monstrous expression. Because it's written in its full abstract form, I almost feel like it looks more monstrous than it needs to. So I'm going to go ahead and go through a specific example here.

Just to remind you of kind of what all these terms are, how there's actually kind of a pattern to what's going on. This here represents, you could think of it as the constant term, where, you know, this is just going to evaluate to some kind of number. These two terms are what you might call the linear term—linear because if you actually look, the only places where the variable x and y comes up is here, where it's just being multiplied by a constant, and here, where it's just being multiplied by a constant.

So it's just variables times constants in there. And then all of this stuff at the end, which is kind of the whole essence of a quadratic approximation, where you start to have things like you get an x squared and you get like x gets to be multiplied by y—all of this stuff is the quadratic term. Although it seems like a lot now, you'll see in the context of an actual example, it's not necessarily as bad as it seems.

So let's say we're looking at the function f of x, y, and let's say it's going to be e to the x divided by 2 multiplied by sine of y. This is our multivariable function, and let's say we want to approximate this near some kind of point. I'm going to choose a point that's, you know, something that we can actually evaluate these at. So like x, it would be convenient if that was 0, and then y, I'll go with pi halves because that's something where I'll know how to evaluate sine and where I'll know how to evaluate its derivatives, things like that.

So we're trying to approximate this function near this point. Now first things first, we're just going to need to get all of the different partial derivatives and second partial derivatives; we know we're going to need them. So let's just kind of start working it through and figuring out what all of them are.

So let's start with the partial derivative with respect to x. So this is also a function of x, y, and we look up at the original function. The only place where x shows up is in this e to the x over two. The derivative of that is one half; we bring down that one half times e to the x over two, and this is being multiplied by something that looks like a constant as far as x is concerned, sine of y.

Now when we do the partial derivative with respect to y, what we get is this first part just looks like a constant, so we kind of keep that constant there as far as y is concerned, and the derivative of sine is cosine, cosine of y. Then now we—let's start taking the second partial derivative.

So I'll start by doing the one where we take the partial derivative with respect to x twice. Now here, I'll actually do this in a different color—what lets do, like, yellow just to make clear which ones are the second partial derivatives. So partial with respect to x twice, also a function of x, y like all of these guys.

Now let's look up the original partial derivative with respect to x, and we're now going to take its derivative again with respect to x. This is the only place where x shows up; that one half kind of comes down again, so now it's going to be one-fourth times e to the x over 2, and we just keep that sine of y because it looks like we're just multiplying by a constant, sine of y.

Next, we'll do the mixed partial derivative where you do first with respect to x, then with respect to y—or you could do it the other way because with almost all functions, it kind of doesn't matter which order you take the two. So I'll go ahead and just look at the one that was with respect to x, and now let's think of its derivative with respect to y. This whole one-half e to the x halves looks like a constant; the derivative of sine of y is cosine of y.

So we take that constant, the one-half e to the e to the x halves, and then we multiply it by the derivative of sine of y which is cosine of y. Finally, we take the second derivative, second partial derivative with respect to y twice in a row, so f with respect to y twice in a row. For this one, let's take a look at the partial derivative with respect to y.

This part is the only part where y shows up; the derivative of cosine is negative sine, and then e to the x halves just still looks like a constant. So we bring that negative out front, that constant e to the x halves, and it was negative sine, so that negative went out front, sine of y.

So that's all of the partial differential information that we're going to need. Now we know we’re going to need to evaluate all of these guys—all of these partial derivatives—at the specific point because if we go up and look at the original function that we have, we're going to need to evaluate f at this point, both of the partial derivatives at this point, and the second partial derivatives.

Oh, I'm realizing actually that I made a little bit of a mistake here; this should be one-half out in front of each of these guys. That should be plus one-half of this second partial derivative and one-half of this second partial derivative. The mixed partial derivative is still one, but these guys should have a one-half—that was a mistake on my part.

In another case, though, we're going to need to evaluate all of these guys. So if we go back down, let's just start plugging in the point 0 and pi halves to each one of these. So the function itself when we plug in 0, e to the 0 is 1, and sine of pi halves is also 1. So this entire thing just comes to 1.

If we do this for the next one, again, e to the e to the 0 is going to be 1, sine of y is also going to be one, but now we have that one-half sitting there, so that will end up as one-half. If we look at the partial derivative with respect to y, cosine of pi halves is zero, so this entire thing is going to be zero.

Moving right along, if we do, let's take a look at the second partial derivative with respect to x, again e to the zero will be one, and sine of pi halves will be one, so this ends up just being that one-fourth. The mixed partial derivative here, if we have one-half, by the pattern, starting to continue we’ve got the one; this one's actually zero. So cosine of pi halves is zero, so the whole thing will be zero, and then the last one— it’ll be negative 1 times that 1, again for sine of pi halves is 1.

So all of that just comes out to be negative 1. I mean, I kind of chose a convenient example, right, where all the derivatives look very similar to the thing itself, which is actually pretty common. So we get to leverage a lot of the work that we did earlier.

Now we have these six different constants since kind of can't keep them all on the screen at the same time, but we've got this six, six different constants. So now we just plug each one of these into the quadratic approximation.

So if we make our quadratic approximation of our function, the first term is that constant term, so we take a look up, and we say where does f of x, y go at this point, and it'll just be 1. I'm going to have to do a lot of scrolling back and forth here; there's a lot of text to deal with. I mean, the next thing is going to be something times x minus, you know, the x coordinate of our specified point, and that something is the first derivative with respect to x, so that's going to be one-half.

So coming back down here, we've got one-half, and then, similarly, we're going to have something multiplied by y minus the y coordinate of the point about which we are approximating, and for that, we take a look at the partial derivative with respect to y, which was just 0. So that's pretty convenient; that's just going to end up being 0.

Then for the second partial derivative terms—maybe I'll actually be able to keep it on the same screen here—we're going to have something multiplied by x minus, you know, its coordinate squared, and that something is whatever the partial derivative with respect to x twice is, which is one-fourth. So we go ahead and plug in one-fourth.

For the mixed partial derivative, I'll put it down here; it'll be something multiplied by, you know, x minus its constant and then y minus that pi halves, and that something is the mixed partial derivative, which in this case is zero.

When I'm realizing I made the same mistake again—it's not one-fourth, it's one-half. For the same reason that I made a mistake up here earlier, where it's actually half multiplied by this second partial derivative and one-half by the second partial derivative there, I guess I keep forgetting that good lesson, I suppose.

That's an easy thing to forget if you find yourself computing one of these. Where I'll put it in here, multiply that guy by one-half. It’s similar to a Taylor expansion in single-variable calculus, where you kind of have to remember what that squared term would be has a one-half associated with it.

So for that same reason now we're going to have—and this time I won't forget; it will be one-half multiplied by something multiplied by the y minus pi halves minus that y coordinate of the point we're approximating near, and this time that something is negative one. So we can kind of plug in here negative one.

Now this is something we can simplify quite a bit because that one stays there. One-half of x minus zero, that's just x halves. This whole part cancels out to zero, so there's nothing there. Over here, we have half times the fourth, one-eighth times x squared, so that's x squared divided by eight. This mixed partial derivative term is zero, so that's pretty nice.

Then this last term here is just negative one-half, so let's see—I’ll write it down as negative one-half times y minus pi halves squared. So that is the quadratic approximation, and you can see this actually feels like a quadratic function.

We've got, you know, up to x squared and up to y squared, and there's a sense in which this is a simpler function. I mean, it looks like it's got more terms than the original one, which was e to the x halves sine of y, but if it's, you know, if it's a computer that needs to compute these things, for example, it's much easier to deal with polynomials. That’s a faster thing to do.

Also, for theoretical purposes, it can be nice to deal with just a quadratic polynomial to make conclusions about things. We'll see that in the context of something called the second partial derivative test. But just to get a feel for what this means, let's pull up the graph of the relevant functions.

So this here is the graph of the original function e to the x halves times sine of y, and the point that we're approximating near was where x equals zero. So let's see how we get oriented: x is equal to zero, and then y is equal to pi halves, so this is the point we're approximating near.

The quadratic approximation, when you plug everything in, has a graph that looks like this white surface here. So if I get rid of that original graph, this is how we're approximating the function near that point. And that does a pretty good job, right? Because even as you step pretty far away from that point, it's pretty closely hugging the original surface.

If you go very far away, you know it certainly doesn't get the oscillating nature of that sine component, and the exponential component grows faster than the quadratic one. But nearby, this actually gives a very good feel for the shape of the graph.

Again, later on, we'll see how this is a pretty useful theoretical tool for drawing conclusions about qualitative features of the shape of the graph. The fact that this looks kind of like a saddle is going to end up being important in certain contexts.

Before we get to any of that, in the next couple videos, I'm going to talk about a simpler, or rather a more generalizable form of writing down this quadratic approximation using vector notation. Because right now, we're just limited to, you know, two variables, and you can imagine how monstrous this might look if you're dealing even just with a three-variable function, right? Think of all the different possible second partial derivatives of a three-variable function or a four-variable function; it would quickly get out of hand.

But there is kind of a nice general way to write all of these. So with that, I will see you next video.

More Articles

View All
Should You Follow Your Passion? – Dalton Caldwell and Michael Seibel
Guess what gives you passion? You want to hear the secret? Guess what keeps you attached to an idea? That damn thing — working, success, users, revenue numbers — that makes a lot of these folks that have no particular ideas suddenly care a lot more when t…
Robinhood REVEALS Their Sneaky Business Model... (Robinhood IPO Filing)
Well, a couple of weeks ago, the commission-free trading app Robinhood submitted their S1 filing to the SEC, which is the initial registration form for new securities based in the US. What this means is that yes, Robinhood is gearing up for their IPO, whi…
Alan Watts and the Illusion of Time
When I started this YouTube channel, I became fixated on the day it would succeed. I stopped going out with friends and spent almost every waking moment working towards and dreaming about the future. When I did manage to go out with friends, I spent all m…
Estimating multi-digit addition and subtraction word problems | Grade 5 (TX TEKS) | Khan Academy
We’re told Minley has 158,159 flight points. About how many total flight points does Minley have now? So why don’t you pause this video and have a go at it? And remember, they don’t want you to figure out the exact number; they just say about how many. So…
Most psychopaths have these 3 characteristics
When I’ve assessed children, adolescence, and adults for psychopathy, there are certain things I look for that suggest to me the person is genuinely psychopathic. But I think it could be useful for people to know. The first one is that they tend to be an…
Ego Is a Veneer for Profound Weakness | Ryan Holiday | Big Think
One of the things that psychologists talk about is threatened egotism, what happens with someone who has a very strong sense of ego is challenged in some fundamental way. So you can take – one of the stories I tell in the book that I think is interesting…