# Integrating Factors

by Justin Skycak on

Integrating factors can be used to solve first-order differential equations with non-constant coefficients.

This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Integrating Factors. In Justin Math: Calculus. https://justinmath.com/integrating-factors/

We know how to solve differential equations of the form

\begin{align*} a_ny^{(n)} + \cdots + a_2 y'' + a_1 y' + a_0 y = f(x) \end{align*}

where each coefficient $a_i$ is a constant. In this chapter, we consider differential equations of the form

\begin{align*} y' + a(x)y = f(x) \end{align*}

where the coefficient $a(x)$ is itself a function of $x$.

To solve such equations using the method of integrating factors, we start off multiplying both sides of the equation by the term $e^{\int a(x) \, dx}$, which is known as the integrating factor. Then, we can write the left hand side as the derivative of $ye^{\int a(x) \, dx}$, antidifferentiate, and solve for $y$.

\begin{align*} y' + a(x)y &= f(x) \\ y'e^{\int a(x) \, dx} + a(x)ye^{\int a(x) \, dx} &= f(x)e^{\int a(x) \, dx} \\ \left( ye^{\int a(x) \, dx} \right)' &= f(x)e^{\int a(x) \, dx} \\ ye^{\int a(x) \, dx} &= \int f(x)e^{\int a(x) \, dx} \, dx \\ y &= e^{-\int a(x) \, dx} \int f(x)e^{\int a(x) \, dx} \, dx \end{align*}

## Demonstration

For example, consider the differential equation $y’-\frac{3}{x}y=2x+1$. The integrating factor for this equation is as follows:

\begin{align*} e^{\int -\frac{3}{x} \, dx} &= e^{ -3 \ln x} \\ &= \left( e^{\ln x} \right)^{-3} \\ &= x^{-3} \\ &= \frac{1}{x^3} \end{align*}

To solve the equation, we multiply both sides of the equation, group the derivative, take the antiderivative, and solve for $y$.

\begin{align*} y'-\frac{3}{x}y &= 2x+1 \\ \frac{1}{x^3} y'- \frac{1}{x^3} \cdot \frac{3}{x}y &= \frac{1}{x^3} \cdot (2x+1) \\ \frac{1}{x^3} y'- \frac{3}{x^4} y &= \frac{2}{x^2} + \frac{1}{x^3} \\ \left( \frac{1}{x^3} y \right)' &= \frac{2}{x^2}+ \frac{1}{x^3} \\ \frac{1}{x^3} y &= \int \frac{2}{x^2} + \frac{1}{x^3} \, dx \\ \frac{1}{x^3} y &= -\frac{2}{x} - \frac{1}{2x^2} + C \\ y &= -2x^2 -\frac{1}{2}x + Cx^3 \end{align*}

## Case when Leading Coefficient is Not One

In equations where the coefficient on the $y’$ is not already $1$, we need to start by dividing the equation by that coefficient.

For example, to solve the equation $xy’ + \frac{y}{\ln x} = x^3$, we start by dividing by $x$, which yields $y’ + \frac{y}{x \ln x} = x^2$. Then, we can proceed as usual to calculate the integration factor.

\begin{align*} e^{\int \frac{1}{x \ln x} \, dx} &= e^{\ln (\ln x)} \\ &= \ln x \end{align*}

Now, we can multiply our updated equation by the integration factor, and solve for $y$ (using integration by parts along the way).

\begin{align*} y' + \frac{y}{x \ln x} &= x^2 \\ y' \ln x + \frac{y}{x \ln x} \cdot \ln x &= x^2 \ln x \\ y' \ln x + \frac{y}{x} &= x^2 \ln x \\ \left( y \ln x \right)' &= x^2 \ln x \\ y \ln x &= \int x^2 \ln x \, dx \\ y \ln x &= \frac{1}{3} x^3 \ln x - \int \frac{x^2}{3} \, dx \\ y \ln x &= \frac{1}{3} x^3 \ln x - \frac{x^3}{9} + C \\ y &= \frac{x^3}{3} - \frac{x^3}{9 \ln x} + \frac{C}{\ln x} \end{align*}

## Exercises

Use integrating factors to solve the following differential equations. (You can view the solution by clicking on the problem.)

\begin{align*} 1) \hspace{.5cm} y' + \frac{y}{x} = \sin x \end{align*}
Solution:
\begin{align*} y=\frac{C_1+\sin x}{x}-\cos x \end{align*}

\begin{align*} 2) \hspace{.5cm} y' + \frac{y}{x \ln x} = \ln x \end{align*}
Solution:
\begin{align*} y=\frac{C_1+2x}{\ln x}-2x-x\ln x \end{align*}

\begin{align*} 3) \hspace{.5cm} y' + y \cot x = 1 \end{align*}
Solution:
\begin{align*} y=C_1 \csc x - \cot x \end{align*}

\begin{align*} 4) \hspace{.5cm} xy' + y = \sec^2(x) \end{align*}
Solution:
\begin{align*} y=\frac{C_1+\tan x}{x} \end{align*}

\begin{align*} 5) \hspace{.5cm} xy' + y = \sec^2(x) \end{align*}
Solution:
\begin{align*} y=\frac{C_1+\tan x}{x} \end{align*}

\begin{align*} 6) \hspace{.5cm} y' \tan x - y = \sec x \end{align*}
Solution:
\begin{align*} y=C_1 \sin x - \cos x \end{align*}

This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Integrating Factors. In Justin Math: Calculus. https://justinmath.com/integrating-factors/

Tags: