Monday, September 2, 2013

Differential Equations #8: Second Order ODEs - Variation of Parameters


Solving y" + A*y' + B*y = f(x)


In part 4 (link: http://edspi31415.blogspot.com/2013/08/differential-equations-4-homogeneous.html ), we looked at homogenous second order differential equations, which have the form

y" + A*y' + B*y = 0. (I)

Now we are going to look at second order differential equations that have the form

y" + A*y' + B*y = f(x). (II)

The solution to (II) has the form y(x) = y_h + y_p.

y_h

y_h is determined by solving the equation as if f(x)=0. In other words, forget f(x) for the moment. Use the techniques similar to Part 4 and solve the characteristic equation λ^2 + A*λ + B = 0.

The nature of λ1 and λ2 determines the nature of solution.

The root is a real double root. B^2 - 4A = 0 and λ1 = λ2
Then y_h = C1 * e^(λ1 * x) + x * C2 * e^(λ1*x)

The roots are distinct and real. B^2 - 4A > 0 and λ1 ≠ λ2
Then y_h = C1 * e^(λ1*x) + C2 * e^(λ2*x)

The roots are complex, in the form of λ = S ± T*i, and B^2 - 4A < 0
Then y_h = C1 * e^(S*x) cos(T*x) + C2 * e^(S*x) * sin(T*x)

y_p

An Abridged Derivation of finding y_p

(0) Start with y" + A * y' + B * y = 0.

Let the particular solution take the form
(1) y_p = u * y1 + v * y2

u, y1, v, and y2 are all functions of x. The functions y1 and y2 correspond to terms of the solution to the equation y" + A*y' + B*y = 0.

Take the derivative of (1) to arrive at
(2) y_p' = u' * y1 + u * y1' + v' * y2 + v * y2'

(3) Let u' * y1 + v' * y2 = 0. Then (2) reduces to:

(4) y_p' = u' * y1 + v * y2'

Take the second derivative of y_p yields
(5) y_p" = u' * y1' + u" * y1' + v" * y2' + v' * y2"

Substitute y = y_p, y' = y_p', and y" = y_p" into (0). After grouping in terms of u, v, u", and v" we arrive at:

(6) u * (y1" + A*y1' + B*y1) + v * (y2" + A*y2' + B*y2) + u' * y1' + v' * y2' = f(x).

Since y1 and y2 are solutions, (6) reduces to:

(7) u' * y1' + v' * y2' = f(x).

We now have the system of equations:
(3) u' * y1 + v' * y2 = 0
(7) u' * y1' + v' * y2' = f(x)

Solving for u' and v' yields
(8)
u' = f(x) * y2 / W
v' = -f(x) * y1 / W
Where W = y2 * y1' - y1 * y2'

W is called the Wronskian.

Taking the integrals of u' and v' and putting the results in (1) yields the formula for y_p:

y_p = y1 * u + y2 * v
y_p = y1 * ∫(f(x) * y2/W) dx - y2 * ∫(f(x) * y1/W) dx
Where W = y2 * y1' - y1 * y2'




Summary

The solution to y" + A*y' + B*y = f(x) is

y(x) = y_h + y_p

y(x) = C1 * y1 + C2 * y2 + y1 * ∫(f(x) * y2/W) dx - y2 * ∫(f(x) * y1/W) dx

Where W = y2 * y1' - y1 * y2'



Let's look at some examples.

1. y" + 9*y = π

The solution has the form y(x) = y_h + y_p

y_h:
The characteristic equation is λ^2 + 9 = 0 with solutions λ = ±3i. Then:

y_h = C1 * cos(3x) + C2 * sin(3x)

Note that
y1 = cos(3x)
y2 = sin(3x)
f(x) = π

y_p:
First figure W (the Wronskian).
W = sin(3x) d/dx cos(3x) - cos(3x) d/dx sin(3x) = -3

Then:
∫ f(x)*y2/W dx = ∫ π*sin(3x)/-3 dx = π/9 * cos(3x)
∫ f(x)*y1/W dx = ∫ π*cos(3x)/-3 dx = -π/9 * sin(3x)
And
y_p = y1 * ∫(f(x) * y2/W) dx - y2 * ∫(f(x) * y1/W) dx
y_p = π/9 * ((cos(3x))^2 + π/9 * ((sin(3x))^2
y_p = π/9

Recall (cos Φ)^2 + (sin Φ)^2 = 1

Solution:
y_p = C1 * cos(3x) + C2 * sin(3x) + π/9

2. y" + y' - 6*y = e^x

y_h:
Characteristic Equation: λ^2 + λ - 6 = 0
Roots: λ1 = 2, λ2 = -3

y_h = C1 * e^(2x) + C2 * e^(-3x)

y1 = e^(2x)
y2 = e^(-3x)
f(x) = e^x

y_p:
W = e^(-3x) * 2 * e^(2x) - e^(2x) * -3 * e^(-3x) = 5 * e^(-x)
∫ f(x)*y2/W dx = ∫ 1/5 *e^(-x) dx = -1/5 * e^(-x)
∫ f(x)*y1/W dx = ∫ 1/5 * e^(4x) dx = 1/20 * e^(4x)

y_p = e^(2x) * (-1/5 * e^(-x)) + e^(-3x) * (1/20 * e^(4x))
y_p = -1/4 * e^x

Solution:
y = C1 * e^(2x) + C2 * e^(-3x) - 1/4 * e^x

3. y" - 6*y' + 9*y = -2x

y_h:
Characteristic Equation: λ^2 - 6*λ + 9 = 0
Roots: λ = 3, double root

y_h = C1 * e^(3x) + C2 * x * e^(3x)

y1 = e^(3x)
y2 = x * e^(3x)
f(x) = -2x

y_p:
W = x*e^(3x)*3*e^(3x) + e^(3x)*(e^(3x)+3*x*e^(3x))
∫ f(x)*y2/W dx = ∫ 2 * x^2 * e^(-3x) dx = e^(-3x) * (-18x^2 - 12x - 4)/27
∫ f(x)*y1/W dx = ∫ 2 * x * e^(-3x) dx = e^(-3x) * (-6x - 2)/9

(You really have to watch your algebra with this one.)

y_p = e^(3x) * [e^(-3x) * (-18x^2 - 12x - 4)/27] + x * e^(3x) * [e^(-3x) * (-6x - 2)/9]
y_p = -2x/9 - 4/27

Solution:
y = C1 * e^(3x) + C2 * x * e^(3x) - 2x/9 - 4/27

That wraps up this edition of Differential Equations. Next time, we are going back to systems of equations.


Thanks as always. Happy Labor Day!

Eddie

This blog is property of Edward Shore. 2013