# Gavin's DiffEq Class Clarification: Mar 29

Question: How do we write out systems of differential equations and solve them? And, how do we do MUC with sines and cosines in the driving term?
Two entirely different topics here:
1. How do we write out systems of differential equations and solve them?
Let's step through an example slowly. We'll rewrite the differential equation
x'' + 2x' + x = sin(t)
in the form of a system. To do this, we introduce another variable, which I will with infinite imagination call y: let y = x'. Then, substituting y everywhere we see an x' in the original equation, we obtain the system of equations
x' = y
y' = -x - 2y + sin(t)
The book considers the systems in terms of the subscripted dependent variables x1, x2, etc. In this case, we'd be taking x1 = x and x2 = y, to get the system
x1' = x2
x2' = -x1 - 2 x2 + sin(t)
It doesn't matter which of these two notations you choose, so long as you're consistent and can see how they are equivalent. Then, how are these written as vectors? Let's think about grouping the left- and right- hand sides of the equations in the system more tightly:
 [ x1' ] = [ x2 ] x2' -x1 - 2 x2 + sin(t)
The entries in the [ ] (square brackets) are the column vectors. So the column vector x' is the vector on the left-hand side, and that on the right-hand side is the column vector f(t, x1, x2).

Great! Now, what about solving these? For this problem we know how to solve it because we can solve the original second-order differential equation. The solution to this is xg = xu + xd, or

xg = (C1 + C2 t) e-t - (1/2) cos(t)
We said that x was x1 and x' was x2, so, taking the derivative of this, we have the solution vector
 [ x1 ] = [ (C1 + C2 t) e-t - (1/2) cos(t) ] x2 (-C1 + -C2 t + C2) e-t + (1/2) sin(t)

2. How do we find the solution to a problem with sines and cosines in the driving term?
For example, the previous problem (a coincidence?). Let's solve
x'' + 2x' + x = sin(t)
For the undriven problem, x'' + 2x' + x = 0, notice that this is the same as
P(D)[x] = (D + 1)2[x] = 0
Plugging in x = er t, we get
P(D)[er t] = (D + 1)2[er t] = 0
Then we know that P(D)[er t] = er t P(r), so
er t (r + 1)2 = 0,
or r = -1 (twice; it's a repeated root). So the undriven solution is
xu = (C1 + C2 t) e-t

Then, to find the driven solution we can proceed in one of two ways:

1. Notice that the driving term f(t) = sin(t) is the same as Imag(ei t). Thus, if we find a solution to
z'' + 2z' + z = ei t,
the solution we want, xd, is just Imag(z).

Let's do this. We want z to be an exponential, so guess z = A ei t. Plugging in, we get

P(D)[z] = (D + 1)2[z] = ei t,
or
(D + 1)2[A ei t] = ei t, so
A ei t (i + 1)2 = ei t.
Dividing by ei t and solving for A, we get A = 1 / 2i. (Because (i+1)2 = i2 + 2i + 1 = -1 + 2i + 1.) It's convenient to multiply the numerator and denominator of A by i to get A = -i / 2. So
z = -(i / 2) ei t = -(i / 2)(cos(t) + i sin(t)) = (1/2)(-i cos(t) + sin(t))
We want the imaginary part of this, which is the cosine. Thus
xd = -(1/2) cos(t)

2. Option two is to just guess
xd = A cos(t) + B sin(t)
plug it in to the equation, and find what A and B work. Notice that we need to start with both the sine and the cosine term in most cases.

The completion of this method is left as an exercise for the reader...

Gavin's DiffEq Clarification 000329