When storage elements such as capacitors and inductors are in a circuit that is to be analyzed, the analysis of the circuit will yield differential equations. This section will deal with solving the types of first and second order differential equations which will be encountered in the analysis of circuits. Higher order equations are to cumbersome to solve directly and other methods will be developed to solve these circuits.

Here is an example of a first order differential equation.

- dx/dt - sx = 0

In this case we can solve the differential equation using separation of variables.

- dx/dt = sx
- dx/x = s dt

Next, integrate both sides.

- ln x = st + k

Here k is the constant of integration. Exponentiating both sides leaves

- x = e
^{(st + k)} - x = e
^{st}e^{k} - x = Ke
^{st}

K is the constant e^{k}.

We now have a solution that will work with the first order equations that we will encounter. The trial solution for first order differential equations will be

- x = Ke
^{st}.

Here we solve another first order equation by using the trial solution.

- dx/dt + 2x = 0
- d (Ke
^{st}) / dt + 2Ke^{st}= 0 - sKe
^{st}+ 2Ke^{st}= 0 - (s + 2)(Ke
^{st}) = 0

The only way this equation can be true is if (s + 2) is equal
to 0 since Ke^{st} is never zero unless K is zero, which it
generally won't be in the problems we will consider. Therefore

- (s + 2) = 0
- s = -2

(Note that the general equation (s + a) = 0 is the characteristic equation for first order differential equations).

This solution is

- x = Ke
^{-2t}

If an initial condition is given, then the constant K can also be found.

- x(0) = 2
- x(0) = 2 = Ke
^{(-2)(0)}= K

K must be 2 then.

- x = 2e
^{-2t}

Solving a second order equation would be even more cumbersome, so we will instead try the trial solution first.

- d²x/dt² + 5 dx/dt + 6x = 0
- d² (Ke
^{st}) /dt² + 5 d(Ke^{st}) /dt + 6Ke^{st}= 0 - s²Ke
^{st}+ 5sKe^{st}+ 6Ke^{st}= 0 - (s² + 5s + 6)(Ke
^{st}) = 0

Once again, either (s² + 5s + 6) or (Ke^{st}) must be zero.
Again, we will consider the case where K is not zero, and
therefore (s² + 5s + 6) must be zero. The quadratic, as² + bs
+ c, is called the characteristic equation of a second order
differential equation. The quadratic equation may be used to find
the two possible solutions, although in some cases, such as this
one, factoring is easier.

- (s² + 5s + 6) = 0
- (s + 3)(s + 2) = 0
- s
_{1,2}= -2, -3

Since we have two separate solutions for s, we must have two separate terms for the solution, the combination of which form the whole solution. We must also have two unknowns.

- K
_{1}e^{s1t}+ K_{2}e^{s2t}

In this case it would be

- x = K
_{1}e^{-2t}+ K_{2}e^{-3t}

To find both these constants, we would need two initial conditions, both the functions initial condition, and its derivatives initial condition.

- x(0) = 2
- dx/dt|
_{0}= -5

(Note that dx/dt|_{0 }means the derivative of x with respect to t
evaluated at 0).

With these conditions, we can find the two constants.

- (Eq. 1) x(0) = 2 = K
_{1}+ K_{2} - (Eq. 2) dx/dt |
_{ 0}= -5 = d(K_{1}e^{-2t})/dt + d(K_{2}e^{-3t})/dt = -2K_{1}- 3K_{2} - (1) K
_{1}= 2 - K_{2} - (2) -5 = -2(2 - K
_{2}) - 3K_{2} - (2) -5 = -4 + 2K
_{2}- 3K_{2} - (2) K
_{2}= 1 - (1) K
_{1}= 2 - K_{2}= 2 - 1 = 1

The final solution is

- x = e
^{-2t}+ e^{-3t}

There are two other possibilities though when solving the characteristic equation. The first is that the solution has repeated roots. In this case, the general form of the solution is different. It is

- K
_{1}e^{st}+ K_{2}te^{st}

Note the extra t is the second term. This is needed to get the two separate parts of the solution necessary to solve the equation. The rest of the solution process is the same.

The other possibility is that the solution is complex. In this case the solutions would be complex conjugates where one solution would have a positive imaginary part and the other would have a negative imaginary part. (Note that j is the imaginary number sqrt(-1). It is called i in most mathematics books but j is used to avoid confusion with the variable i used for an unknown current.)

Finding the unknowns when the two solutions are complex is more difficult than with the repeated solutions, so we will go through an example here.

- d²x/dt² + 2 dx/dt + 5x = 0
- (s² + 2s + 5) = 0
- s
_{1,2}= (-2 +/- sqrt(2² - (4)(5))) / 2 - s
_{1,2}= -1 +/- sqrt(-16) / 2 - s
_{1,2}= -1 +/- j2

So the solution with the two unknowns is

- x = K
_{1}e^{(-1 + j2)t}+ K_{2}e^{(-1 - j2)t}

or

- x = e
^{-t}(K_{1}e^{j2t}+ K_{2}e^{-j2t})

When finding the unknowns is necessary, there is a more useful form of the solution. (See section on Complex Numbers for derivation). The general form is

- x = B
_{1}e^{Re(s)}cos Im(s) * t + B_{2}e^{Re(s)}cos Im(s) * t

For this problem, the solution would be

- x = B
_{1}e^{-t}cos 2t + B_{2}e^{-t}sin 2t

With the initial conditions

- x(0) = 4, dx/dt|
_{0}= 0 - (Eq. 1) 4 = B
_{1} - (Eq. 2) 0 = -B
_{1}+ 2B_{2} - (2) 2B
_{2}= B_{1}= 4 - (2) B
_{2}= 2

The final solution is

- x = 4e
^{-t}cos 2t + 2e^{-t}sin 2t

Up to this point, the differential equations we have solved have all consisted of an unknown and derivatives of that unknown with no other functions. Basically, this means when you gather all instances of that unknown on one side of the equation, the other side is 0. This response is called the natural response. When there is an additional function, the forced response must be considered as well. The total response is then the sum of the natural and forced responses. They can be found separately but it is required that the total response be considered when finding the unknowns in the natural response, otherwise the solution will be wrong. Here is a simple example.

- dx/dt + 5x = 10

Notice the constant on the right side of the equation. We will first find the forced response. To find the forced response, we will plug a trial solution into the problem and the solve for the unknowns in the solution. The type of trial solution depends on the terms which appear on the right side of the equation. In this case it is a constant so the trial solution will be a constant.

- x
_{f}= A - dA/dt + 5A = 10
- 5A = 10
- A = 2 = x
_{f}

So the forced response is equal to 2. Now we find the natural response by removing the forcing function.

- dx/dt + 5x = 0

Solving the characteristic equation.

- s + 5 = 0
- s = -5

So the natural solution is

- x
_{n}= Ke^{-5t}

Now, if we are given an initial condition, we must find K using the total response.

- x(0) = 7
- x = x
_{n}+ x_{f}= Ke^{-5t}+ 2 - x(0) = 7 = Ke
^{(-5)(0)}+ 2 - 7 = K + 2
- K = 5

The total solution is

- x = 5e
^{-5t}+ 2

Here is a table of some forcing functions and their trial solutions.

Forcing Function | Trial Forced Solution |

constant | A |

t | At + B |

t^{n} |
At^{n} + Bt^{n-1} + . . . + Et + F |

e^{st} |
Ae^{st} |

sin wt, cos wt | A sin wt + B cos wt |

e^{at} sin wt, e^{at}
cos wt |
e^{at}(A sin wt + B cos wt) |

te^{at} sin wt, te^{at}
cos wt |
te^{at}(A sin wt + B cos wt)
+ e^{at}(C sin wt + D cos wt) |

When working with second order equations or with forcing functions which are not constants, the computation is obviously harder. Here is a second order problem with a sinusoid as the forcing function.

- d²x/dt² + 2dx/dt + x = 2sin 2t

First, we will find the forced solution.

- x
_{f}= A sin wt + B cos wt

In this case, w = 2.

- d²(A sin 2t + B cos 2t)/dt² + 2 d(A sin 2t + B cos 2t)/dt + A sin 2t + B cos 2t = 2 sin 2t
- -4A sin 2t - 4B cos 2t + 4A cos 2t - 4B sin 2t + A sin 2t + B cos 2t = 2 sin 2t
- -3A sin 2t - 4B sin 2t + 4A cos 2t - 3B cos 2t = 2 sin 2t

Now, divide this into two different equations, one equating the cosine terms and one equating the sine terms.

- (Eq. 1) -3A sin 2t - 4B sin 2t = 2 sin 2t
- (Eq. 2) 4A cos 2t - 3B cos 2t = 0
- (2) 4A = 3B
- (2) A = 3/4 B
- (1) -3 (3/4 B) - 4B = 2
- (1) -25/4 B = 2
- (1) B = -8/25
- (2) A = 3/4 B = -6/25

So the forced solution is

- x
_{f}= -6/25 sin 2t - 8/25 cos 2t

Once again, to find the natural solution, remove the forcing term

- dx²/dt² + 2 dx/dt + x = 0

Solve the characteristic equation.

- (s² + 2s + 1) = 0
- (s + 1)² = 0
- s
_{1,2}= -1

This is a case of repeated roots, so the natural solution is

- x
_{n}= K_{1}e^{-t}+ K_{2}te^{-t}

The total solution is then

- x = x
_{n}+ x_{f}= K_{1}e^{-t}+ K_{2}te^{-t}- 6/25 sin 2t - 8/25 cos 2t

With initial conditions

- x(0) = 2, dx/dt|
_{0}= 1 - (Eq. 1) x(0) = 2 = K
_{1}e^{0}+ K_{2}(0)e^{0}- 6/25 sin 0 - 8/25 cos 0 - (Eq. 2) dx/dt = -K
_{1}e^{-t}- K_{2}te^{-t}+ K_{2}e^{-t}- 12/25 cos 2t + 16/25 sin 2t - (2) dx/dt |
_{0}= 1 = -K_{1}e^{-0}- K_{2}(0) e^{-0}+ K_{2}e^{-0}- 12/25 cos 0 + 16/25 sin 0 - (1) 2 = K
_{1}- 8/25 - (1) K
_{1}= 58/25 - (2) 1 = -K
_{1}+ K_{2}- 12/25 - (2) K2 = 1 + 58/25 + 12/25 = 95/25

The final solution is

- x = 58/25 e
^{-t}+ 95/25 te^{-t}- 6/25 sin 2t - 8/25 cos 2t