# Higher Order Linear Nonhomogeneous Differential Equations with Constant Coefficients

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Find the general solution of the differential equation $y^{\prime\prime\prime} + 3y^{\prime\prime} - 10y' = x - 3.$

### Example 2

Solve the differential equation $y^{\prime\prime\prime} - y' = \sin 3x.$

### Example 3

Solve the differential equation ${y^{IV}} - y = 2\cos x.$

### Example 4

Solve the equation

${y^{IV}} + y^{\prime\prime\prime} - 3y^{\prime\prime} - 5y' - 2y = {e^{2x}} - {e^{ - x}}.$

### Example 5

Find the general solution of the equation $y^{\prime\prime\prime} + y' = \frac{1}{{\cos x}}$ using the method of variation of constants.

### Example 1.

Find the general solution of the differential equation $y^{\prime\prime\prime} + 3y^{\prime\prime} - 10y' = x - 3.$

Solution.

First we find the general solution of the homogeneous equation

$y^{\prime\prime\prime} + 3y^{\prime\prime} - 10y' = 0.$

Calculate the roots of the characteristic equation:

${\lambda ^3} + 3{\lambda ^2} - 10\lambda = 0,\;\; \Rightarrow \lambda \left( {{\lambda ^2} + 3\lambda - 10} \right) = 0,\;\; \Rightarrow \lambda \left( {\lambda - 2} \right)\left( {\lambda + 5} \right) = 0.$

Hence,

${\lambda _1} = 0,\;\; {\lambda _2} = 2,\;\; {\lambda _3} = - 5.$

So the general solution of the homogeneous equation is given by

${y_0}\left( x \right) = {C_1} + {C_2}{e^{2x}} + {C_3}{e^{ - 5x}},$

where $${C_1},$$ $${C_2},$$ $${C_3}$$ are arbitrary numbers.

The right side of the equation contains only a polynomial. However, if we take into account that $${e^0} = 1,$$ we see that in fact we have the resonance case (in disguised form) as one of the roots of the characteristic equation is also zero: $${\lambda_1} = 0.$$ Therefore, we will seek a particular solution in the form

${y_1}\left( x \right) = x\left( {Ax + B} \right) = A{x^2} + Bx.$

Substitute the derivatives

${y'_1} = 2Ax + B,\;\; {y^{\prime\prime}_1} = 2A,\;\; {y^{\prime\prime\prime}_1} = 0$

into the nonhomogeneous equation and determine the coefficients $$A, B:$$

$0 + 3 \cdot 2A - 10\left( {2Ax + B} \right) = x - 3,\;\; \Rightarrow 6A - 20Ax - 10B = x - 3,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} { - 20A = 1}\\ {6A - 10B = - 3} \end{array}} \right.,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} {A = - \frac{1}{{20}}}\\ {B = \frac{{27}}{{100}}} \end{array}} \right.,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} {A = - \frac{5}{{100}}}\\ {B = \frac{{27}}{{100}}} \end{array}} \right..$

The particular solution $${y_1}$$ is written as

${y_1}\left( x \right) = x\left( { - \frac{5}{{100}}x + \frac{{27}}{{100}}} \right) = \frac{x}{{100}}\left( {27 - 5x} \right).$

Thus, the general solution of nonhomogeneous differential equation is given by

$y\left( x \right) = {y_0}\left( x \right) + {y_1}\left( x \right) = {C_1} + {C_2}{e^{2x}} + {C_3}{e^{ - 5x}} + \frac{x}{{100}}\left( {27 - 5x} \right).$

### Example 2.

Solve the differential equation $y^{\prime\prime\prime} - y' = \sin 3x.$

Solution.

We construct the general solution of the homogeneous equation

$y^{\prime\prime\prime} - y' = 0.$

The roots of the characteristic equation are

${\lambda ^3} - \lambda = 0,\;\; \Rightarrow \lambda \left( {{\lambda ^2} - 1} \right) = 0,\;\; \Rightarrow \lambda \left( {\lambda - 1} \right)\left( {\lambda + 1} \right) = 0,\;\; \Rightarrow {\lambda _1} = 0,\;\; {\lambda _2} = 1,\;\; {\lambda _3} = - 1.$

Consequently, the general solution of the homogeneous equation can be written as

${y_0}\left( x \right) = {C_1} + {C_2}{e^x} + {C_3}{e^{ - x}},$

where $${C_1},{C_2},{C_3}$$ are arbitrary numbers.

Based on the structure of the right-hand side, we seek a particular solution in the form of trial function

${y_1}\left( x \right) = A\sin 3x + B\cos 3x.$

The derivatives of this function are as follows:

${y'_1} = 3A\cos 3x - 3B\sin 3x,$
${y^{\prime\prime}_1} = - 9A\sin 3x - 9B\cos 3x,$
${y^{\prime\prime\prime}_1} = - 27A\cos 3x + 27B\sin 3x.$

Substituting these derivatives into the equation, we obtain

$- 27A\cos 3x + 27B\sin 3x - 3A\cos 3x + 3B\sin 3x = \sin 3x,\;\; \Rightarrow - 30A\cos 3x + 30B\sin 3x = \sin 3x,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} { - 30A = 0}\\ {30B = 1} \end{array}} \right.,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} {A = 0}\\ {B = \frac{1}{{30}}} \end{array}} \right..$

Thus, a particular solution can be written as

${y_1}\left( x \right) = \frac{1}{{30}}\cos 3x.$

Accordingly, the general solution of the nonhomogeneous equation is described by

$y\left( x \right) = {y_0}\left( x \right) + {y_1}\left( x \right) = {C_1} + {C_2}{e^x} + {C_3}{e^{ - x}} + \frac{1}{{30}}\cos 3x.$

### Example 3.

Solve the differential equation ${y^{IV}} - y = 2\cos x.$

Solution.

We first consider the homogeneous equation

${y^{IV}} - y = 0$

and construct its general solution. The characteristic equation

${\lambda ^4} - 1 = 0$

has the roots:

$\left( {{\lambda ^2} - 1} \right)\left( {{\lambda ^2} + 1} \right) = 0,\;\; \Rightarrow \left( {\lambda - 1} \right)\left( {\lambda + 1} \right)\left( {{\lambda ^2} + 1} \right) = 0,\;\; \Rightarrow {\lambda _1} = 1,\;\; {\lambda _2} = - 1,\;\; {\lambda _{3,4}} = \pm i.$

Consequently, the general solution of the homogeneous equation has the form:

${y_0}\left( x \right) = {C_1}{e^x} + {C_2}{e^{ - x}} + {C_3}\cos x + {C_4}\sin x,$

where $${C_1}, \ldots ,{C_4}$$ are arbitrary numbers.

Now we find a particular solution of the nonhomogeneous equation. Here we have the resonance case, since the expression in the right side corresponds to one of the roots of the characteristic equation. Hence, we seek a particular solution in the form

${y_1}\left( x \right) = x\left( {A\cos x + B\sin x} \right).$

The derivatives of this function are

${y'_1} = A\cos x + B\sin x + x\left( { - A\sin x + B\cos x} \right),$
${y^{\prime\prime}_1} = - A\sin x + B\cos x + \left( { - A\sin x + B\cos x} \right) + x\left( { - A\cos x - B\sin x} \right) = - 2A\sin x + 2B\cos x - x\left( {A\cos x + B\sin x} \right),$
${y^{\prime\prime\prime}_1} = - 2A\cos x - 2B\sin x - \left( {A\cos x + B\sin x} \right) - x\left( { - A\sin x + B\cos x} \right) = - 3A\cos x - 3B\sin x + x\left( {A\sin x - B\cos x} \right),$
${y^{IV}} = 3A\sin x - 3B\cos x + \left( {A\sin x - B\cos x} \right) + x\left( {A\cos x + B\sin x} \right) = 4A\sin x - 4B\cos x + x\left( {A\cos x + B\sin x} \right).$

Substitute the derivatives in the nonhomogeneous equation and determine the coefficients $$A, B:$$

$4A\sin x - 4B\cos x + \cancel{x\left( {A\cos x + B\sin x} \right)} - \cancel{x\left( {A\cos x + B\sin x} \right)} = 2\cos x,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} {4A = 0}\\ { - 4B = 2} \end{array}} \right.,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} {A = 0}\\ {B = - \frac{1}{2}} \end{array}} \right..$

Thus, a particular solution is expressed as

${y_1}\left( x \right) = - \frac{x}{2}\sin x.$

Then the general solution of the original nonhomogeneous equation can be written as

$y\left( x \right) = {y_0}\left( x \right) + {y_1}\left( x \right) = {C_1}{e^x} + {C_2}{e^{ - x}} + {C_3}\cos x + {C_4}\sin x - \frac{x}{2}\sin x.$

### Example 4.

Solve the equation

${y^{IV}} + y^{\prime\prime\prime} - 3y^{\prime\prime} - 5y' - 2y = {e^{2x}} - {e^{ - x}}.$

Solution.

First we find the general solution of the homogeneous equation

${y^{IV}} + y^{\prime\prime\prime} - 3y^{\prime\prime} - 5y' - 2y = 0.$

Write the characteristic equation and find its roots:

${\lambda ^4} + {\lambda ^3} - 3{\lambda ^2} - 5\lambda - 2 = 0,\;\; \Rightarrow {\lambda ^4} - 2{\lambda ^3} + 3{\lambda ^3} - 6{\lambda ^2} + 3{\lambda ^2} - 6\lambda + \lambda - 2 = 0,\;\; \Rightarrow {\lambda ^3}\left( {\lambda - 2} \right) + 3{\lambda ^2}\left( {\lambda - 2} \right) + 3\lambda \left( {\lambda - 2} \right) + \lambda - 2 = 0,\;\; \Rightarrow \left( {{\lambda ^3} + 3{\lambda ^2} + 3\lambda + 1} \right) \left( {\lambda - 2} \right) = 0,\;\; \Rightarrow {\left( {\lambda + 1} \right)^3}\left( {\lambda - 2} \right) = 0.$

It is seen that the equation has two roots:

${\lambda _1} = - 1,\;\; {\lambda _2} = 2,$

and the multiplicity of the first root is $$3.$$

Then the general solution of the homogeneous equation can be written as

${y_0}\left( x \right) = \left( {{C_1} + {C_2}x + {C_3}{x^2}} \right){e^{ - x}} + {C_4}{e^{2x}},$

where $${C_1}, \ldots ,$$ $${C_4}$$ are as usual arbitrary numbers.

We now construct a particular solution of the nonhomogeneous equation. Using the superposition principle, it is convenient to consider two nonhomogeneous equations of the form

1. $${y^{IV}} + y^{\prime\prime\prime} - 3y^{\prime\prime}$$ $$-\;5y' - 2y =$$ $${e^{2x}};$$
2. $${y^{IV}} + y^{\prime\prime\prime} - 3y^{\prime\prime}$$ $$-\;5y' - 2y =$$ $$-{e^{-x}}.$$

The sum of the right sides of these equations corresponds to the right side of the original nonhomogeneous equation.

Note that we have the resonance cases in both equations. In the first equation the number $$2$$ in the exponential function coincides with the root $${\lambda_2} = 2$$ of multiplicity $$2.$$ In the second equation the number $$-1$$ in the exponential function coincides with another root $${\lambda_1} = -1,$$ the multiplicity of which is equal to $$3.$$ With this in mind, we seek particular solutions $${y_1},$$ $${y_2},$$ respectively, for Equations $$1$$ and $$2$$ in the form

${y_1} = Ax{e^{2x}},\;\; {y_2} = B{x^3}{e^{ - x}}.$

The derivatives for the trial solution $${y_1}$$ have the form

${y'_1} = A\left( {{e^{2x}} + 2x{e^{2x}}} \right) = A\left( {2x + 1} \right){e^{2x}},$
${y^{\prime\prime}_1} = A\left[ {2{e^{2x}} + \left( {4x + 2} \right){e^{2x}}} \right] = A\left( {4x + 4} \right){e^{2x}},$
${y^{\prime\prime\prime}_1} = A\left[ {4{e^{2x}} + \left( {8x + 8} \right){e^{2x}}} \right] = A\left( {8x + 12} \right){e^{2x}},$
${y_1^{IV}} = A\left[ {8{e^{2x}} + \left( {16x + 24} \right){e^{2x}}} \right] = A\left( {16x + 32} \right){e^{2x}}.$

Substituting this into the first equation, we find the coefficient $$A:$$

$A\left( {16x + 32} \right){e^{2x}} + A\left( {8x + 12} \right){e^{2x}} - 3A\left( {4x + 4} \right){e^{2x}} - 5A\left( {2x + 1} \right){e^{2x}} - 2Ax{e^{2x}} = {e^{2x}},$
$\Rightarrow A\left( {\cancel{16x} + \cancel{8x} - \cancel{12x} - \cancel{10x} - \cancel{2x}} \right){e^{2x}} + A\left( {32 + \cancel{12} - \cancel{12} - 5} \right){e^{2x}} = {e^{2x}},$
$\Rightarrow {27A = 1,\;\; }\Rightarrow {A = \frac{1}{{27}}.}$

Therefore, the particular solution $${y_1}$$ is given by

${y_1}\left( x \right) = \frac{x}{{27}}{e^{2x}}.$

Similarly, we find the particular solution $${y_2}.$$ The derivatives of the trial function $${y_2}$$ are

${y'_2} = B\left( {3{x^2}{e^{ - x}} - {x^3}{e^{ - x}}} \right) = B\left( { - {x^3} + 3{x^2}} \right){e^{ - x}},$
${y^{\prime\prime}_2} = B\left[ {\left( { - 3{x^2} + 6x} \right){e^{ - x}} - \left( { - {x^3} + 3{x^2}} \right){e^{ - x}}} \right] = B\left( {{x^3} - 6{x^2} + 6x} \right){e^{ - x}},$
${y^{\prime\prime\prime}_2} = B\left[ {\left( {3{x^2} - 12x + 6} \right){e^{ - x}} - \left( {{x^3} - 6{x^2} + 6x} \right){e^{ - x}}} \right] = B\big( { - {x^3} + 9{x^2} - 18x + 6} \big){e^{ - x}},$
${y_2^{IV}} = B\left[ {\left( { - 3{x^2} + 18x - 18} \right){e^{ - x}} - \left( { - {x^3} + 9{x^2} - 18x + 6} \right){e^{ - x}}} \right] = B\big( {{x^3} - 12{x^2} + 36x - 24} \big){e^{ - x}}.$

Substituting these derivatives into the second equation, we calculate the coefficient $$B:$$

$B\left( {{x^3} - 12{x^2} + 36x - 24} \right){e^{ - x}} + B\left( { - {x^3} + 9{x^2} - 18x + 6} \right){e^{ - x}} - 3B\left( {{x^3} - 6{x^2} + 6x} \right){e^{ - x}} - 5B\left( { - {x^3} + 3{x^2}} \right){e^{ - x}} - 2B{x^3}{e^{ - x}} = - {e^{ - x}},$
$\Rightarrow B\left( {\cancel{x^3} - \cancel{x^3} - \cancel{3{x^3}} + \cancel{5{x^3}} - \cancel{2{x^3}}} \right){e^{ - x}} + B\left( { - \cancel{12{x^2}} + \cancel{9{x^2}} + \cancel{18{x^2}} - \cancel{15{x^2}}} \right){e^{ - x}} + B\left( {\cancel{36x} - \cancel{18x} - \cancel{18x}} \right){e^{ - x}} + B\left( { - 24 + 6} \right){e^{ - x}} = - {e^{ - x}},$
$\Rightarrow - 18B = - 1,\;\; \Rightarrow B = \frac{1}{{18}}.$

We obtain the solution $${y_2}$$ as follows:

${y_2}\left( x \right) = \frac{{{x^3}}}{{18}}{e^{ - x}}.$

In accordance with the principle of superposition, a particular solution of the original nonhomogeneous equation is represented as

${y_{\text{p}}} = {y_1}\left( x \right) + {y_2}\left( x \right) = \frac{x}{{27}}{e^{2x}} + \frac{{{x^3}}}{{18}}{e^{ - x}}.$

Finally, the general solution is given by

$y\left( x \right) = \left( {{C_1} + {C_2}x + {C_3}{x^2}} \right){e^{ - x}} + {C_4}{e^{2x}} + \frac{x}{{27}}{e^{2x}} + \frac{{{x^3}}}{{18}}{e^{ - x}} = \left( {{C_1} + {C_2}x + {C_3}{x^2} + \frac{{{x^3}}}{{18}}} \right){e^{ - x}} + \left( {{C_4} + \frac{x}{{27}}} \right){e^{2x}}.$

### Example 5.

Find the general solution of the equation $y^{\prime\prime\prime} + y' = \frac{1}{{\cos x}}$ using the method of variation of constants.

Solution.

First we solve the corresponding homogeneous equation

$y^{\prime\prime\prime} + y' = 0.$

The roots of its characteristic equation are:

${\lambda ^3} + \lambda = 0,\;\; \Rightarrow \lambda \left( {{\lambda ^2} + 1} \right) = 0,\;\; \Rightarrow {\lambda _1} = 0,\;{\lambda _{2,3}} = \pm i.$

Consequently, the general solution of the homogeneous equation has the form:

${y_0}\left( x \right) = {C_1} + {C_2}\cos x + {C_3}\sin x,$

where $${C_1},{C_2},{C_3}$$ are arbitrary numbers.

According to the method of variation of constants, we will consider the functions $${C_1}\left( x \right),$$ $${C_2}\left( x \right),$$ $${C_3}\left( x \right)$$ instead of the numbers $${C_1},{C_2},{C_3}$$ to construct the general solution of the nonhomogeneous equation. These functions will satisfy the nonhomogeneous equation, provided

$\left\{ \begin{array}{l} {C'_1}{Y_1} + {C'_2}{Y_2} + {C'_3}{Y_3} = 0\\ {C'_1}{Y'_1} + {C'_2}{Y'_2} + {C'_3}{Y'_3} = 0\\ {C'_1}{Y^{\prime\prime}_1} + {C'_2}{Y^{\prime\prime}_2} + {C'_3}{Y^{\prime\prime}_3} = \frac{1}{{\cos x}} \end{array} \right.$

Here the functions $${Y_1},{Y_2},{Y_3}$$ are the fundamental system of solutions. They were found in the solution of the homogeneous equation:

${Y_1} = 1,\;\;\; {Y_2} = \cos x,\;\;\; {Y_3} = \sin x.$

Then the system of equations takes the form:

$\left\{ \begin{array}{l} {C'_1} \cdot 1 + {C'_2}\cos x + {C'_3}\sin x = 0\\ {C'_1} \cdot 0 + {C'_2}\left( { - \sin x} \right) + {C'_3}\cos x = 0\\ {C'_1} \cdot 0 + {C'_2}\left( { - \cos x} \right) + {C'_3}\left( { - \sin x} \right) = \frac{1}{{\cos x}} \end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l} {C'_1} + {C'_2}\cos x + {C'_3}\sin x = 0\\ - {C'_2}\sin x + {C'_3}\cos x = 0\\ - {C'_2}\cos x - {C'_3}\sin x = \frac{1}{{\cos x}} \end{array} \right..$

The main determinant (Wronskian) is

$W = \left| {\begin{array}{*{20}{l}} 1&{\cos x}&{\sin x}\\ 0&{ - \sin x}&{\cos x}\\ 0&{ - \cos x}&{ - \sin x} \end{array}} \right| = 1 \cdot \left| {\begin{array}{*{20}{l}} { - \sin x}&{\cos x}\\ { - \cos x}&{ - \sin x} \end{array}} \right| = {\sin ^2}x + {\cos ^2}x = 1.$

We find expressions for the derivatives $${C'_1},{C'_2},{C'_3}$$ calculating the other three determinants:

${\Delta _1} = \left| {\begin{array}{*{20}{c}} 0&{\cos x}&{\sin x}\\ 0&{ - \sin x}&{\cos x}\\ {\frac{1}{{\cos x}}}&{ - \cos x}&{ - \sin x} \end{array}} \right| = \frac{1}{{\cos x}}\left| {\begin{array}{*{20}{c}} {\cos x}&{\sin x}\\ { - \sin x}&{\cos x} \end{array}} \right| = \frac{1}{{\cos x}}\left( {{{\cos }^2}x + {{\sin }^2}x} \right) = \frac{1}{{\cos x}},$
${\Delta _2} = \left| {\begin{array}{*{20}{c}} 1&0&{\sin x}\\ 0&0&{\cos x}\\ 0&{\frac{1}{{\cos x}}}&{ - \sin x} \end{array}} \right| = 1 \cdot \left| {\begin{array}{*{20}{c}} 0&{\cos x}\\ {\frac{1}{{\cos x}}}&{ - \sin x} \end{array}} \right| = - \frac{1}{{\cos x}} \cdot \cos x = - 1,$
${\Delta _3} = \left| {\begin{array}{*{20}{c}} 1&{\cos x}&0\\ 0&{ - \sin x}&0\\ 0&{ - \cos x}&{\frac{1}{{\cos x}}} \end{array}} \right| = 1 \cdot \left| {\begin{array}{*{20}{c}} { - \sin x}&0\\ { - \cos x}&{\frac{1}{{\cos x}}} \end{array}} \right| = - \sin x \cdot \frac{1}{{\cos x}} = - \tan x.$

Consequently, the derivatives $${C'_1},$$ $${C'_2},$$ $${C'_3}$$ are given by

${C'_1} = \frac{{{\Delta _1}}}{W} = \frac{1}{{\cos x}},\;\; {C'_2} = \frac{{{\Delta _2}}}{W} = - 1, {C'_3} = \frac{{{\Delta _3}}}{W} = - \tan x.$

The integrals of these functions are tabulated, so that we can immediately write:

${C_1}\left( x \right) = \int {\frac{{dx}}{{\cos x}}} = \ln \left| {\tan \left( {\frac{x}{2} + \frac{\pi }{4}} \right)} \right| + {A_1},$
${C_2}\left( x \right) = \int {\left( { - 1} \right)dx} = - x + {A_2},$
${C_3}\left( x \right) = \int {\left( { - \tan x} \right)dx} = \ln \left| {\cos x} \right| + {A_3},$

where $${A_1},$$ $${A_2},$$ $${A_3},$$ are constants of integration.

Substituting this into the general solution, we find the answer in the following form:

$y\left( x \right) = {C_1}\left( x \right) + {C_2}\left( x \right)\cos x + {C_3}\left( x \right)\sin x = \ln \left| {\tan \left( {\frac{x}{2} + \frac{\pi }{4}} \right)} \right| + {A_1} + \left( { - x + {A_2}} \right)\cos x + \left( {\ln \left| {\cos x} \right| + {A_3}} \right)\sin x = {A_1} + {A_2}\cos x + {A_3}\sin x + \ln \left| {\tan \left( {\frac{x}{2} + \frac{\pi }{4}} \right)} \right| - x\cos x + \sin x\ln \left| {\cos x} \right|.$