Wednesday, March 15, 2023

Solving Differential Equations Using Variation Of Parameters

 The method of undetermined coefficients to solve differential equations was examined in an earlier blog post, i.e.

Tricks to Solving Higher Order DEs (4): Undetermined Coefficients

Which I showed could be useful in solving many linear differential equations. However, a  method with wider applicability is needed to solve more challenging differential equations.  That method which I will focus on here is called "the variation of parameters."

I first saw the movie reference to this mathematical technique in the 1951 version of 'The Day The Earth Stood Still'.  In the film the visiting alien, Klatu, had entered the office of a physics professor named Barnhardt.  When the prof saw the changes he said he still didn't understand the celestial mechanics of how a space ship like Klatu's could travel between worlds.  Klatu made a few more changes, reprimanding the prof ("I thought you'd have solved it by now") and adding, "This is the answer using variation of  parameters."   The scene is shown below, from the movie:



In variation of parameters, the method entails replacing the constants in the complementary function with undetermined functions of the independent variable, x.   Then determining these latter functions so that when the modified complementary function is substituted into the given differential equation, f(x) will be obtained.  We use a detailed example and solution below:  

Solve:

d2y/dx 2    + y = tan x

We write the complementary function:

c  = sin x +  c 2  cos x

Assume: yp  = sin x +  v 2  cos x

Where  1 , v 2  will be determined such that this is a particular integral of the original differential equation, e.g.  y" + y  = tan x.   

Then: y'p  = 1  cos x -  v 2  sin x  +  v' sin x +  v' 2  cos x

Impose the condition that: 

v' sin x +  v' 2  cos x  =  0

ð

y'p  =  cos x -  v 2  sin x 

Then:

y''p  =   - sin x -  v 2  cos x + v'  cos x -  v' 2  sin x  

Subst. back into original DE:   y" + y  = tan x

ð

v'  cos x -  v' 2  sin x  = tan x

Then 2 equations are left from which to determine  v' ,  v' 2:

v' sin x +  v' 2  cos x = 0

v'  cos x -  v' 2  sin x =  tan x

Solving the above simultaneous eqns.:

v' 1  =  sin x

v' 2   =  cos x  - sec x

Integrate:   =   - cos x  +   c 3

v = sin x  - ln |sec x + tan x |  +   c 4

Substitute into:  yp  = sin x +  v 2  cos x

ð

yp  = c sin x +  c 4  cos x - cos x (ln |sec x + tan x 

We now write: 

yp  = A sin x +  B  cos x - cos x (ln |sec x + tan x 

Since we may assign any particular values A, B to the constants: c 3 and c .

Then write: y =  c  +   yp 

ð

y = c sin x +  c 2  cos x  +A sin x +  B  cos x - cos x (ln |sec x + tan x |)

Or:  

y = C sin x +  C 2  cos x  - cos x (ln |sec x + tan x |)

Where:  C 1  =  c    + A,   C 2  =  c 2   + B

Thus we could as well have chosen the constants c 3 and c 4  =  0, for essentially the same result.  I.e. The general solution to the differential equation being:

y = c sin x +  c 2  cos x   - cos x (ln |sec x + tan x |)


Suggested Problem:  

Solve using variation of parameters:

d2y/dx 2   - dy/ dx  - 2y  =  e 3x



No comments:

Post a Comment