Differential Equations

Second Order Equations

2nd Order Diff Equations Logo

Second Order Linear Nonhomogeneous Differential Equations with Variable Coefficients

Solved Problems

Example 1.

Find the general solution of the differential equation

\[{x^2}y^{\prime\prime} - 2xy' + 2y = {x^2} + 1 \;\text{for}\; x \gt 0.\]

Solution.

Consider first the associated homogeneous equation and construct its fundamental system of solutions. One can notice that one of the solutions of the homogeneous equation

\[{x^2}y^{\prime\prime} - 2xy' + 2y = 0\]

is the function \({y_1} = x.\) We find the second independent solution \({y_2}\) using the Liouville formula:

\[{W_{{y_1}{y_2}}}\left( x \right) = \left| {\begin{array}{*{20}{c}} {{y_1}}&{{y_2}}\\ {{y'_1}}&{{y'_2}} \end{array}} \right| = {C_1}\exp \left( { - \int {\frac{{{a_1}\left( x \right)}}{{{a_2}\left( x \right)}}dx} } \right).\]

Hence,

\[{y'_2}{y_1} - {y_2}{y'_1} = {C_1}{e^{ - \int {\left( {\frac{{ - 2x}}{{{x^2}}}} \right)dx} }} = {C_1}{e^{2\int {\frac{{dx}}{x}} }} = {C_1}{e^{2\ln \left| x \right|}} = {C_1}{e^{\ln {x^2}}} = {C_1}{x^2}.\]

Divide both sides of the equation by \(y_1^2:\)

\[\frac{{{y'_2}{y_1} - {y_2}{y'_1}}}{{y_1^2}} = \frac{{{C_1}{x^2}}}{{y_1^2}} = \frac{{{C_1}{x^2}}}{{{x^2}}} = {C_1},\;\; \Rightarrow \left( {\frac{{{y_2}}}{{{y_1}}}} \right)^\prime = C_1.\]

After integration, we have

\[\frac{{{y_2}}}{{{y_1}}} = {C_1}x + {C_2},\;\; \Rightarrow {y_2} = {y_1}\left( {{C_1}x + {C_2}} \right) = x\left( {{C_1}x + {C_2}} \right) = {C_1}{x^2} + {C_2}x.\]

Thus, the general solution of the homogeneous equation is given by the function

\[{y_0}\left( x \right) = {C_1}{x^2} + {C_2}x,\]

where \({C_1},\) \({C_2}\) are arbitrary constants.

Now we use the method of variation of parameters and construct the general solution of the inhomogeneous equation. We will consider the parameters \({C_1}\) and \({C_2}\) as functions of the variable \(x.\) The derivatives of these functions are determined from the equations

\[\left\{ \begin{array}{l} {C'_1}{x^2} + {C'_2}x = 0\\ {{C'_1}{\left( {{x^2}} \right)^\prime } + {C'_2}{\left( x \right)^\prime }} = {1 + \frac{1}{{{x^2}}}} \end{array} \right..\]

Here the right-hand side \(1 + {\frac{1}{{{x^2}}}}\) in the second equation is written after conversion of the original differential equation into the standard form:

\[{x^2}y^{\prime\prime} - 2xy' + 2y = {x^2} + 1,\;\; \Rightarrow y^{\prime\prime} - \frac{2}{x}y' + \frac{2}{{{x^2}}}y = 1 + \frac{1}{{{x^2}}}.\]

Solving this system of equations, we find the derivatives \({C'_1}\left( x \right),\) \({C'_2}\left( x \right)\) and then the functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right).\) So we have

\[{C'_1} = \frac{1}{x} + \frac{1}{{{x^3}}},\;\; {C'_2} = - 1 - \frac{1}{{{x^2}}},\;\; {C_1} = \ln x - \frac{1}{{2{x^2}}} + {A_1},\;\; {C_2} = - x + \frac{1}{x} + {A_2},\]

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

As a result, we obtain the general solution of the nonhomogeneous equation in the form

\[y\left( x \right) = {C_1}\left( x \right){x^2} + {C_2}\left( x \right)x = \left( {\ln x - \frac{1}{{2{x^2}}} + {A_1}} \right){x^2} + \left( { - x + \frac{1}{x} + {A_2}} \right)x = {A_1}{x^2} + {A_2}x + {x^2}\left( {\ln x - 1} \right) + \frac{1}{2}.\]

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},\;x \gt e.\]

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

Solution.

First we determine the general solution of the homogeneous equation

\[\left( {\ln x - 1} \right)y^{\prime\prime} - \frac{{y'}}{x} + \frac{y}{{{x^2}}} = 0.\]

One of the solutions is known: \({y_1} = x.\) Then, using the Liouville formula, we have

\[{W_{{y_1},{y_2}}}\left( x \right) = \left| {\begin{array}{*{20}{c}} {{y_1}}&{{y_2}}\\ {{y'_1}}&{{y'_2}} \end{array}} \right| = {C_1}\exp \left[ { - \int {\frac{{{a_1}\left( x \right)}}{{{a_2}\left( x \right)}}dx} } \right],\;\; \Rightarrow {y'_2}{y_1} - {y_2}{y'_1} = {C_1}\exp \left[ { - \int {\left( {\frac{{ - \frac{1}{x}}}{{\ln x - 1}}} \right)dx} } \right] = {C_1}\exp \left[ {\int {\frac{{dx}}{{x\left( {\ln x - 1} \right)}}} } \right].\]

The integral in the last expression is evaluated by the change:

\[\ln x - 1 = t,\;\; \Rightarrow \frac{{dx}}{x} = dt.\]

Hence,

\[\int {\frac{{dx}}{{x\left( {\ln x - 1} \right)}}} = \int {\frac{{dt}}{t}} = \ln t = \ln \left( {\ln x - 1} \right).\]

As a result, we obtain

\[{y'_2}{y_1} - {y_2}{y'_1} = {C_1}{e^{\ln \left( {\ln x - 1} \right)}},\;\; \Rightarrow {y'_2}{y_1} - {y_2}{y'_1} = {C_1}\left( {\ln x - 1} \right).\]

Divide both sides by \(y_1^2:\)

\[\frac{{{y'_2}{y_1} - {y_2}{y'_1}}}{{y_1^2}} = \frac{{{C_1}\left( {\ln x - 1} \right)}}{{y_1^2}},\;\; \Rightarrow \left( {\frac{{{y_2}}}{{{y_1}}}} \right)^\prime = \frac{{{C_1}\left( {\ln x - 1} \right)}}{{{x^2}}},\;\; \Rightarrow \frac{{{y_2}}}{{{y_1}}} = {C_1}\int {\frac{{\ln x - 1}}{{{x^2}}}dx} .\]

The resulting integral can be integrated by parts. We denote

\[u' = \frac{1}{{{x^2}}},\;\; v = \ln x - 1,\;\; \Rightarrow u = - \frac{1}{x},\;\; v' = \frac{1}{x}.\]

The integral becomes equal

\[\int {\frac{{\ln x - 1}}{{{x^2}}}dx} = - \frac{{\ln x - 1}}{x} - \int {\left( { - \frac{1}{x}} \right)\left( {\frac{1}{x}} \right)dx} = - \frac{{\ln x - 1}}{x} + \int {\frac{{dx}}{{{x^2}}}} = - \frac{{\ln x - 1}}{x} - \frac{1}{x} + {C_2}.\]

Then, considering the coefficients \({C_1},\) \({C_2}\) as arbitrary numbers, we can write

\[\frac{{{y_2}}}{{{y_1}}} = {C_1}\left[ { - \frac{{\ln x - 1}}{x} - \frac{1}{x} + {C_2}} \right] = {C_1}\frac{{\ln x}}{x} + {C_2}.\]

Hence we obtain:

\[{y_2} = {y_1}\left( {{C_1}\frac{{\ln x}}{x} + {C_2}} \right) = x\left( {{C_1}\frac{{\ln x}}{x} + {C_2}} \right) = {C_1}\ln x + {C_2}x.\]

This expression represents the general solution of the homogeneous equation.

Now, using the method of variation of parameters, we find the general solution of the nonhomogeneous equation, which is written in standard form as

\[y^{\prime\prime} - \frac{{y'}}{{x\left( {\ln x - 1} \right)}} + \frac{y}{{{x^2}\left( {\ln x - 1} \right)}} = \frac{{\ln x - 1}}{x}.\]

Assuming that

\[y\left( x \right) = {C_1}\left( x \right)\ln x + {C_2}\left( x \right)x,\]

we find the functions \({C_1}\left( x \right)\) and \({C_2}\left( x \right)\) from the system of equations

\[\left\{ \begin{array}{l} {{C'_1}\ln x + {C'_2}x} = 0\\ {{C'_1}{\left( {\ln x} \right)^\prime }} + {{C'_2}{\left( x \right)^\prime }} = {\frac{{\ln x - 1}}{x}} \end{array} \right.,\;\; \Rightarrow \left\{ \begin{array}{l} {C'_1}\ln x + {C'_2}x = 0\\ \frac{{{C'_1}}}{x} + {C'_2} = \frac{{\ln x - 1}}{x} \end{array} \right..\]

Multiply the second equation by \(x\) and subtract the first equation from it:

\[\left\{ \begin{array}{l} {C'_1}\ln x + {C'_2}x = 0\\ {C'_1} + {C'_2}x = \ln x - 1 \end{array} \right.,\;\; \Rightarrow {C'_1}\left( {1 - \ln x} \right) = \ln x - 1,\;\; \Rightarrow {C'_1} = - 1.\]

Next, substituting \({C'_1},\) for example, in the first equation, we find \({C'_2}:\)

\[- \ln x + {C'_2}x = 0,\;\; \Rightarrow {C'_2} = \frac{{\ln x}}{x}.\]

Integrating, we obtain

\[{C_1} = \int {\left( { - 1} \right)dx} = - x + {A_1},\;\; {C_2} = \int {\frac{{\ln x}}{x}dx} = \int {\ln x\,d\left( {\ln x} \right)} = \frac{{{{\ln }^2}x}}{2} + {A_2},\]

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

Thus, the general solution of the original nonhomogeneous equation has the form:

\[y\left( x \right) = {C_1}\left( x \right)\ln x + {C_2}\left( x \right)x = \left( { - x + {A_1}} \right)\ln x + \left( {\frac{{{{\ln }^2}x}}{2} + {A_2}} \right)x = {A_1}\ln x + {A_2}x + \frac{x}{2}\ln x\left( {\ln x - 2} \right).\]

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} \;\text{for}\; x \gt 1\]

assuming that the function \({y_1} = {e^x}\) is a particular solution of the associated homogeneous equation.

Solution.

We find the second independent solution of the homogeneous equation

\[\left( {x - 1} \right)y^{\prime\prime} - xy' + y = 0,\]

using the Liouville formula. Given that \({y_1} = {e^x},\) we have:

\[{W_{{y_1},{y_2}}}\left( x \right) = \left| {\begin{array}{*{20}{c}} {{y_1}}&{{y_2}}\\ {{y'_1}}&{{y'_2}} \end{array}} \right| = {C_1}\exp \left[ { - \int {\frac{{{a_1}\left( x \right)}}{{{a_2}\left( x \right)}}dx} } \right],\;\; \Rightarrow {y'_2}{y_1} - {y_2}{y'_1} = {C_1}\exp \left[ { - \int {\left( {\frac{{ - x}}{{x - 1}}} \right)dx} } \right] = {C_1}\exp \left[ {\int {\frac{x}{{x - 1}}dx} } \right] = {C_1}\exp \left[ {\int {\frac{{x - 1 + 1}}{{x - 1}}dx} } \right] = {C_1}\exp \left[ {\int {\left( {1 + \frac{1}{{x - 1}}} \right)dx} } \right] = {C_1}{e^{x + \ln \left| {x - 1} \right|}} = {C_1}{e^x}{e^{\ln \left| {x - 1} \right|}} = {C_1}\left( {x - 1} \right){e^x}.\]

We assumed here, by the condition of the problem, that \(x \gt 1\). Dividing the equation by \(y_1^2 = {e^{2x}}\) yields

\[\frac{{{y'_2}{y_1} - {y_2}{y'_1}}}{{y_1^2}} = \frac{{{C_1}\left( {x - 1} \right){e^x}}}{{y_1^2}},\;\; \Rightarrow \left( {\frac{{{y_2}}}{{{y_1}}}} \right)^\prime = \frac{{{C_1}\left( {x - 1} \right){e^x}}}{{{e^{2x}}}} = {C_1}\left( {x - 1} \right){e^{ - x}}.\]

We integrate the resulting expression by parts.

\[\frac{{{y_2}}}{{{y_1}}} = {C_1}\int {\left( {x - 1} \right){e^{ - x}}dx} = \left[ {\begin{array}{*{20}{l}} {u' = {e^{ - x}}}\\ {v = x - 1}\\ {u = - {e^{ - x}}}\\ {v' = 1} \end{array}} \right] = {C_1}\Big[ { - \left( {x - 1} \right){e^{ - x}} - \int {\left( { - {e^{ - x}}} \right)dx} } \Big] = {C_1}\Big[ { - \left( {x - 1} \right){e^{ - x}} + \int {{e^{ - x}}dx} } \Big] = {C_1}\left[ { - \left( {x - 1} \right){e^{ - x}} - {e^{ - x}}} \right] + {C_2} = - {C_1}x{e^{ - x}} + {C_2}.\]

This shows that the fundamental system of solutions consists of the functions \({e^x}, x.\) Renaming the constants \({C_1}, {C_2},\) we can write the general solution of the homogeneous equation as follows:

\[{y_0}\left( x \right) = {C_1}{e^x} + {C_2}x.\]

Now we construct the general solution of the nonhomogeneous equation. According to the method of variation of parameters we will seek it in the form

\[y\left( x \right) = {C_1}\left( x \right){e^x} + {C_2}\left( x \right)x,\]

where \({C_1}\left( x \right),\) \({C_2}\left( x \right)\) are unknown functions to be determined from the system of equations

\[\left\{ \begin{array}{l} {C'_1}{e^x} + {C'_2}x = 0\\ {C'_1}{e^x} + {C'_2} \cdot 1 = \frac{{{{\left( {x - 1} \right)}^2}}}{{x - 1}} = x - 1 \end{array} \right.\]

Subtracting the second equation from the first one, we obtain

\[{C'_2}\left( {x - 1} \right) = - \left( {x - 1} \right),\;\; \Rightarrow {C'_2} = - 1.\]

It follows from the first equation that

\[{C'_1}{e^x} - x = 0,\;\; \Rightarrow {C'_1} = \frac{x}{{{e^x}}} = x{e^{ - x}}.\]

Integrating the expressions for \({C'_1},\) \({C'_2}\) gives

\[{C_2} = \int {\left( { - 1} \right)dx} = - x + {A_2},\]
\[{C_1} = \int {x{e^{ - x}}dx} = \left[ {\begin{array}{*{20}{l}} {v = x}\\ {u' = {e^{ - x}}}\\ {u = - {e^{ - x}}}\\ {v' = 1} \end{array}} \right] = - x{e^{ - x}} - \int {\left( { - {e^{ - x}}} \right)dx} = - x{e^{ - x}} - {e^{ - x}} + {A_1}.\]

Thus, we have the general solution of the original equation in the form

\[y\left( x \right) = {C_1}\left( x \right){e^x} + {C_2}\left( x \right)x = \left( { - x{e^{ - x}} - {e^{ - x}} + {A_1}} \right){e^x} + \left( { - x + {A_2}} \right)x = - x - 1 + {A_1}{e^x} - {x^2} + {A_2}x = {A_1}{e^x} + {A_2}x - {x^2} - x - 1.\]
Page 1 Page 2