# Integrating factor

In mathematics, an integrating factor is a function that is chosen to facilitate the solving of a given equation involving differentials. It is commonly used to solve ordinary differential equations, but is also used within multivariable calculus when multiplying through by an integrating factor allows an inexact differential to be made into an exact differential (which can then be integrated to give a scalar field). This is especially useful in thermodynamics where temperature becomes the integrating factor that makes entropy an exact differential.

## Use in solving first order linear ordinary differential equations

Integrating factors are useful for solving ordinary differential equations that can be expressed in the form

$y'+ P(x)y = Q(x)$

The basic idea is to find some function $M(x)$, called the "integrating factor," which we can multiply through our DE in order to bring the left-hand side under a common derivative. For the canonical first-order, linear differential equation shown above, our integrating factor is chosen to be

$M(x) = e^{\int_{s_0}^{x} P(s) ds}$

In order to derive this, let $M(x)$ be the integrating factor of a first order, linear differential equation such that multiplication by $M(x)$ transforms a partial derivative into a total derivative, then:

\begin{align} (1) \qquad & M(x)\underset{\text{partial derivative}}{(\underbrace{y'+P(x)y})} \\ (2) \qquad & M(x)y'+M(x)P(x)y \\ (3) \qquad & \underset{\text{total derivative}}{\underbrace{M(x)y'+M'(x)y}} \end{align}

Going from step 2 to step 3 requires that $M(x)P(x)=M'(x)$, which is a separable differential equation, whose solution yields $M(x)$ in terms of $P(x)$:

\begin{align} (4) \qquad & M(x)P(x)=M'(x) \\ (5) \qquad & P(x)=\frac{M'(x)}{M(x)}\\ (6) \qquad & \int P(x) dx=\ln M(x) \\ (7) \qquad & e^{\int P(x) dx}=M(x) \end{align}

To verify see that multiplying through by $M(x)$ gives

$y' e^{\int_{s_0}^{x} P(s) ds} + P(x) y e^{\int_{s_0}^{x} P(s) ds} = Q(x)e^{\int_{s_0}^{x} P(s) ds}$

By applying the product rule in reverse, we see that the left-hand side can be expressed as a single derivative in $x$

$y' e^{\int_{s_0}^{x} P(s) ds} + P(x) y e^{\int_{s_0}^{x} P(s) ds} = \frac{d}{dx}(y e^{\int_{s_0}^{x} P(s) ds})$

We use this fact to simplify our expression to

$\frac{d}{dx}(y e^{\int_{s_0}^{x} P(s) ds}) = Q(x) e^{\int_{s_0}^{x} P(s) ds}$

We then integrate both sides with respect to $x$, firstly by renaming $x$ to $t$, obtaining

$y e^{\int_{s_0}^{x} P(s) ds} = \int_{t_0}^{x} Q(t) e^{\int_{s_0}^{t} P(s) ds} dt + C$

Finally, we can move the exponential to the right-hand side to find a general solution to our ODE:

$y = e^{- \int_{s_0}^{x} P(s) ds} \int_{t_0}^x Q(t) e^{\int_{s_0}^{t} P(s) ds} dt + Ce^{- \int_{s_0}^{x} P(s) ds}$

In the case of a homogeneous differential equation, in which $Q(x) = 0$, we find that

$y = \frac{C}{e^{\int_{s_0}^{x} P(s) ds}}$

where $C$ is a constant.

### Example

Solve the differential equation

$y'-\frac{2y}{x} = 0.$

We can see that in this case $P(x) = \frac{-2}{x}$

$M(x)=e^{\int P(x)\,dx}$
$M(x)=e^{\int \frac{-2}{x}\,dx} = e^{-2 \ln x} = {(e^{\ln x})}^{-2} = x^{-2}$ (Note we do not need to include the integrating constant - we need only a solution, not the general solution)
$M(x)=\frac{1}{x^2}.$

Multiplying both sides by $M(x)$ we obtain

$\frac{y'}{x^2} - \frac{2y}{x^3} = 0$
$\frac{y'x^3 - 2x^2y}{x^5} = 0$
$\frac{x(y'x^2 - 2xy)}{x^5} = 0$
$\frac{y'x^2 - 2xy}{x^4} = 0.$

Reversing the quotient rule gives

$\left(\frac{y}{x^2}\right)' = 0$

or

$\frac{y}{x^2} = C\,$

which gives

$y\left(x\right) = Cx^2.$

## General use

An integrating factor is any expression that a differential equation is multiplied by to facilitate integration and is not restricted to first order linear equations. For example, the nonlinear second order equation

$\frac{d^2 y}{d t^2} = A y^{2/3}$

admits $\tfrac{d y}{d t}$ as an integrating factor:

$\frac{d^2 y}{d t^2} \frac{d y}{d t} = A y^{2/3} \frac{d y}{d t}.$

To integrate, note that both sides of the equation may be expressed as derivatives by going backwards with the chain rule:

$\frac{d}{d t}\left(\frac 1 2 \left(\frac{d y}{d t}\right)^2\right) = \frac{d}{d t}\left(A \frac 3 5 y^{5/3}\right).$

Therefore

$\left(\frac{d y}{d t}\right)^2 = \frac{6 A}{5} y^{5/3} + C_0.$

This form may be more useful, depending on application. Performing a separation of variables will give:

$\int \frac{d y}{\sqrt{\frac{6 A}{5} y^{5/3} + C_0}} = t + C_1;$

this is an implicit solution which involves a nonelementary integral. Though likely too obscure to be useful, this is a general solution. Also, because the previous equation is first order, it could be used for numeric solution in favor of the original equation.