You are on page 1of 4

11

Vector and Matrix Representations

So far, we have only worked with very, very simple systems. But you can imagine that if we have
lots of springs, dampers, and masses all connected togetherlike the slinky I used in the class
lecture where I connected several sections togetherthen we have an ordinary differential equation
that has a separate equation for every state. Here is where things might get a bit complicated; and,
therefore vector and matrix representations become really useful. You should think of these as
largely being useful notation; that is, vector representations and matrix representations of ordinary
differential equations primarily serve as a way of organizing information in a nice, convenient way
that helps with computations.
Lets say we have a linear, constant coefficient, first-order differential equation that has states
x, y, and z.
x

+2y

+3z

+4z

+z

I have spaced these numbers and letters in a way that will help us in a moment. You can imagine
that if I had fifty or a hundred or a thousand states here, this could become very challenging to
manage. Im going to group the states into a single vector
2 3
x
4 y 5
z

and by definition the time derivative of this vector of states is equal to the vector of time derivatives
of the states.
2 3 2 3
x
x
d 4 5 4 5
y = y
dt
z
z
So far, I have not done anything very interestingIm just putting variables into a list. Now comes
the useful part. Im going to define a matrix to be an array of numbers, like
2
3
1 2 3
A = 4 4 5 6 5.
7 8 9

This is a matrix that has three rows and three columns, with a total of nine numbers.
Our goal is to define some notion of multiplication between the matrix A and the vector of
states so that if I take
2 3
x
A4 y 5
z
I will2get the
3 right hand side of the differential equation. In fact, if I just relabel the state vector as
x
w = 4 y 5, I can write Aw to represent the multiplication.
z
34

The right way to define multiplication between A and w is to take elements of the rows of A
and multiply them by their corresponding elements of the state vector and sum them together. For
instance, if I take the A matrix I just defined and multiply A and w, I get
2
32 3 2
3
1 2 3
x
1x+2y+3z
Aw = 4 4 5 6 5 4 y 5 = 4 4 x + 5 y + 6 z 5
7 8 9
z
7x+8y+9z

Note that the result is a vector again, so multiplying a matrix times a vector gives a vector. Now,
lets go back to the differential equation and see how we could choose different values in the components of A so that we get the right hand side of the differential equation we started with. The
idea is to choose the elements of A so that when you multiply A and the state vector you get the
right hand side of the differential equation.
If you look at how I wrote the differential equation in the first place, it is reasonably easy to do
this. In particular, if I choose15
2
3
2
32 3 2
3
1 2 3
1 2 3
x
1x+2y+3z
A=4 0 1 4 5
)
Aw = 4 0 1 4 5 4 y 5 = 4 0 x + 1 y + 4 z 5
1 0 1
1 0 1
z
1x+0y+1z
I get Aw equal to a vector that is exactly the right hand side of the differential equation.
This has important consequences, because now I can rewrite the differential equation as
w = Aw.
This is exactly the same equation as the one I started with, but with a different notation being used.
Now, how is this useful? Lets think back to Lecture 4. Id like to use this vector and matrix
notation in my Euler integration code. The initial condition for the differential equation needs to
include initial conditions of all the states
2
3
x0
w 0 = 4 y0 5
z0
and Euler integrationexpressed in terms of vectors and matriceswill look like
w(t + dt) = w(t) + dtAw(t).
The great thing about this formula is that once you have the matrix A, the code for your Euler
integration will always look the same! As an example, lets look at the vector and matrix notation
for the spring-mass system. We know from Lecture 7 that we get a second-order differential
equation
k
x =
x
m
15

Choosing the elements of A comes down to just reading off the coefficients of x, y, and z in each element of the
vector, but this often is not obvious at first.

35

Figure 17: A spring-mass system


and if we rewrite that equation in first order form we get two first-order differential equations with
a state of position x and velocity v.
x = v
k
x
m

v =

0 1
x
If we set w =
, and choose A =
, then Aw gives us the right hand side of the
k
v
0
m
differential equation.
Lets say that x0 = 0.5 and v0 = 0 and we want to use this vector notation in Euler integration
with a time step of dt = 0.1. We set w0 to be the vector of intial conditions of the two states and
then

0 1
0.5
x0
0.5
0.5
w0 =
)
w(0.1)
+ |{z}
0.1
=
k
k
v0
0
0
0
m
20m
dt

If I multiply this out, I get an approximation of w(0.1). Just as in Lecture 4, we can repeat this
process as many times as we like to get an approximate solution of the differential equation at any
time.
What should you remember from today? Vector and Matrix representations are really, really
useful for organizing information. The more complex a system is, the more useful this notation
becomes. If you find yourself dealing with really complicated systems a lotand as engineers we
use them all the timeyou probably will eventually want to take a class that focuses on them. But
for now, just think of them as a notational convenience that simplifies your life.
Example: Consider (again!) the mechanical diagram.

Figure 18: One mass with four elements attached to it

36

We already saw that if we choose states x1 and vm , we get


x 1 = vm
k
v m =
x1
m
k
=
x1
m
2k
=
x1
m

b
k
b
v2 + x2 + v4
m
m
m
b
k
b
vm + ( x1 ) + ( vm )
m
m
m
2b
vm .
m

How can
we write this as a vector-valued differential equation? Lets choose the state vector x to
x1
be x =
. Then the choice of
vm

0
1
A=
2k
2b
m

makes x = Ax equivalent to the ODE above because

0
1
x1
x = Ax =
=
2k
2b
vm
m
m

37

vm
2k
x
m 1

2b
v
m m

You might also like