In the last section we utilized the method of Undetermined Coefficients to find a particular solution to a nonhomogeneous linear differential equation. After also solve 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 of 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.
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.
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{align*}
L[y(t)] &= L\left[u\cos(2t) + v\sin(2t)\right] = y'' + 4y = \tan(2t) \\
\\
4y(t) &= \ \ 4u\cos(2t) + 4v\sin(2t) \\
y''(t) &= -4u\cos(2t) - 4v\sin(2t) - 2u'\sin(2t) + 2v'\cos(2t) \\
----&- ----------------------- \\
\tan(2t) &= \qquad 0\quad\ \ \ \ + \qquad 0\ \ \ \ - 2u'\sin(2t) + 2v'\cos(2t) \\
\end{align*}$$
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!
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\,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 $-\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. The method of variation of parameters is also useful when we do not already know the nonhomogeneous function $g(t)$. This often happens in engineering and science as we want design our testing or manufacturing device to adapt to the situation at hand; $g(t)$ is not known until it is measured in a real-time environment. Our computer program must compute the
response
or solution to the differential equation using the measured
input
$g(t)$ and the equation for the general solution.
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'' - 2y' + y = \dfrac{e^t}{1+t^2}$$
Find the general solution of the nonhomogeneous equation
$$ y'' + 4y' + 4y = t^{-2}e^{-2t}. $$