Paul's Online Notes
Paul's Online Notes
Home / Differential Equations / Second Order DE's / Variation of Parameters
Show Mobile Notice Show All Notes Hide All Notes
Mobile Notice
You appear to be on a device with a "narrow" screen width (i.e. you are probably on a mobile phone). Due to the nature of the mathematics on this site it is best viewed in landscape mode. If your device is not in landscape mode many of the equations will run off the side of your device (you should be able to scroll/swipe to see them) and some of the menu items will be cut off due to the narrow screen width.

Section 3.10 : Variation of Parameters

In the last section we looked at the method of undetermined coefficients for finding a particular solution to

\[\begin{equation}p\left( t \right)y'' + q\left( t \right)y' + r\left( t \right)y = g\left( t \right)\label{eq:eq1}\end{equation}\]

and we saw that while it reduced things down to just an algebra problem, the algebra could become quite messy. On top of that undetermined coefficients will only work for a fairly small class of functions.

The method of Variation of Parameters is a much more general method that can be used in many more cases. However, there are two disadvantages to the method. First, the complementary solution is absolutely required to do the problem. This is in contrast to the method of undetermined coefficients where it was advisable to have the complementary solution on hand but was not required. Second, as we will see, in order to complete the method we will be doing a couple of integrals and there is no guarantee that we will be able to do the integrals. So, while it will always be possible to write down a formula to get the particular solution, we may not be able to actually find it if the integrals are too difficult or if we are unable to find the complementary solution.

We’re going to derive the formula for variation of parameters. We’ll start off by acknowledging that the complementary solution to \(\eqref{eq:eq1}\) is

\[{y_c}\left( t \right) = {c_1}{y_1}\left( t \right) + {c_2}{y_2}\left( t \right)\]

Remember as well that this is the general solution to the homogeneous differential equation.

\[\begin{equation}p\left( t \right)y'' + q\left( t \right)y' + r\left( t \right)y = 0\label{eq:eq2}\end{equation}\]

Also recall that in order to write down the complementary solution we know that \(y_{1}(t)\) and \(y_{2}(t)\) are a fundamental set of solutions.

What we’re going to do is see if we can find a pair of functions, \(u_{1}(t)\) and \(u_{2}(t)\) so that

\[{Y_P}\left( t \right) = u{_1}\left( t \right){y_1}\left( t \right) + u{_2}\left( t \right){y_2}\left( t \right)\]

will be a solution to \(\eqref{eq:eq1}\). We have two unknowns here and so we’ll need two equations eventually. One equation is easy. Our proposed solution must satisfy the differential equation, so we’ll get the first equation by plugging our proposed solution into \(\eqref{eq:eq1}\). The second equation can come from a variety of places. We are going to get our second equation simply by making an assumption that will make our work easier. We’ll say more about this shortly.

So, let’s start. If we’re going to plug our proposed solution into the differential equation we’re going to need some derivatives so let’s get those. The first derivative is

\[{Y'_P}\left( t \right) = {u'_1}{y_1} + {u_1}{y'_1} + {u'_2}{y_2} + {u_2}{y'_2}\]

Here’s the assumption. Simply to make the first derivative easier to deal with we are going to assume that whatever \(u_{1}(t)\) and \(u_{2}(t)\) are they will satisfy the following.

\[\begin{equation}{u'_1}{y_1} + {u'_2}{y_2} = 0\label{eq:eq3}\end{equation}\]

Now, there is no reason ahead of time to believe that this can be done. However, we will see that this will work out. We simply make this assumption on the hope that it won’t cause problems down the road and to make the first derivative easier so don’t get excited about it.

With this assumption the first derivative becomes.

\[{Y'_P}\left( t \right) = {u_1}{y'_1} + {u_2}{y'_2}\]

The second derivative is then,

\[{Y''_P}\left( t \right) = {u'_1}{y'_1} + {u_1}{y''_1} + {u'_2}{y'_2} + {u_2}{y''_2}\]

Plug the solution and its derivatives into \(\eqref{eq:eq1}\).

\[p\left( t \right)\left( {{{u'}_1}{{y'}_1} + {u_1}{{y''}_1} + {{u'}_2}{{y'}_2} + {u_2}{{y''}_2}} \right) + q\left( t \right)\left( {{u_1}{{y'}_1} + {u_2}{{y'}_2}} \right) + r\left( t \right)\left( {u{_1}{y_1} + u{_2}{y_2}} \right) = g\left( t \right)\]

Rearranging a little gives the following.

\[\begin{align*}& p\left( t \right)\left( {{{u'}_1}{{y'}_1} + {{u'}_2}{{y'}_2}} \right) + {u_1}\left( t \right)\left( {p\left( t \right){{y''}_1} + q\left( t \right){{y'}_1} + r\left( t \right){y_1}} \right) + \\ & \hspace{3.0in}{u_2}\left( t \right)\left( {p\left( t \right){{y''}_2} + q\left( t \right){{y'}_2} + r\left( t \right){y_2}} \right) = g\left( t \right)\end{align*}\]

Now, both \(y_{1}(t)\) and \(y_{2}(t)\) are solutions to \(\eqref{eq:eq2}\) and so the second and third terms are zero. Acknowledging this and rearranging a little gives us,

\[p\left( t \right)\left( {{{u'}_1}{{y'}_1} + {{u'}_2}{{y'}_2}} \right) + {u_1}\left( t \right)\left( 0 \right) + {u_2}\left( t \right)\left( 0 \right) = g\left( t \right)\] \[\begin{equation}{u'_1}{y'_1} + {u'_2}{y'_2} = \frac{{g\left( t \right)}}{{p\left( t \right)}}\label{eq:eq4}\end{equation}\]

We’ve almost got the two equations that we need. Before proceeding we’re going to go back and make a further assumption. The last equation, \(\eqref{eq:eq4}\), is actually the one that we want, however, in order to make things simpler for us we are going to assume that the function \(p(t) = 1\).

In other words, we are going to go back and start working with the differential equation,

\[y'' + q\left( t \right)y' + r\left( t \right)y = g\left( t \right)\]

If the coefficient of the second derivative isn’t one divide it out so that it becomes a one. The formula that we’re going to be getting will assume this! Upon doing this the two equations that we want to solve for the unknown functions are

\[\begin{equation}{u'_1}{y_1} + {u'_2}{y_2} = 0\label{eq:eq5}\end{equation}\] \[\begin{equation}{u'_1}{y'_1} + {u'_2}{y'_2} = g\left( t \right)\label{eq:eq6}\end{equation}\]

Note that in this system we know the two solutions and so the only two unknowns here are \({u'_1}\) and \({u'_2}\). Solving this system is actually quite simple. First, solve \(\eqref{eq:eq5}\) for \({u'_1}\) and plug this into \(\eqref{eq:eq6}\) and do some simplification.

\[\begin{equation}{u'_1} = - \frac{{{{u'}_2}{y_2}}}{{{y_1}}}\label{eq:eq7}\end{equation}\] \[\begin{align*}\left( { - \frac{{{{u'}_2}{y_2}}}{{{y_1}}}} \right){{y'}_1} + {{u'}_2}{{y'}_2} & = g\left( t \right)\\ {{u'}_2}\left( {{{y'}_2} - \frac{{{y_2}{{y'}_1}}}{{{y_1}}}} \right) & = g\left( t \right)\\ {{u'}_2}\left( {\frac{{{y_1}{{y'}_2} - {y_2}{{y'}_1}}}{{{y_1}}}} \right) & = g\left( t \right)\end{align*}\] \[\begin{equation}{u'_2} = \frac{{{y_1}g\left( t \right)}}{{{y_1}{{y'}_2} - {y_2}{{y'}_1}}}\label{eq:eq8}\end{equation}\]

So, we now have an expression for \({u'_2}\). Plugging this into \(\eqref{eq:eq7}\) will give us an expression for \({u'_1}\).

\[\begin{equation}{u'_1} = - \frac{{{y_2}g\left( t \right)}}{{{y_1}{{y'}_2} - {y_2}{{y'}_1}}}\label{eq:eq9}\end{equation}\]

Next, let’s notice that

\[W\left( {{y_1},{y_2}} \right) = {y_1}{y'_2} - {y_2}{y'_1} \ne 0\]

Recall that \(y_{1}(t)\) and \(y_{2}(t)\) are a fundamental set of solutions and so we know that the Wronskian won’t be zero!

Finally, all that we need to do is integrate \(\eqref{eq:eq8}\) and \(\eqref{eq:eq9}\) in order to determine what \(u_{1}(t)\) and \(u_{2}(t)\) are. Doing this gives,

\[{u_1}\left( t \right) = - \int{{\frac{{{y_2}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}}\hspace{0.25in}\hspace{0.25in}\hspace{0.25in}{u_2}\left( t \right) = \int{{\frac{{{y_1}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}}\]

So, provided we can do these integrals, a particular solution to the differential equation is

\[\begin{align*}{Y_P}\left( t \right) & = {y_1}{u_1} + {y_2}{u_2}\\ & = - {y_1}\int{{\frac{{{y_2}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}} + {y_2}\int{{\frac{{{y_1}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}}\end{align*}\]

So, let’s summarize up what we’ve determined here.

Variation of Parameters

Consider the differential equation,

\[y'' + q\left( t \right)y' + r\left( t \right)y = g\left( t \right)\]

Assume that \(y_{1}(t)\) and \(y_{2}(t)\) are a fundamental set of solutions for

\[y'' + q\left( t \right)y' + r\left( t \right)y = 0\]

Then a particular solution to the nonhomogeneous differential equation is,

\[{Y_P}\left( t \right) = - {y_1}\int{{\frac{{{y_2}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}} + {y_2}\int{{\frac{{{y_1}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}}\]

Depending on the person and the problem, some will find the formula easier to memorize and use, while others will find the process used to get the formula easier. The examples in this section will be done using the formula.

Before proceeding with a couple of examples let’s first address the issues involving the constants of integration that will arise out of the integrals. Putting in the constants of integration will give the following.

\[\begin{align*}{Y_P}\left( t \right) & = - {y_1}\left( {\int{{\frac{{{y_2}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}} + c} \right) + {y_2}\left( {\int{{\frac{{{y_1}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}} + k} \right)\\ & = - {y_1}\int{{\frac{{{y_2}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}} + {y_2}\int{{\frac{{{y_1}g\left( t \right)}}{{W\left( {{y_1},{y_2}} \right)}}\,dt}} + \left( { - c{y_1} + k{y_2}} \right)\end{align*}\]

The final quantity in the parenthesis is nothing more than the complementary solution with c1 = -c and \(c\)2 = k and we know that if we plug this into the differential equation it will simplify out to zero since it is the solution to the homogeneous differential equation. In other words, these terms add nothing to the particular solution and so we will go ahead and assume that \(c\) = 0 and \(k\) = 0 in all the examples.

One final note before we proceed with examples. Do not worry about which of your two solutions in the complementary solution is \(y_{1}(t)\) and which one is \(y_{2}(t)\). It doesn’t matter. You will get the same answer no matter which one you choose to be \(y_{1}(t)\) and which one you choose to be \(y_{2}(t)\).

Let’s work a couple of examples now.

Example 1 Find a general solution to the following differential equation. \[2y'' + 18y = 6\tan \left( {3t} \right)\]
Show Solution

First, since the formula for variation of parameters requires a coefficient of a one in front of the second derivative let’s take care of that before we forget. The differential equation that we’ll actually be solving is

\[y'' + 9y = 3\tan \left( {3t} \right)\]

We’ll leave it to you to verify that the complementary solution for this differential equation is

\[{y_c}\left( t \right) = {c_1}\cos \left( {3t} \right) + {c_2}\sin \left( {3t} \right)\]

So, we have

\[{y_1}\left( t \right) = \cos \left( {3t} \right)\hspace{0.25in}\hspace{0.25in}{y_2}\left( t \right) = \sin \left( {3t} \right)\]

The Wronskian of these two functions is

\[W = \left| {\begin{array}{*{20}{c}}{\cos \left( {3t} \right)}&{\sin \left( {3t} \right)}\\{ - 3\sin \left( {3t} \right)}&{3\cos \left( {3t} \right)}\end{array}} \right| = 3{\cos ^2}\left( {3t} \right) + 3{\sin ^2}\left( {3t} \right) = 3\]

The particular solution is then,

\[\begin{align*}{Y_P}\left( t \right) & = - \cos \left( {3t} \right)\int{{\frac{{3\sin \left( {3t} \right)\tan \left( {3t} \right)}}{3}\,dt}} + \sin \left( {3t} \right)\int{{\frac{{3\cos \left( {3t} \right)\tan \left( {3t} \right)}}{3}\,dt}}\\ & = - \cos \left( {3t} \right)\int{{\frac{{{{\sin }^2}\left( {3t} \right)}}{{\cos \left( {3t} \right)}}\,dt}} + \sin \left( {3t} \right)\int{{\sin \left( {3t} \right)\,dt}}\\ & = - \cos \left( {3t} \right)\int{{\frac{{1 - {{\cos }^2}\left( {3t} \right)}}{{\cos \left( {3t} \right)}}\,dt}} + \sin \left( {3t} \right)\int{{\sin \left( {3t} \right)\,dt}}\\ & = - \cos \left( {3t} \right)\int{{\sec \left( {3t} \right) - \cos \left( {3t} \right)\,dt}} + \sin \left( {3t} \right)\int{{\sin \left( {3t} \right)\,dt}}\\ & = - \frac{{\cos \left( {3t} \right)}}{3}\left( {\ln \left| {\sec \left( {3t} \right) + \tan \left( {3t} \right)} \right| - \sin \left( {3t} \right)} \right) + \frac{{\sin \left( {3t} \right)}}{3}\left( { - \cos \left( {3t} \right)} \right)\\ & = - \frac{{\cos \left( {3t} \right)}}{3}\ln \left| {\sec \left( {3t} \right) + \tan \left( {3t} \right)} \right|\end{align*}\]

The general solution is,

\[y\left( t \right) = {c_1}\cos \left( {3t} \right) + {c_2}\sin \left( {3t} \right) - \frac{{\cos \left( {3t} \right)}}{3}\ln \left| {\sec \left( {3t} \right) + \tan \left( {3t} \right)} \right|\]
Example 2 Find a general solution to the following differential equation. \[y'' - 2y' + y = \frac{{{{\bf{e}}^t}}}{{{t^2} + 1}}\]
Show Solution

We first need the complementary solution for this differential equation. We’ll leave it to you to verify that the complementary solution is,

\[{y_c}\left( t \right) = {c_1}{{\bf{e}}^t} + {c_2}t{{\bf{e}}^t}\]

So, we have

\[{y_1}\left( t \right) = {{\bf{e}}^t}\hspace{0.25in}\hspace{0.25in}{y_2}\left( t \right) = t{{\bf{e}}^t}\]

The Wronskian of these two functions is

\[W = \left| {\begin{array}{*{20}{c}}{{{\bf{e}}^t}}&{t{{\bf{e}}^t}}\\{{{\bf{e}}^t}}&{{{\bf{e}}^t} + t{{\bf{e}}^t}}\end{array}} \right| = {{\bf{e}}^t}\left( {{{\bf{e}}^t} + t{{\bf{e}}^t}} \right) - {{\bf{e}}^t}\left( {t{{\bf{e}}^t}} \right) = {{\bf{e}}^{2t}}\]

The particular solution is then,

\[\begin{align*}{Y_P}\left( t \right) & = - {{\bf{e}}^t}\int{{\frac{{t{{\bf{e}}^t}\,{{\bf{e}}^t}}}{{{{\bf{e}}^{2t}}\left( {{t^2} + 1} \right)}}\,dt}} + t{{\bf{e}}^t}\int{{\frac{{{{\bf{e}}^t}\,{{\bf{e}}^t}}}{{{{\bf{e}}^{2t}}\left( {{t^2} + 1} \right)}}\,dt}}\\ & = - {{\bf{e}}^t}\int{{\frac{t}{{{t^2} + 1}}\,dt}} + t{{\bf{e}}^t}\int{{\frac{1}{{{t^2} + 1}}\,dt}}\\ & = - \frac{1}{2}{{\bf{e}}^t}\ln \left( {1 + {t^2}} \right) + t{{\bf{e}}^t}{\tan ^{ - 1}}\left( t \right)\end{align*}\]

The general solution is,

\[y\left( t \right) = {c_1}{{\bf{e}}^t} + {c_2}t{{\bf{e}}^t} - \frac{1}{2}{{\bf{e}}^t}\ln \left( {1 + {t^2}} \right) + t{{\bf{e}}^t}{\tan ^{ - 1}}\left( t \right)\]

This method can also be used on non-constant coefficient differential equations, provided we know a fundamental set of solutions for the associated homogeneous differential equation.

Example 3 Find the general solution to \[ty'' - \left( {t + 1} \right)y' + y = {t^2}\]

given that

\[{y_1}\left( t \right) = {{\bf{e}}^t}\hspace{0.25in}\hspace{0.25in}{y_2}\left( t \right) = t + 1\]

form a fundamental set of solutions for the homogeneous differential equation.

Show Solution

As with the first example, we first need to divide out by a \(t\).

\[y'' - \left( {1 + \frac{1}{t}} \right)y' + \frac{1}{t}y = t\]

The Wronskian for the fundamental set of solutions is

\[W = \left| {\begin{array}{*{20}{c}}{{{\bf{e}}^t}}&{t + 1}\\{{{\bf{e}}^t}}&1\end{array}} \right| = {{\bf{e}}^t} - {{\bf{e}}^t}\left( {t + 1} \right) = - t{{\bf{e}}^t}\]

The particular solution is.

\[\begin{align*}{Y_P}\left( t \right) & = - {{\bf{e}}^t}\int{{\frac{{\left( {t + 1} \right)t}}{{ - t{{\bf{e}}^t}}}\,dt}} + \left( {t + 1} \right)\int{{\frac{{{{\bf{e}}^t}\left( t \right)}}{{ - t{{\bf{e}}^t}}}\,dt}}\\ & = {{\bf{e}}^t}\int{{\left( {t + 1} \right){{\bf{e}}^{ - t}}\,dt}} - \left( {t + 1} \right)\int{{\,dt}}\\ & = {{\bf{e}}^t}\left( { - {{\bf{e}}^{ - t}}\left( {t + 2} \right)} \right) - \left( {t + 1} \right)t\\ & = - {t^2} - 2t - 2\end{align*}\]

The general solution for this differential equation is.

\[y\left( t \right) = {c_1}{{\bf{e}}^t} + {c_2}\left( {t + 1} \right) - {t^2} - 2t - 2\]

We need to address one more topic about the solution to the previous example. The solution can be simplified down somewhat if we do the following.

\[\begin{align*}y\left( t \right) & = {c_1}{{\bf{e}}^t} + {c_2}\left( {t + 1} \right) - {t^2} - 2t - 2\\ & = {c_1}{{\bf{e}}^t} + {c_2}\left( {t + 1} \right) - {t^2} - 2\left( {t + 1} \right)\\ & = {c_1}{{\bf{e}}^t} + \left( {{c_2} - 2} \right)\left( {t + 1} \right) - {t^2}\end{align*}\]

Now, since \({c_2}\) is an unknown constant subtracting 2 from it won’t change that fact. So we can just write the \({c_2} - 2\) as \({c_2}\) and be done with it. Here is a simplified version of the solution for this example.

\[y\left( t \right) = {c_1}{{\bf{e}}^t} + {c_2}\left( {t + 1} \right) - {t^2}\]

This isn’t always possible to do, but when it is you can simplify future work.