Back to the on-screen lesson ·

Linear equations and the integrating factor

Writing a first-order linear equation as $y' + p(x)y = q(x)$, multiplying by $e^{\int p}$ so the left side becomes one derivative, and reading the transient and the steady state out of the answer.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to put a first-order linear equation into standard form, build its integrating factor from the coefficient of $y$, recognise the derivative of a product on the left-hand side after multiplying, integrate and divide to get the general solution, split a constant-coefficient answer into its transient and its steady state, and say on which interval the solution is guaranteed to exist.

2. What you already have

You can separate an equation whose right-hand side factors, and you know the product rule. This lesson is what to do when separation fails — when $x$ and $y$ are added rather than multiplied, as in $y' = x + y$ — and the tool is the product rule read backwards.

3. Words for this lesson

TermWhat it means
Linear of first orderAn equation in which the unknown and its derivative each appear once, to the first power.
Standard formThe equation written as $y' + p(x)y = q(x)$, with the coefficient of $y'$ equal to $1$.
Forcing termThe function $q$ on the right-hand side.
HomogeneousThe case $q = 0$: nothing drives the equation from outside.
Integrating factor$\mu(x) = e^{\int p(x)\,dx}$, which turns the left-hand side into the derivative $(\mu y)'$.
TransientThe part of the solution that decays, such as $Ce^{-kx}$ when $p = k$ is a positive constant.
Steady stateWhat is left once the transient has decayed; the value the solution settles at.
Time constantFor $y' + ky = q$, the time $\frac{1}{k}$ over which the transient falls by a factor of $e$.

4. Making the left-hand side a derivative

Put the equation in standard form:

$$y' + p(x)y = q(x).$$

The left-hand side is two terms, and there is no rule for integrating two terms like that. But the product rule says

$$(\mu y)' = \mu y' + \mu' y,$$

which has exactly the shape of the left-hand side multiplied by $\mu$ — provided $\mu' = \mu p$. That is a separable equation for $\mu$, and its solution is

$$\mu(x) = e^{\int p(x)\,dx}.$$

No constant of integration is needed in $\mu$: multiplying $\mu$ by a constant multiplies both sides of the equation by it and changes nothing.

So multiply through by $\mu$, and the equation becomes

$$(\mu y)' = \mu q,$$

one derivative on the left. Integrate once, divide by $\mu$, and the general solution is

$$y = \frac{1}{\mu(x)}\left(\int \mu(x)q(x)\,dx + C\right).$$

The method answers every first-order linear equation, which is a stronger guarantee than separation offers. What it does not answer is anything nonlinear: $y' + y^{2} = x$ has no integrating factor of this kind, because the derivation above used the first power of $y$ in every line.

Another way: picture

The two terms on the left are the two halves of a product rule with one half missing. The factor $\mu$ is the missing half: multiplying by it completes the pattern, and what was a sum of two unrelated pieces becomes the derivative of one thing. It is the same manoeuvre as completing the square, and for the same reason — a shape you can undo is worth more than a shape you can only read.

Another way: steps

  1. Divide until the coefficient of $y'$ is $1$; now read off $p$ and $q$.
  2. Compute $\int p\,dx$ and set $\mu = e^{\int p}$.
  3. Multiply the whole equation by $\mu$; the left side is now $(\mu y)'$, and it is worth differentiating the product once to check.
  4. Integrate both sides, keeping one constant.
  5. Divide by $\mu$, then apply the initial condition.

5. Transient and steady state

When $p$ is a positive constant the whole solution can be read without integrating anything. For $y' + py = q$ with $y(0) = y_{0}$,

$$y = \frac{q}{p} + \left(y_{0} - \frac{q}{p}\right)e^{-px}.$$

The first term is the steady state: the value at which $y' = 0$, found by setting the derivative to zero and solving $py = q$. The second is the transient: it remembers where the solution started and then forgets, because $e^{-px} \to 0$.

Two consequences are worth having by heart. The long-run value does not depend on the initial condition at all — every solution of the same equation ends in the same place. And the time it takes is set by $p$ alone: after a time $1/p$ the transient is down to about $37$ per cent of where it began, which is what an engineer means by the time constant of a system.

If $p$ were negative the same formula would describe a solution running away from the constant rather than towards it, and the word steady would be a lie. The sign of $p$ decides which story the formula is telling.

6. Where the method is put in danger

Not dividing first. In $x^{2}y' + xy = e^{x}$ the coefficient of $y$ is $x$, but $p(x)$ is $1/x$. Reading $p$ off an equation that still has a coefficient in front of $y'$ gives the wrong factor and a wrong answer that looks like a right one.

Forgetting the constant inside the bracket. The constant of integration appears before the division by $\mu$, so it ends up multiplied by $1/\mu$. Writing $y = \frac{1}{\mu}\int \mu q\,dx + C$ instead of $\frac{1}{\mu}\left(\int \mu q\,dx + C\right)$ is a different family of functions and solves nothing.

Losing the interval. Dividing by a coefficient that vanishes somewhere creates a point the solution cannot cross. A solution is a function together with an interval it is a solution on. The existence theorem promises only a neighbourhood, and a formula that blows up at a finite point stops being an answer there — so a solution written without its interval is an answer to a question nobody asked.

Applying it to a nonlinear equation. Every method in this course answers one shape of equation and no other. So the first question is never how do I solve this but what is this — the order, whether it is linear, and which of the standard shapes it already is. An integrating factor applied to a nonlinear equation produces confident nonsense.

7. The method, step by step, and how to check it

Every first-order linear problem is solved by the same five moves, in the same order, and each move has a reason you should be able to say out loud.

  1. Standard form. Divide every term by the coefficient of $y'$, so the equation reads $y' + p(x)y = q(x)$. Read $p$ and $q$ only after this, and note every point where the division put a zero underneath: the solution cannot cross it.
  2. The factor. Integrate $p$ (no constant needed) and exponentiate: $\mu = e^{\int p\,dx}$. A constant $p$ gives an exponential; a $p$ of the form $\frac{k}{x}$ gives the power $x^{k}$.
  3. Multiply and recognise. Multiply both sides by $\mu$. The left side is now $(\mu y)'$; confirm it by differentiating $\mu y$ with the product rule.
  4. Integrate and divide. Integrate both sides once, writing one constant $C$, then divide every term by $\mu$. The constant is divided too.
  5. The condition. Only now substitute the initial condition to find $C$.

How to check an answer. A solution can always be verified, and the check is quicker than the solving: differentiate your $y$, substitute $y$ and $y'$ into the original equation, and confirm both sides agree for every $x$. Then put the initial point in and confirm the starting value. When $p$ is a positive constant there is a third check: as $x$ grows, $y$ must approach $\frac{q}{p}$, the value where $y' = 0$. An answer that fails any of these has a slip in it, and the checks usually say where: a wrong factor fails the first, a constant fitted too early fails the second, and a sign error in the exponent fails the third.

Why no constant in the factor. Any antiderivative of $p$ works. Adding a constant $k$ to $\int p\,dx$ multiplies $\mu$ by $e^{k}$, and that number multiplies both sides of the equation and then divides out again in step 4, so it never reaches the answer. Leaving it out saves writing it twice.

8. In the world: a drug infusion and its steady state

A drug dripped into a vein at a steady $D$ milligrams an hour, and cleared by the liver and kidneys at a rate proportional to the amount present, obeys

$$y' + ky = D,$$

a first-order linear equation with constant coefficients. The integrating factor $e^{kt}$ gives $y = \frac{D}{k} + \left(y_0 - \frac{D}{k}\right)e^{-kt}$.

The two terms answer two clinical questions. Where does it settle? At $\frac{D}{k}$, whatever the starting amount. How fast? The gap from the steady state shrinks by a factor of $e$ every $\frac{1}{k}$ hours, so it falls to a tenth after $\frac{\ln 10}{k}$ hours.

Take $D = 20$ milligrams an hour and $k = 0.25$ per hour, starting from nothing. The steady amount is $\frac{20}{0.25} = 80$ milligrams, and $y = 80\left(1 - e^{-0.25t}\right)$. After $4$ hours $y = 80(1 - e^{-1}) \approx 50.6$ milligrams, and reaching $90\%$ of the steady level takes $\frac{\ln 10}{0.25} \approx 9.2$ hours. That wait is why a doctor often starts with a loading dose: giving $y_0 = 80$ at once makes the bracket $y_0 - \frac{D}{k}$ zero, and the patient is at the steady level from the first minute.

9. In the world: charging a capacitor

A capacitor $C$ charged through a resistor $R$ from a battery of voltage $E$ holds a charge $q$ that obeys $Rq' + \frac{q}{C} = E$. Dividing by $R$ gives standard form, $q' + \frac{1}{RC}q = \frac{E}{R}$, and the same method gives $q = CE\left(1 - e^{-t/RC}\right)$ from an empty start.

The number $RC$ is the circuit's time constant. With $R = 10\,000$ ohms and $C = 100$ microfarads, $RC = 10^{4} \times 10^{-4} = 1$ second. After one time constant the capacitor holds $1 - e^{-1} \approx 63\%$ of its final charge, after three $95\%$, after five $99.3\%$. Engineers treat five time constants as full.

This is how a camera flash times its recharge, how the delay in a windscreen wiper's intermittent setting is set, and how a smoothing filter in a power supply is sized: the designer chooses $R$ and $C$ to make $RC$ the time they need. The equation is the drug infusion again, with charge for drug and $\frac{1}{RC}$ for the clearance rate, which is the point of learning the method once: every first-order linear process with a constant input settles exponentially to its steady state, at a rate its own coefficient sets.

10. The integrating factor is built from the left-hand side only

The commonest wrong instinct is to let the right-hand side into the factor — to look at $y' + 2y = e^{3x}$ and reach for something involving $e^{3x}$. It never enters. The factor is chosen to solve one problem, which is that $\mu y' + \mu p y$ should be the derivative of $\mu y$; that condition is $\mu' = \mu p$, and $q$ appears nowhere in it. The forcing term is not an obstacle to be cleared away but the thing that gets integrated at the end, and an equation with a horrible $q$ has exactly the same integrating factor as the homogeneous equation beside it. The second wrong instinct follows from the first: writing $\mu$ with its own $+C$ in the exponent. That multiplies $\mu$ by a constant, which cancels off both sides, so the extra constant is not merely harmless but invisible — and carrying it makes the algebra look as though two constants are in play when only one ever is.

11. A variable coefficient, where dividing matters

  1. Solve $xy' + 3y = x^{2}$. Divide every term by $x$ to reach standard form.

    $\dfrac{xy'}{x} + \dfrac{3y}{x} = \dfrac{x^{2}}{x} \quad\Rightarrow\quad y' + \dfrac{3}{x}y = x, \quad p = \dfrac{3}{x}$

    Reading $p = 3$ off the original equation would build the wrong factor.

  2. Integrate $p$ and exponentiate.

    $\displaystyle\int \frac{3}{x}\,dx = 3\ln x \quad\Rightarrow\quad \mu = e^{3\ln x} = x^{3}$

    A logarithm in the exponent gives a power.

  3. Multiply both sides by $x^{3}$ and recognise the product rule.

    $$\begin{aligned} x^{3} \cdot y' + x^{3} \cdot \frac{3}{x}y &= x^{3} \cdot x \\ x^{3}y' + 3x^{2}y &= x^{4} \\ \left(x^{3}y\right)' &= x^{4} \end{aligned}$$

    $\left(x^{3}y\right)' = x^{3}y' + 3x^{2}y$, exactly the left side.

  4. Integrate both sides once, then divide both sides by $x^{3}$.

    $x^{3}y = \displaystyle\int x^{4}\,dx = \tfrac{1}{5}x^{5} + C \quad\Rightarrow\quad \dfrac{x^{3}y}{x^{3}} = \dfrac{\tfrac{1}{5}x^{5} + C}{x^{3}} \quad\Rightarrow\quad y = \tfrac{1}{5}x^{2} + Cx^{-3}$

    The constant sits inside the division, so it arrives as $Cx^{-3}$.

  5. Say where the solution lives.

    $x > 0 \quad\text{or}\quad x < 0, \quad\text{never across } x = 0$

    Dividing by $x$ made $0$ a point the solution cannot cross, and $Cx^{-3}$ is unbounded there.

12. A constant coefficient, worked through

  1. Solve $y' + 2y = e^{x}$ with $y(0) = 1$. First check the form and read off $p$ and $q$.

    $y' + 2y = e^{x}: \quad p = 2, \quad q = e^{x}$

    The coefficient of $y'$ is already $1$, so this is standard form.

  2. Build the integrating factor from $p$.

    $\mu = e^{\int 2\,dx} = e^{2x}$

    Integrate $p$ and exponentiate. No constant is needed in $\mu$.

  3. Multiply every term by $e^{2x}$ and recognise the product rule.

    $$\begin{aligned} e^{2x}y' + 2e^{2x}y &= e^{2x}e^{x} = e^{3x} \\ \left(e^{2x}y\right)' &= e^{3x} \end{aligned}$$

    $\left(e^{2x}y\right)' = e^{2x}y' + 2e^{2x}y$, so the left side is one derivative.

  4. Integrate both sides once.

    $e^{2x}y = \tfrac{1}{3}e^{3x} + C$

    One derivative, one integration, one constant.

  5. Divide both sides by $e^{2x}$ to get the general solution.

    $\dfrac{e^{2x}y}{e^{2x}} = \dfrac{\tfrac{1}{3}e^{3x}}{e^{2x}} + \dfrac{C}{e^{2x}} \quad\Rightarrow\quad y = \tfrac{1}{3}e^{x} + Ce^{-2x}$

    The constant is divided too, which is why it arrives multiplied by $e^{-2x}$ and decays.

  6. Apply $y(0) = 1$ to fix the constant.

    $1 = \tfrac{1}{3} + C \;\Rightarrow\; C = \tfrac{2}{3}, \qquad y = \tfrac{1}{3}e^{x} + \tfrac{2}{3}e^{-2x}$

    At $x = 0$ both exponentials equal $1$.

  7. Check by putting the answer back into the equation.

    $y' + 2y = \left(\tfrac{1}{3}e^{x} - \tfrac{4}{3}e^{-2x}\right) + \left(\tfrac{2}{3}e^{x} + \tfrac{4}{3}e^{-2x}\right) = e^{x}$

    The $e^{-2x}$ terms cancel and exactly the forcing term is left, so the solution is right.

13. An initial value problem with a variable coefficient

  1. Solve $xy' + 2y = 4x^{2}$ with $y(1) = 2$, for $x > 0$. Divide every term by $x$.

    $\dfrac{xy'}{x} + \dfrac{2y}{x} = \dfrac{4x^{2}}{x} \quad\Rightarrow\quad y' + \dfrac{2}{x}y = 4x$

    The coefficient of $y'$ must be $1$ before $p$ can be read: here $p = \frac{2}{x}$ and $q = 4x$.

  2. Integrate $p$ and exponentiate to build the factor.

    $\displaystyle\int \frac{2}{x}\,dx = 2\ln x \quad\Rightarrow\quad \mu = e^{2\ln x} = x^{2}$

    For $x > 0$, $\ln x$ is defined and $e^{2\ln x} = \left(e^{\ln x}\right)^{2} = x^{2}$.

  3. Multiply both sides by $x^{2}$ and recognise the product rule.

    $$\begin{aligned} x^{2}y' + 2xy &= 4x^{3} \\ \left(x^{2}y\right)' &= 4x^{3} \end{aligned}$$

    $\left(x^{2}y\right)' = x^{2}y' + 2xy$, exactly the left side.

  4. Integrate both sides with respect to $x$.

    $\displaystyle x^{2}y = \int 4x^{3}\,dx = x^{4} + C$

    The power rule: $\int 4x^{3}\,dx = x^{4}$, plus one constant.

  5. Divide both sides by $x^{2}$.

    $\dfrac{x^{2}y}{x^{2}} = \dfrac{x^{4} + C}{x^{2}} \quad\Rightarrow\quad y = x^{2} + \dfrac{C}{x^{2}}$

    Both terms on the right are divided, so the constant arrives as $\frac{C}{x^{2}}$.

  6. Substitute $x = 1$, $y = 2$ and solve for $C$.

    $2 = 1^{2} + \dfrac{C}{1^{2}} = 1 + C \quad\Rightarrow\quad C = 1, \qquad y = x^{2} + \dfrac{1}{x^{2}}$

    The initial condition is used last, once the constant exists.

  7. Check the answer in the original equation, and state where it holds.

    $xy' + 2y = x\left(2x - \dfrac{2}{x^{3}}\right) + 2\left(x^{2} + \dfrac{1}{x^{2}}\right) = 2x^{2} - \dfrac{2}{x^{2}} + 2x^{2} + \dfrac{2}{x^{2}} = 4x^{2}$

    The equation holds, $y(1) = 2$, and the solution lives on $x > 0$: dividing by $x$ made $0$ a point it cannot cross.

14. Your turn: solve $y' - y = 4$ with $y(0) = 1$

  1. Read off $p$, keeping its sign, and build the factor.

    $p = -1 \quad\Rightarrow\quad \mu = e^{\int (-1)\,dx} = e^{-x}$

    The sign of $p$ goes into the factor unchanged.

  2. Your turn: work this step out. Its working is at the end of the packet.

    Multiply both sides by $e^{-x}$, recognise the product rule, and integrate once.

  3. Your turn: work this step out. Its working is at the end of the packet.

    Divide both sides by $e^{-x}$, then apply $y(0) = 1$.

15. Guided practice

Put the steps of solving $xy' + 5y = x^{4}$ with $y(1) = 5$ into the order they must be done.

Number the steps in order (write the number in the box):

16. Guided practice

Complete the worked solution of $y' + 3y = 21$ with $y(0) = 9$.

  1. The equation is in standard form, with $p = 3$. Integrate $p$ and exponentiate.

    $\displaystyle\int 3\,dx = 3x \quad\Rightarrow\quad \mu = e^{3x}$

    The integrating factor is $e^{\int p\,dx}$, built from the coefficient of $y$ alone.

  2. Multiply both sides of the equation by $e^{3x}$.

    $e^{3x}y' + 3e^{3x}y = 21e^{3x}$

    Multiplying both sides by the same non-zero function keeps the equation equivalent.

  3. Recognise the left side as the derivative of a product.

    $\left(e^{3x}y\right)' = 21e^{3x}$

    The product rule: $\left(e^{3x}y\right)' = e^{3x}y' + 3e^{3x}y$, exactly the left side.

  4. Integrate both sides with respect to $x$, and simplify the fraction.

    $\displaystyle e^{3x}y = \int 21e^{3x}\,dx = \frac{21}{3}e^{3x} + C,$ $\quad \frac{21}{3} =$ a

    $\int e^{3x}\,dx = \frac{1}{3}e^{3x}$, so the coefficient is divided by $3$.

  5. Divide both sides by $e^{3x}$.

    $\dfrac{e^{3x}y}{e^{3x}} = \dfrac{\frac{21}{3}e^{3x} + C}{e^{3x}} \quad\Rightarrow\quad y = \dfrac{21}{3} + Ce^{-3x}$

    Every term on the right is divided, so the constant arrives multiplied by $e^{-3x}$.

  6. Substitute $x = 0$ and $y = 9$, then subtract $\frac{21}{3}$ from both sides.

    $9 = \dfrac{21}{3} + Ce^{0} \quad\Rightarrow\quad C = 9 - \dfrac{21}{3} =$ b

    $e^{0} = 1$, and the initial condition fixes the one constant the integration produced.

  7. Let $x$ grow without bound.

    $e^{-3x} \to 0 \quad\Rightarrow\quad y \to$ s

    Because $3 > 0$ the transient dies away, and the steady state is what is left.

17. Guided practice

Each equation is already in standard form. Match it to its integrating factor.

$\mu = e^{5x}$$\mu = e^{-5x}$$\mu = x^{5}$$\mu = e^{5x^{2}}$
$y' + 5y = \sin x$
$y' - 5y = \cos x$
$y' + \dfrac{5}{x}y = 1$
$y' + 10xy = x$

18. Practice

$y' + 6y = 18$ with $y(0) = 8$. What value does $y$ approach as $x$ grows without bound?

Answer:

19. Practice

A drug is infused into the blood at $6$ milligrams an hour and cleared at a rate $6$ times the amount present, so the amount $y$ after $x$ hours obeys $y' + 6y = 6$. At the start there are $8$ milligrams. Solve $y' + 6y = 6$ with $y(0) = 8$. Write $y$ as a formula in $x$ (type the exponential as e^(...)).

Answer:

20. Practice

The equation $y' + 4y = 6e^{x}$ is multiplied through by $e^{4x}$. What has that achieved?

21. Somewhere new

For $xy' + y = x^{2}$ with $y(4) = 6$, on which interval does the theory guarantee a solution?

This task has no paper form; do it on a device.

22. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

23. Test question

A drug is infused into the blood at $8$ milligrams an hour and cleared at a rate $4$ times the amount present, so the amount $y$ after $x$ hours obeys $y' + 4y = 8$. At the start there are $6$ milligrams. Solve $y' + 4y = 8$ with $y(0) = 6$. Write $y$ as a formula in $x$ (type the exponential as e^(...)).

Answer:

24. What you can do now

You can put an equation in standard form, build and use the integrating factor, and separate the transient from the steady state. Say in your own words why the forcing term plays no part in building the factor.

Working for the steps left to you

14. Your turn: solve $y' - y = 4$ with $y(0) = 1$, step 2

$e^{-x}y' - e^{-x}y = 4e^{-x} \;\Rightarrow\; \left(e^{-x}y\right)' = 4e^{-x} \;\Rightarrow\; e^{-x}y = \displaystyle\int 4e^{-x}\,dx = -4e^{-x} + C$

The integral of $4e^{-x}$ is $-4e^{-x}$.

14. Your turn: solve $y' - y = 4$ with $y(0) = 1$, step 3

$\dfrac{e^{-x}y}{e^{-x}} = \dfrac{-4e^{-x} + C}{e^{-x}} \;\Rightarrow\; y = -4 + Ce^{x}; \qquad 1 = -4 + C \;\Rightarrow\; C = 5, \quad y = 5e^{x} - 4$

Here $p < 0$, so the exponential grows. The value $-4$ is where $y' = 0$, but the solution runs away from it: an equilibrium, not a destination.