You are on page 1of 10

10/28/13

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

Linear Ordinary Differential Equations


Solving linear ordinary differential equations
This is a short paper on linear ordinary differential equations (ODE or ODEs or ODE's), of the type that you'll encounter in MIT 6.002x. You should visit MIT 18.03 or 18.03SC in MIT OCW for more in-depth treatment, or the Khan Academy videos here. First of all, some terminology: An "ordinary" differential equation (ODE) has only one independent variable, let's say t. For example, if you have a function
y = f (t) with derivative y
df

dt

, second derivative y

f
2

and you combine some of these derivatives, y itself, and other time functions, say g (t) , in an expression, you are building an ordinary differential equation. Here are some examples of linear ODEs (see below the explanation of linear):
y + by + c y = A cos(t)

dt

, etc...,

+ cw = 0 w

The concrete name of the variable described by the ODE is irrelevant: time function, g (t) , in the ODE would be A
cos(t) .

y , w,

etc... In the first example, the "extra"

The order of the ODE is the highest derivative order present in it. The two examples above are second order ODEs. The variable in the ODE, y(t) , can be an N-vector, that is
y (t) = [y 1 (t) y N (t)]
T

. This means you are

governing several scalar dependent variables, y k (t) , within the same ODE. In electrical circuits these variables are typically capacitor voltages, vC (t) , and inductor currents, iL (t) . When multiplying coefficients in the ODE (b and
c y (t)

is a vector, the constant

in the examples above) become matrices of suitable dimensions.


f x

If you have y=f(x,t) and you have partial derivatives deal with partial differential equations.

and

f t

combined in your expression, then you have to

In MIT 6.002x, you only need to worry about linear ordinary differential equations. Linear means that if is your ODE variable, you only would see things like f ,
df df dt

y = f (t)
2

f
2

dt

, etc..., but you would NOT see things like f ,

dt

in your differential equations.

An example of a nonlinear second order ordinary differential equation is that which governs the oscillation of a pendulum:
d
2

(t )
2

dt

sin[(t)] = 0

since it makes use of a nonlinear transcendental function, sin(). Here (t) is the angular displacement of the pendulum from the vertical, is it's length and
g

is the gravity acceleration (constant).


x

Let (x, t) be the relevant dependent function, and the time t and 1-D position A well-known partial differential equation is the wave equation:
(x, t ) x
2

be the independent variables.

1 v
2

(x, t ) t
2

https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/

1/10

10/28/13

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

where v is the velocity of propagation of the wave. For instant, the deformation propagating along a rope can be described by the wave equation. Fortunately, in this course you will not deal with nonlinear ODEs; neither will you ever have to solve partial differential equations here. For the rest of this section, we are concerned with time t as the independent variable, so we are interested in, for
example, some circuit voltage v(t). For short hand, I will write v =
dv dt

.
v

A homogeneous differential equation is one where there is a combination of functions of


, v , v

and of its derivatives,

etc..., in the left-hand side, and there is a 0 in the right-hand side. To solve it, you need to account for some

boundary or initial conditions.

Homogeneous first order linear ODEs


Here is a homogeneous linear ordinary differential equation:
+ a v = 0, v

with the boundary condition that at t

= 0, v (0) = d . a

is a constant coefficient;

is some constant initial value.

To solve explicitly, we separate the two sides like this:


= a v v

Then, isolate the differentials:


dv v

= a dt

Integrate both sides of the equation:

dv v

= a dt

The result is:


ln(v ) = a t + c

where c is the constant of integration. Finally, to find


v(t) = c e
(at )

v (t),

we exponentiate both sides of the equation, and get:

We find the constant of integration


t = 0,

by applying the boundary condition (initial value) that v(0)


(0) = b , v

= d,

so, setting

we can find the constant c. Similarly, if your boundary condition was


v

you would use your

solution for
Note that v

to find the constant c .


(at )

= a c e

, so in fact, v

+ a v = a c e

(at )

+ a c e

(at )

= 0.

Don't forget your units: If

v(t)

has units of volts/second (V /s) , and a must has units of volts (V ) , then v

have units of inverse-seconds (s1 ) . Also, note that one Hertz (H z) equals one cycle/second equals 2 (radians/cycle)*(cycles/second), i.e. 2 radians/second (rad/s) .

Inhomogeneous first order ODEs


Suppose we had an inhomogeneous ODE, for example:
https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/ 2/10

10/28/13
+ a v = q(t) v

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

In general (and this is painful to do!), multiply both sides of the equation by e that:
d dt

adt

, then, integrate to solve. Note

(e

adt

v(t))) = e

adt

dv dt

+ v(t)a e

adt

= e

adt

dv dt

+ a v(t))

So, we have:
d dt

(e

adt

v(t)) = q(t) e

adt

Now, separate the differentials and integrate:


e
adt

v(t) = q(t)e v(t),

adt

dt + c

Now, isolating
v(t) = e

adt

( q(t)e

adt

dt + c)

And there you are! This is painful. For MIT 6.002x, the material is limited to a few specific cases, so rather than asking you to integrate (heck, I can't integrate this myself!), we will present some specific solutions to commonly encountered inhomogeneous equations:

Specific inhomogeneous first order equations:


One first order equation that you will see is:
+ a v = 0, v t = 0,

but with the initial value that v(0)

= b.

We are not interested in what happens before time


Vo .

but we want to know what happens for

t 0.

For example, see this circuit, where you want to solve for

https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/

3/10

10/28/13

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

After applying KCL and moving all the terms in


C Vo +
Vo R

Vo

to the left hand side, you would get:

V in R

Which you can rearrange to:


R C V o + V o = V in ,

or you can also write it as:

V o +

Vo RC

Vin RC

Vin

could be an initial condition, that is, it might be a value


v (t) = c e t 0).
at

until time =0, then, it is equal to zero. Recall that the


= b,

general solution is
v(t) = b e
at

. We simply match the boundary condition that v(0)

and we have:

(for

This satisfies both the original differential equation, and the initial value. Note that for this circuit model, a is always a positive number (a
b = 1 = 1/(RC )).

Here is a plot of what v(t) looks like (I took values of

a = 1, 2, 3

and

for this plot):

If

Vin (t)

is an impulse, that is, Vin

= 0

for

t 0,

but at t

= 0, Vin =,

such that the integral

V in dt = 1,

you would see the same results as the response to an initial condition as above. Now, let's look at another very simple inhomogeneous equation:
v a

+ v = 1

(with the initial value for

v (t < 0) = 0.

Again, we are not interested in what happens before time

t = 0.

Notice that I've sort-of-rearranged the original first order equation (dividing through both sides by a )
< 0,

before applying the "1". Anyway, this sort of inhomogeneous equation is what you would see if you modeled a circuit attached to a switch to a battery (or Thevenin source). For time t you close the switch, and the circuit sees a sudden change in voltage. If you did all the integrals in the previous section, you would see that the solution is
https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/ 4/10

the switch is open. At time t

= 0,

10/28/13
v(t) = (1 e
at

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x
)
v a

, then, apply I leave it to you to verify that if you take the derivative to get v

+ v,

you would get the right hand

side "1". Here's the response:

Last, let's consider:


v a

+ v = cos(t)

Now, we're not interested at time near t=0, but we want to see what's the behavior at t In general, your solution in the case Vin
= cos(t)

would be (you can actually get this by doing that

multiplication by e raised to the integral of a dt!):


Vo = C1 e
at

+ M cos(t + )
at

So, you can visually see there's a short term response with

that will decay away as t

1,

and a response to

the sinusoid, multiplied by the value M (which I'll call a magnitude), and offset with a phase . Without proof: The magnitude (specifically, the relative magnitude) M is:
M =
1 (1+(
a 2

) )

And the phase is:


https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/ 5/10

10/28/13

And the phase is:


= tan
1

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

Note that in the limiting case where step function). The result is result Vo (t)
= e
at

= 0

(so Vin (t)

= 1),

we're back to inputting a "1" function (also called a


Vo = C1 e
at

M = 1,

and using the equation

+ M cos(t + ) ,

we get the

+ 1,

which we'd already plotted above.


RC = 1second

Below are four plots that illustrate sinusoid response.

in the circuit sketched above; and I apply

four frequency sinusoids: 0.5 rad/s, 1.0 rad/s, 2.0 rad/s, 4.0 rad/s. Observe that at the low frequency, the output response Vo follows the input Vin (t) pretty well, but it lags--that is, it peaks a bit behind (later than) the input. As the frequency goes up, the magnitude of magnitude of
Vo Vo

relative to Vin falls, and the phase lags some more. In the limit, the
90 deg.

will go towards zero, while the phase will go towards

I probably need to write a short math review for working with complex numbers, and Euler's equation
e
jt

= cos(t) + j sin(t)

where j

= ( 1).

2nd order homogeneous linear ODE's:


On to 2nd order linear ODE's:
+ b v + c v(t) = 0 a v

https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/

6/10

10/28/13

a v + b v + c v(t) = 0

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

Subject to initial conditions

v(0) = vi V e
at

and

v (0) = vs V /s.

Mathematicians like to see patterns and apply

them. Since the exponential function

worked out so well with first order linear ODE's, we guess that an

exponential function would also be the solution for 2nd order linear ODE's. Guess
a
2

v (t) = e
t

, and substitute your guess into your ODE. Note that then, v
t t

= e

and

= v

. Then,

+ b e
t

+ c e

= 0

Factoring out e ,
(a
2

+ b + c) e
t

= 0 0,

Since e

is always

then (a

+ b + c) = 0 .

If we solve the quadratic a

+ b + c = 0

for , we would

have our solution.


1 =
b +b 4 ac 2a
2

2 =

b 2 4 ac b 2a

A couple of notes: Without rigor, 2nd order linear ODE's encountered in MIT 6.002x will always have a and
c 0.

> 0,

and

So, there are several possibilities: (1) 1 , 2 are real, but different (that is, 1 (2)
1 , 2 2
2

and

(b

4ac) > 0 )

are complex conjugates (that is,

(b

4ac) < 0
2

(3) 1 , 2 are real, but the same values (that is, b

4ac = 0 )

We will investigate each of these cases. Again, without rigor, these 3 cases are the only ones you will encounter in MIT 6.002x, and in MIT 6.002x, the real part of

is always

0.

So, for cases (1) and (2) your homogeneous (or general) solution will always be:
v(t) = C1 e
1 t

+ C2 e

2 t

where C1 and C2 are constants determined by your initial conditions For case (3), your homogeneous solution will always be:
v(t) = C1 e
t

v (0)

and

(0) . v

+ C2 t e

You will recall from the lecture that the complete solution is going to be the superposition of the homogeneous solution and a particular solution. We will graphically explore the solution of second order solutions to a step: That is, the inhomogeneous part will be 0 for
v(0) = 0 t < 0

and 1 for

t > 0.

The initial conditions are that at t=0,

and

(0) = 0 . v

Let's look first at case 3, that is:


+ 2v v + v = 1

Clearly, the homogeneous solution is of the form v(t)


(
2

= C1 e

+ C2 t e

, with

the roots of

+ 2 + 1) = 0 .

https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/

7/10

10/28/13

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

Here is the response to the step input (note that when the roots are equal, this is called "critically damped"):

Now, let's look at case 1: (Two distinct real roots). We'll consider this equation:
+ 3v v + v = 1

Again, initial conditions for

and

are zero. Your roots are 1

= 1

and 2

= 2 .

The step response is below.

This is basically two first order responses; one is feeding into the other.

https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/

8/10

10/28/13

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x

Lastly, let's look at the step response of a system with complex conjugate :
+v v + v = 1 = 1 .

The roots of
e
j

+ + 1) = 0

are

= 0.5 j

3 2

where j

Remember Euler's equation?

= cos() + j sin() ,
3 2

so:

3 2

(0.5j

)t


3 2

= e

0.5 t

(cos(

t) + j sin(

t))

The homogeneous solution is a decaying exponential envelope, multiplying an oscillation! Here's what it looks like for the step:

And that should take care of you until week 9 of the class!!!! Still needed, but this wiki is getting awfully long, and could use some splitting up? Breaking down a higher order linear ODE into a system of 1st order ODE's? Numerical solutions and matrix methods? Frequency response of 2nd order systems
https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/ 9/10

10/28/13

Linear Ordinary Differential Equations - MITX 6.002x Wiki - Wiki MITx 6.002x Frequency response of 2nd order systems Linear ODE's; the substitution of s = j and transformation of ODE's to algebra (the Laplace transform method)?

(Not yet complete as of April 7, 2012, but getting close).

https://6002x.mitx.mit.edu/wiki/view/LinearOrdinaryDifferentialEquations/

10/10

You might also like