📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

The Jacobian Matrix

Christopher Lum40:21

Transcription

Hello everyone and welcome to another video. So today I want to spend a couple of minutes talking about the Jacobian matrix. And I know that name might sound a little bit intimidating, but really the idea behind it is surprisingly simple. We're going to see that the Jacobian matrix is really nothing more than taking the idea of a derivative, extending that to a gradient, and then extending that again to what's known as this Jacobian matrix. And this matrix actually shows up a lot in science and engineering because we're going to see at the end of the day what this thing does is it allows us a way to calculate and quantify the sensitivity of a particular function element to pertabbations in a given independent variable. So that might sound like a mouthful but if we take uh a crawl walk run approach to this I think you'll see that uh this is actually pretty pretty consumable.

So to start with our crawl phase, let's jump back to the idea of a derivative, right? Derivative is surprisingly simple, right? We all remember this from high school calculus. If we have some function f like this and it takes in some input x and does something to it to produce an output. In this case, what it does is subtracts two from that value. It raises it to the power three and then multiplies by three. Right? So again you can think about this from a functional perspective as a function which takes in a single independent variable x and it spits out f(x) right? Okay, so you might ask yourself, okay, this is what this function is. We can easily plot this. This is nothing uh earthshattering, right? I'll plot f(x) versus x, right? And it looks something like this, okay?

And now the next logical step might be to ask, what is the derivative of this function f? And again, don't overthink this, right? You can break out your old high school calculus textbooks, right? And you can say, okay, the derivative of this function, it's just this, right? Um, now the only thing that maybe we should mention is we're going to write this like this, right? The function f, it's only a function of a single variable. So I don't need partial symbols. I can just use a d, right? Because there it's only a function of one variable. So df/dx is just this. And what I want to make a note of is notice here, right? That this is still a function of the independent variable or the input x. Right? So to make this explicit, what I want to write, and a lot of times you'll see this is something like this, right? I'm going to add this notation just to remind ourselves that the derivative of the function, it's still potentially a function of the independent variable. And in fact, when you plot this, I think you'll see that yeah, that's definitely the case. It's just some other function of x, right? As x changes, the derivative value changes, right? And again, nothing earthshattering because what this is doing, right, is everyone knows that the derivative is basically telling you the slope of the original function f, right?

So, if I look at different points along this or a different input values of x, like let's say I choose some x value out here like at uh I don't know, -0.75, right? So what this derivative is telling me, and sorry I didn't draw this very well. I should have probably extended this a little bit more. All right, is what this is telling me is I can read this value here, and that's telling me effectively the slope or how fast is this function f changing at this particular x value. So if I'm sitting here, if the input to this function is 0.75, right? And now I perturb it by some little amount, like let's add on a 0.1, right? What this derivative is telling me is how much is this perturbation basically amplified in the output, right? Because this little 0.1 perturbation here, it's going to result in some type of perturbation in the output, right? So it's basically a specific run is going to produce a rise, right? So you can see this that obviously this sensitivity of this function changes as you change the value of x, right? So for example, if I choose another value, x=2, right, over here, right? Right, we see that it actually doesn't change here, right? The slope of this function is completely flat here, meaning if you're sitting here at two, if the input to this function is now two, right? And you put in a little bit of a 0.1 or the tiniest little input perturbation, you don't expect the output to change at all, right? That's what this is telling you. And again, you can change this. So, let's see. Red. Um, oh, sorry. I probably should have made this green. Sorry. To be consistent with uh, sorry, I I got too excited with the colors. Tell you what, let's leave it like uh, no, let's change this. Let's make this green because later on I do I have another example. Okay, so this should have been green, too, because I want to go red, green, blue, just to kind of be consistent. Okay, there we go. Okay, so there's my green value. And then let's choose a blue value over here. You know, something uh, what did I pick here? 3.25. Right? Here's some other blue value. And again, you can read this up here to get the slope of the function or the sensitivity of the function there, right? So you can now ask yourself, okay, if the function has an input of 3.25 and I put some little tiny perturbation on it, how much does the output change? Right? So again, all the derivative is giving you, right? The derivative. One physical way to think about this is sure, it's the slope of the function, but really physically what that's telling you is how much does the function change when you change the input or you perturb it a little bit away from a given input value, right? That's what this slope is effectively giving you. It's right. It's how sensitive is the function to changes at this particular lo particular location, right? So that's what the derivative tells you. And obviously as we discussed, it changes depending on where x is, right? Okay.

So that's the idea of a derivative. Um, let's extend this idea now to the idea of a gradient. Okay. So remember the idea with the gradient now is let's still go ahead and consider a scalar function. Meaning the function still outputs a single variable, but now you could have potentially multiple inputs or multiple independent parameters or variables feeding into the function, right? So in this case, let's say there are n different inputs or independent variables to this function, x1, x2, all the way down to xn, right? Now, if you remember our previous video where we discussed the gradient, we know that the gradient then of this given function f, which has these inputs, it's just given as this, right? It's written sometime as del f or nabla f. The other alternative notation for this is it's now it's a partial of this function f with respect to this vector x. Okay? And what that actually means, right, is it means again, you got to remember that this vector, this x-bar is a vector, right? There are n independent inputs, right? So what this notation means is it just means the partial of f with respect to x1, stacked on top with partial of f with respect to x2, all the way down, stacked at the bottom with partial of this function f with respect to xn, right? And again, we got to remind ourselves and remember that I and others like the notation that you got to remember that by the time you take these partials, this is likely still a function of the independent variables x. So again, I'm going to put the notation like this, right? So the gradient of f is a function of x. It depends on where you are, just like we saw here, right? Its value depends on what the value of x is. And again, I'm going to put this notation up here as well, right? And actually, what we should probably do is we should put this notation here as well, right? Because every single one of these components is going to be a function of the input variable or the input vector x. All right? So, at the end of the day, you end up with an n by one vector which represents the gradient. Okay? And again, depending on which uh reference you're looking at or what author, some people like to stack it the gradient vector uh uh sorry, stack the vector as a column vector like like I'm drawing here. This is what I prefer. Some other people like it as a row vector. Um, but again, just be careful of what notation is being used and um, be consistent, right? So I like to stack this up vertically. A lot of people do. So you'll see the gradient written as a vertical column vector. Okay?

So that's the idea, right? So again, let's look at a concrete example just to drive this home. In fact, in this gradient video, right, where we discussed this gradient in a little bit more detail, this is the example function that I used. So just to refresh your memory, right? The way we can visualize this again, it's still a scalar function, right? In the sense that it still outputs a single number, right? The way it computes this single number, though, is this function has two inputs. Now it has an x1 and it has an x2, right? Two independent variables or independent parameters, however you want to think about this. These two inputs produce a single output, right? Which is f(x1, x2), right? And here's the algorithm or the formula of how it does this, right? Um, so to compute the gradient of this particular function, right? I'm just going to use my expression or my equation over here. All I got to do is the first entry is the partial of this function with respect to x1, while holding x2 constant or treating x2 as a constant. The second element is the is the exact opposite, right? Right? I'm going to take the partial of this function with respect to x2, while holding x1 constant. So what you end up with here is, I think everyone can see, you can take the partial derivatives of these two. You'll get these two expressions, right? So again, what this in physically means is let's go ahead and um, actually, I'm going to spin a movie over uh of this function on the side. Um, what you're seeing in this picture is the orange surface is obviously this function for a whole bunch of different x1 and x2 values. And as you can see, right, the slopes uh of this function change depending on where you are. So again, maybe what we'll do is, let me use our same red, green, blue idea. So depending, let's choose a red vector x of, in this case, I think what you're seeing here is these red dots. Let me just make sure I've got this correct. Right. I used uh min -3 for x1 and positive 2 for x2. And then the green dot you're seeing here is another x value of, I think this is actually 0, 0. Okay. And then the blue one that I'm drawing on that surface here is 12, 0. Okay. So at these different locations, right, these numbers change, right? So the gradient changes, right? And what you can see from this picture is what the gradient is actually telling us, right? Physically, what comes up, right, is this first element, it's telling you the sensitivity of this function f to changes or perturbations in only x1. So if you move in the x1 direction, right, how much does that or do you expect that to change the output of the function, right? Does the function grow quickly or slowly? Does it go positive or negative, right? That's what this first entry of the gradient is telling you, right? It's the sensitivity of the function to perturbations in the first independent variable, right? The second element of the gradient, right, is is very similar, right? It's the sensitivity of the function to changes/perturbations in x2, considering that you hold x1 constant, right? So again, depending on where you are, if you're at that red, green, or blue dot in that picture, in in the movie you're seeing on the side here, right? You can see that the function changes um at different rates at those different locations and depending if you're moving in the x1 or the x2 direction, right? So that's what the gradient is is measuring, right? So really, if you come back to this idea of the derivative, right? It's nothing more. The gradient is just a multi-dimensional derivative, right? That's all that's telling you, right? Both of these things, right? All these derivatives are telling you, right? Either it's the total derivative here or a partial derivative over here. It's just telling you the sensitivity of the function. How is the output of the function going to change as you change one of these independent parameters? So that's the idea with the gradient. Let's see. Let's let's leave this uh discussion of the gradient up on this side of the board. Let me erase this over here to get a little bit more space because all we're going to do now is extend this idea of the gradient to build the Jacobian matrix.

All right. So now we've got the Jacobian matrix discussion and all the Jacobian matrix is is now instead of dealing with a scalar function, let's talk about using a vector valued function. Meaning that now this function instead of having a scalar output, it has a vector output. So in this case, I've drawn three. And one way to visualize this or to think about this is that this vector valued function, it's nothing more than in this case, three scalar ve uh scalar functions stacked on top of one another, right? So that's all this thing is. You can take a look at this, stack these three up. And now let's call this orange box, right? It's still it's a function which takes two independent variables or two inputs and now outputs three things. Okay? So what we can do is we can just call this now, let's call it f-bar of x-bar, right? Again, the notation here is that this function f, the bar on top, if we contrast that with over here, is the bar on top means that the output, right? This is a vector function in the sense that now there are 1, 2, 3, the output is a vector and the input x is still a vector, just like we had over on this side, we called this f of x-bar, okay? So that's what we've got. It's nothing more than three scalar uh functions stacked on top of one another. So if you want to think about this, we can write this as defining, okay, f-bar of x-bar is our vector valued function, which is nothing more than a certain number, let's call it maybe m, m number of these different scalar functions stacked on top of one another. So you could have f1 of x, f2 of x, all the way down to fm of x, something like this, okay? So that's all this function is, right? The vector value function is nothing more than m scalar functions stacked on top of one another. Okay?

So with this in mind, now we can ask ourselves the exact same question we've been asking ourselves earlier, is how does this function f-bar, how is it sensitive to changes in different parameters or different input variables x1, x2, all the way down to xn? Okay? So that's all the Jacobian matrix is. So the Jacobian matrix is just a partial set of derivatives asking how do each one of these scalar functions f_sub_1, f_sub_2, all the way down to fm change as a function of how these input variables uh input parameters change. So if you think about this, stare at this first one right here, okay? This is exactly what we just did, correct? So all that we want is basically the gradient of function f_sub_1. That already told us how function f_sub_1 is sensitive to perturbations in x1 and x2. Correct? So all you need is uh, again, let me use this other notation. I'm just going to write df-bar/dx-bar. Right? Same same idea, except now I've got instead of a scalar f, I've got a vector f. And all this thing is, okay, is we can stack up and put the gradient in the first row. Now remember, I was stressing earlier that in in this notation, we are considering the gradient to be a column vector. What we're going to do right here is we're going to knock this over on its side and actually make it a row vector. Okay? So again, you just got to be a little careful depending on what notation or what reference you're using. So in this case, what we want to write here is we want the gradient of f1 of x. Okay? Then you have the gradient of f2 of x, all the way down to gradient of fm of x. And again, what we have to do is we have to transpose each one of these to take the column vector, knock it over on its side, make it a row vector like this. Okay? And again, let's make sure and remind ourselves, we're going to use this notation that this Jacobian matrix, it's a function of where the inputs are or what inputs are going into this, right? So, we should use consistent notation just like we did over here with the gradient, right? Because all we see is the Jacobian matrix. It's nothing more than m gradients stacked on top of one another. That's all it is. Okay? And in fact, if we want to be explicit and write this out, let me go ahead and erase some of this. See if we can fit all of this onto one board. Let me get get ourselves a little bit of room. I I think we can make this work. Okay.

So if you look at this long enough, let's go ahead and just get this first row, right? It's nothing more than the gradient of f_sub_1 with resp uh, the gradient of f1, right? And we said the gradient is nothing more than the the partial derivative of the function with respect to each one of the independent parameters. So this is partial of f1 with respect to x1. Okay? And again, let's make a note that this is a function of where you are. Then you have partial of f_sub_1 with respect to x1 and it's still a function of where you are, all the oh sorry, x2, okay, all the way down to partial of f_sub_1 with respect to xn, right? Because there are n independent variables, okay, or n inputs to this function, okay? That's the first row. It's just the gradient of f1 knocked over on its side. So the second is similar, right? It's plus partial of f_sub_2 with respect to x1. Partial of f_sub_2 with respect to x2, all the way down to partial of f_sub_2 with respect to xn. And you repeat this all the way down to the last row, which is now partial of fm with respect to x1. Then you get partial of fm of x with respect to x2, all the way down to partial of fm with respect to xn. There you go. Okay. So what we end up with is this entire thing is now an m by n matrix. Okay? Because we see it's nothing more than m gradient vectors laid out on their side in row vector format. Okay? So that's all the Jacobian matrix is. It's basically a giant matrix of all the mixed partial derivatives of all of these functions. And in fact, maybe what we should do is we should write this down in the sense that the Jacobian matrix we see here, it's an m by n matrix. Okay? But the row i, column j. Okay? What this tells you is it is basically it's the sensitivity, right? It's Whoops. Let me write this down. Sensitivity of function i output, right? To the change in xj, right? So and in fact, maybe the the better way we should have said this, it's really it's the entire function, it's the function f. Let's let's rewrite this maybe in a little bit more clear fashion, right? It's a sensitivity of f-bar's i output to the change in xj. Okay? So if I want to understand how the third output, this third output responds to changes in the first input, okay? That would be located in this Jacobian matrix, row 3, column 1. All right, that's how this works. So again, the Jacobian matrix, it basically tells you the complete sensitivity or all the slopes, if you want to think about it that way, of all of these different scalar functions and how they change. So to help visualize that, maybe let me let me stand over here. I'll try to put a picture over on the other side of the board where you can visualize each one of these. In this case, they're are basically two-dimensional functions, right? In sense that there are two input parameters and each one of them produce a single output. And that's what I'm plotting over on the side. You can see in the red, green, and blue, they're just different surfaces. So, they have different sensitivities depending on how you change x1 and x2. You're you're basically walking in different directions on either the red surface for this first one, the green surface for the second one, or the blue surface for for the bottom one. So all the Jacobian matrix is basically capturing is every single derivative. And as we see, you can be anywhere on that surface depending on what your x1 and x2 values are. So this Jacobian matrix changes depending on the values of x1 and x2. Just like how we saw the gradient vector changes depending on what the inputs were and just like how we saw a derivative changes depending on what its input was. So again, we now see the whole picture, right? We start with the single derivative, we then move and extend that idea to a gradient, and then we move and extend a gradient idea now to the Jacobian matrix. So this is going to be a pretty powerful tool.

Um, some history behind it. The Jacobian matrix, it's named after Carl Gustav Jacob Jacobi. You can see over here, this is what he looked like. He was uh born in 1804, died in 1851. Um, he was a German mathematician who made some pretty fundamental contributions to things like elliptical functions, um, dynamics, which we're actually going to take a look at in just a second, um, differential equations. Uh, in fact, there was a there the the famous name that sometimes you'll hear is the Hamilton-Jacobi equations, which is basically an alternative way to express um equations of motion for dynamic systems. Um, and in fact, a kind of fun note, there's actually a crater on the near side of the moon named after him. And as we see in this case, there's also the Jacobian matrix which is named after him.

So, with that history aside, maybe what we should do is let's let's go get into an example. And in fact, why don't we use this picture we've got right here? We've got these three functions. This is as good of a set of functions as any. Let's go ahead and compute the Jacobian of this function which has two inputs and three outputs. And the way those inputs and outputs are computed are given these three functions. So we have enough information at this point to go ahead and compute the Jacobian matrix by just taking all of these partial derivatives. So let me clear off the board and let's do that next.

All right. So let's go ahead and compute the Jacobian for this orange function. So I've just written it down. Um, as we saw, it's just the the gradient of the first function laid on its side, the gradient of the function of the second function laid on its side, and the gradient of the third function laid on its side. So it's all of these mixed partial derivatives here. So for example, let's look at the one-one element. It's the partial of f_sub_1 with respect to x1, right? So all you got to do is take, here's f1. Take this partial with respect to x1. And as you can see, that gets us what? Just 6x1. So that's this element here, right? And then the one-two element, it's the partial of f_sub_1 with respect to x2. So again, still keep your eye on this first function f1. Take its partial with respect to x2. And you can see that just turns into what? 3x2 squared, which is that element, right? So you just go through this and now moving down to the second row, it's now you'd repeat this operation now for the second function with respect to x1 and you get this, right? By just taking this partial and blah blah blah, right? So at the end of the day, what we see is you end up with this 3x2 matrix, right? And again, it's physical interpretation of what this matrix is, is each element of this matrix, right? It's measuring the sensitivity of the i output to the change in the j input. So in other words, if we look at the input outputs, let me see if I can do this [laughter], right? If I make a little table, if I want to look at what the the sensitivity of the first function output is to the first input variable, that's the one-one element right here, correct? And then this one-two element tells me the sensitivity or the slope effectively of the first function's output to perturbations in the second input, right? And etc., etc. You keep moving down. So the the sensitivity of the second function with respect to the first input is there. And then the sensitivity of the second function to the second input is here. And then similarly, you just kind of you can pick off each element of this matrix, right? And what it's basically telling you, right, is that matrix is fully characterizing every possible combination of the output to input sensitivity, right? So now you can pretty much fully characterize this orange vector valued function. We understand now if you perturb or change the inputs x1 and x2, how is that going to change each one of these three outputs, right? And that is exactly what the Jacobian matrix is giving us, right? So this is a nice abstract mathematical formulation and example.

Um, let's look at an example of how this might show up in an actual engineering application. All right, so let's look at an example of an engineering system, uh, namely a dynamic system. Uh, as many of you know, I'm a controls engineer. And a lot of times the classic example that controls engineers love to look at for a nonlinear um set of ordinary differential equations is a classic pendulum, right? It's just a pendulum which is swinging about some point up here. It has some mass on the end of it, and that's it. It's just swinging. And as we've seen in the past, this admits a set of nonlinear dynamics. To make this a little bit more interesting, um, I've tried to spice up this pendulum a little bit. So let's assume that instead of this just being like a simple boring pendulum, maybe this is a test stand with a two uh, bidirectional rocket engine down here where you can fire the engine in either direction, and that is going to create an a propulsive force um that I'm denoting as F engine. And as this thing is swinging around due to this engine force, there's going to be some drag on it, some aerodynamic drag. So I've denoted this as FD. Okay. Um, as we've seen, there's going to be obviously gravity pulling down on the pendulum, which is going to impart some kind of moment. And then the only other moment we're going to add on this test stand is let's say that there's a brake up here that an operator can turn on and off. So, the operator can really control two things. They control the throttle to the engine that will basically influence this engine force. They can also control the brake between like zero meaning no brake and one meaning full brake or something like that. And that's going to go ahead and control how much it tries to stop this whole test stand from spinning around, right? And again, here's some of the relevant geometry. It's a length L. And then, as you can expect, given the geometry, this moment arm here is L sin theta. Again, this is a pretty standard problem at this point. So, let's just walk through it. And again, some of these details are just I pulled it out of thin air just to kind of illustrate um how this might generate some set of equations of motion. So again, I'm going to assume that the engine thrust is, you know, it's maybe nonlinear depending on the throttle setting between, I don't know, maybe like a negative one means back it up in reverse. A positive one means go forward. But it looks like this. It's some coefficient alpha times U1 cubed. Okay, that's that's the engine thrust. The uh aerodynamic drag, let's just assume that this is something really simple. It's some coefficient times the velocity of the vehicle or this engine. So it's basically it's it's a linear sort of viscous uh type of damping you've got here. So again, velocity you could write that as just L * theta dot. Okay. And then the breaking moment, I, you know, again, I I made this up. It's some breaking coefficient gamma times how much brake is being applied by the operator between 0 and 1. And then it's going to matter how fast it's spinning. If this thing is spinning quicker, the brake is going to be more effective. And if the if it's not spinning at all, like theta dot is zero, the breaking moment is going to be zero no matter what the operator puts on it. So again, I'm just I'm picking this out of thin air. It's not super germane to the problem, but I just want to have some somewhat quasi realistic um reasonable set of dynamics. Okay, so if you've got all these forces on moments on this thing, let's just go ahead and sum up all of the moments, right? So you've got the moment due to the engine F * L. You've got the moment, the retarding moment due to drag, the retarding moment due to um due to the brake, and then this term here is the moment due to gravity, which is either going to impart a positive or a negative moment depending on sin theta, right? How this term looks, okay? So this is our moments. So let's go ahead and apply Newton's second law, right? So Newton's second law for rotation, right? It's the moment of inertia times the angular acceleration is just the sum of the moments. So I'm going to go say dot dot dot, skip a couple of steps. If you're interested in all the nitty-gritty details, actually for this or for any other part of this discussion, right, check the link in the description of this video where you can download my um PDF set of notes where I've got uh pretty much line by line of how to get here. But I'm going to assume that people are comfortable with developing equations of motion. So you basically get this, right? This is your equation of motion.

So now let's choose a state and control vector for this. Um, in this case, the state vector is just going to be theta and theta dot. And then the control vector, the two controls that the that the user would have is U1 and U2, right? So, it's the engine throttle and the brake command. Okay. So if you've got these two, we can now take a step back and say, okay, this is how I would formulate the problem as a controls engineer. But as a mathematician wanting to look at this from sort of a sterile abstract mathematical point of view, both these control vector, or sorry, the state vector and the control vector, they're kind of just they're independent param or independent variables or they're inputs to this set of equations of motion, right? So what I mean by that is let's just go ahead and consider those two as independent variables. I'm going to create an independent variable vector. Let's call it Z. And I'm just going to stack X on top of U. So Z is four elements long and it's just Z1, Z2, U1, U2. Okay? Now the reason I want to do that is because then I can rewrite my equations of motion and get a nonlinear state space representation. And again, if you want a refresher on state space representations, right, we've got a dedicated video talking about that. But you can write your equations of motion to look like this. Okay? So it's x dot, right? Which is basically Z1 and Z dot, Z1 and Z2 dot, right? As you see right here, x dot is equal to this ugly nonlinear function. Okay? And this is a vector valued function. Correct? You put in four things. You put in these four independent variables, Z1, Z2, Z3, and Z4. And this spits out two things. It spits out a uh Z1 dot and a Z2 dot. So again, think about this. This is nothing more than the the vector valued function f that we were talking about earlier. Okay? So I'm going to call this whole thing f. And again, the picture that goes along with it is this orange picture. Again, the vector value function f, it's nothing more than two scalar functions stacked on top of one another. [snorts] This whole thing takes in four inputs, spits out two outputs. Okay?

So now we can now start talking about the Jacobian of this f function, f-bar, right? That's all we need to do. And again, we saw earlier that the Jacobian is basically assessing the sensitivity of all of these outputs to perturbations in these inputs. Okay? So what I can write here is that the change in the output, right? Is the Jacobian matrix times some perturbation in the inputs, a delta Z. Okay? So delta output is the Jacobian times delta input. Again, this is just the higher dimension vector valued interpretation of a derivative. A derivative is basically saying the change in the output is the slope times the change in the input. Okay? That's all this is saying in matrix form. So if I want to write this, it's basically um, sorry, maybe what we should do then is let's calculate this Jacobian J. So I'm going to do that over here. Okay? So the Jacobian J, as we see here, it's nothing more than four um independent parameters. Sorry, I missed a parenthesis there. Okay? So it's a 2x4 matrix of all of these partials. Okay? So all you got to do is just start taking all these partial derivatives. This first row is super easy because it's the derivative of f_sub_1 with respect to all the independent variables. And f1, luckily for us, it's super easy. It's just Z2. So you end up with just 0, 1, 0, 0. Okay? Now that's not the case for the second row. The second row is where all the dynamics come into the into play. Okay? So it's the derivative of this ugly nasty expression with respect to Z1, Z2, Z3, Z4. Okay? So, this is what you end up with, correct? This is the Jacobian matrix here. And this is your two Whoopsie, my pen is super dead. Um, I guess this one is dead. Let's try this blue pen. I've been using blue to denote the the the dimensions, right? This is a 2x4 matrix. Okay? So here's your Jacobian matrix. So now I can plug it into this equation down here, which is telling us the change in outputs is the Jacobian times the change in inputs. So it's just this 4x2 matrix times delta Z. And remember, delta Z is just delta of all these X1, X2, U1, U2. So that's what I'm writing right here. And if you stare at this long enough, you can see that okay, the X terms here, right? This multiplies this first 2x2 block. Okay? The U terms or your control vectors multiplies this second 2x2 block. So why don't I go ahead and just I'm going to rewrite this. I'm going to break this up. Okay? I'm going to break this up into some 2x2 matrix times your state vector plus another 2x2 matrix times your control vector. Right? If you go ahead and if we call this A and this matrix over here B, this starts to look, and I got to be a little bit careful here. I'm uh, let let me just say this equals A * delta X + B * delta U. Okay? Now I'm not going to say here that this is x dot. Okay? Because that's actually not true. We got to be a little bit careful and I'm going to have to handwave a little bit and punt this discussion down to our other video where we will talk about formally linearizing a system because if you stare at this long enough, this is the foundation of how we're going to do this. What we end up with. This should look really familiar, right? This is sort of like x dot is equal to Ax + Bu. Of course, we've got these deltas, we're going to have to reconcile a little bit later, but at the end of the day, like we said, this is the foundation of basically your linear OD, right? It's your linear set of dynamics. And remember, where did we start from? We started from this function. It's ugly. It's nonlinear. This thing effectively at the end of the day, right? It's this is describing x dot is equal to f(x and u). This is your nonlinear OD or set of dynamics. So you have an ugly nonlinear system like this, you can describe it here, and now we can use this Jacobian matrix to basically linearize the system and turn it into, and again, hold, we're not totally turning this, so don't quote me on this, right? But we're we're 90% of the way to the x dot is equal to A delta X + B delta U. Right? So we're going from nonlinear to linear dynamics. And the Jacobian is the key to making all of this work. And again, let's just reiterate this for for for to to really drive the point home, right? All the Jacobian matrix is talking about, right? What the A and the B matrix capture here. It's the sensitivity of the dynamics to perturbations in the state and control vector depending on where you happen to be locating and where you're operating in state and control space. So if this pendulum is, you know, caned over like this with a certain set of input conditions, right? Its dynamics behave differently than if it were say vertically straight up, right? And the Jacobian matrix captures all of that in a nice graceful elegant fashion. Okay.

So I think this is super exciting because yeah, this is the key and the foundation for linearizing dynamic systems. Now I know not all of you are interested in uh controls and dynamic systems. But let's just say this Jacobian matrix idea. This is also the foundation for our next video where we're going to start talking about the chain rule. And the chain rule, we're going to see, is basically uh it's it's a way that we can look at composite functions and try to understand again how perturbations in inputs affect outputs at all of these different layers of this composite function that is going to be the building blocks for a lot of other engineering uh tools. For example um in AI and machine learning, there's the concept of a neural network and back propagation and how to train that network. And we're going to see that that is founded on the idea of the chain rule, which we are going to show the chain rule is founded on the idea of the Jacobian. We just saw the Jacobian is found on the idea of a gradient, and the gradient is founded on the idea of a derivative. So really, all of this is just fancy ways of looking at how the derivative affects a lot of these interesting engineering systems.

So with that being said, I think this is probably a great spot to leave it. Um, I hope you enjoy the video and if so, I also hope you'll consider subscribing to the channel. Um, if you scroll a little ways down and click on that subscribe button, it really does help me continue making these videos. And remember, new videos come out every Monday. So, I hope we'll be able to catch you at a future discussion and we can all learn something new together. So, until then, I think I'm going to sign off. Talk to you later. Bye.