# Differential Equations

2nd Order Equations# Second Order Linear Nonhomogeneous Differential Equations with Variable Coefficients

Theory

Problems 1-3

### Definition and General Scheme for Solving the 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].\)

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

{{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, i.e. 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 on problem description to see solution.

### ✓ Example 1

Find the general solution of the differential equation \({x^2}y^{\prime\prime} – 2xy’ + 2y \) \(= {x^2} + 1\) (for \(x \gt 0\)).

### ✓ Example 2

Find the general solution of the nonhomogeneous differential equation

{\left( {\ln x – 1} \right)y^{\prime\prime} – \frac{{y’}}{x} + \frac{y}{{{x^2}}} }={ \frac{{{{\left( {\ln x – 1} \right)}^2}}}{x},\;\;}\kern-0.3pt

{\left( {x \gt e} \right).}

\]

A particular solution of the associated homogeneous equation is known: \({y_1} = x.\)

### ✓ Example 3

Find the general solution of the nonhomogeneous differential equation \(\left( {x – 1} \right)y^{\prime\prime} – xy’ + y\) \( = {\left( {x – 1} \right)^2}\) (for \(x \gt 1\)) assuming that the function \({y_1} = {e^x}\) is a particular solution of the associated homogeneous equation.

Theory

Problems 1-3

### Related Pages

- Second Order Linear Homogeneous Differential Equations with Constant Coefficients
- Second Order Linear Nonhomogeneous Differential Equations with Constant Coefficients
- Second Order Linear Homogeneous Differential Equations with Variable Coefficients
- Higher Order Linear Homogeneous Differential Equations with Constant Coefficients
- Higher Order Linear Nonhomogeneous Differential Equations with Constant Coefficients
- Higher Order Linear Homogeneous Differential Equations with Variable Coefficients
- Higher Order Linear Nonhomogeneous Differential Equations with Variable Coefficients