So, in the previous lecture, we saw that there was something fishy at play here, where sometimes we can do pole-placement and sometimes we cannot. And what we really have here is, it's a question of the b matrix. Is the b matrix rich enough, so that we can make the system do whatever we want it to do? And remember, that the b matrix, really describes the actuators we have. So, if we're cheap and we don't buy any actuators, I mean there's nothing we can do, of course, we cannot affect the system. So, the choice of b matrix meaning what actuators we buy will matter and whether or not we have enough control authority revolves around the concept of controlability. And that is the topic of this lecture. And in order to sneak up on controlability, I'm going to start with a rather modest example. Let's do a discrete-time system, we have seen mainly continuous times systems but let's start with discrete-time system here starting a time zero at the origin at 0. So, what I would like to do is take this system and in n steps, where n is the dimension of, of my state, I'm going to drive it to a target state, x*. So basically, here's what I want to do, I want to start at the origin. And then in n steps [SOUND] flow around until I get to where I would like to be. And the question one can ask then is, can I do that? Is it possible? Does there exist such a u? Well, let's figure it out. the first thing I do is I pick view at time 0 and x1, it's Ax0+Bu0. Well, x0 was equal to 0, so this whole thing is simply equal to B times u0. Well x2, that's A times x1 plus B times u1. Well, x1 is Bu0, right, so the whole thing becomes ABu0+Bu1. x3, well if I plug things in, I get A^2Bu0+ABu1+Bu2. In fact, if I keep going to xn, I get A n-1 Bu0, blah, blah, blah, blah, right? So, we seem to have a formula, really, for for where we end up. And, in fact, what we want to do, of course, is make xn equal to this desired point. And what I can do is I can rewrite this thing, this equation, which is really an equation in the u's in the following form. I have u n-1 times B. Well, that's this term. And then, all the way down to u0B an-1, which is this term right here. So, what I'm doing is I'm just saying, this is what I would like to solve with respect to my u's. Well, when can I do that? Well, first of all, this matrix here, the B AB all the way to A n-1 B, it's a fancy-looking matrix and, in fact, it's an important-looking matrix. I'm going to call this matrix, gamma. And gamma is an n by m times n matrix, where n is the dimension of the state and m is the dimension of the input. Well, this solution, or sorry, this equation x* is gamma times this U u vector has a solution in terms of u's, if and only if the rank of gamma is equal to n. And rank is the number of linearly independent rows or columns in gamma. Well, so that's what we want to do, right? We want to somehow have a gamma that's rich enough. And it turns out that this thing generalizes, this way of thinking about the control problem, generalizes quite nicely to continuous time systems as well. So, if I have a continuous time system, x dot is Ax+Bu, x in Rn. Well, first of all, this system is completely controllable, which we're going to call CC. If it is possible to go from any initial state to any final state, so, meaning, if I start here and I want to end up here, there is a u that takes me between these 2 points, for any such points, that's what it means for the system to be completely controllable. And now, I'm going to define gamma again, which is this B AB all the way to A n-1 B. This is known as the controllability matrix. And here, ladies and gentlemen, is the first theorem of this entire course. Controllability theorem or complete controllability theorem 1. The system is completely controllable. If and only if the rank, which means the number of linearly independent columns of gamma or rows, it's the same. if and only if the rank of gamma is equal to n, where n is the dimension of the system. So, this is the rank test as its known and its a way of checking controllability of a linear time-invariance system. So, let's see what happens. Here I have two different systems, 2 0 1 1 x plus 1 1 u is the first one and 0 1 0 0 and 0 1 u, fine, there should be an x here, by the way. so the lower one is the point mass the upper one was one where we actually saw that pole-placement was not possible. In fact, pole-placement is possible for the lower system and not possible for the upper system. This is, in fact, the system used when we couldn't do it. Well, let's look at them. First of all, this top system is a two-dimensional system, n=2. And gamma, in this case, is B AB, all the way A n-1 B. But n-1=1 so gamma is simply B times AB. Well, the lower system also istwo- dimensional. Gamma is equal B times AB. Well, let's compute AB then. It turns out to be equal to 2 2 for the upper system and if I apply this into gamma, I get B here and AB here. So, this is 1, 1 the first column and 2, 2 the second column. And if I multiply the first column by two, I get the second column. So, this thing does not have two linearly independent columns. In fact, it has one linearly independent column. So, the rank of gamma is equal to one, which means, it's not completely controllable. Well, looking at the lower system. Well, this is AB, this is my gamma, 0 1 1 0. There is no way I can multiply this column by anything to get this column. So, the lower gamma has rank equal to 2 because that's two linearly independant columns. So, it is completely controlable. So here, pole-placement not possible, not completely controllable. Here, pole-placement possible, not completely controllable. It seems like we're ready for theorem number 2. So, if I have u as -Kx, x dot then become A-BKx. This is the close loop dynamics. Then, controllability theorem number 2 says that pole-placement to arbitrary eigenvalues is possible if and only if the system is completely controllable. So, what this tells me is that we need to check controllability. If we don't have complete controllability, chances are we're not going to be able to control them. So, this is the obstruction to pole-placement. And, in fact let's let's see how we would actually compute something like this for real. So, let's say that I have again, my point, my, my system. Well, in MatLab, luckily for us, we don't have to compute things at all. We just say, here is the controllability matrix. So, gamma or g is controllability of AB, we can check the rank. In this case, we get the answer out, 2. So, the rank of g is 2. n is 2, in this case, so we have indeed, a completely controllable system, which means, again I forgot an x there, I apologize, which means that we can place the poles wherever we want and we all, it also means that it's possible to go between any two points. So, let's say that I start here and I want to go to x*. Is it possible to go like this? Well, I know it's possible to go from x0 to x* but it turns out that just because you can go between any two points, doesn't mean you can follow any trajectory because this system, the point mass, well, x1 here is position, right? And x2 is velocity. Well, if I'm here, that means I have a positive velocity and a positive possession. And now, what I'm going to do if I start moving like this, I'm going backwards, meaning, x1 is reduced with a positive velocity and there is no way I can go backwards with a positive velocity, so this is not possible. So, what do we need to do? Well, here I have a positive velocity so I'm going to keep growing but I can reduce the velocity. And here, I have zero velocity, right? Down here. And that negative velocity, I start going backwards. And [SOUND] I'm going backwards. And then, I can start going forward again to get to x*. So, this is how you would have to go from x0 to x*. So, you can't follow arbitrary trajectories just because the system is completely controllable, but you know that you can go between arbitrary points. So, that gives us the tools that we really need to understand when we can control the system and that tool is controllability.