# Second Order Linear Nonhomogeneous Differential Equations with Constant Coefficients

## Structure of the General Solution

The nonhomogeneous differential equation of this type has the form

where *p, q* are constant numbers (that can be both as real as complex numbers). For each equation we can write the related homogeneous or complementary equation:

### Theorem.

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

Below we consider two methods of constructing the general solution of a nonhomogeneous differential equation.

## Method of Variation of Constants

If the general solution \({y_0}\) of the associated homogeneous equation is known, then the general solution for the nonhomogeneous equation can be found by using the method of variation of constants.

Let the general solution of a second order homogeneous differential equation be

Instead of the constants \({C_1}\) and \({C_2}\) we will consider arbitrary functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right).\) We will find these functions such that the solution

satisfies the nonhomogeneous equation with the right side \(f\left( x \right).\)

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

## Method of Undetermined Coefficients

The right side \(f\left( x \right)\) of a nonhomogeneous differential equation is often an exponential, polynomial or trigonometric function or a combination of these functions. In this case, it's more convenient to look for a solution of such an equation using the method of undetermined coefficients.

The given method works only for a restricted class of functions in the right side, such as

where \({{P_n}\left( x \right)}\) and \({{Q_m}\left( x \right)}\) are polynomials of degree \(n\) and \(m,\) respectively.

In both cases, a choice for the particular solution should match the structure of the right side of the nonhomogeneous equation.

In case \(1,\) if the power \(\alpha\) of the exponential function coincides with a root of the auxiliary characteristic equation, the particular solution will contain the additional factor \({x^s},\) where \(s\) is the order of the root \(\alpha\) in the characteristic equation.

In case \(2,\) if the number \(\alpha + \beta i\) coincides with a root of the characteristic equation, the expected expression for the particular solution should be multiplied by the additional factor \(x.\)

The unknown coefficients can be determined by substitution of the expected type of the particular solution into the original nonhomogeneous differential equation.

## Superposition Principle

If the right side of a nonhomogeneous equation is the sum of several functions of kind

then a particular solution of the differential equation is also the sum of particular solutions constructed separately for each term in the right side.

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Solve the differential equation \[y^{\prime\prime} + y = \sin \left( {2x} \right).\]

### Example 2

Find the general solution of the equation \[y^{\prime\prime} + y' - 6y = 36x.\]

### Example 1.

Solve the differential equation \[y^{\prime\prime} + y = \sin \left( {2x} \right).\]

Solution.

First we solve the related homogeneous equation \(y^{\prime\prime} + y = 0.\) The roots of the corresponding characteristic equation are purely imaginary:

Hence, the general solution of the homogeneous equation is given by

Let's go back to the nonhomogeneous equation. We will seek for its solution in the form

using the method of variation of constants.

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

Then

We can express the derivative \({C'_1}\left( x \right)\) from the first equation:

Substituting this in the second equation, we find the derivative \({C'_2}\left( x \right):\)

It follows from here that

Integrating the expressions for the derivatives \({C'_1}\left( x \right)\) and \({C'_2}\left( x \right),\) gives

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

Now we substitute the found functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right)\) into the formula for \({y_1}\left( x \right)\) and write the general solution of the nonhomogeneous equation:

### Example 2.

Find the general solution of the equation \[y^{\prime\prime} + y' - 6y = 36x.\]

Solution.

We will use the method of undetermined coefficients. The right side of the given equation is a linear function \(f\left( x \right) = ax + b.\) Therefore, we will look for a particular solution in the form

Then the derivatives are

Substituting this in the differential equation gives:

The last equation must be valid for all values of \(x,\) so the coefficients with the like powers of \(x\) in the right and left sides must be identical:

We find from this system that \(A = -6,\) \(B = -1.\) As a result, the particular solution is written as

Now we find the general solution of the homogeneous differential equation. Calculate the roots of the auxiliary characteristic equation:

Hence, the general solution of the related homogeneous equation is given by

Thus, the general solution of the initial nonhomogeneous equation is expressed by the formula