Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 39 ยท First-order ODEs

Linear First-order Equations and Integrating Factors

Solve y' + p(t)y = g(t) with an integrating factor. Learn the derivation, transient versus steady-state parts, and apply it to circuits and mixing, checked in Python.

The linear first-order equation in standard form is

y' + p(t)*y = g(t).

It is the workhorse of applied mathematics: RC circuits, mixing problems with changing volume, drug concentration with a continuing infusion, and cooling in a changing environment are all of this type. Unlike separable equations, the method always works (given integrals you can compute), and the solution has a clean structure that previews everything in chapter 3.

The trick: make the left side a derivative

Multiply the equation by a function mu(t) chosen so that the left side becomes (mu*y)'. By the product rule (mu*y)' = mu*y' + mu'*y, so we need mu' = p(t)*mu. That is a separable equation for mu, solved by

mu(t) = e**(integral of p(t) dt).

This mu is the integrating factor. Then (mu*y)' = mu*g, so mu*y = integral of mu*g dt + C, and

y = (1/mu) * ( integral of mu(t)*g(t) dt + C ).

Worked example

Solve y' + 2*y = e**(-t). Here p = 2, so mu = e**(2*t). Multiply: (e**(2*t)*y)' = e**(2*t)*e**(-t) = e**t. Integrate: e**(2*t)*y = e**t + C. Divide: y = e**(-t) + C*e**(-2*t).

Python Integrating factor step by step

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Always put the equation in standard form first

The coefficient of y' must be 1. For t*y' + 3*y = t**2 (valid for t > 0), divide by t: y' + (3/t)*y = t. Now p = 3/t, mu = e**(3*ln t) = t**3, so (t**3*y)' = t**4, giving t**3*y = t**5/5 + C and y = t**2/5 + C/t**3. Forgetting to divide by t first is the single most common error.

Note also the interval: the equation was divided by t, so the solution lives on t > 0 or on t < 0 separately, and the constant C may differ on each interval.

Structure of the solution: transient plus steady state

Look at y = e**(-t) + C*e**(-2*t) again. The term C*e**(-2*t) carries the initial condition and dies away: the transient. The other term persists and follows the forcing: the steady-state (or particular) part. In general

y = y_particular + C * y_homogeneous,

where y_h = e**(-integral of p) solves the homogeneous equation y' + p*y = 0. This decomposition, homogeneous plus one particular solution, is the central theme of linear theory and returns for second-order equations.

Python Transient dies, steady state remains

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

All three runs merge onto the same curve: the initial condition is forgotten at the rate e**(-2*t).

Application: the RC circuit

A resistor R and capacitor C in series with source voltage E(t) give R*C*dq/dt + q = C*E(t), i.e. q' + q/(R*C) = E/R. For a constant source E, the integrating factor is e**(t/(R*C)) and the capacitor charge approaches C*E with time constant tau = R*C. After one time constant the transient has dropped to 1/e (about 37%), after five to under 1%.

Python Charging a capacitor

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Varying volume mixing

A tank starts with 100 L of pure water. Brine at 0.5 kg/L flows in at 3 L/min and the mixture leaves at 2 L/min, so volume grows as V = 100 + t. With x(t) kg of salt: x' = 1.5 - 2*x/(100 + t), or x' + (2/(100 + t))*x = 1.5. Here mu = (100 + t)**2, and (mu*x)' = 1.5*(100 + t)**2 gives x = 0.5*(100 + t) - 0.5*10**6/(100 + t)**2... check: at t = 0, 50 - 50 = 0.

When it fails or when to prefer another method

  • If the equation is also separable (like y' = k*y), either method works.
  • If y appears nonlinearly, try substitutions; the Bernoulli equation turns into a linear one.
  • If you cannot evaluate integral of mu*g, leave it as an integral or use numerical methods.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the integrating factor for y' + (3/t) y = t, t > 0?

    mu = exp(integral of 3/t dt) = exp(3 ln t) = t**3.
  2. 2. Before applying the integrating factor to ty' + 3y = t**2 you must

    The method needs the standard form y' + p(t) y = g(t) with leading coefficient 1.
  3. 3. In the general solution of a linear first-order equation, the transient part is

    The term C*y_h carries the initial condition and typically decays; the particular solution follows the forcing.
  4. 4. An RC circuit with constant source has time constant

    tau = R*C is the time for the transient to fall to 1/e of its initial size.

Summary

  • Standard form y' + p(t) y = g(t); integrating factor mu = exp(integral p dt).
  • Then (mu*y)' = mu*g, so y = (1/mu)*(integral of mu*g + C).
  • The solution is a particular solution plus C times the homogeneous solution.
  • The homogeneous part is the transient; it fades while the forced response persists.
  • Circuits and mixing tanks are standard applications.

Next: Exact Equations