# Second Order Linear Nonhomogeneous Differential Equations with Variable Coefficients

## Definition and General Scheme for Solving Nonhomogeneous Equations

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

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].\)

A The associated homogeneous equation is written as

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:

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):\)

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

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

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):\)

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

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

where

denotes a particular solution of the nonhomogeneous equation.