### Definition and General Scheme for Solving Nonhomogeneous Equations

A linear nonhomogeneous second-order equation with variable coefficients has the form

\[{y^{\prime\prime} + {a_1}\left( x \right)y’ }+{ {a_2}\left( x \right)y }={ f\left( x \right),}\]

where \({a_1}\left( x \right),\) \({a_2}\left( x \right)\) and \(f\left( x \right)\) are continuous functions on the interval \(\left[ {a,b} \right].\)

The associated homogeneous equation is written as

\[{y^{\prime\prime} + {a_1}\left( x \right)y’ }+{ {a_2}\left( x \right)y }={ 0.}\]

The general solution of the nonhomogeneous equation is the sum of the general solution \({y_0}\left( x \right)\) of the associated homogeneous equation and a particular solution \(Y\left( x \right)\) of the nonhomogeneous equation:

\[y\left( x \right) = {y_0}\left( x \right) + Y\left( x \right).\]

To construct the general solution of the nonhomogeneous equation the following approach is most often used:

- First, by guessing, we find a particular solution of the homogeneous equation.
- Then using the Liouville formula, we get the general solution of the homogeneous equation.
- Further, using the method of variation of parameters (Lagrange’s method), we determine the general solution of the nonhomogeneous equation.

The first two steps of this scheme were described on the page Second Order Linear Homogeneous Differential Equations with Variable Coefficients. Below we consider in detail the third step, that is, the method of variation of parameters.

### Method of Variation of Parameters

The method of variation of parameters (Lagrange’s method) is used to construct the general solution of the nonhomogeneous equation, when we know the general solution of the associated homogeneous equation.

Suppose that the general solution of the second order homogeneous equation is expressed through the fundamental system of solutions \({y_1}\left( x \right)\) and \({y_2}\left( x \right):\)

\[{{y_0}\left( x \right) }={ {C_1}{y_1}\left( x \right) + {C_2}{y_2}\left( x \right),}\]

where \({C_1},{C_2}\) are arbitrary constants.

The idea of this method is to replace the constants \({C_1}\) and \({C_2}\) by functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right),\) which are chosen so that the solution satisfies the nonhomogeneous equation.

The derivatives of the unknown functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right)\) can be determined from the system of equations

\[\left\{ \begin{array}{l} {{C’_1}\left( x \right){y_1}\left( x \right) }+{ {C’_2}\left( x \right){y_2}\left( x \right)} = 0\\ {{C’_1}\left( x \right){y’_1}\left( x \right) }+{ {C’_2}\left( x \right){y’_2}\left( x \right)} = {f\left( x \right)} \end{array} \right.\]

The main determinant of this system is the Wronskian of the functions \({y_1}\) and \({y_2},\) which is not equal to zero due to linear independence of the solutions \({y_1}\) and \({y_2}.\) Therefore, this system of equations always has a unique solution. The final formulas for \({C’_1}\left( x \right)\) and \({C’_2}\left( x \right)\) have the form

\[ {{C’_1}\left( x \right) = – \frac{{{y_2}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}},\;\;}\kern-0.3pt {{C’_2}\left( x \right) = \frac{{{y_1}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}.} \]

When using the method of variation of parameters, it is important to remember that the function \(f\left( x \right)\) must correspond to the differential equation in the standard form, that is the coefficient \({a_0}\left( x \right)\) at the second derivative must be equal to \(1.\)

Furthermore, knowing the derivatives \({C’_1}\left( x \right)\) and \({C’_2}\left( x \right),\) one can find the functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right):\)

\[

{{{C_1}\left( x \right) }={ – \int {\frac{{{y_2}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}dx} }+{ {A_1},\;\;}}\kern-0.3pt

{{{C_2}\left( x \right) }={ \int {\frac{{{y_1}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}dx} }+{ {A_2},}}

\]

where \({A_1},\) \({A_2}\) are constants of integration.

Then the general solution of the original nonhomogeneous equation will be expressed by the formula

\[ {y\left( x \right) }={ {C_1}\left( x \right){y_1}\left( x \right) + {C_2}\left( x \right){y_2}\left( x \right) } = {{\left[ { – \int {\frac{{{y_2}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}dx} + {A_1}} \right] \cdot}\kern0pt{ {y_1}\left( x \right) }} + {{\left[ {\int {\frac{{{y_1}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}dx} + {A_2}} \right] \cdot}\kern0pt{ {y_2}\left( x \right) }} = {{{A_1}{y_1}\left( x \right) + {A_2}{y_2}\left( x \right) }+{ Y\left( x \right),}} \]

where

\[ {Y\left( x \right) } = {{y_2}\left( x \right)\int {\frac{{{y_1}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}dx} } – {{y_1}\left( x \right)\int {\frac{{{y_2}\left( x \right)f\left( x \right)}}{{{W_{{y_1},{y_2}}}\left( x \right)}}dx} } \]

denotes a particular solution of the nonhomogeneous equation.

## Solved Problems

Click or tap a problem to see the solution.