# Second Order Linear Nonhomogeneous Differential Equations with Constant Coefficients

## Solved Problems

Click or tap a problem to see the solution.

### Example 3

Solve the differential equation \[y^{\prime\prime} - 5y' + 4y = {e^{4x}}.\]

### Example 4

Find the general solution of the equation \[y^{\prime\prime} + 9y = 2{x^2} - 5.\]

### Example 5

Solve the differential equation \[y^{\prime\prime} + 16y = 2{\cos ^2}x.\]

### Example 6

Solve the equation \[y^{\prime\prime} + y = {\sec ^2}x\] using the method of variation of constants.

### Example 7

Find the solution of the differential equation \[y^{\prime\prime} - 7y' + 12y = 8\sin x + {e^{3x}}.\]

### Example 3.

Solve the differential equation \[y^{\prime\prime} - 5y' + 4y = {e^{4x}}.\]

Solution.

First we solve the related homogeneous equation \(y^{\prime\prime} - 5y' + 4y = 0.\) The roots of the characteristic equation are

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

where \({C_1},\) \({C_2}\) are constant numbers.

Find a particular solution of the nonhomogeneous differential equation. Notice that the power of the exponential function on the right coincides with the root \({k_1} = 4\) of the auxiliary characteristic equation. Therefore we will look for a particular solution of the form

The derivatives are given by

Substituting the function \({y_1}\) and its derivatives in the differential equation yields:

Thus, the particular solution to the differential equation can be written in the form:

Now we can write the full solution of the nonhomogeneous equation:

### Example 4.

Find the general solution of the equation \[y^{\prime\prime} + 9y = 2{x^2} - 5.\]

Solution.

First we determine the general solution of the related homogeneous equation. Solve the auxiliary characteristic equation:

The solution is written in the form:

Now we construct a particular solution. The right-hand side of the given equation is a quadratic function. So we can guess on a particular solution of the same form:

where the numbers \(A, B, C\) can be determined by the method of undetermined coefficients. Hence, we can write:

Substituting this into the original nonhomogeneous differential equation, we have

By equating the coefficients of like powers of \(x,\) we obtain:

Thus, the particular solution is given by

Then the general solution of the original nonhomegeneous differential equation is expressed by the formula

### Example 5.

Solve the differential equation \[y^{\prime\prime} + 16y = 2{\cos ^2}x.\]

Solution.

First of all we solve the related homogeneous equation. The characteristic equation has roots:

so the general solution has the form:

Now we find a particular solution for the nonhomogeneous equation. Rewrite the right-hand side as

It follows from here that the particular solution is defined by the function

where the numbers \(A, B,\) and \(C\) can be calculated using the method of undetermined coefficients. The first and second derivatives of the function \({y_1}\) are

Substituting this back into the differential equation produces:

The latter expression is identical. Therefore we can write the following system of equations to determine the coefficients \(A, B, C:\)

Thus, the particular solution has the form:

Respectively, the general solution of the original nonhomogeneous equation is written as

### Example 6.

Solve the equation \[y^{\prime\prime} + y = {\sec ^2}x\] using the method of variation of constants.

Solution.

Find the solution for the related homogeneous equation \(y^{\prime\prime} + y = 0.\) The characteristic equation has roots:

Hence, the general solution of the homogeneous equation is

Find now the general solution of the original nonhomogeneous equation. According to the method of variation of constants we will consider the coefficients \({C_1}\) and \({C_2}\) as functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right).\)

The derivatives \({C'_1}\left( x \right),\) \({C'_2}\left( x \right)\) are defined by the following system of equations:

It follows from the first equation that

Substituting this into the second equation, we get

Then we have

Integrate these expressions to find the functions \({C_1}\left( x \right),\) \({C_2}\left( x \right):\)

As a result, the general solution of the nonhomogeneous equation is represented in the form:

where \({A_1}, {A_2}\) are constant numbers.

### Example 7.

Find the solution of the differential equation \[y^{\prime\prime} - 7y' + 12y = 8\sin x + {e^{3x}}.\]

Solution.

Consider the related homogeneous equation \(y^{\prime\prime} - 7y' + 12y = 0.\) The roots of the auxiliary equation are

Hence, the general solution is given by

We see that the right-hand side is the sum of two functions. According to the superposition principle, a particular solution is expressed by the formula

where \({y_2}\left( x \right)\) is a particular solution for the differential equation \(y^{\prime\prime} - 7y' + 12y = 8\sin x,\) and \({y_3}\left( x \right)\) is a particular solution for the equation \(y^{\prime\prime} - 7y' + 12y = {e^{3x}}.\)

First we determine the function \({y_2}\left( x \right).\) In this case we will be looking for a solution in the form

Substitute the function \({y_2}\left( x \right)\) and its derivatives

into the corresponding differential equation:

Hence,

Then we get

Similarly, we can construct a particular solution \({y_3}\left( x \right)\) for the equation \(y^{\prime\prime} - 7y' + 12y = {e^{3x}}.\) Notice, that the power of the exponential function coincides with the root \({k_2} = 3\) of the characteristic equation of the related homogeneous equation. Therefore, we will look for a particular solution in the form:

The derivatives are given by

Substitute the function \({y_3}\left( x \right)\) and its derivatives into the differential equation:

As it can be seen, \(A = -1.\) Hence, the particular solution \({y_3}\left( x \right)\) has the form:

As a result, the general solution of the original nonhomogeneous equation is given by