In the last section we utilized the method of undetermined coefficients to find a particular solution to a nonhomogeneous linear differential equation. After also solving the associated homogeneous solution we added them together to get the general solution of the linear differential equation.
In general if we have a 2nd-order linear nonhomogeneous initial value problem
$$y''(t) + p(t)y'(t) + q(t)y = g(t);\qquad y(t_0) = y_0,\ y'(t_0)=y_1,$$
then we solve the differential equation in three steps.
First we set the right-hand side of the differential equation to zero
$$y''(t) + p(t)y'(t) + q(t)y = 0$$
This can be thought of as solving the linear operator problem
$$L[y] = 0,$$
where $L[y] = y''(t) + p(t)y'(t) + q(t)y$. The solutions form a two-dimensional vector space called the
kernel
of the differential operator. We find two
fundamental solutions
$y_1(t)$ and $y_2(t)$ for the homogenous differential equation and the kernel of the differential equation, the two-dimensional vector space of all solutions, is the set of all possible linear combinations of the two fundamental solutions
$$y(t) = c_1y_1(t) + c_2y_2(t).$$
Next we look at the 2nd-order linear nonhomogeneous differential equation and try to find a particular solution $\Psi(t)$. There are several methods for finding a particular solution and they generally depend on the function on the right-hand side $g(t)$. If right-hand side $g(t)$ is the first and second derivative of functions we recognize, then one can use the method of undetermined coefficients to find a particular solution $\Psi(t)$.
If the method of undetermined coefficients fails, there are other methods for finding a particular solution so that
$$L\left[\Psi(t)\right] = \Psi''(t) + p(t)\Psi'(t) + q(t)\Psi(t) = g(t).$$
In any case if a particular solution is found then the general solution of the 2nd-order linear nonhomogeneous differential equation is given by
$$y(t) = c_1y_1(t) + c_2y_2(t) + \Psi(t).$$
This is because $L$ is a linear operator so
$$\begin{align*}
L\left[c_1y_1(t) + c_2y_2(t) + \Psi(t)\right] &= c_1L\left[y_1(t)\right] + c_2L\left[y_2(t)\right] + L\left[\Psi(t)\right] \\
\\
&= c_1(0) + c_2(0) + g(t) \\
\\
&= g(t).
\end{align*}$$
At this point we differentiate our general solution and use our initial conditions to obtain two equations for our arbitrary constants
$$\begin{align*}
y_0 &= y(t_0) = c_1y_1(t_0) + c_2y_2(t_0) + \Psi(t_0) \\
\\
y_1 &= y'(t_0) = c_1y_1'(t_0) + c_2y_2'(t_0) + \Psi'(t_0). \\
\end{align*}$$
This results in a system of two linear equations for our two unknown constants.
The method of variation of parameters is more general than the method of undetermined coefficients and will work for any 2nd-order linear differential equation. If we have a homogeneous differential equation or we recognize the types of functions that our nonhomogeneous differential equation must take, then we prefer the simpler methods already introduced. Think of the methods of this section like the quadratic formula; it is a method of last resort that you know will always work; it just takes a lot more effort. The method of variation of parameters is a three-step process just like the method of undetermined coefficients. The first and last step are also the same.
Variation of Parameters ¶
- Solve the associated 2nd-order linear homogeneous differential equation.
- Utilize Variation of Parameters to find a particular solution.
- Use the initial conditions to find the unique solution.
The only difference is how we find a particular solution.
Find the general solution to the 2nd-order linear differential equation
$$y'' + 4y = 8\tan(2t).$$
Notice that we do
not
have an initial value problem so we will not be using the third step in our process.
Writing down the characteristic equation we have
$$\begin{align*}
d^2 + 4 &= 0 \\
\\
d^2 &= -4 \\
\\
d &= \pm 2i
\end{align*}$$
The homogeneous solution is therefore
$$y_h(t) = c_1 \cos(2t) + c_2 \sin(2t).$$
Unlike sine and cosine, one generally doesn't recognize functions whose second derivative is the tangent function. We can integrate tangent to get
$$\displaystyle\int\tan(t)\,dt = -\log\left|\cos(t)\right| + C = \log\left|\sec(t)\right| + C.$$
Looking for elementary functions whose second derivative are $\tan(t)\ $ is much more difficult. Instead we will resort to variation of parameters because it always works. We will start as we did in d'Alembert's method in
Section 3.4
by replacing the arbitrary constants in our homogeneous solution with functions $u(t)$ and $v(t)$ to write our solution
$$y(t) = u(t)y_1(t) + v(t)y_2(t) = u\cos(2t) + v\sin(2t).$$
Next, we substitute this into our differential equation. To do this we will need the second derivative as well. We write out both terms vertically one derivative at a time.
$$\begin{align*}
y'(t) &= u'\cos(2t) - 2u\sin(2t) + v'\sin(2t) + 2v\cos(2t) \\
\\
&= 2v\cos(2t) - 2u\sin(2t) + u'\cos(2t) + v'\sin(2t).
\end{align*}$$
Notice that one differentiates using the product rule, but we write the first derivative with the two terms with $u(t)$ and $v(t)$ first and the terms with $u'(t)$ and $v'(t)$ last. When we finish substituting $u\cos(2t) + v\sin(2t)$ into our differential equation by evaluating our differential operator at $u\cos(2t) + v\sin(2t)$ we will obtain
$$L\left[u\cos(2t) + v\sin(2t)\right] = \tan(2t).$$
We will have only one equation and two unknowns $u(t)$ and $v(t)$. This means that there are infinitely many different particular solutions we might find. However, we only need one particular solution. We need some other condition imposed on our system. When we are in this position of selecting one from infinitely many possible solutions we generally look for a condition that helps us pick out a solution in some way.
Choosing a Condition on our Particular Solution
- A condition that is easy to use and consistent with our system of equations.
- A condition that simplifies our computations.
- A condition that selects an elementary solution over more complicated ones.
The condition we choose is
$$u'\cos(2t) + v'\sin(2t) = 0.$$
This makes the computation for $y'(t)$
$$\begin{align*}
y'(t) &= 2v\cos(2t) - 2u\sin(2t) + u'\cos(2t) + v'\sin(2t) \\
\\
&= 2v\cos(2t) - 2u\sin(2t) + 0 \\
\\
&= 2v\cos(2t) - 2u\sin(2t).
\end{align*}$$
Differentiating again to obtain $y''(t)$ gives us
$$y''(t) = -4u\cos(2t) - 4v\sin(2t) - 2u'\sin(2t) + 2v'\cos(2t).$$
Using the equations for $y'$ and $y''$, we can now substitute $u\cos(2t) + v\sin(2t)$ into our differential equation.
$$\begin{array}{rcl}
L[y(t)] & = & L\left[u\cos(2t) + v\sin(2t)\right] = y'' + 4y = \tan(2t) \\
\\
y''(t) & = & -4u\cos(2t) - 4v\sin(2t) - 2u'\sin(2t) + 2v'\cos(2t) \\
+\ 4y(t) & = & \, \ \ 4u\cos(2t) + 4v\sin(2t) \\ \hline
\tan(2t) &= & \qquad 0\quad\ \ \ \ + \qquad 0\ \ \ \ - 2u'\sin(2t) + 2v'\cos(2t)
\end{array} $$
This gives us a second equation we can use
$$ - 2u'\sin(2t) + 2v'\cos(2t) = \tan(2t).$$
Together our chosen condition on the particular solution and the above equation give us a linear system of two equations and two unknowns
$$\begin{align*}
u'\cos(2t) + v'\sin(2t) &= 0 \\
\\
-2u'\sin(2t) + 2v'\cos(2t) &= \tan(2t).
\end{align*}$$
To make this easier to see, let us write the system in matrix form
$$\left[\begin{array}{cc} \cos(2t) & \sin(2t) \\ -2\sin(2t) & 2\cos(2t) \end{array}\right]\left[\begin{array}{c} u'(t) \\ v'(t) \end{array}\right] = \left[\begin{array}{c} 0 \\ \tan(t) \end{array}\right].$$
The linear equation can be solved for $u'(t)$ and $v'(t)$ using Cramer's Rule
$$\begin{align*}
W\left[\cos(t),\ \sin(t)\right] &= \left|\begin{array}{cc} \cos(2t) & \sin(2t) \\ -2\sin(2t) & 2\cos(2t) \end{array}\right| \\
\\
&= 2\cos^2(t) + 2\sin^2(t) = 2 \\
\\
u'(t) &= \dfrac{\left|\begin{array}{cc} 0 & \sin(2t) \\ \tan(2t) & 2\cos(2t) \end{array}\right|}{\left|\begin{array}{cc} \cos(2t) & \sin(2t) \\ -2\sin(2t) & 2\cos(2t) \end{array}\right|} \\
\\
&= \dfrac{-\sin(2t)\tan(2t)}{2} \\
\\
v'(t) &= \dfrac{\left|\begin{array}{cc} \cos(2t) & 0 \\ -2\sin(2t) & \tan(2t) \end{array}\right|}{\left|\begin{array}{cc} \cos(2t) & \sin(2t) \\ -2\sin(2t) & 2\cos(2t) \end{array}\right|} \\
\\
&= \dfrac{\sin(2t)}{2}
\end{align*}$$
Unfortunately, we have yet to find $u(t)$ and $v(t)$. We found $u'(t)$ and $v'(t)$. We integrate to $u'(t)$ to get
$$\begin{align*}
u(t) &= \displaystyle\int -\dfrac{1}{2}\sin(2t)\tan(2t)\,dt \\
\\
&= -\dfrac{1}{2}\displaystyle\int\dfrac{\sin^2(2t)}{\cos(2t)}\,dt \\
\\
&= -\dfrac{1}{2}\displaystyle\int\dfrac{1 - \cos^2(2t)}{\cos(2t)}\,dt \\
\\
&= \dfrac{1}{2}\displaystyle\int\left(\cos(2t) - \sec(2t)\right)\,dt \\
\\
&= \dfrac{1}{4}\sin(2t) - \dfrac{1}{4}\log\left|\sec(2t) + \tan(2t)\right| + c_1
\end{align*}$$
We integrate $v'(t)$ to obtain
$$\begin{align*}
v(t) &= \displaystyle\int \dfrac{\sin(2t)}{2}\,dt \\
\\
&= -\dfrac{\cos(2t)}{4} + c_2.
\end{align*}$$
Substituting our expressions for $u(t)$ and $v(t)$ into our general solution we see that the solution takes the form
$$y(t) = \left(\dfrac{1}{4}\sin(2t) - \dfrac{1}{4}\log\left|\sec(2t) + \tan(2t)\right| + c_1\right)\cos(2t) + \left(-\dfrac{\cos(2t)}{4} + c_2\right)\sin(2t).$$
If we distribute our multiplication over addition are rearrange the terms the solution becomes
$$\begin{align*}
y(t) &= c_1\cos(2t) + c_2\sin(2t) + \dfrac{1}{4}\sin(2t)\cos(2t) - \dfrac{1}{4}\sin(2t)\cos(2t) \\
&\qquad\qquad -\cos(2t)\dfrac{1}{4}\log\left|\sec(2t) + \tan(2t)\right|.
\end{align*}$$
This simplifies to our general solution for the 2nd-order linear nonhomogeneous differential equation
$$y(t) = c_1\cos(2t) + c_2\sin(2t) - \dfrac{\cos(2t)}{4}\log\left|\sec(2t) + \tan(2t)\right|.$$
Isn't it a good thing we don't have initial conditions and this problem is over!
The above set of calculations are very tedious, so let us derive the variation of parameters technique in general to see if there is a more direct way to use it. Beginning with a general 2nd-order linear nonhomogeneous equation,
$$ y'' + p(t)y' + q(t)y = g(t) $$
imagine that we have a family of fundamental solutions $y_1$ and $y_2$ to the associated homogeneous equation. This means that the complimentary solution to the nonhomogeneous equation can be expressed as a linear combination of $y_1$ and $y_2$ and we will replace the scalars in this linear combination with unknown functions as we did above:
$$ y(t) = u(t)y_1(t) + v(t)y_2(t). $$
Assuming that our solution to the nonhomogeneous equation has this form, we differentiate to find $y'$ and $y''$ to plug into our differential equation.
$$ y' = u'y_1 + uy_1' + v'y_2 + vy_2', $$
(where we leave off the $t$ terms to ease of reading). Before moving on, we are going to impose a condition on this derivative. We know from the previous derivation that we require a second equation to be able to find $u$ and $v$, so we choose
$$ u'y_1 + v'y_2 = 0 $$
because it allows us to simplify this expression and eliminates several inconvenient terms that would appear in the second derivative. With this condition, we have
$$ y' = \color{#ec008c}{\underbrace{u'y_1 + v'y_2}_0} + uy_1' + vy_2' = uy_1' + vy_2' $$
and
$$ y'' = u'y_1' + uy_1'' + v'y_2 + vy_2''. $$
Now we add these expressions together to recover our differential equation
$$ \begin{array}{rcl} y'' & = & \qquad uy_1'' + vy_2'' + u'y_1' + v'y_2' \\
p(t)y'\, & = & p(t)\left(uy_1' + vy_2'\right) \\
+\ q(t)y\,\ & = & q(t)\left(uy_1 + vy_2\right) \\ \hline
g(t)& = & u\color{#ec008c}{\underbrace{\left(y_1'' + p(t)y_1' + q(t)y_1\right)}_0} + v\color{#ec008c}{\underbrace{\left(y_2'' + p(t)y_2' + q(t)y_2\right)}_0} + u'y_1' + v'y_2'
\end{array}$$
where the indicated terms are $0$ because they are solutions to the homogeneous equation. This leaves us with
$$ u'(t)y_1'(t) + v'(t)y_2'(t) = g(t). $$
Recalling our earlier condition on the first derivative of the solution, $u'y_1 + v'y_2 = 0$, we can construct a system of two equations and two unknowns.
$$\begin{align*}
u'(t)y_1(t) + v'(t)y_2(t) &= 0 \\
\\
u'(t)y_1'(t) + v'(t)y_2'(t) &= g(t)
\end{align*}$$
It is more convenient to write this as a matrix equation
$$ \begin{bmatrix} y_1(t) & y_2(t) \\ y_1'(t) & y_2'(t) \end{bmatrix} \begin{bmatrix} u'(t) \\ v'(t) \end{bmatrix}
= \begin{bmatrix} 0 \\ g(t) \end{bmatrix}, $$
which suggests a method of solution: Cramer's rule.
Since $y_1$ and $y_2$ are a fundamental set of solutions, we know that their Wronskian $W\left[y_1,y_2\right] \neq 0$, so Cramer's rule to find $u'$ and $v'$ will work. The formulas for $u'$ and $v'$ will look like
$$ u'(t) = \dfrac{\begin{vmatrix} \color{#307fe2}{0} & y_2(t) \\ \color{#307fe2}{g(t)} & y_2'(t) \end{vmatrix}}{\begin{vmatrix} y_1(t) & y_2(t) \\ y_1'(t) & y_2'(t) \end{vmatrix}} \qquad\qquad
v'(t) = \dfrac{\begin{vmatrix} y_1(t) & \color{#307fe2}{0} \\ y_1'(t) & \color{#307fe2}{g(t)} \end{vmatrix}}{\begin{vmatrix} y_1(t) & y_2(t) \\ y_1'(t) & y_2'(t) \end{vmatrix}}.$$
Do not
bother trying to remember these formulas. Just write down the matrix equation above and apply Cramer's rule.
Theorem 3.6.1 ¶
Variation of Parameters
Consider a nonhomogeneous 2nd-order linear differential equation
$$ y'' + p(t)y' + q(t)y = g(t).$$
If the functions $p$, $q$, and $g$ are continuous on an open interval $I$, and if the functions $y_1$ and $y_2$ form a fundamental set of solutions of the corresponding homogeneous equation
$$ y'' + p(t)y' + q(t)y = 0, $$
then a general solution of the nonhomogeneous equation exists in the form
$$y(t) = u(t)y_1(t) + v(t)y_2(t)$$
where $u(t)$ and $v(t)$ are the solutions to the matrix equation
$$ \left.\begin{bmatrix} y_1(t) & y_2(t) \\ y_1'(t) & y_2'(t) \end{bmatrix} \begin{bmatrix} u'(t) \\ v'(t) \end{bmatrix} = \begin{bmatrix} 0 \\ g(t) \end{bmatrix}\right._{\Large .}$$
In many practical applications, such as engineering, we will have a homogeneous system whose general solution is known but the solution for a nonhomogeneous problem. For example, you have a device that is meant to be used in a uncontrolled environment (say due to weather conditions changing while flying an aircraft). The precise conditions the device will be operating under will not be known until they are measured, and the device must know these conditions to function properly. These conditions are represented as an input $g(t)$ and the resulting solution to the initial value problem is the device or system's response .
Find the
response
or solution of the initial value problem with
input
$g(t)$
$$y'' + 5y' + 6y = g(t),\qquad y(0)=0,\ y'(0)=1$$
Find the general solution of the nonhomogeneous equation
$$ y'' + 4y' + 4y = t^{-2}e^{-2t}. $$
Given the differential equation
$$ ty'' - (1+t)y' + y = t^2 e^{2t},\qquad t\gt 0, $$
verify that the functions $y_1 = 1+t$ and $y_2 = e^t$ are both solutions to the associated homogeneous equation and then find a general solution to the nonhomogeneous case.
There are simpler methods than variation of parameters, however they don't work with every 2nd-order linear nonhomogeneous differential equation
$$y'' + p(t)y' + q(t)y = g(t).$$
Undetermined coefficients works well only if we recognize the two antiderivatives of $g(t)$. If we can factor the differential operator into a composition of two first order differential equations, then we can solve two 1st-order linear differential equations.
Consider the 2nd-order linear nonhomogeneous differential equation
$$y'' - 2y' - 3y = -3te^{-t}. $$
Factoring the characteristic polynomial, we obtain
$$\begin{align*}
(d^2 - 2d - 3)[y] &= -3te^{-t} \\
\\
(d + 1)(d - 3)[y] &= -3te^{-t} \\
\end{align*}$$
If we define $v(t) = (d - 3)y(t),$ then we have
$$\begin{align*}
(d + 1)[v] &= -3te^{-t} \\
\\
v' + v &= -3te^{-t} \\
\\
\mu(t) &= e^{\int 1\,dt} = e^t\qquad\text{integrating factor} \\
\\
e^tv' + e^tv &= -3te^{-t}e^t = -3t \\
\\
\left[e^tv\right]' &= -3t \\
\\
e^tv &= \displaystyle\int -3t\,dt = -\dfrac{3}{2}t^2 + c_1 \\
\\
v(t) &= -\dfrac{3}{2}t^2e^{-t} + c_1e^{-t} \\
\\
(d - 3)[y] &= -\dfrac{3}{2}t^2e^{-t} + c_1e^{-t} \\
\\
y' - 3y &= -\dfrac{3}{2}t^2e^{-t} + c_1e^{-t} \\
\\
\mu(t) &= e^{\int -3\,dt} = e^{-3t}\qquad\text{integrating factor} \\
\\
e^{-3t}y' - 3e^{-3t}y &= \left(-\dfrac{3}{2}t^2e^{-t} + c_1e^{-t}\right)e^{-3t} \\
\\
\left[e^{-3t}y\right]' &= -\dfrac{3}{2}t^2e^{-4t} + c_1e^{-4t} \\
\\
e^{-3t}y &= \displaystyle\int -\dfrac{3}{2}t^2e^{-4t} + c_1e^{-4t}\,dt \\
\end{align*}$$
In order to integrate $\displaystyle\int-\frac{3}{2}t^2e^{-4t}\,dt$ we will need to integrate by parts several times
Completing our integration, we obtain
$$e^{-3t}y = \dfrac{3}{8}t^2e^{-4t} + \dfrac{3}{16}te^{-4t} + \dfrac{3}{64}e^{-4t} -\dfrac{c_1}{4}e^{-4t} + c_2. $$
If we multiply both sides of the equation by $e^{3t}$ and recall that an arbitrary constant divided by $-4$ and added to $\frac{3}{64}$ is also an arbitrary constant, then we get our general solution
$$y(t) = \dfrac{3}{8}t^2e^{-t} + \dfrac{3}{16}te^{-t} + c_1e^{-t} + c_2e^{3t}. $$
This solution is often written
$$y(t) = \dfrac{3}{16}e^{-t}\left( 2t^2 + t\right) + c_1e^{-t} + c_2e^{3t}. $$
This method works well if you can factor the characteristic polynomial to get a composition of two real 1st-order differential operators. If the characteristic polynomial has complex conjugate roots then you will usually resort to the method of variation of parameters.
Find the general solution of the nonhomogeneous equation
$$y'' - 2y' + y = \dfrac{e^t}{1+t^2}$$
Creative Commons Attribution-NonCommercial-ShareAlike 4.0
Attribution
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Noncommercial
You may not use the material for commercial purposes.
Share Alike
You are free to share, copy and redistribute the material in any medium or format. If you adapt, remix, transform, or build upon the material, you must distribute your contributions under the
same license
as the original.