### Definition of Linear Equation of First Order

A differential equation of type

\[y’ + a\left( x \right)y = f\left( x \right),\]

where \(a\left( x \right)\) and \(f\left( x \right)\) are continuous functions of \(x,\) is called a linear nonhomogeneous differential equation of first order. We consider two methods of solving linear differential equations of first order:

- Using an integrating factor;
- Method of variation of a constant.

### Using an Integrating Factor

If a linear differential equation is written in the standard form:

\[y’ + a\left( x \right)y = f\left( x \right),\]

the integrating factor is defined by the formula

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

Multiplying the left side of the equation by the integrating factor \(u\left( x \right)\) converts the left side into the derivative of the product \(y\left( x \right) u\left( x \right).\)

The general solution of the differential equation is expressed as follows:

\[y = \frac{{\int {u\left( x \right)f\left( x \right)dx} + C}}{{u\left( x \right)}},\]

where \(C\) is an arbitrary constant.

### Method of Variation of a Constant

This method is similar to the previous approach. First it’s necessary to find the general solution of the homogeneous equation:

\[y’ + a\left( x \right)y = 0.\]

The general solution of the homogeneous equation contains a constant of integration \(C.\) We replace the constant \(C\) with a certain (still unknown) function \(C\left( x \right).\) By substituting this solution into the nonhomogeneous differential equation, we can determine the function \(C\left( x \right).\)

The described algorithm is called the method of variation of a constant. Of course, both methods lead to the same solution.

### Initial Value Problem

If besides the differential equation, there is also an initial condition in the form of \(y\left( {{x_0}} \right) = {y_0},\) such a problem is called the initial value problem (IVP) or Cauchy problem.

A particular solution for an IVP does not contain the constant \(C,\) which is defined by substitution of the general solution into the initial condition \(y\left( {{x_0}} \right) = {y_0}.\)

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Solve the equation \(y’ – y – x{e^x} \) \(= 0.\)### Example 2

Solve the differential equation \(xy’ = y + 2{x^3}.\)### Example 3

Solve the equation \(y’ – 2y = x.\)### Example 4

Solve the differential equation \({x^2}y’ + xy + 2 \) \(= 0.\)### Example 5

Solve the initial value problem: \(y’ – y\tan x \) \(= \sin x,\) \(y\left( 0 \right) = 1.\)### Example 6

Solve the differential equation (IVP) \(y’ + {\large\frac{3}{x}\normalsize}y \) \(= {\large\frac{2}{{{x^2}}}\normalsize}\) with the initial condition \(y\left( 1 \right) = 2.\)### Example 7

Find the general solution of the differential equation \(y = \left( {2{y^4} + 2x} \right)y’.\)### Example 1.

Solve the equation \(y’ – y – x{e^x} \) \(= 0.\)Solution.

We rewrite this equation in standard form:

\[y’ – y = x{e^x}.\]

We will solve this equation using the integrating factor

\[{u\left( x \right) = {e^{\int {\left( { – 1} \right)dx} }} }={ {e^{ – \int {dx} }} }={ {e^{ – x}}.}\]

Then the general solution of the linear equation is given by

\[\require{cancel}

{y\left( x \right) }={ \frac{{\int {u\left( x \right)f\left( x \right)dx} + C}}{{u\left( x \right)}} }

= {\frac{{\int {\cancel{e^{ – x}}x\cancel{e^x}dx} + C}}{{{e^{ – x}}}} }

= {\frac{{\int {xdx} + C}}{{{e^{ – x}}}} }

= {{e^x}\left( {\frac{{{x^2}}}{2} + C} \right).}

\]

### Example 2.

Solve the differential equation \(xy’ = y + 2{x^3}.\)Solution.

We will solve this problem by using the method of variation of a constant. First we find the general solution of the homogeneous equation:

\[xy’ = y,\]

which can be solved by separating the variables:

\[

{x\frac{{dy}}{{dx}} = y,\;\;}\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,\;\;}\Rightarrow

{y = Cx.}

\]

where \(C\) is a positive real number.

Now we replace \(C\) with a certain (still unknown) function \(C\left( x \right)\) and will find a solution of the original nonhomogeneous equation in the form:

\[y = C\left( x \right)x.\]

Then the derivative is given by

\[{y’ = {\left[ {C\left( x \right)x} \right]^\prime } }={ C’\left( x \right)x + C\left( x \right).}\]

Substituting this into the equation gives:

\[

{{x\left[ {C’\left( x \right)x + C\left( x \right)} \right] }={ C\left( x \right)x + 2{x^3},\;\;}}\Rightarrow

{{C’\left( x \right){x^2} + \cancel{C\left( x \right)x} }={ \cancel{C\left( x \right)x} + 2{x^3},\;\;}}\Rightarrow

{C’\left( x \right) = 2x.}

\]

Upon integration, we find the function \({C\left( x \right)}:\)

\[{C\left( x \right) = \int {2xdx} }={ {x^2} + {C_1},}\]

where \({C_1}\) is an arbitrary real number.

Thus, the general solution of the given equation is written in the form

\[{y = C\left( x \right)x }={ \left( {{x^2} + {C_1}} \right)x }={ {x^3} + {C_1}x.}\]