# Differential Equations

## First Order Equations # Using an Integrating Factor

Consider a differential equation of type

$P\left( {x,y} \right)dx + Q\left( {x,y} \right)dy = 0,$

where $$P\left( {x,y} \right)$$ and $$Q\left( {x,y} \right)$$ are functions of two variables $$x$$ and $$y$$ continuous in a certain region $$D.$$ If

$\frac{{\partial Q}}{{\partial x}} \ne \frac{{\partial P}}{{\partial y}},$

the equation is not exact. However, we can try to find so-called integrating factor, which is a function $$\mu \left( {x,y} \right)$$ such that the equation becomes exact after multiplication by this factor. If so, then the relationship

$\frac{{\partial \left( {\mu Q\left( {x,y} \right)} \right)}}{{\partial x}} = \frac{{\partial \left( {\mu P\left( {x,y} \right)} \right)}}{{\partial y}}$

is valid. This condition can be written in the form:

$Q\frac{{\partial \mu }}{{\partial x}} + \mu \frac{{\partial Q}}{{\partial x}} = P\frac{{\partial \mu }}{{\partial y}} + \mu \frac{{\partial P}}{{\partial y}},\;\; \Rightarrow Q\frac{{\partial \mu }}{{\partial x}} - P\frac{{\partial \mu }}{{\partial y}} = \mu \left( {\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}}} \right).$

The last expression is the partial differential equation of first order that defines the integrating factor $$\mu \left( {x,y} \right).$$

Unfortunately, there is no general method to find the integrating factor. However, one can mention some particular cases for which the partial differential equation can be solved and as a result we can construct the integrating factor.

## 1. Integrating Factor Depends on the Variable $$x:$$ $$\mu = \mu \left( x \right).$$

In this case we have $$\frac{{\partial \mu }}{{\partial y}} = 0,$$ so the equation for $$\mu \left( {x,y} \right)$$ can be written in the form:

$\frac{1}{\mu }\frac{{d\mu }}{{dx}} = \frac{1}{Q}\left( {\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}}} \right).$

The right side of this equation must be a function of only $$x.$$ We can find the function $$\mu \left( x \right)$$ by integrating the last equation.

## 2. Integrating Factor Depends on the Variable $$y:$$ $$\mu = \mu \left( y \right).$$

Similarly, if $$\frac{{\partial \mu }}{{\partial x}} = 0,$$ we get the following ordinary differential equation for the integrating factor $$\mu:$$

$\frac{1}{\mu }\frac{{d\mu }}{{dy}} = -\frac{1}{P}\left( {\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}}} \right),$

where the right side depends only on $$y.$$ The function $$\mu \left( y \right)$$ can be found by integrating the given equation.

## 3. Integrating Factor Depends on a Certain Combination of the Variables $$x$$ and $$y:$$ $$\mu = \mu \left( {z\left( {x,y} \right)} \right).$$

The new function $${z\left( {x,y} \right)}$$ can be, for example, of the following type:

$z = \frac{x}{y},\;\; z = xy,\;\; z = {x^2} + {y^2},\;\; z = x + y,$

and so on.

Here it is important that the integrating factor $$\mu \left( {x,y} \right)$$ becomes a function of one variable $$z:$$

$\mu \left( {x,y} \right) = \mu \left( z \right)$

and can be found from the differential equation:

$\frac{1}{\mu }\frac{{d\mu }}{{dz}} = \frac{{\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}}}}{{Q\frac{{\partial z}}{{\partial x}} - P\frac{{\partial z}}{{\partial y}}}}.$

We assume that the right side of the equation depends only on $$z$$ and the denominator is not zero.

Below we consider some particular examples of the equation

$P\left( {x,y} \right)dx + Q\left( {x,y} \right)dy = 0,$

where we can determine the integrating factor. The general conditions of existence of the integrating factor are derived in the theory of Lie Group.

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Solve the equation $\left( {1 + {y^2}} \right)dx + xydy = 0.$

### Example 2

Solve the differential equation $\left( {x - \cos y} \right)dx - \sin ydy = 0.$

### Example 1.

Solve the equation $\left( {1 + {y^2}} \right)dx + xydy = 0.$

Solution.

First we test this differential equation for exactness:

$\frac{{\partial Q}}{{\partial x}} = \frac{\partial }{{\partial x}}\left( {xy} \right) = y,\;\; \frac{{\partial P}}{{\partial y}} = \frac{\partial }{{\partial y}}\left( {1 + {y^2}} \right) = 2y.$

As one can see, this equation is not exact. We try to find an integrating factor to convert the equation into exact. Calculate the function

$\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}} = 2y - y = y.$

One can notice that the expression

$\frac{1}{Q}\left( {\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}}} \right) = \frac{1}{{xy}} \cdot y = \frac{1}{x}$

depends only on the variable $$x.$$ Hence, the integrating factor will also depend only on $$x:$$ $$\mu = \mu \left( x \right).$$ We can get it from the equation

$\frac{1}{\mu }\frac{{d\mu }}{{dx}} = \frac{1}{x}.$

Separating variables and integrating, we obtain:

$\int {\frac{{d\mu }}{\mu }} = \int {\frac{{dx}}{x}} ,\;\; \Rightarrow \ln \left| \mu \right| = \ln \left| x \right|,\;\; \Rightarrow \mu = \pm x.$

We choose $$\mu = x.$$ Multiplying the original differential equation by $$\mu = x,$$ produces the exact equation:

$\left( {x + x{y^2}} \right)dx + {x^2}ydy = 0.$

Indeed, now we have

$\frac{{\partial Q}}{{\partial x}} = \frac{\partial }{{\partial x}}\left( {{x^2}y} \right) = 2xy = \frac{{\partial P}}{{\partial y}} = \frac{\partial }{{\partial y}}\left( {x + x{y^2}} \right) = 2xy.$

Solve the resulting equation. The function $$u\left( {x,y} \right)$$ can be found from the system of equations:

$\left\{ \begin{array}{l} \frac{{\partial u}}{{\partial x}} = x + x{y^2}\\ \frac{{\partial u}}{{\partial y}} = {x^2}y \end{array} \right..$

It follows from the first equation that

$u\left( {x,y} \right) = \int {\left( {x + x{y^2}} \right)dx} = \frac{{{x^2}}}{2} + \frac{{{x^2}{y^2}}}{2} + \varphi \left( y \right).$

Substitute this in the second equation to determine $$\varphi \left( y \right):$$

$\frac{{\partial u}}{{\partial y}} = \frac{\partial }{{\partial y}}\left[ {\frac{{{x^2}}}{2} + \frac{{{x^2}{y^2}}}{2} + \varphi \left( y \right)} \right] = {x^2}y,\;\; \Rightarrow {x^2}y + \varphi'\left( y \right) = {x^2}y,\;\; \Rightarrow \varphi'\left( y \right) = 0.$

It follows from here that $$\varphi \left( y \right) = C,$$ where $$C$$ is a constant.

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

$\frac{{{x^2}}}{2} + \frac{{{x^2}{y^2}}}{2} + C = 0.$

### Example 2.

Solve the differential equation $\left( {x - \cos y} \right)dx - \sin ydy = 0.$

Solution.

If we test this equation for exactness, we find that

$\frac{{\partial Q}}{{\partial x}} = \frac{\partial }{{\partial x}}\left( { - \sin y} \right) = 0,\;\; \frac{{\partial P}}{{\partial y}} = \frac{\partial }{{\partial y}}\left( {x - \cos y} \right) = \sin y.$

Hence, this equation is not exact. We try to construct an integrating factor. Notice that

$\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}} = \sin y,$

and the expression

$\frac{1}{Q}\left( {\frac{{\partial P}}{{\partial y}} - \frac{{\partial Q}}{{\partial x}}} \right) = \frac{{\sin y}}{{\left( { - \sin y} \right)}} = - 1$

is constant.

Hence, we can find the integrating factor as a function $$\mu \left( x \right)$$ by solving the following equation:

$\frac{1}{\mu }\frac{{d\mu }}{{dx}} = - 1,\;\; \Rightarrow \int {\frac{{d\mu }}{\mu }} = - \int {dx} ,\;\; \Rightarrow \ln \left| \mu \right| = - x,\;\; \Rightarrow \mu = {e^{ \pm x}}.$

We choose the function $$\mu = {e^{ - x}}$$ and make sure that the equation becomes exact after multiplication by $$\mu = {e^{ - x}}:$$

${e^{ - x}}\left( {x - \cos y} \right)dx - {e^{ - x}}\sin ydy = 0,$
$\frac{{\partial Q}}{{\partial x}} = \frac{\partial }{{\partial x}}\left( { - {e^{ - x}}\sin y} \right) = {e^{ - x}}\sin y = \frac{{\partial P}}{{\partial y}} = \frac{\partial }{\partial }\left( {{e^{ - x}}\left( {x - \cos y} \right)} \right) = {e^{ - x}}\sin y.$

Its general solution can be found from the system of equations:

$\left\{ \begin{array}{l} \frac{{\partial u}}{{\partial x}} = {e^{ - x}}\left( {x - \cos y} \right)\\ \frac{{\partial u}}{{\partial y}} = - {e^{ - x}}\sin y \end{array} \right..$

Here it is more convenient to integrate the second equation with respect to $$y:$$

$u\left( {x,y} \right) = \int {\left( { - {e^{ - x}}\sin y} \right)dy} = {e^{ - x}}\cos y + \psi \left( x \right).$

Substituting this in the first equation, we have

$\frac{{\partial u}}{{\partial x}} = \frac{\partial }{{\partial x}}\left[ {{e^{ - x}}\cos y + \psi \left( x \right)} \right] = {e^{ - x}}\left( {x - \cos y} \right),\;\; \Rightarrow - \cancel{{e^{ - x}}\cos y} + \psi'\left( x \right) = x{e^{ - x}} - \cancel{{e^{ - x}}\cos y},\;\; \Rightarrow \psi'\left( x \right) = x{e^{ - x}}.$

Integrating by parts gives:

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

Thus, the general solution of the equation is given by

${e^{ - x}}\cos y - x{e^{ - x}} - {e^{ - x}} = C\;\; \text{or}\;\; {e^{ - x}}\left( {\cos y - x - 1} \right) = C,$

where $$C$$ is an arbitrary real number.

See more problems on Page 2.