If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Quadratic approximation formula, part 1

How to create a quadratic function that approximates an arbitrary two-variable function. Created by Grant Sanderson.

Want to join the conversation?

Video transcript

- [Voiceover] So, our setup is that we have some kind of two variable function f of x, y, who has a scaler output, and the goal is to approximate it near a specific input point, and this is something I've already talked about in context of a local linearization, and I've written out the full local, the full local linearization, hard words to say, local linearization in its most abstract and general form, and it looks like quite the beast, but once you actually break it apart, which I'll do in a moment, it's, it's not actually that bad. And the goal of this video is gonna be to extend this idea and it'll literally be just adding terms onto this formula to get a quadratic approximation. And what that means is, we're starting to allow ourselves to use terms like x squared, x times y, and y squared. And quadratic basically just means any time you have two variables multiplied together. So here you have two Xs multiplied together, here it's an x multiplied with a y, and here y squared, that kind of thing. So let's take a look at this local linearization. It seems like a lot, but once you actually kind of go through term by term, um, you realize it's a relatively simple function, and if you were to plug in numbers for the constant terms, it would come out as something relatively simple. Cause this right here where you're evaluating the function at this specific input point, that's just gonna be some kind of constant. That's just gonna output some kind of number. And similarly, when you do that to the, the partial derivative, this little f of x means partial derivative at that point, you're just getting another number. And over here, this is also just another number, but we've written it in the abstract form so that ah, you can see what you would need to plug-in for any function and for any possible input point. And the reason for having it like this, the reason that it comes out to this form is because of a few important properties that this linearization has. Let me move this stuff out of the way. We'll get back to it in a moment, um, but I just wanna emphasize a few properties that this has because it's gonna be properties that we want our quadratic approximation to have as well. First of all, when you actually evaluate this function at the desired point, at x knot, y knot, what do you get? Well, this constant term isn't influenced by the variable, so you'll just get that f evaluated at those points x knot, y knot. And now the rest of the terms. When we plug-in x here, this is the only place where you actually see the variable. Maybe that's worth pointing out, right? We've got two variables here and there's a lot going on, but the only places where you actually see those variables show up where you have to plug-in anything, um, is over here and over here. When you plug-in x knot for our, our initial input, this entire term goes to zero, right? And then similarly when you plug in y knot over here, this entire term is gonna go to zero, which multiplies out to zero for everything. So what you end up with, you don't have to add anything else. This is just a fact, and this is an important fact cause it tells you your, your approximation for the function at the point about which you are approximating, actually equals the value of the function at that point. So that's very good. But we have a couple other important facts also because this isn't just a constant approximation, this is doing a little bit more for us. If you were to take the partial derivative of this linearization with respect to x, um, what do you get? What do you get when you actually take this partial derivative? Well, if you look up at the original function this constant term is nothing, so that just corresponds to a zero. Over here, this entire thing looks like a constant multiplied by x minus something, and if you differentiate this with respect to x, what you're gonna get is that constant term, which is the partial derivative of f evaluated at our, our specific point. And then the other term has no Xs in it, it's just a y, which as far as x concerned is a constant. So this whole thing would be zero. Which means the partial derivative with respect to x is equal to the value of the partial derivative of our original function with respect to x at that point. Now notice, this is not saying that our linearization has the same partial derivative as f everywhere, it's just saying that its partial derivative happens to be a constant and the constant that it is, is the value of the partial derivative of f at that specific input point. And you can do pretty much the same thing, and you'll, you'll see that the partial derivative of the linearization with respect to y is a constant, and the constant that it happens to be is the value of the partial derivative of f evaluated at that desired point. So these are three facts. You know the, the value of the linearization at the point, and the value of its two different partial derivatives. And these kind of define the linearization itself. Now what we're gonna do for the quadratic approximation is take this entire formula, and I'm just literally gonna copy it here, and then we're gonna add to it so that the second partial differential information of our approximation matches that of the original function. Okay, that's kind of a mouthful, but it'll become clear as I actually, um, as I actually work it out. Now, let me just kinda clean it up at least a little bit here. Um, so what we're gonna do is we're gonna extend this, and I'm gonna change its name because I don't want it to be a linear function anymore. What I want is for this to be a quadratic function, so instead, I'm gonna call it q of x, y. And now we're gonna add some terms, and what I could do, what I could do is add, you know, a constant times x squared, since that's something we're allowed, plus some kind of constant times x, y and then another constant times y squared. But the problem there, is that, if I just add these as they are, then it might mess things up when I plug-in x knot and y knot, right? Well it was very important that when you plug-in those values, that you get the original value of the function, and that the partial derivatives of the approximation also match that of the function. And that could mess things up, because once you start plugging in x knot and y knot over here, that might actually mess with the value. So we're basically gonna do the same thing we did with the linearization, where we put in, every time we have an x we kind of attach it, we say x minus x knot, just to make sure that we don't mess things up when we plug-in x knot. So instead, instead of what I had written there, what we're gonna add as our quadratic approximation is some kind of constant, and we'll fill in that constant in a moment, times x minus x knot squared, and then we're gonna add another constant multiplied by x minus x knot times y minus y knot and then that times yet another constant, which I'll call c multiplied by y minus y knot squared. All right, this is quite a lot going on. This is a heck of a function and these are three different constants that we're gonna try to fill in, um, to figure out what they should be to most closely approximate the original function f. Now the important part of making this x minus x knot and y minus y knot is that when we plug-in here, when we plug-in, you know, x knot for our variable x and when we plug-in y not for our variable y, all of this stuff is just gonna go to zero and it's gonna cancel out. And moreover, when we take the partial derivatives, all of it's gonna go to zero as well. And, and we'll see that in a moment, maybe I'll just actually show that right now. Or rather, I think I'll call the video done here and then start talking about how we fill in these constants in the next video. So I will see you then.