# Linear Control Theory: Part I

July 17, 2010 1 Comment

Last time I talked about linear control, I presented a Linear Quadratic Regulator as a general purpose hammer for solving linear control problems. In this post I’m going to explain why LQR by itself is not enough (even for nominally linear systems). *(Author’s note: I got to the end of the post and realized I didn’t fulfill my promise in the previous sentence. So it’s redacted, but will hopefully be dealt with in a later post.)* Then I’m going to do my best to introduce a lot of the standard ideas in linear control theory.

My motivation for this is that, even though these ideas have a reasonably nice theory from a mathematical standpoint, they are generally presented from an engineering standpoint. And although all of the math is right there, and I’m sure that professional control theorists understand it much better than I do, I found that I had to go to a lot of effort to synthesize a good mathematical explanation of the underlying theory.

However, this effort was not due to any inherent difficulties in the theory itself, but rather, like I said, a disconnect in the intuition of, and issues relevant to, an engineer versus a mathematician. I’m not going to claim that one way of thinking is better than the other, but my way of thinking, and I assume that of most of my audience, falls more in line with the mathematical viewpoint. What’s even better is that many of the techniques built up for control theory have interesting ramifications when considered as statements about vector spaces. I hope that you’ll find the exposition illuminating.

As before, we will consider a linear system

where and are matrices and is a vector of control inputs ( is the state of the system). However, in addition to a control input , we will have an output , such that is a function of and :

In some cases, will be a set of observed states of a system, but in principal can be any quantity we care about, provided that it is a linear function of state and control. We further assume that , , , and are constant with respect to time. We call a system that follows this assumption a linear time-invariant system, or just LTI system.

Since the system is linear, we have superposition and therefore can break up any function (for example, the function from to ) into a function from each coordinate of to each coordinate of . For each of these functions, we can take their Laplace transform. So, we start with

and end up with (after taking the Laplace transform)

Solving these two equations for as a function of gives . We call this mapping from to the *transfer function* of the system. Cramer’s Rule implies that the transfer function of any linear time-invariant system will be a matrix where each entry is a ratio of two polynomials. We refer to such transfer functions as *rational*. I will show later that the converse is also true: any rational matrix is the transfer function of some LTI system. We call such an LTI system the *state-space representation* of the transfer function. (I apologize for throwing all this terminology at you, but it is used pretty unapologetically in control systems literature so I’d feel bad leaving it out.)

As an example, consider a damped harmonic oscillator with an external force as a control input, and suppose that the outputs we care about are position and velocity. We will let denote the position of the oscillator. This has the following state-space representation:

Here is the spring constant of the oscillator and is the damping factor. For convenience we will write instead of and instead of . Also, we will let denote the identity matrix. Then, after taking the Laplace transform, we get

Solving the first equation gives

or

Therefore, the transfer function from to is .

We can think of the transfer function as a multiplier on the frequency spectrum of (note that is allowed to be an arbitrary complex number; if is non-real then we have oscillation at a frequency equal to the imaginary part of ; if then we have damped oscillation, whereas if then the magnitude of the oscillation increases exponentially. Note that denotes the real part of .

Exercise: What does a pole of a transfer function correspond to? What about a zero? Answers below the fold.

If a transfer function has a pole, then it means that even if a given frequency doesn’t show up in the input , it can still show up in the output . Thus it is some self-sustaining, natural mode of the system. For LTI systems, this corresponds to an eigenvector of the matrix , and the location of the pole is the corresponding eigenvalue.

A zero, on the other hand, means that a mode will not show up in the output even if it is present in the input. So for instance, the damped oscillator has poles at . Let us assume that and are both positive for the damped oscillator. Then, for , both of the poles are real and negative, meaning that the system is critically damped. For , the poles have negative real part and imaginary part equal to , meaning that the system will exhibit damped oscillation. Finally, there is a zero in the second coordinate of the transfer matrix at . This corresponds to the fact that a harmonic oscillator can be held at a fixed distance from its natural fixed point by a fixed external force. Since the distance is fixed, the contribution to velocity is zero.

There is more to be said on transfer functions, but before I go into that I would like to give you a working picture of how and should be viewed mathematically. This is a view that I only recently acquired. For this I owe thanks to Stefano Stramigioli, who gave a very interesting talk on port-Hamiltonian methods at Dynamic Walking 2010. *(Update: Stefano recommends this book as a resource for learning more.)*

**Duality**

Here is how I think you should think about linear control mathematically. First, you have a state-space . You also have a space of controls and a space of outputs . Finally, you have a space , the tangent space to .

Ignoring and for a moment, let’s just focus on and . We can think of elements of as generalized forces, and the elements of as generalized velocities. I realize that state-space also takes position into account, but you will note that no external forces show up in the equations for position, so I think this view still makes sense.

If we have a set of forces and velocities, then we can compute power (if our system is in regular Cartesian coordinates, then this is just ). In this way, we can think of and as dual to each other. I think that generalized velocities are actually somehow supposed to live in the cotangent space , rather than , but I don’t know enough analysis to see why this is true. If someone else does, I would love to hear your explanation.

At any rate, we have these two spaces, and , that are in duality with each other. The operator then induces a map from to , where is the space of Lesbegue-integrable functions from to (although in practice all of our inputs and outputs will be real-valued, not complex-valued, since the systems we care about are all physical). Since and are in duality with each other, we can also think of this as assigning a power history to any force history (the power history being , where is the force history).

What’s more remarkable is that the transfer function from force histories to state histories is in the Laplace domain (as discussed above — just set for the state-space representation). Therefore it is invertible except on a set of measure zero (the poles of ) and so as far as spaces are concerned it is an isomorphism; this is a bit of a technical point here, but I’m using the fact that spaces are composed of equivalence classes of functions that differ on sets of measure zero, and also probably implicitly using some theorems from Fourier analysis about how the Fourier (Laplace) transform is an isomorphism from to itself. I’m still glossing over some technical details here; in particular, I think you might need to consider the intersection of and instead of just , and also the target space of the Fourier transform is really , not , but these details aren’t really important to the exposition.

Getting back on track, we’ve just shown that the dynamics matrix of a linear system induces an isomorphism between force histories and state histories. My guess is that you can also show this for reasonably nice non-linear systems, but I don’t have a proof off the top of my head. So, letting denote the space of control signals and the space of outputs, what we have is something like this:

Incidentally, that middle map (the isomorphism with ) is hideous-looking, and if someone has a good way to typeset such a thing I would like to know about it.

In any case, in this context it is pretty easy to see how the inputs and outputs play dual roles to each other, and in fact if we replaced , , and each with their adjoints , , and , then we get a new dynamical system where the inputs and outputs actually switch places (as well as the matrices governing the inputs and outputs). Note that I’ve left out of this for now. I’m not really sure yet of a good way to fit it into this picture; it’s possible that is just unnatural mathematically but sometimes necessary physically (although usually we can assume that ).

Now that we have this nice framework for thinking about linear control systems, I’m going to introduce controllers and observers, and it will be easy to see that they are dual to each other in the sense just described.

**Controllability and Observability**

Go back to the non-linear case for a moment and suppose that we have a system , or, in the notation I’ve been using, . We say that such a system is controllable if for any two states and , there exists a time and a control signal such that if then when the system is driven by the control signal . What this says intuitively is that we can get from any state to any other state in a finite amount of time.

For linear systems, controllability implies something stronger — we can actually get from any state to any other state arbitrarily quickly, and this is often times the definition given in the linear case. For non-linear systems, this is not the case, as a trivial example we could have

There are a few important properties of linear systems that are equivalent to controllability:

(1) There is no proper subspace of the state space such that and , where is the space of possible instantaneous control signals. The intuition is that there is no subspace that the passive dynamics (without control) can get stuck in such that the control input can’t move the dynamics out of that space.

(2) There is no left eigenvector of that is in the left null space of . In other words, it actually suffices to check the criterion (1) above just for one-dimensional subspaces.

(3) The matrix , where is the dimension of the state space of the system, has full row rank.

(4) For any choice of eigenvalues , there exists a matrix such that has generalized eigenvalues . We can think of this as saying that an appropriate linear feedback law can be used to give the closed-loop (i.e. after control is applied) dynamics arbitrary eigenvalues.

I will leave (1) and (2) to you as exercises. Note that this is because I actually think you can solve them, not because I’m being lazy. (3) I will prove shortly (it is a very useful computational criterion for testing controllability). (4) I will prove later in this post. I should also note that these criteria also hold for a discrete-time system

Proof of (3): In the case of a discrete-time system, if we have control inputs , then will be

In particular, after time steps we can affect by an arbitrary linear combination of elements from the row spaces of , where ranges from to . In other words, we can drive to an arbitrary state if and only if the row space of is the entire state space, i.e. has full row rank. So a discrete-time system is controllable if and only if has full row rank for some sufficiently large .

To finish the discrete-time case, we use the Cayley-Hamilton theorem, which shows that any matrix satisfies a degree polynomial, and so in particular it suffices to pick above, since can be written as a linear combination of for , and similarly for any larger powers of .

Now we need to deal with the continuous time case. In this case, we can use the theory of linear differential equations to show that

where is the matrix exponential of . But if we use the Cayley-Hamilton theorem a second time, we see that $e^{A\tau}$ can be expressed as an st degree polynomial in , so that there exists some such that

From here it is clear that, in order for a continuous time system to be controllable, the controllability matrix must have full row rank (since is equal to plus something in the row space of the controllability matrix). The converse is less obvious. If the were linearly independent functions, then we would be done, because the last term in the sum can be thought of as the inner product of and , and we can just use Gram-Schmidt orthogonalization to show that those inner products can be chosen arbitrarily (if you don’t see this then figuring it out is a good linear algebra exercise).

The problem is that the are not necessarily linearly independent. If has all distinct eigenvalues, then they will be. This is because we have the relations and for any -eigenvector of , so we can write distinct exponential functions as a linear combination of the , and any relation among the would imply a relation among the , which is impossible (it is a basic result from Fourier analysis that exponential functions are linearly independent).

However, this result actually needs to have distinct eigenvalues. In particular, if one takes , the identity matrix, then you can show that all but one of the can be chosen arbitrarily. This is because , , are all equal to each other, and thus linearly dependent.

What we need to do instead is let be the degree of the minimal polynomial such that . Then we can actually write as for some functions :

By the way in which the were constructed (by applying polynomial relations to an absolutely convergent Taylor series), we know that they are all infinitely differentiable, hence we can differentiate both sides times and write

Now look at these derivatives from to . If the were linearly dependent, their derivatives would satisfy the same relation, and therefore (by evaluating everything at , the matrices would satisfy a linear relation, which is impossible, since then would satisfy a polynomial relation of degree less than .

So, the are linearly independent, and thus by the argument with Gram-Schmidt above we can write anything in the row space of as

for any . So are we done? Almost. The last step we need to finish is to note that if satisfies a polynomial of degree then the row space of is the same as the row space of , for .

So, that proves the result (3) about the controllability matrix. It was a lot of work in the continuous time case, although it matches our intuition for why it should be true (taking an exponential and taking a derivative are somewhat complementary to each other, so it made sense to do so; and I think there are probably results in analysis that make this connection precise and explain why we should get the controllability result in the continuous case more or less for free).

As I said before, (4) will have to wait until later.

In addition to controllability, we have a notion of stabilizability, which means that we can influence all unstable modes of . In other words, we can make sure that the system eventually converges to the origin (although not necessarily in finite time). Versions of criteria (2) and (4) exist for stabilizable systems. Criterion (2) becomes a requirement that no left eigenvector of whose eigenvalue has non-negative real part is in the left null space of . Criterion (4) becomes a requirement that there exist such that has only eigenvalues with negative real part.

**Observers**

We say that a system is *observable* if, for any initial state and any control tape , it is possible in finite time to infer given only and the output . In particular, we are *not* given any information about the internal states of the system (except through ), although it is assumed that , , , and are known. If we have a non-linear system

then it is assumed that and are known.

It turns out that observability for a system is exactly the same as controllability for the dual system, so all the criteria from the previous section hold in a suitably dual form. One thing worth thinking about is why these results still hold for *any* control tape .

(1) There is no non-zero subspace of such that and . In other words, there is no space that doesn’t show up in the output and such that the natural dynamics of the system stay in that space.

(2) There is no right eigenvector of that is in the right null space of .

(3) The matrix has full column rank.

(4) The eigenvalues of can be assigned arbitrarily by an appropriate choice of .

Just as the matrix from the previous section can be thought of as a linear feedback law that gives the system arbitrary eigenvalues, the matrix is part of a feedback law for something called a Luenburger observer.

Also, just as there is stabilizability for a system, meaning that we can control all of the unstable modes, there is also detectability, which means that we can detect all of the unstable modes.

**Luenburger Observers**

An observer is a process that estimates the state of an observable system given information about its outputs. If a system is detectable, and is such that has only eigenvalues with negative real part, then consider the system

Using the fact that , we see that

, so that decays exponentially to zero (by the assumption on the eigenvalues of . Thus the dynamical system above, which is called a Luenburger observer, will asymptotically approach the true state of a system given arbitrary initial conditions.

If a system is both controllable and observable, can we design an observer and a controller that working together successfully control the system? (This question is non-trivial because the controller has to use the estimated state from the controller, rather than the actual state of the system, for feedback.) The answer is no in general, but it is yes for linear systems.

Let $F$ be such that is stable and let be such that is stable. (A matrix is stable if all of its eigenvalues have negative real part.) Now we will consider the system obtained by using as a Luenburger observer and as a linear feedback law. Let . Then we have

In matrix form, this gives

Because of the block triangular form of the matrix, we can see that its eigenvalues are given by the eigenvalues of and . Since and are both stable, so is the matrix given above, so we can successfully stabilize the above system to the origin. Of course, this is weaker than full controllability. However, if we have full controllability and observability, then we can set the eigenvalues of the above matrix arbitrarily, which should imply full controllability (I haven’t sat down and proved this rigorously, though).

So, now we know how to stabilize a linear system if it is detectable and stabilizable. The main thing to take away from this is the fact that the poles of the coupled dynamics of state and observation error are exactly the eigenvalues of and considered individually.

**State-space representations**

The final topic I’d like to talk about in this post is state-space representations of transfer functions. It is here that I will prove all of the results that I promised to take care of later. There are plenty more topics in linear control theory, but I’ve been writing this post for a few days now and it’s at a good stopping point, so I’ll leave the rest of the topics for a later post.

A state-space representation of a transfer function is exactly what it sounds like. Given a transfer function from to , find a state-space model

that has as a transfer function. We’ll be concerned with linear state-space representations only.

The first thing to note is that a linear state-space representation of can always be reduced to a smaller representation unless the representation is both controllable and observable (by just restricting to the controllable and observable subspace).

The next thing to note is that, since the transfer function of a state-space representation is , a transfer function has an irreducible (in the sense of the preceding paragraph) linear state-space representation of degree if and only if , where and are polynomials with . Thus all controllable and observable linear state-space representations of have the same dimension, and therefore there exists some non-canonical vector space isomorphism such that we can think of any two such representations as living in the same state space (though possibly with different matrices , , , and ).

Finally, if two state-space representations over the same vector space have the same transfer function, then one can be obtained from the other by a chance of coordinates. I will now make this more precise and also prove it.

**Claim: **Suppose that and are two (not necessarily linear) state-space representations with the same input-output mapping. If is controllable and is observable, then there is a canonical map from the state space of to the state space of . If is observable, then this map is injective. If is controllable, then this map is surjective. If and are both linear representations, then the map is linear.

**Proof:** Let the two representations be and .

Since is controllable, we can take an input tape that sends to an arbitrary state at some time . Then by looking at evolve under the same input tape, by the observability of we will eventually be able to determine uniquely. The canonical map sends the we chose to .The fact that for all guarantees that is well-defined (i.e., it doesn’t matter what we choose to get there).

If is controllable, then we can choose a that causes us to end up with whatever we choose, which implies that the map is surjective. Now for the purposes of actually computing the map, we can always assume that the control input becomes once we get to the desired . Then there is a one-to-one correspondence between possible output tapes after time and possible values of . If is observable, this is also true for , which implies injectivity. I will leave it to you to verify that the map is linear if both representations are linear.

Finally, I would like to introduce a special case of *controllable canonical form* and use it to prove criterion (4) about controllability. It will also show, at least in a special case, that any transfer function that is a quotient of two polynomials (where the denominator has at least as high degree as the numerator) has a linear state-space representation.

The special case is when is one-dimensional. Then our transfer matrix can be written in the form

It turns out that this transfer function can be represented by the following transfer matrix:

This might seem a bit contrived, but the construction for is a nice trick for constructing a matrix with a given characteristic polynomial. Also note that $A$ will have a single Jordan block for each distinct eigenvalue (whose size is the number of times that eigenvalue appears in the list ). One can show directly that this is a necessary and sufficient condition for being controllable by a single input.

I will leave it to you to check the details that the above state-space model actually has as a transfer function. (Bonus question: what is the equivalent *observable canonical form* for observable single-output systems?)* *I will wrap up this post by proving criterion (4) about controllability, as promised. I have reproduced it below for convenience:

(4) An LTI system is controllable if and only if we can assign the eigenvalues of arbitrarily by a suitable choice of .

Proof: I will prove the “only if” direction, since that is the difficult direction. First consider the case when we have a single-input system. Then take the transfer function from to (this is the same as assuming that , ). By the result above and the assumption of controllability, there exists a system with the same transfer function in controllable canonical form, and thus there is a change of coordinates that puts our system in controllable canonical form. Once we are in canonical form, it is easy to see that by choosing , we end up with a system whose characteristic polynomial is . We can therefore give an arbitrary characteristic polynomial, and thus choose its eigenvalues arbitrarily.

This proves the desired result in the case when we have a single input to our system. When we have multiple inputs, we have to consider them one-by-one, and use the fact that linear feedback can’t affect the eigenvalues of the parts of the system that are outside the controllable subspace. I haven’t checked this approach very carefully, so it might not work, but I am pretty sure it can be made to work. If you want more details, feel free to ask me and I will provide them. At this point, though, I’m writing more of a treatise than a blog post, so I really think I should cut myself off here. I hope the exposition hasn’t suffered at all from this, but if it has, feel free to call me on it and I will clarify myself.

My next post will take a break from linear control and tell you why using least squares is one of the worst ideas ever (because you think it will work when it actually won’t; if you don’t believe me I’ll show you how negligible sampling errors can easily cause you to be off by 10 percent in your model parameters).

The companion matrix isn’t contrived at all! Think about how its transpose acts on the standard basis.