T.J.I. 🪼 📚 Notes 🏦 Question Banks! 📃 Paper 02s ✏️ Quizzes 🗄️ Flashcards 🔎 SEARCH
🎓 Study Centre Blog Team About Contact Us!

The Integrating Factor

An introductory note on solving first-order linear differential equations using the integrating factor method, showing how to transform non-exact equations into exact derivatives through theory, worked examples, and practice exercises.

Author:Author ImageRahul Kissoon

Edu Level: Unit2

Date: Jan 10 2026 - 2:06 PM

⏱️Read Time:



Consider the differential equation $$P(x)\frac{\mathrm{d}y}{\mathrm{d}x} + P'(x)y = Q(x)$$

Notice that the left-hand side is simply an expanded product rule. $$\frac{\mathrm{d}}{\mathrm{d}x}[P(x)y] = P(x)\frac{\mathrm{d}y}{\mathrm{d}x} + P'(x)y$$

Therefore, to solve this equation, we can simply integrate both sides with respect to $x$.

$$\begin{align*} \int \frac{\mathrm{d}}{\mathrm{d}x}[P(x)y] \, \mathrm{d}x &= \int Q(x) \, \mathrm{d}x \\ P(x)y &= Q(x) + C \\ y &= \frac{Q(x) + C}{P(x)} \end{align*} $$

But what if the left-hand-side wasn't as simple as reversing the product rule? What then?

Consider the differential equation $$\begin{equation} \frac{\mathrm{d}y}{\mathrm{d}x} + P(x)y = Q(x) \tag{1} \end{equation} $$

There's a subtle difference in this differential equation: the $\displaystyle P'(x)\frac{\mathrm{d}y}{\mathrm{d}x}$ term from the left-hand side is now just $\displaystyle \frac{\mathrm{d}y}{\mathrm{d}x}$ . Therefore, we can no longer express the left-hand side as $\displaystyle \frac{\mathrm{d}}{\mathrm{d}x}[P(x)y]$.

So what if we introduced a term that allowed us to express the left-hand side as the derivative of the product of two functions? This is the idea behind the integrating factor. Essentially, by introducing a new term, $I(x)$, we can force the left-hand side to be expressed as $\displaystyle \frac{\mathrm{d}}{\mathrm{d}x}[I(x) y]$, where $I(x)$ is a function to be determined.

To achieve this, we will multiply equation $(1)$ by $I(x)$. $$\begin{equation} \frac{\mathrm{d}y}{\mathrm{d}x}I(x) + P(x)I(x) y = Q(x)I(x) \tag{2} \end{equation} $$

Next, we will equate the left-hand side of equation $(2)$ to $\displaystyle \frac{\mathrm{d}}{\mathrm{d}x}[I(x) y]$.

$$\begin{align*} \frac{\mathrm{d}y}{\mathrm{d}x}I(x) + P(x)I(x) y &\equiv \frac{\mathrm{d}}{\mathrm{d}x}[I(x) y] \\ \frac{\mathrm{d}y}{\mathrm{d}x}I(x) + P(x)I(x)y &\equiv yI'(x) + I(x)\frac{\mathrm{d}y}{\mathrm{d}x} \text{ (Product Rule)} \\ P(x)I(x) y &\equiv y I'(x) \text{ (Subtracting }\frac{\mathrm{d}y}{\mathrm{d}x}I(x))\\ P(x)I(x) &\equiv I'(x) \text{ (Dividing by }y) \end{align*} $$

This differential equation can be solved as follows.

$$\begin{align*} \frac{I'(x)}{I(x)} &= P(x) \\ \int \frac{I'(x)}{I(x)} \, \mathrm{d}x &= \int P(x) \, \mathrm{d}x \\ \ln{I(x)} &= \int P(x) \, \mathrm{d}x \\ I(x) &= e^{\int P(x) \, \mathrm{d}x} \\
\end{align*} $$

$I(x) = e^{\int P(x) \, \mathrm{d}x}$ is the integrating factor. By multiplying our initial differential equation by $I(x)$, we can express the left-hand side as $\displaystyle \frac{\mathrm{d}}{\mathrm{d}x}[I(x) y]$ and easily integrate both sides to solve.


Example 1: Solve $\displaystyle \frac{\mathrm{d}y}{\mathrm{d}x} + y \tan{x} = \sin{x}$

Let $$\frac{\mathrm{d}y}{\mathrm{d}x} + y \tan{x} = \sin{x} \rightarrow \frac{\mathrm{d}y}{\mathrm{d}x} + P(x)y = Q(x) \tag{1}$$

where $P(x) = \tan{x}$ and $Q(x) = \sin{x}$

Therefore, the integrating factor, $I(x) = e^{\int P(x) \, \mathrm{d}x}$

$$\begin{align*} I(x) &= e^{\int \tan{x} \, \mathrm{d}x} \\ &= e^{\ln|\sec{x}| + C_1} \\ &= e^{C_1} \cdot e^{\ln|\sec{x}|} \\ &= C_2e^{\ln{|\sec{x}|}} \text{ (Let }C_2 = e^{C_1})\\ I(x) &= C_2|\sec{x}| \end{align*} $$

Note, however, that $$|\sec{x}| = \begin{cases} \sec{x}, & \sec{x} > 0 \\ -\sec{x}, & \sec{x} < 0 \end{cases}$$ The modulus sign can just be expressed into a constant $C_3 = \pm 1$ which depends on whether $\sec{x}$ is positive or negative. Hence, let $|\sec{x}| = C_3\sec{x}$.

It follows that $I(x) = C_2C_3\sec{x}$.

Multiplying equation $(1)$ by $I(x)$,

$$\begin{align*} C_2C_3\frac{\mathrm{d}y}{\mathrm{d}x}\sec{x} + C_2C_3y\sec{x}\tan{x} &= C_2C_3\sin{x}\sec{x} \\ \frac{\mathrm{d}y}{\mathrm{d}x}\sec{x} + y\sec{x}\tan{x} &= \sin{x}\sec{x} \text{ (Dividing by }C_2C_3) \\ \frac{\mathrm{d}}{\mathrm{d}x}(y \sec{x}) &= \tan{x} \\ \int \frac{\mathrm{d}}{\mathrm{d}x}(y \sec{x}) \, \mathrm{d}x &= \int \tan{x} \, \mathrm{d}x \\ y \sec{x} &= \ln{|\sec{x}|} + C \\ y &= \cos{x}(\ln|\sec{x}| + C) \end{align*} $$

Notice that we end up cancelling the constant $C_2C_3$ after multiplying equation $(1)$ by the integrating factor. From this, we can deduce that any multiplicative constant applied to the integrating factor can be ignored.

  • For this reason, there is also no need to enclose $\sec{x}$ with the modulus brackets because it is merely a multiplicative constant, as shown above.
  • Furthermore, the constant of integration ends up becoming $e^C$ which can be rewritten as a multiplicative constant as well. Thus, there is no need to include the constant of integration when determining the integrating factor.

Instead, we could've just done

$$\begin{align*} I(x) &= e^{\int \tan{x} \, \mathrm{d}x} \\ &= e^{\ln\sec{x}} \\ I(x) &= \sec{x} \end{align*} $$

and obtained the same result.

Example 2: Solve $\displaystyle \frac{\mathrm{d}y}{\mathrm{d}x} + \frac{2xy}{1 + x^2} = e^x$

Let $$\frac{\mathrm{d}y}{\mathrm{d}x} + \frac{2xy}{1 + x^2} = e^x \rightarrow \frac{\mathrm{d}y}{\mathrm{d}x} + P(x)y = Q(x) \tag{1}$$

where $\displaystyle P(x) = \frac{2x}{1 + x^2}$ and $Q(x) = e^x$

Therefore, the integrating factor, $I(x) = e^{\int P(x) \, \mathrm{d}x}$

$$\begin{align*} I(x) &= e^{\int \frac{2x}{1 + x^2} \, \mathrm{d}x} \\ &= e^{\ln(1 + x^2)} \\ &= 1 + x^2 \end{align*} $$

Multiplying equation $(1)$ by $I(x)$,

$$\begin{align*} \frac{\mathrm{d}y}{\mathrm{d}x}(1+x^2) + \frac{2xy\cancel{(1 + x^2)}}{\cancel{1 + x^2}} &= e^x(1+x^2) \\ \frac{\mathrm{d}y}{\mathrm{d}x}(1+x^2) + 2xy &= e^x + x^2e^x \\ \frac{\mathrm{d}}{\mathrm{d}x}[y(1+x^2)] &= e^x + x^2e^x \\ \int \frac{\mathrm{d}}{\mathrm{d}x}[y(1+x^2)] \, \mathrm{d}x &= \int (e^x + x^2e^x) \, \mathrm{d}x \\ y(1+x^2) &= e^x + \int x^2e^x \, \mathrm{d}x \end{align*} $$

The integral on the right-hand side can be determined using integration by parts.

Let $$I_1 = \int x^2e^x \, \mathrm{d}x \rightarrow \int u \, \mathrm{d}v$$

Let $\displaystyle u = x^2 \implies \mathrm{d}u = 2x \, \mathrm{d}x$

Let $\displaystyle \mathrm{d}v = e^x \, \mathrm{d}x \implies v = e^x$

$$\begin{align*} I_1 &= uv - \int v \, \mathrm{d}u \\ &= x^2e^x - \int 2xe^x \, \mathrm{d}x \end{align*} $$

Let $$I_2 = \int 2xe^x \, \mathrm{d}x \rightarrow \int u \, \mathrm{d}v$$

Let $\displaystyle u = 2x \implies \mathrm{d}u = 2 \, \mathrm{d}x$

Let $\displaystyle \mathrm{d}v = e^x \, \mathrm{d}x \implies v = e^x$

$$\begin{align*} I_2 &= uv - \int v \, \mathrm{d}u \\ &= 2xe^x - \int 2e^x \, \mathrm{d}x \\ I_2 &= 2xe^x - 2e^x \\ \implies I_1 &= x^2e^x - 2xe^x + 2e^x \\ \implies y(1+x^2) &= e^x + x^2e^x - 2xe^x + 2e^x + C \\ y(1+x^2) &= x^2e^x - 2xe^x + 3e^x + C \\ y &= \frac{x^2e^x - 2xe^x + 3e^x + C}{1+x^2} \\ y &= \frac{e^x(x^2 - 2x + 3) + C}{1 + x^2} \end{align*} $$

Example 3: Solve $ (x+1)y' - 3y = (x+1)^5$

Let $$y' - \frac{3y}{x+1} = (x+1)^4 \rightarrow y' + P(x)y = Q(x) \tag{1}$$ where $\displaystyle P(x) = -\frac{3}{x+1}$ and $Q(x) = (x+1)^4$

(Notice, we need to arrange the equation to be in that specific form by dividing by $(x+1)$ and isolating $y'$.)

Therefore, the integrating factor, $I(x) = e^{\int P(x) \, \mathrm{d}x}$

$$\begin{align*} I(x) &= e^{\int \frac{-3}{x+1} \, \mathrm{d}x} \\ &= e^{-3\ln{(x+1)}} \\ &= e^{\ln{(x+1)^{-3}}} \\ &= (x+1)^{-3} \end{align*} $$Multiplying equation $(1)$ by $I(x)$,

$$\begin{align*} y'(x+1)^{-3} - \frac{3y}{(x+1)^4} = x+1 \\ \frac{\mathrm{d}}{\mathrm{d}x}[y(x+1)^{-3}] &= x+1 \\ \int \frac{\mathrm{d}}{\mathrm{d}x}[y(x+1)^{-3}] \, \mathrm{d}x &= \int (x+1) \, \mathrm{d}x \\ y(x+1)^{-3} &= \frac{x^2}{2} + x + C \\ y &= (x+1)^3\left(\frac{x^2}{2} + x + C\right) \end{align*} $$

Exercise 1: Solve the following differential equations.

  1. $\displaystyle x\frac{\mathrm{d}y}{\mathrm{d}x} + 2y = \frac{\sin{x}}{x}$ (Answer: $\displaystyle y = \frac{C - \cos{x}}{x^2}$) (Katy Dobson, University of Leeds)
  2. $\displaystyle \frac{\mathrm{d}y}{\mathrm{d}x} - \frac{y}{x} = -xe^{-x}$ (Answer: $\displaystyle y = x(e^{-x} + C)$) (Katy Dobson, University of Leeds)
  3. $\displaystyle y' + y = \frac{1}{e^{2x} - 5e^x + 4}$ (Answer: $\displaystyle \frac{1}{3e^x}\ln{\left|\frac{e^x-4}{e^x-1}\right|} + Ce^{-x}$) (MATH 123, Drexel University)

Exercise 2: Bonus Questions

  1. By solving the differential equation, show that the equation $y + xy + x^2 = 0$ is a solution of the differential equation $\displaystyle \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{y - x^2}{x(1+x)}$. (Adapted from CAPE Pure Mathematics Unit 2 2015 Paper 2, Caribbean Examinations Council)
  2. Given that the curve with equation $y = f(x)$ passes through the origin and satisfies the relationship $\displaystyle \frac{\mathrm{d}}{\mathrm{d}x}[y(x^2+1)] = x^5 + 2x^3 + x + 3xy$, show that $\displaystyle y = \frac{1}{3}(x^2+1)^2 - \frac{1}{3}(x^2 + 1)^{\frac{1}{2}}$. (MadAsMaths, Dr. Trifon Madas)
  3. Given that the curve with equation $y = f(x)$ such that $\displaystyle f\left(\frac{\pi}{4}\right) = \frac{\pi}{4}$ satisfies the differential equation $\displaystyle \left(\frac{\mathrm{d}y}{\mathrm{d}x} - \sqrt{\tan{x}}\right)\sin{2x} = y$, show that $y = x\sqrt{\tan{x}}$. (MadAsMaths, Dr. Trifon Madas)

About Rahul Kissoon

Loading bio... Read More

Mode

We have a new Instagram Account! Follow us @edukattedotcom.