Second Order Linear Nonhomogeneous Differential Equations with Constant Coefficients
Solved Problems
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
\[{k^2} - 5k + 4 = 0,\;\; \Rightarrow
D = 25 - 4 \cdot 4 = 9,\;\; \Rightarrow
{k_{1,2}} = \frac{{5 \pm \sqrt 9 }}{2}
= \frac{{5 \pm 3}}{2} = 4,1.\]
Hence, the general solution of the homogeneous equation is given by
\[{y_0}\left( x \right) = {C_1}{e^{4x}} + {C_2}{e^x},\]
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
\[{y_1} = Ax{e^{4x}}.\]
The derivatives are given by
\[{y'_1} = {\left( {Ax{e^{4x}}} \right)^\prime }
= A{e^{4x}} + 4Ax{e^{4x}}
= \left( {A + 4Ax} \right){e^{4x}};\]
\[y^{\prime\prime}_1 = \left[ {\left( {A + 4Ax} \right){e^{4x}}} \right]^\prime
= 4A{e^{4x}} + \left( {4A + 16Ax} \right){e^{4x}}
= \left( {8A + 16Ax} \right){e^{4x}}.\]
Substituting the function \({y_1}\) and its derivatives in the differential equation yields:
\[\left( {8A + 16Ax} \right){e^{4x}} - 5\left( {A + 4Ax} \right){e^{4x}} + 4Ax{e^{4x}} = {e^{4x}},\;\; \Rightarrow
8A + \cancel{16Ax} - 5A - \cancel{20Ax} + \cancel{4Ax} = 1,\;\; \Rightarrow
3A = 1,\;\; \Rightarrow A = \frac{1}{3}.\]
Thus, the particular solution to the differential equation can be written in the form:
\[{y_1} = \frac{x}{3}{e^{4x}}.\]
Now we can write the full solution of the nonhomogeneous equation:
\[y = {y_0} + {y_1} = {C_1}{e^{4x}} + {C_2}{e^x} + \frac{x}{3}{e^{4x}}.\]
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:
\[{k^2} + 9 = 0,\;\; \Rightarrow {k^2} = - 9,\;\; \Rightarrow {k_{1,2}} = \pm 3i.\]
The solution is written in the form:
\[{y_0}\left( x \right) = {C_1}\cos 3x + {C_2}\sin 3x.\]
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:
\[{y_1} = A{x^2} + Bx + C,\]
where the numbers \(A, B, C\) can be determined by the method of undetermined coefficients. Hence, we can write:
\[{y'_1} = 2Ax,\;\; {y^{\prime\prime}_1} = 2A.\]
Substituting this into the original nonhomogeneous differential equation, we have
\[2A + 9\left( {A{x^2} + Bx + C} \right) = 2{x^2} - 5,\;\; \Rightarrow
2A + 9A{x^2} + 9Bx + 9C = 2{x^2} - 5.\]
By equating the coefficients of like powers of \(x,\) we obtain:
\[\left\{ \begin{array}{l}
9A = 2\\
9B = 0\\
2A + 9C = - 5
\end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l}
A = \frac{2}{9}\\
B = 0\\
C = - \frac{{49}}{{81}}
\end{array} \right..\]
Thus, the particular solution is given by
\[{y_1} = \frac{2}{9}{x^2} - \frac{{49}}{{81}}.\]
Then the general solution of the original nonhomegeneous differential equation is expressed by the formula
\[y = {y_0} + {y_1} = {C_1}\cos 3x + {C_2}\sin 3x + \frac{2}{9}{x^2} - \frac{{49}}{{81}}.\]
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:
\[{k^2} + 16 = 0,\;\; \Rightarrow
{k^2} = - 16,\;\; \Rightarrow
{k_{1,2}} = \pm 4i,\]
so the general solution has the form:
\[{y_0}\left( x \right) = {C_1}\cos 4x + {C_2}\sin 4x.\]
Now we find a particular solution for the nonhomogeneous equation. Rewrite the right-hand side as
\[2{\cos ^2}x = \cos 2x + 1.\]
It follows from here that the particular solution is defined by the function
\[{y_1} = A\cos 2x + B\sin 2x + C,\]
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
\[{y'_1} = - 2A\sin 2x + 2B\cos 2x,\]
\[y^{\prime\prime}_1 = - 4A\cos 2x - 4B\sin 2x.\]
Substituting this back into the differential equation produces:
\[- 4A\cos 2x - 4B\sin 2x + 16\left( {A\cos 2x + B\sin 2x + C} \right) = \cos 2x + 1,\]
\[- 4A\cos 2x - 4B\sin 2x + 16A\cos 2x + 16B\sin 2x + 16C = \cos 2x + 1,\]
\[12A\cos 2x + 12B\sin 2x + 16C = \cos 2x + 1.\]
The latter expression is identical. Therefore we can write the following system of equations to determine the coefficients \(A, B, C:\)
\[\left\{ \begin{array}{l}
12A = 1\\
12B = 0\\
16C = 1
\end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l}
A = \frac{1}{{12}}\\
B = 0\\
C = \frac{1}{{16}}
\end{array} \right..\]
Thus, the particular solution has the form:
\[{y_1} = \frac{1}{{12}}\cos 2x + \frac{1}{{16}}.\]
Respectively, the general solution of the original nonhomogeneous equation is written as
\[y = {y_0} + {y_1} = {C_1}\cos 4x + {C_2}\sin 4x + \frac{1}{{12}}\cos 2x + \frac{1}{{16}}.\]
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:
\[{k^2} + 1 = 0,\;\; \Rightarrow {k_{1,2}} = \pm i.\]
Hence, the general solution of the homogeneous equation is
\[{y_0}\left( x \right) = {C_1}\cos x + {C_2}\sin x.\]
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:
\[\left\{ \begin{array}{l}
{{C'_1}\left( x \right)\cos x} + {{C'_2}\left( x \right)\sin x} = 0\\
{{C'_1}\left( x \right){\left( {\cos x} \right)^\prime }} + {{C'_2}\left( x \right){\left( {\sin x} \right)^\prime }} = {{\sec ^2}x}
\end{array} \right.,\;\; \Rightarrow
\left\{ \begin{array}{l}
{{C'_1}\left( x \right)\cos x} + {{C'_2}\left( x \right)\sin x} = 0\\
{ - {C'_1}\left( x \right)\sin x} + {{C'_2}\left( x \right)\cos x} = {\frac{1}{{{{\cos }^2}x}}}
\end{array} \right..\]
It follows from the first equation that
\[{C'_1}\left( x \right) = - {C'_2}\left( x \right)\frac{{\sin x}}{{\cos x}}.\]
Substituting this into the second equation, we get
\[- \left( { - {C'_2}\left( x \right)\frac{{\sin x}}{{\cos x}}} \right)\sin x + {C'_2}\left( x \right)\cos x = \frac{1}{{{{\cos }^2}x}},\;\; \Rightarrow
{C'_2}\left( x \right)\left( {\frac{{{{\sin }^2}x}}{{\cos x}} + \cos x} \right) = \frac{1}{{{{\cos }^2}x}},\;\; \Rightarrow
{C'_2}\left( x \right)\frac{{{{\sin }^2}x + {{\cos }^2}x}}{{\cos x}} = \frac{1}{{{{\cos }^2}x}},\;\; \Rightarrow
{C'_2}\left( x \right) = \frac{1}{{\cos x}}.\]
Then we have
\[{C'_1}\left( x \right) = - \frac{1}{{\cos x}} \cdot \frac{{\sin x}}{{\cos x}}
= - \frac{{\sin x}}{{{{\cos }^2}x}}.\]
Integrate these expressions to find the functions \({C_1}\left( x \right),\) \({C_2}\left( x \right):\)
\[{C_1}\left( x \right) = \int {{C'_1}\left( x \right)dx}
= \int {\left( { - \frac{{\sin x}}{{{{\cos }^2}x}}} \right)dx}
= \int {\frac{{d\left( {\cos x} \right)}}{{{{\cos }^2}x}}}
= - \frac{1}{{\cos x}} + {A_1},\]
\[{C_2}\left( x \right) = \int {{C'_2}\left( x \right)dx}
= \int {\frac{{dx}}{{\cos x}}}
= \int {\frac{{\cos xdx}}{{{{\cos }^2}x}}}
= \int {\frac{{d\left( {\sin x} \right)}}{{1 - {\sin^2}x}}}
= \frac{1}{2}\ln \left| {\frac{{1 + \sin x}}{{1 - \sin x}}} \right| + {A_2}.\]
As a result, the general solution of the nonhomogeneous equation is represented in the form:
\[y\left( x \right) = {C_1}\left( x \right)\cos x + {C_2}\left( x \right)\sin x
= \left( { - \frac{1}{{\cos x}} + {A_1}} \right)\cos x
+ \left( {\frac{1}{2}\ln \left| {\frac{{1 + \sin x}}{{1 - \sin x}}} \right| + {A_2}} \right)\sin x
= {A_1}\cos x + {A_2}\sin x - 1
+ \frac{{\sin x}}{2}\ln \left| {\frac{{1 + \sin x}}{{1 - \sin x}}} \right|,\]
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
\[{k^2} - 7k + 12 = 0,\;\; \Rightarrow
D = 49 - 4 \cdot 12 = 1,\;\; \Rightarrow
{k_{1,2}} = \frac{{7 \pm 1}}{2} = 4,3.\]
Hence, the general solution is given by
\[{y_0}\left( x \right) = {C_1}{e^{4x}} + {C_2}{e^{3x}}.\]
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
\[{y_1}\left( x \right) = {y_2}\left( x \right) + {y_3}\left( x \right),\]
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
\[{y_2}\left( x \right) = A\cos x + B\sin x.\]
Substitute the function \({y_2}\left( x \right)\) and its derivatives
\[{y'_2}\left( x \right) = - A\sin x + B\cos x,\;\; {y^{\prime\prime}_2}\left( x \right) = - A\cos x - B\sin x\]
into the corresponding differential equation:
\[y^{\prime\prime} - 7y' + 12y = 8\sin x,\;\; \Rightarrow
- A\cos x - B\sin x
- 7\left( { - A\sin x + B\cos x} \right)
+ 12\left( {A\cos x + B\sin x} \right)
= 8\sin x,\;\; \Rightarrow
- \color{blue}{A\cos x} - \color{red}{B\sin x} + \color{red}{7A\sin x} - \color{blue}{7B\cos x}
+ \color{blue}{12A\cos x} + \color{red}{12B\sin x}
= \color{black}{8\sin x},\;\;\Rightarrow
\left( {11A - 7B} \right)\cos x + \left( {11B + 7A} \right)\sin x = 8\sin x.\]
Hence,
\[\left\{ \begin{array}{l}
11A - 7B = 0\\
11B + 7A = 8
\end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l}
A = \frac{{28}}{{85}}\\
B = \frac{{44}}{{85}}
\end{array} \right..\]
Then we get
\[{y_2}\left( x \right) = {\frac{{28}}{{85}}}\cos x + {\frac{{44}}{{85}}}\sin x.\]
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:
\[{y_3}\left( x \right) = Ax{e^{3x}}.\]
The derivatives are given by
\[{y'_3}\left( x \right) = \left( {Ax{e^{3x}}} \right)^\prime = A{e^{3x}} + 3Ax{e^{3x}},\]
\[{y^{\prime\prime}_3}\left( x \right) = \left( {A{e^{3x}} + 3Ax{e^{3x}}} \right)^\prime
= 3A{e^{3x}} + 3A{e^{3x}} + 9Ax{e^{3x}}
= 6A{e^{3x}} + 9Ax{e^{3x}}.\]
Substitute the function \({y_3}\left( x \right)\) and its derivatives into the differential equation:
\[6A{e^{3x}} + 9Ax{e^{3x}} - 7\left( {A{e^{3x}} + 3Ax{e^{3x}}} \right) + 12Ax{e^{3x}} = {e^{3x}},\;\; \Rightarrow
\color{blue}{6A{e^{3x}}} + \cancel{\color{red}{9Ax{e^{3x}}}} - \color{blue}{7A{e^{3x}}} - \cancel{\color{red}{21Ax{e^{3x}}}} + \cancel{\color{red}{12Ax{e^{3x}}}} = \color{black}{e^{3x}},\;\; \Rightarrow
- A{e^{3x}} = {e^{3x}}.\]
As it can be seen, \(A = -1.\) Hence, the particular solution \({y_3}\left( x \right)\) has the form:
\[{y_3}\left( x \right) = - x{e^{3x}}.\]
As a result, the general solution of the original nonhomogeneous equation is given by
\[y = {y_0} + {y_2} + {y_3}
= {C_1}{e^{4x}} + {C_2}{e^{3x}} + \frac{{28}}{{85}}\cos x + \frac{{44}}{{85}}\sin x - x{e^{3x}}.\]