---
title: Linear Equations and Integrating Factors
module: First-Order Equations
moduleNumber: 2
lessonNumber: 1
order: 201
summary: >
  A first-order linear equation has the unknown and its derivative to the first
  power only. Multiplying by an integrating factor collapses the left side into a
  single derivative, and one integration gives the general solution in closed
  form. The solution exists wherever the coefficients are continuous, and for a
  constant coefficient it splits into a decaying transient and a steady state set
  by the forcing.
topics: [First-Order Equations]
draft: false
sources:
  - book: Boyce
    ref: "Ch. 2 — First-Order Differential Equations; §2.1 Linear Differential Equations; Method of Integrating Factors"
  - book: Boyce
    ref: "§2.4 Differences Between Linear and Nonlinear Equations (Theorem 2.4.1)"
  - book: Simmons
    ref: "Ch. 2 §10 The Linear Equation of the First Order; §9 Exact Equations and Integrating Factors"
---

A first-order equation $y' = f(t,y)$ is **linear** when $f$ depends on $y$ to the
first power only. Collecting the terms in $y'$ and $y$ on the left, every such
equation can be put in the **standard form**

$$
\frac{\d y}{\d t} + p(t)\,y = g(t),
$$

where $p$ and $g$ are given functions of the independent variable $t$. When the
original equation carries a leading coefficient, $P(t)\,y' + Q(t)\,y = G(t)$,
dividing by $P(t)$ recovers the standard form on any interval where $P(t) \neq 0$,
with $p = Q/P$ and $g = G/P$. This is the one first-order class that a single,
uniform procedure always solves.[^boyce-21] An **integrating factor** does this:
a function $\mu(t)$ chosen so that multiplying the equation by it turns the left
side into the derivative of a product.

## When the left side is already a derivative

Occasionally the left side is a total derivative before any manipulation. For

$$
(4 + t^2)\,\frac{\d y}{\d t} + 2t\,y = 4t,
$$

the product rule gives $\frac{\d}{\d t}\big[(4+t^2)\,y\big] = (4+t^2)\,y' + 2t\,y$,
exactly the left side. The equation collapses to

$$
\frac{\d}{\d t}\big[(4 + t^2)\,y\big] = 4t,
$$

and integrating both sides yields $(4+t^2)\,y = 2t^2 + c$, so
$y = (2t^2 + c)/(4 + t^2)$. The method generalizes this case: given an
equation whose left side is _not_ a derivative, find a multiplier that makes it
one.

## Constructing the integrating factor

Take the constant-coefficient case $y' + a y = g(t)$ first. Multiply by an
undetermined $\mu(t)$:

$$
\mu(t)\,\frac{\d y}{\d t} + a\,\mu(t)\,y = \mu(t)\,g(t).
$$

The left side equals $\frac{\d}{\d t}\big[\mu(t)\,y\big] = \mu\,y' + \mu'\,y$ provided
the coefficient of $y$ matches, that is $\mu'(t) = a\,\mu(t)$. That condition is
itself a differential equation, solved by $\mu(t) = e^{at}$. With this factor the
equation becomes $\frac{\d}{\d t}\big[e^{at} y\big] = e^{at} g(t)$, and one
integration finishes it.

The general variable-coefficient case runs the same way. Multiplying
$y' + p(t)\,y = g(t)$ by $\mu(t)$ and demanding that the left side be
$\frac{\d}{\d t}[\mu y]$ forces

$$
\frac{\d\mu}{\d t} = p(t)\,\mu(t)
\qquad\Longrightarrow\qquad
\mu(t) = \exp\!\left(\int p(t)\,\d t\right).
$$

The arbitrary constant of integration in $\int p\,\d t$ only rescales $\mu$ by a
constant, which cancels out of the final answer, so we drop it and take the
simplest factor. Because $\mu$ is an exponential, it is positive for all $t$,
which justifies dividing by it later.

> **Definition (Integrating factor).** For the linear equation
> $y' + p(t)\,y = g(t)$, the integrating factor is
> $\mu(t) = \exp\!\big(\int p(t)\,\d t\big)$. Multiplying the equation by $\mu$
> makes its left side the exact derivative $\frac{\d}{\d t}\big[\mu(t)\,y\big]$.

$$
% caption: Multiplying by the integrating factor $I = \exp(\int p\,dt)$ recombines
% the two left-hand terms into a single product derivative $\frac{\d}{\d t}(Iy)$,
% after which one integration solves the equation.
\begin{tikzpicture}[>=stealth, font=\footnotesize,
  box/.style={draw, minimum width=44mm, minimum height=12mm, align=center}]
  \definecolor{acc}{HTML}{4A6FA5}
  \node[box] (a) at (0,0) {$\dfrac{dy}{dt} + p\,y = g$};
  \node[box] (b) at (0,-1.7) {multiply by factor $I$};
  \node[box, draw=acc, text=acc] (c) at (0,-3.4) {$\dfrac{d}{dt}(I\,y) = I\,g$};
  \node[box] (d) at (0,-5.1) {integrate to f\/ind $y$};
  \draw[->, black, thick] (a) -- (b);
  \draw[->, black, thick] (b) -- (c);
  \draw[->, black, thick] (c) -- (d);
  \node[anchor=west, black] at (2.6,-2.55) {left side is now};
  \node[anchor=west, black] at (2.6,-2.95) {a total derivative};
  \node[anchor=west, black] at (2.6,-4.25) {integrate both};
  \node[anchor=west, black] at (2.6,-4.65) {sides once};
\end{tikzpicture}
$$

Carrying out the last integration and solving for $y$ gives the general solution
in closed form.

> **Theorem (General solution of the linear equation).** If $p$ and $g$ are
> continuous on an interval $I$, then every solution of $y' + p(t)\,y = g(t)$ on
> $I$ has the form
>
> $$
> y = \frac{1}{\mu(t)}\left(\int_{t_0}^{t} \mu(s)\,g(s)\,\d s + c\right),
> \qquad \mu(t) = \exp\!\left(\int_{t_0}^{t} p(s)\,\d s\right),
> $$
>
> with $c$ an arbitrary constant. Prescribing $y(t_0) = y_0$ fixes $c = y_0$.

The formula involves two integrations: one to build $\mu$, one to recover $y$.
In practice it is cleaner to reconstruct the steps than to memorize the formula,
since the key step is recognizing $\frac{\d}{\d t}[\mu y]$.

## Worked initial value problems

> **Worked example.** Solve $y' + \tfrac{1}{2}y = \tfrac{1}{2}e^{t/3}$ with the
> integral curve through $(0,1)$. Here $p = \tfrac12$, so $\mu(t) = e^{t/2}$.
> Multiplying and recognizing the product derivative,
>
> $$
> \frac{\d}{\d t}\big[e^{t/2} y\big] = \tfrac{1}{2}e^{5t/6},
> \qquad
> e^{t/2} y = \tfrac{3}{5}e^{5t/6} + c,
> \qquad
> y = \tfrac{3}{5}e^{t/3} + c\,e^{-t/2}.
> $$
>
> Setting $t = 0$, $y = 1$ gives $1 = \tfrac35 + c$, so $c = \tfrac25$ and the
> particular solution is $y = \tfrac{3}{5}e^{t/3} + \tfrac{2}{5}e^{-t/2}$. As
> $t \to \infty$ the $e^{-t/2}$ term decays and every solution merges with the
> growing $\tfrac35 e^{t/3}$; the constant $c$ only sets how fast that happens.

$$
% caption: Members of the solution family for different constants c, with the
% one through (0,1) singled out; the exponential term e^{-t/2} decays and the
% curves fan into a common growth.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
  \definecolor{acc}{HTML}{4A6FA5}
  % axes
  \draw[->, black] (-0.2,0) -- (5.4,0) node[right] {$t$};
  \draw[->, black] (0,-1.6) -- (0,3.0) node[above] {$y$};
  % common growth branch 0.6 e^{t/3} sampled, plus and minus decaying terms
  % curve c = +0.9
  \draw[black, thick] plot[domain=0:5, samples=60] (\x, {0.6*exp(\x/3) + 0.9*exp(-\x/2)});
  % curve c = -0.9
  \draw[black, thick] plot[domain=0:5, samples=60] (\x, {0.6*exp(\x/3) - 0.9*exp(-\x/2)});
  % selected curve c = 0.4 through (0,1)
  \draw[acc, very thick] plot[domain=0:5, samples=60] (\x, {0.6*exp(\x/3) + 0.4*exp(-\x/2)});
  \fill[acc] (0,1) circle (2pt);
  \node[anchor=south east] at (0,1.05) {$(0$, $1)$};
  \node[anchor=west] at (3.7,2.4) {selected};
\end{tikzpicture}
$$

> **Worked example.** Solve $t\,y' + 2y = 4t^2$ with $y(1) = 2$. Dividing by $t$
> puts it in standard form $y' + \tfrac{2}{t}y = 4t$, so $p = 2/t$ and
>
> $$
> \mu(t) = \exp\!\left(\int \tfrac{2}{t}\,\d t\right) = e^{2\ln|t|} = t^2.
> $$
>
> Then $\frac{\d}{\d t}[t^2 y] = 4t^3$, giving $t^2 y = t^4 + c$ and, for $t > 0$,
>
> $$
> y = t^2 + \frac{c}{t^2}.
> $$
>
> The initial condition $y(1) = 2$ forces $c = 1$, so $y = t^2 + 1/t^2$ on
> $0 < t < \infty$. The solution blows up as $t \to 0^+$: the coefficient
> $p = 2/t$ is discontinuous at the origin, and the interval of existence stops
> there. Only the special value $c = 0$ (from $y(1) = 1$) gives a solution,
> $y = t^2$, that stays bounded through the origin.

> **Worked example.** Solve $2y' + t y = 2$ with $y(0) = 1$. Standard form is
> $y' + \tfrac{t}{2}y = 1$, so $\mu = e^{t^2/4}$ and
>
> $$
> e^{t^2/4} y = \int_0^t e^{s^2/4}\,\d s + c.
> $$
>
> The integral $\int e^{s^2/4}\,\d s$ has no elementary antiderivative, so the
> answer is left as $y = e^{-t^2/4}\!\int_0^t e^{s^2/4}\,\d s + e^{-t^2/4}$, with
> $c = 1$ from the initial condition. This is the generic situation, not a failure
> of the method. For any fixed $t$ the integral is a number that a
> [numerical integrator](/differential-equations/numerical/euler-and-runge-kutta)
> evaluates to any accuracy.

> **Worked example.** Solve $y' + y = 5\sin(2t)$. The factor is $\mu = e^{t}$, and
> $\frac{\d}{\d t}[e^t y] = 5e^t\sin(2t)$. Integrating the right side by parts
> twice, $\int e^t \sin(2t)\,\d t = \tfrac{1}{5}e^t(\sin 2t - 2\cos 2t)$, so
>
> $$
> y = \sin(2t) - 2\cos(2t) + c\,e^{-t}.
> $$
>
> The transient $c\,e^{-t}$ decays and the solution locks onto the periodic part
> $\sin 2t - 2\cos 2t$, an oscillation of amplitude $\sqrt{5}$ at the forcing
> frequency. A sinusoidal input drives a sinusoidal steady state, and the initial
> condition affects only the fading transient.

The same sinusoidal steady state, now with damping and mass, reappears in the
[forced vibrations](/differential-equations/second-order-linear/mechanical-electrical-vibrations)
of second-order systems.

## Existence and uniqueness for linear equations

The linear case carries a guarantee stronger than anything available for
nonlinear equations, a direct consequence of the explicit solution formula.

> **Theorem (Existence and uniqueness, linear case).** If $p$ and $g$ are
> continuous on an open interval $I = (\alpha, \beta)$ containing $t_0$, then the
> initial value problem $y' + p(t)\,y = g(t)$, $y(t_0) = y_0$ has exactly one
> solution, and that solution exists on the whole interval $I$.

The interval of existence is read off in advance from the coefficients: a
solution runs as far as $p$ and $g$ stay continuous, and singularities can occur
only where $p$ or $g$ is discontinuous. In $t\,y' + 2y = 4t^2$ the coefficient $p = 2/t$ fails
at $t = 0$, and indeed the solution through $t_0 = 1$ lives on $(0, \infty)$ and no
further. This advance prediction is special to linear equations; the
[nonlinear theory](/differential-equations/first-order/existence-uniqueness-euler)
guarantees a solution only on some possibly small interval, and even that
interval usually cannot be found without solving the equation.

$$
% caption: For the linear equation the solution exists across every interval on
% which p and g are continuous; a break in a coefficient marks a wall the
% solution cannot cross.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
  \definecolor{acc}{HTML}{4A6FA5}
  % number line
  \draw[black, thick] (-0.4,0) -- (7.4,0);
  % discontinuity at t = 2.3
  \draw[black, dashed] (2.3,-1.3) -- (2.3,1.3);
  \fill[black] (2.3,0) circle (1.6pt);
  \node[black, anchor=south] at (2.3,0.15) {break in $p$};
  % interval of existence
  \draw[acc, very thick] (2.45,-0.75) -- (7.2,-0.75);
  \fill[black] (4.6,-0.75) circle (2pt);
  \node[anchor=south] at (4.6,-0.68) {$t_0$};
  \node[acc, anchor=north] at (4.8,-0.9) {solution lives here};
  \node[black, anchor=west] at (0.1,1.0) {$p$, $g$ continuous};
\end{tikzpicture}
$$

## Transient and steady state

When $p$ is a positive constant $a$, the general solution splits into two named
pieces. Write $y' + a y = g(t)$; the solution is

$$
y(t) = \underbrace{c\,e^{-at}}_{\text{transient}} + \underbrace{y_p(t)}_{\text{steady state}},
$$

where $y_p$ is any particular solution driven by $g$. The two parts behave
differently as $t$ grows:

- **Transient.** The term $c\,e^{-at}$ carries all the dependence on the initial
  condition and decays to zero. It matters early and vanishes late.
- **Steady state.** The part $y_p(t)$ is what the forcing $g$ sustains. Every
  solution, regardless of $y_0$, converges to it.

For $y' - 2y = 4 - t$ the integrating factor is $e^{-2t}$ and the general solution
is $y = -\tfrac{7}{4} + \tfrac{1}{2}t + c\,e^{2t}$. Here $a = -2 < 0$, so the
"transient" $c\,e^{2t}$ actually grows and the roles invert: the exponential
dominates and solutions diverge, except for the single curve $c = 0$ that follows
the line $y = -\tfrac74 + \tfrac12 t$. The sign of the coefficient decides whether
the exponential part is a decaying transient or a runaway.

$$
% caption: For a decaying coefficient the exponential transient fades and every
% curve settles onto the steady state driven by the forcing term.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
  \definecolor{acc}{HTML}{4A6FA5}
  \draw[->, black] (-0.2,0) -- (5.4,0) node[right] {$t$};
  \draw[->, black] (0,-0.3) -- (0,3.0) node[above] {$y$};
  % steady state line y_p = 1.4
  \draw[acc, very thick] (0,1.4) -- (5.2,1.4);
  \node[acc, anchor=south east] at (5.2,1.4) {steady state $y_p$};
  % transient-plus-steady curves approaching 1.4 from above and below
  \draw[black, thick] plot[domain=0:5, samples=50] (\x, {1.4 + 1.3*exp(-0.9*\x)});
  \draw[black, thick] plot[domain=0:5, samples=50] (\x, {1.4 - 1.1*exp(-0.9*\x)});
  \draw[black, thick] plot[domain=0:5, samples=50] (\x, {1.4 + 0.5*exp(-0.9*\x)});
  \node[black, anchor=west] at (1.4,2.55) {transient decays};
\end{tikzpicture}
$$

## Variation of parameters

The integrating factor is one route to the solution; **variation of parameters**
is another, and it is the one that generalizes to
[higher-order linear equations](/differential-equations/second-order-linear/variation-of-parameters).
The homogeneous equation $y' + p(t)\,y = 0$ has solution
$y = A\exp\!\big(-\!\int p\,\d t\big)$ with $A$ constant. To solve the full equation,
promote the constant to a function, $y = A(t)\exp\!\big(-\!\int p\,\d t\big)$, and
substitute. The terms in $A$ cancel by construction, leaving

$$
A'(t) = g(t)\exp\!\left(\int p\,\d t\right),
$$

which integrates directly and reproduces the general solution formula above. The
name records the idea: the parameter $A$ that was constant for the homogeneous
problem is allowed to vary to absorb the forcing $g$.

## Summary

Every first-order linear equation is solved by the same procedure:

- **Standardize.** Divide by the leading coefficient to reach
  $y' + p(t)\,y = g(t)$.
- **Build the factor.** Compute $\mu = \exp\!\big(\int p\,\d t\big)$.
- **Collapse and integrate.** Multiply through; the left side is
  $\frac{\d}{\d t}[\mu y]$, so $\mu y = \int \mu g\,\d t + c$.
- **Apply data.** Fix $c$ from $y(t_0) = y_0$; the solution exists wherever $p$
  and $g$ are continuous.

[^boyce-21]: **Boyce**, _Elementary Differential Equations_, §2.1 — Linear Differential Equations; Method of Integrating Factors: the standard form $y' + p(t)y = g(t)$, construction of $\mu = \exp\int p\,\d t$, and the general solution formula, following Leibniz's observation that a suitable multiplier makes the equation immediately integrable.
