Linear Differential Equations

Solve first-order linear equations with integrating factors.

First-order linear equations are another important solvable family. They may not separate easily, but they have a reliable method called an integrating factor.

Learning objectives

After this lesson you should be able to:

  • recognize standard linear form;
  • identify p(x) and q(x);
  • compute the integrating factor;
  • multiply the whole equation by the integrating factor;
  • rewrite the left side as a product derivative;
  • solve and apply initial conditions;
  • interpret proportional feedback and forcing terms.

Standard form

A first-order linear differential equation has the form

dy/dx + p(x)y = q(x)

The term p(x)y often represents feedback, decay, growth, resistance, or a proportional response to the current state. The term q(x) is often called a forcing or input term.

WarningPut the equation in standard form first

If the equation starts as

2 dy/dx + 6y = x

divide everything by 2 before identifying p(x) and q(x):

dy/dx + 3y = x/2

The integrating factor

The integrating factor is

mu(x) = e^(∫ p(x) dx)

It is chosen so that after multiplying the equation by mu(x), the left side becomes

d/dx [mu(x)y]

That is the product rule working backward.

Workflow

  1. Put the equation in the form y' + p(x)y = q(x).
  2. Compute mu(x)=e^(∫p(x)dx).
  3. Multiply every term by mu(x).
  4. Rewrite the left side as (mu y)'.
  5. Integrate both sides.
  6. Divide by mu(x) to solve for y.
  7. Use the initial condition if given.

Worked example 1: constant coefficient

Solve

dy/dx + 2y = 6

Here p(x)=2, so

mu(x)=e^(∫2 dx)=e^(2x)

Multiply the equation by e^(2x):

e^(2x)y' + 2e^(2x)y = 6e^(2x)

The left side is a product derivative:

d/dx [e^(2x)y] = 6e^(2x)

Integrate:

e^(2x)y = 3e^(2x) + C

Divide by e^(2x):

y = 3 + Ce^(-2x)

The solution approaches 3 as x increases if C is finite.

Worked example 2: variable coefficient

Solve for x > 0:

dy/dx + (1/x)y = x

Here p(x)=1/x, so

mu(x)=e^(∫1/x dx)=e^(ln x)=x

Multiply by x:

x y' + y = x^2

The left side is (xy)', so

(xy)' = x^2

Integrate:

xy = x^3/3 + C

Divide by x:

y = x^2/3 + C/x

The restriction x > 0 matters because ln x appeared during the process.

Common pitfalls

  • Using q(x) instead of p(x) in the integrating factor.
  • Forgetting to divide into standard form first.
  • Multiplying only part of the equation by the integrating factor.
  • Not recognizing the product derivative.
  • Dropping the constant after integration.
  • Ignoring domain restrictions such as x > 0.

Practice

  1. Identify p(x) and q(x) in y' + 5y = sin(x).

  2. Put 3y' + 6y = x into standard form.

  3. Find the integrating factor for y' - 4y = x^2.

  4. Explain why the left side becomes a product derivative after multiplying by the integrating factor.

  1. p(x)=5, q(x)=sin(x).
  2. Divide by 3: y' + 2y = x/3.
  3. p(x)=-4, so mu(x)=e^(-4x).
  4. The integrating factor is chosen so that the product rule gives exactly mu y' + mu p(x)y.

Subtopic guided practice and checkpoints

The integrating-factor method is reliable when you follow the same order every time. Most mistakes happen before the integration: wrong standard form, wrong p(x), or multiplying only part of the equation.

Lab 1: put the equation in standard form

Guess first. In 4y' + 8y = 12x, is p(x) equal to 8 or 2?

Guided exercise.

First divide every term by 4:

4y' + 8y = 12x
y' + 2y = 3x

Now compare with y' + p(x)y = q(x):

p(x) = 2
q(x) = 3x

Checkpoint. Put 3y' - 6y = x^2 in standard form. Identify p(x) and q(x).

Lab 2: compute the integrating factor

Guess first. For y' - 5y = x, should the exponent in the integrating factor be 5x or -5x?

Guided exercise.

p(x) = -5
mu(x) = e^(∫p(x) dx)
      = e^(∫-5 dx)
      = e^(-5x)

The sign comes from the coefficient of y in standard form.

Checkpoint. Find the integrating factor for y' + (2/x)y = x, assuming x > 0.

Lab 3: use the product derivative

Guess first. After multiplying y' + 2y = 6 by e^{2x}, what product should appear on the left?

Guided exercise.

y' + 2y = 6
mu = e^(2x)
e^(2x)y' + 2e^(2x)y = 6e^(2x)

The left side is exactly the derivative of e^{2x}y:

d/dx[e^(2x)y] = e^(2x)y' + 2e^(2x)y

Checkpoint. For y' - 3y = 9, multiply by the integrating factor and write the left side as a product derivative.

Lab 4: integrate, divide, and use an initial condition

Guess first. If (e^{2x}y)' = 6e^{2x}, what do you do next?

Guided exercise.

(e^(2x)y)' = 6e^(2x)
e^(2x)y = ∫6e^(2x) dx
e^(2x)y = 3e^(2x) + C
y = 3 + Ce^(-2x)

If y(0)=5, then:

5 = 3 + C
C = 2

The particular solution is y = 3 + 2e^{-2x}.

Checkpoint. Solve y' + y = 4, y(0)=1. Show the integrating factor, the product derivative, and the value of C.

Linear equation checkpoint

Using this lesson with edumath and SymPy

SymPy’s dsolve can solve first-order linear equations.

import sympy as sp

x = sp.Symbol("x")
y = sp.Function("y")
ode = sp.Eq(sp.diff(y(x), x) + 2 * y(x), 6)
sp.dsolve(ode)

\(\displaystyle y{\left(x \right)} = C_{1} e^{- 2 x} + 3\)

Use edumath to generate integrating-factor practice.

from edumath.differential_equations import linear_integrating_factor_exercise

exercise = linear_integrating_factor_exercise(seed=3)
exercise.prompt, exercise.expected
('Find the integrating factor for dy/dx + 2y = x.', exp(2*x))