Differential Equations

First Order Equations

1st Order Diff Equations Logo

Linear Differential Equations of First Order

Solved Problems

Example 3.

Solve the equation \[y' - 2y = x.\]

Solution.

\(A.\;\) First we solve this problem using an integrating factor. The given equation is already written in the standard form. Therefore

\[a\left( x \right) = - 2.\]

Then the integrating factor is

\[u\left( x \right) = \exp \left( {\int {a\left( x \right)dx} } \right) = \exp \left( {\int {\left( { - 2} \right)dx} } \right) = {e^{ - 2x}}.\]

The general solution of the original differential equation has the form:

\[y = \frac{{\int {u\left( x \right)f\left( x \right)dx} + C}}{{u\left( x \right)}} = \frac{{\int {{e^{ - 2x}}xdx} + C}}{{{e^{ - 2x}}}}.\]

We calculate the last integral with help of integration by parts.

\[\int {\underbrace {{e^{ - 2x}}}_{q'} \underbrace x_pdx} = \left[ {\begin{array}{*{20}{l}} {\int {q'pdx} = qp - \int {q'pdx} }\\ {p = x,\;p' = 1}\\ {q' = {e^{ - 2x}},\;q = - \frac{1}{2}{e^{ - 2x}}} \end{array}} \right] = - \frac{x}{2}{e^{ - 2x}} - \int {1 \cdot \left( { - \frac{1}{2}{e^{ - 2x}}} \right)dx} = - \frac{x}{2}{e^{ - 2x}} + \frac{1}{2}\int {{e^{ - 2x}}dx} = - \frac{x}{2}{e^{ - 2x}} - \frac{1}{4}{e^{ - 2x}} = - \frac{1}{4}{e^{ - 2x}}\left( {1 + 2x} \right).\]

Then

\[y = \frac{{ - \frac{1}{4}{e^{ - 2x}}\left( {1 + 2x} \right) + C}}{{{e^{ - 2x}}}} = - \frac{1}{4}\left( {1 + 2x} \right) + C{e^{2x}}.\]

\(B.\;\) Now we construct the solution by the method of variation of a constant. Consider the corresponding homogeneous equation:

\[y' - 2y = 0\]

and find its general solution.

\[\frac{{dy}}{{dx}} = 2y,\;\; \Rightarrow \frac{{dy}}{y} = 2dx,\;\; \Rightarrow \int {\frac{{dy}}{y}} = 2\int {dx} ,\;\; \Rightarrow \ln \left| y \right| = 2x + C,\;\; \Rightarrow \left| y \right| = {e^{2x + C}} = {e^{2x}}{e^C} = {C_1}{e^{2x}},\;\; \Rightarrow y = \pm {C_1}{e^{2x}} = C{e^{2x}},\]

where \(C\) again denotes any real number. Notice that at \(C = 0\), we get \(y = 0\) that is also a solution of the homogeneous equation.

Next we suppose that \(C\) is a function of \(x\) and substitute the solution \(y = C\left( x \right){e^{2x}}\) into the initial nonhomogeneous equation. We can write

\[y' = {\left[ {C\left( x \right){e^{2x}}} \right]^\prime } = C'\left( x \right)\cdot{e^{2x}} + C\left( x \right) \cdot 2{e^{2x}}.\]

Hence,

\[C'\left( x \right){e^{2x}} + \cancel{2C\left( x \right){e^{2x}}} - \cancel{2C\left( x \right){e^{2x}}} = x,\;\; \Rightarrow C'\left( x \right) = {e^{ - 2x}}x,\;\; \Rightarrow C\left( x \right) = \int {{e^{ - 2x}}xdx} .\]

This integral was already found above in section \(A\), so we obtain

\[C\left( x \right) = - \frac{1}{4}{e^{ - 2x}}\left( {1 + 2x} \right) + C.\]

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

\[y = C\left( x \right){e^{2x}} = \left[ { - \frac{1}{4}{e^{ - 2x}}\left( {1 + 2x} \right) + C} \right]{e^{2x}} = - \frac{1}{4}\left( {1 + 2x} \right) + C{e^{2x}}.\]

As you can see, both methods give the same answer :).

Example 4.

Solve the differential equation \[{x^2}y' + xy + 2 = 0.\]

Solution.

We solve this problem using the method of variation of a constant. For convenience, we write this equation in the standard form:

\[y' + \frac{y}{x} = - \frac{2}{{{x^2}}}.\]

Divide both sides by \({{x^2}}.\) Obviously, that \(x = 0\) is not the solution of the equation.

Consider the homogeneous equation:

\[y' + \frac{y}{x} = 0,\;\; \Rightarrow \frac{{dy}}{{dx}} = - \frac{y}{x},\;\; \Rightarrow \frac{{dy}}{y} = - \frac{{dx}}{x},\;\; \Rightarrow \int {\frac{{dy}}{y}} = - \int {\frac{{dx}}{x}} ,\;\; \Rightarrow \ln \left| y \right| = - \ln \left| x \right| + \ln {C_1}\; \left( {{C_1} \gt 0} \right),\;\; \ln \left| y \right| = \ln \frac{{{C_1}}}{{\left| x \right|}},\;\; y = \frac{{{C_1}}}{{\left| x \right|}}.\]

After easy transformations we find the answer \(y = {\frac{C}{x}},\) where \(C\) is any real number. The last expression includes the case \(y = 0,\) which is also a solution of the homogeneous equation.

Now we replace the constant \(C\) with the function \(C\left( x \right)\) and substitute the solution \(y = C\left( x \right)\) into the initial nonhomogeneous differential equation. As

\[y' = {\left[ {\frac{{C\left( x \right)}}{x}} \right]^\prime } = \frac{{C'\left( x \right) \cdot x - C\left( x \right)}}{{{x^2}}},\]

we obtain

\[\frac{{C'\left( x \right) \cdot x - C\left( x \right)}}{{{x^2}}} + \frac{{C\left( x \right)}}{{{x^2}}} = - \frac{2}{{{x^2}}},\;\; \Rightarrow \frac{{C'\left( x \right)}}{x} - \cancel{\frac{{C\left( x \right)}}{{{x^2}}}} + \cancel{\frac{{C\left( x \right)}}{{{x^2}}}} = - \frac{2}{{{x^2}}},\;\; \Rightarrow C'\left( x \right) = - \frac{2}{x},\;\; \Rightarrow C\left( x \right) = - \int {\frac{2}{x}dx} = - 2\ln \left| x \right| + C.\]

Thus, the general solution of the initial equation is given by

\[y = \frac{{C\left( x \right)}}{x} = - \frac{{2\ln \left| x \right|}}{x} + \frac{C}{x}.\]

Example 5.

Solve the initial value problem: \[y' - y\tan x = \sin x, \;y\left( 0 \right) = 1.\]

Solution.

First of all we calculate the integrating factor, which is written as

\[u\left( x \right) = {e^{\int {\left( { - \tan x} \right)dx} }} = {e^{ - \int {\tan xdx} }}.\]

Here

\[\int {\tan xdx} = \int {\frac{{\sin x}}{{\cos x}}dx} = - \int {\frac{{d\left( {\cos x} \right)}}{{\cos x}}} = - \ln \left| {\cos x} \right|.\]

Hence, the integrating factor is given by

\[u\left( x \right) = e^{ - \int {\tan xdx} } = e^{\ln \left| {\cos x} \right|} = \left| {\cos x} \right|.\]

We can take the function \(u\left( x \right) = \cos x\) as the integrating factor. Make sure that the left side of the equation is the derivative of the product \(y\left( x \right)u\left( x \right):\)

\[\left( {y' - y\tan x} \right)\cos x = y'\cos x - y\tan x\cos x = y'\cos x - y\sin x = \left( {y\cos x} \right)^\prime = \left[ {y\left( x \right)u\left( x \right)} \right]^\prime .\]

Then the general solution of the equation is written in the form:

\[y\left( x \right) = \frac{1}{{u\left( x \right)}} \left[ {\int {u\left( x \right)\sin xdx} + C} \right] = \frac{1}{{\cos x}} \left[ {\int {\cos x\sin xdx} + C} \right] = \frac{1}{{2\cos x}}\int {\sin 2xdx} + \frac{C}{{\cos x}} = \frac{C}{{\cos x}} - \frac{{\cos 2x}}{{4\cos x}}.\]

Next, we determine the value of \(C,\) which satisfies the initial condition \(y\left( 0 \right) = 1:\)

\[y\left( 0 \right) = \frac{C}{{\cos 0}} - \frac{{\cos 0}}{{4\cos 0}} = C - \frac{1}{4} = 1,\]

so \(C = {\frac{5}{4}}.\)

Hence, the solution for the initial value problem is given by

\[y\left( x \right) = \frac{5}{{4\cos x}} - \frac{{\cos 2x}}{{4\cos x}} = \frac{{5 - \cos 2x}}{{4\cos x}}.\]

Example 6.

Solve the differential equation (IVP) \[y' + \frac{3}{x} y = \frac{2}{{{x^2}}}\] with the initial condition \(y\left( 1 \right) = 2.\)

Solution.

Determine the integrating factor:

\[u\left( x \right) = {e^{\int {\frac{3}{x}dx} }} = e^{3\int {\frac{{dx}}{x}}} = e^{3\ln \left| x \right|} = e^{\ln {{\left| x \right|}^3}} = \left| x \right|^3.\]

We can take the function \(u\left( x \right) = {x^3}\) as the integrating factor. One can check that the left side of the equation is the derivative of the product \(y\left( x \right)u\left( x \right):\)

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

The general solution of the differential equation is written as

\[y = \frac{{\int {u\left( x \right)f\left( x \right)dx} + C}}{{u\left( x \right)}} = \frac{{\int {{x^3} \cdot \frac{2}{{{x^2}}}dx} + C}}{{{x^3}}} = \frac{{\int {2xdx} + C}}{{{x^3}}} = \frac{{{x^2} + C}}{{{x^3}}} = \frac{1}{x} + \frac{C}{{{x^3}}}.\]

Now we can find the constant \(C\) using the initial condition \(y\left( 1 \right) = 2.\) Substituting the general solution into this condition gives:

\[y\left( 1 \right) = \frac{1}{1} + \frac{C}{{{1^3}}} = 2,\;\; \Rightarrow C = 1.\]

Thus, the solution of the IVP is given by

\[y = \frac{1}{x} + \frac{1}{{{x^3}}}.\]

Example 7.

Find the general solution of the differential equation \[y = \left( {2{y^4} + 2x} \right)y'.\]

Solution.

One can see that this equation is not linear with respect to the function \(y\left( x \right).\) However, we can try to find the solution for the inverse function \(x\left( y \right).\) We write the given equation in terms of differentials and make some transformations:

\[y = \left( {2{y^4} + 2x} \right)\frac{{dy}}{{dx}},\;\; \Rightarrow ydx = 2{y^4}dy + 2xdy,\;\; \Rightarrow y\frac{{dx}}{{dy}} = 2{y^4} + 2x,\;\; \Rightarrow \frac{{dx}}{{dy}} - \frac{2}{y}x = 2{y^3}.\]

Now we see that we have a linear differential equation with respect to the function \(x\left( y \right).\) We can solve it with help of the integrating factor:

\[u\left( y \right) = e^{\int {\left( { - \frac{2}{y}} \right)dy} } = e^{ - 2\int {\frac{{dy}}{y}} } = e^{ - 2\ln \left| y \right|} = e^{\ln \frac{1}{{{{\left| y \right|}^2}}}} = e^{\ln \frac{1}{{{y^2}}}} = \frac{1}{{{y^2}}}.\]

Then the general solution as the inverse function \(x\left( y \right)\) is expressed in the form

\[x\left( y \right) = \frac{{\int {u\left( y \right)f\left( y \right)dy} + C}}{{u\left( y \right)}} = \frac{{\int {\frac{1}{{{y^2}}} \cdot 2{y^3}dy} + C}}{{\frac{1}{{{y^2}}}}} = \frac{{\int {2ydy} + C}}{{\frac{1}{{{y^2}}}}} = {y^2}\left( {{y^2} + C} \right).\]
Page 1 Page 2