Ma · Mathematics

How to Solve a First-Order ODE with an Integrating Factor

Published By the 9to5Science editorial team

At a glance

  1. 1. Put it in standard form

    Rewrite the equation as y' + P(x)y = Q(x).

  2. 2. Find the factor

    Compute μ(x) = exp(∫P(x) dx) on an interval where P is continuous.

  3. 3. Multiply and integrate

    Multiply through by μ so the left side becomes the derivative of μy, then integrate.

  4. 4. Solve for y

    Divide by μ to obtain the general solution; use an initial condition to determine its constant.

The phrase “integrating factor method” most commonly means the method for solving a first-order linear ordinary differential equation. The equation must first be written in a particular standard form; then a carefully chosen multiplier turns its left side into a product derivative. This article derives the method, works through an example, and notes what to do when an equation does not fit this form.

The standard form

Write the equation as

y′+P(x)y=Q(x),y' + P(x)y = Q(x),

where yy is the unknown function of xx, and PP and QQ are known functions. Assume they are continuous on the interval where you want the solution. The method also works when the unknown is named something other than yy.

The integrating factor is

μ(x)=e∫P(x) dx.\mu(x)=e^{\int P(x)\,dx}.

In computing the factor, the constant of integration can be omitted: multiplying an integrating factor by any nonzero constant gives an equivalent method. The exponential form ensures that μ(x)\mu(x) never vanishes.

Why the method works

Multiply the standard equation by μ(x)\mu(x):

μy′+μPy=μQ.\mu y' + \mu P y = \mu Q.

Since μ′=Pμ\mu'=P\mu, the product rule gives

(μy)′=μy′+μ′y=μy′+Pμy.(\mu y)'=\mu y'+\mu' y=\mu y'+P\mu y.

Thus the equation becomes

(μy)′=μQ.(\mu y)'=\mu Q.

Now integrate with respect to xx and isolate yy:

μy=∫μQ dx+C,y=1μ(∫μQ dx+C).\mu y=\int \mu Q\,dx+C, \qquad y=\frac{1}{\mu}\left(\int \mu Q\,dx+C\right).

This is the general solution on the interval. The integral need not have an elementary antiderivative; in that case it can still be written as a definite integral or left in integral form.

Step-by-step procedure

  1. Rearrange the equation into y′+P(x)y=Q(x)y'+P(x)y=Q(x). If the coefficient of y′y' is not 1, divide the whole equation by it first.
  2. Identify P(x)P(x) as the coefficient of yy after that division.
  3. Calculate μ(x)=e∫P(x) dx\mu(x)=e^{\int P(x)\,dx}.
  4. Multiply every term in the equation by μ(x)\mu(x) and verify that the left side is (μy)′(\mu y)'.
  5. Integrate, include an arbitrary constant, and solve for yy.
  6. If an initial condition is given, substitute it into the general solution to find the constant.

Worked example

Solve

y′+2y=e−x.y'+2y=e^{-x}.

Here P(x)=2P(x)=2 and Q(x)=e−xQ(x)=e^{-x}. The integrating factor is

μ(x)=e∫2 dx=e2x.\mu(x)=e^{\int 2\,dx}=e^{2x}.

Multiply the equation by e2xe^{2x}:

e2xy′+2e2xy=ex.e^{2x}y'+2e^{2x}y=e^x.

The left side is (e2xy)′(e^{2x}y)', so

(e2xy)′=ex.(e^{2x}y)'=e^x.

Integrating both sides gives

e2xy=ex+C.e^{2x}y=e^x+C.

Therefore the general solution is

y=e−x+Ce−2x.y=e^{-x}+Ce^{-2x}.

For example, if y(0)=3y(0)=3, then 3=1+C3=1+C, so C=2C=2 and the particular solution is y=e−x+2e−2xy=e^{-x}+2e^{-2x}. As a check, differentiating the general solution gives y′=−e−x−2Ce−2xy'=-e^{-x}-2Ce^{-2x}; adding 2y2y leaves e−xe^{-x}, as required.

Common mistakes

  • Using the wrong coefficient in the factor. The exponent uses P(x)P(x), the coefficient of yy only after the coefficient of y′y' has been normalized to 1.
  • Forgetting to multiply the entire equation. Every term, including the right side, must be multiplied by μ\mu.
  • Treating the left side as a product derivative without checking. The identity works because μ′=Pμ\mu'=P\mu. If the selected factor does not satisfy this, the product-rule step is invalid.
  • Dropping the constant of integration. The CC is needed for the general solution. Leaving it out gives at most one particular solution.
  • Applying the method directly to a nonlinear equation. An equation such as y′+y2=0y'+y^2=0 is not linear in yy. It may be solvable by another method, but the standard integrating-factor formula does not apply as written.

If your equation looks different

An equation a(x)y′+b(x)y=c(x)a(x)y'+b(x)y=c(x) fits the method wherever a(x)≠0a(x)\ne 0: divide by a(x)a(x) first, so P=b/aP=b/a and Q=c/aQ=c/a. If the equation is written as M(x,y) dx+N(x,y) dy=0M(x,y)\,dx+N(x,y)\,dy=0, it may instead be an exact-equation problem, where “integrating factor” can mean a factor chosen to make the differential form exact. That is a related but different method, and there is no single formula e∫P(x) dxe^{\int P(x)\,dx} for every differential equation.

References

  1. Elementary Differential Equations and Boundary Value Problems — William E. Boyce, Richard C. DiPrima, and Douglas B. Meade

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.