Now that we've seen how to linearize
a single differential equation,
and how to take derivatives of functions
at several variables, let's see how to
linearize systems of 
differential equations.
The example we're gonna work
with is this one.
Where x_1 and x_2 both evolve.
And the change in x_1 is a 
nonlinear function of x.
This is a quadratic polynomial and the
rate at which x_2 is changing is this
other nonlinear function of x.
In general, we write it in vector form 
as the derivative of the vector x is
some nonlinear vector value function
of the vector x.
As before, fixed points are where f is 0
because if f is 0,
then the derivative of x is 0 and
x never leaves that point.
If you start off with x = a, 
then you stay at x = a.
As long as f(a) is 0.
So that's the solution.
You plug it in, you see it works.
As always, we ask the question,
what happens if we start off
close to a fixed point?
The idea is that we want to use a linear
approximation to f and we saw in
the last video on Taylor series
how to do that linear approximation.
The procedure is as always, 
we let y be the change in x,
how far x is from the fixed point.
Then we say the derivative of y is the
same as the derivative of x because
they just differ by a constant,
and that was f(x).
And that's f(x) - f(a) because f(a) was 0.
And that's approximately the 
derivative of f * (x-a) where
you remember the derivative of a vector
valued function is a matrix.
So we have the derivative of y is
approximately a matrix * y,
because y is (x - a).
And that matrix was all the 
partial derivatives.
The first row is the derivative of f_1
with respect to x_1, x_2, x_3, x_4, x_m.
The second row is the 
derivative of f_2.
The bottom row is the
derivative of f_m.
In general, if you go to the i-th row
and the j-th column, you take
the derivative of the i-th function with
respect to x_j.
So now we approximate our differential
equations with derivative of y is
a matrix * y.
We know how to solve that.
We diagonalize y, we find the eigenvalues
and the eigenvectors.
We expand in terms of the eigenvectors and
our solution looks something like this.
y is gonna be a linear combination 
of a bunch of modes, going as
( e^the eigenvalue * t ) multiplied
by the eigenvector.
The lambdas are the eigenvalues,
the b is the corresponding eigenvectors.
And if the real part of the eigenvalue
is positive, then this grows.
We call this an unstable mode.
If the real part is negative, it shrinks.
We call that a stable mode.
If the real part is 0, it's neutral,
or borderline.
For a fixed point to be stable, all of
the modes have to be stable because
if even one of these terms is growing,
you'll eventually run away.
y will get bigger and bigger and bigger
and eventually you won't be close
to the fixed point anymore.
With all that general theory in mind,
let's go back to our example.
In our example, here was the formula 
for dx_1/dt and dx_2/dt.
And this was f_1(x) and this was f_2(x).
Now to find the fixed point, 
this has to be 0.
If the product of two numbers is 0,
one of them has to be 0.
If this times this is 0, either x_1 is 0
or (3-2x_1-x_2) is 0.
Likewise if this is 0 then either x_2 is 0
or (3-2x_2x_1) is 0.
So that leaves four possibilities.
Either x_1 is 0 and an x_2 is 0.
Or x_1 is 0 and (3-2x_2-x_1) is 0.
Or (3-2x_1-x_2) is 0 and x_2 is 0.
Or this is 0 and this is 0.
In each case, you can solve the equations
and you can figure out the fixed points.
The fixed points are (0, 0). That's where
this is true and this is true.
(0, 3/2)
(3/2, 0)
And (1, 1)
Those are our four fixed points.
Next we have to figure out 
our matrix of derivatives.
If you multiply this out, you get that
f_1 is 3x_1 -(2x_1)^2 -(x_1)(x_2).
You take the derivative with respect to x,
you get 3-4x_1 -x_2.
Derivative with respect to x_2
and you get -x_1.
Likewise you write down what f_2 is
and what the derivatives of f_2 are.
At each fixed point, we have to do
a separate analysis at this fixed point,
this one, this one, and this one.
At each fixed point, we have to write
down the matrix and then we look at
the eigenvalues and the eigenvectors.
Here is our matrix.
At (0, 0) x_1 and x_2 are 0 and you
just get 3 0 0 3.
λ (Lambda) equals 3 as a double root
and you could pick our basis to be
1 0 and 0 1 if you wish.
Every mode grows as e^3t 
because 3 is positive.
And it's unstable, everything grows.
If you start of near (0, 0), you quickly grow
away and go away from (0, 0).
What about at (0, 3/2)?
Then the matrix comes out to be this
and the eigenvalues are 3/2 and -3.
When the eigenvalue is -3,
the eigenvector is 0 1. That's stable.
If you move away from the fixed point
in the 0 1 direction, that is if you stay
on the x_1 axis, then you rush back
towards the fixed point and
you do it like e^-3t.
But the other eigenvalue is positive.
If you move away from the fixed point
in this direction, you grow like e^(3/2)t.
Since there's one stable and one unstable
mode, the whole system is unstable.
No matter how quickly this shrinks,
this will grow and that will
cause you trouble.
The third fixed point looks just like the
second one, only with the roles of
x_1 and x_2 reversed.
Eigenvalues are 3/2 and -3,
and there are the eigenvectors.
So this is unstable.
This is stable.
Finally, the fixed point at (1, 1),
we get this matrix.
The eigenvalues are -1 and -3.
-1 has eigenvector 1 (-1).
-3 has eigenvector 1 1.
They're both negative so 
they both are stable.
The dominant mode is this one
because it's less negative than the other.
If you start off close to (1, 1), 
any deviations in the (1, 1) direction
are gonna shrink really quickly.
And deviations in the (1, (-1))
direction are gonna shrink,
but a little bit more slowly.
Let's put that together as a picture.
Here are our four fixed points.
Fixed point at the origin,
at the (3/2, 0),
at (0, 3/2) and at (1, 1).
Near the origin, you get pushed away,
no matter where you are,
you get pushed away quickly.
Near (3/2, 0), there's one direction where
you get pushed in and another direction
where you get pushed out.
Likewise here, if you start off on the x_2
axis you get pushed in, but there's
another direction where you 
get pushed out.
Over here, we got pushed in very quickly
in this direction and not so quickly
in this direction.
What happens is if you start out 
over here, you get pushed out.
And you eventually approach (1, 1).
You start off over here, you get pushed
away and you eventually approach (1, 1).
If you start off over here, you approach
(1, 1) this way.
If you start off over here, 
you go this way.
No matter where you are, 
you wind up getting sucked in
towards this spot (1, 1).
There are lots of trajectories depending
on where you start but once you understand
what's happening near this point, 
that you're running away from this point,
and what happens near this point, 
that you're getting pulled
towards it side-to-side, but pushed away 
from it along this trajectory.
And what's happening over here,
and that this is stable.
You understand that there are 
lots of different patterns.
But they all lead to (1, 1).
So from just linearizing around
these four points,
we can get a qualitative understanding of
this nonlinear problem pretty much
no matter where you start.
