girgit.org

Differential Equations

Linear equations and the integrating factor

The big ideaA linear equation \( \frac{dy}{dx} + Py = Q \) is solved by multiplying through by the integrating factor \( e^{\int P\,dx} \), which turns the left side into the derivative of a single product, \( \frac{d}{dx}\left(y \cdot \text{I.F.}\right) \).

In simple words

Some equations come in an untidy shape: a bit of the rate here, a bit of the amount there, and you cannot pull them apart. But if you multiply the whole thing by just the right helper, the untidy left side snaps together into "the rate of change of one thing". And when you know the rate of change of one thing, you just integrate to get the thing back. The whole trick is finding that helper, and there is a formula for it.

What a linear equation looks like

A first order linear differential equation has the form

\[ \frac{dy}{dx} + Py = Q, \]

where P and Q are constants or functions of x only. "Linear" means y and y′ appear only to the first power, never multiplied together, and never inside sin, log or a root. It does not mean the graph is a straight line.

EquationLinear?Why
\( \frac{dy}{dx} + 3y = x \)yesP = 3, Q = x
\( \frac{dy}{dx} + \frac{y}{x} = \cos x \)yes\( P = \frac{1}{x} \), Q = cos x
\( x\frac{dy}{dx} - 2y = x^3 \)yes, after dividing by x\( P = -\frac{2}{x} \), \( Q = x^2 \)
\( \frac{dy}{dx} + y^2 = x \)noy is squared
\( y\frac{dy}{dx} + x = 0 \)noy multiplies y′
\( \frac{dy}{dx} + \sin y = x \)noy is inside sine

Always make the coefficient of \( \frac{dy}{dx} \) equal to 1 before you read off P and Q.

Where the integrating factor comes from

Multiply \( \frac{dy}{dx} + Py = Q \) by some function g(x):

\[ g\frac{dy}{dx} + Pg\,y = Qg. \]

We want the left side to be \( \frac{d}{dx}(y\,g) = g\frac{dy}{dx} + y\,g' \), by the product rule. Comparing, we need \( g' = Pg \), that is \( \frac{g'}{g} = P \). Integrate: \( \log g = \int P\,dx \), so

\[ g(x) = e^{\int P\,dx}. \]

This g is the integrating factor (I.F.). With it, the equation becomes \( \frac{d}{dx}(y \cdot \text{I.F.}) = Q \cdot \text{I.F.} \), and integrating both sides gives the solution.

The recipe

StepWhat to doExample: \( \frac{dy}{dx} + 2y = 6e^x \)
1Write as \( \frac{dy}{dx} + Py = Q \).P = 2, \( Q = 6e^x \)
2Find I.F. \( = e^{\int P\,dx} \) (no constant needed).\( e^{\int 2\,dx} = e^{2x} \)
3Write \( y \cdot \text{I.F.} = \int Q \cdot \text{I.F.}\,dx + C \).\( ye^{2x} = \int 6e^{3x}\,dx + C \)
4Integrate the right side.\( ye^{2x} = 2e^{3x} + C \)
5Divide by the I.F.\( y = 2e^x + Ce^{-2x} \)

Check: \( y' = 2e^x - 2Ce^{-2x} \), so \( y' + 2y = 2e^x - 2Ce^{-2x} + 4e^x + 2Ce^{-2x} = 6e^x \). It works for every C.

Integrating factors you will meet often

Use \( e^{\log f(x)} = f(x) \): the exponential and the log cancel.

P\( \int P\,dx \)I.F.
\( \frac{1}{x} \)\( \log x \)x
\( \frac{2}{x} \)\( 2\log x = \log x^2 \)\( x^2 \)
\( -\frac{1}{x} \)\( -\log x \)\( \frac{1}{x} \)
\( \tan x \)\( \log\sec x \)\( \sec x \)
\( \cot x \)\( \log\sin x \)\( \sin x \)
\( \frac{2x}{1 + x^2} \)\( \log(1 + x^2) \)\( 1 + x^2 \)
\( -x \)\( -\frac{x^2}{2} \)\( e^{-x^2/2} \)

(Strictly, \( \int \frac{dx}{x} = \log|x| \); on an interval where x > 0 we drop the modulus, as is usual for an I.F.)

Practise: read off P, then the integrating factor.

Worked example: divide first

Solve \( x\frac{dy}{dx} + y = x^3 \) (x > 0).

  1. Divide by x: \( \frac{dy}{dx} + \frac{1}{x}y = x^2 \). So \( P = \frac{1}{x} \), \( Q = x^2 \).
  2. I.F. \( = e^{\log x} = x \).
  3. \( y \cdot x = \int x^2 \cdot x\,dx + C = \frac{x^4}{4} + C \).
  4. Divide by x: \( y = \frac{x^3}{4} + \frac{C}{x} \).

Guess first: where does the C go?

You have reached \( xy = \frac{x^4}{4} \) and need to add the constant. Guess: is the answer \( y = \frac{x^3}{4} + C \)?

See what happens
No. The constant belongs to the integral, so it must be added before dividing by the I.F.: \( xy = \frac{x^4}{4} + C \), giving \( y = \frac{x^3}{4} + \frac{C}{x} \). Try \( y = \frac{x^3}{4} + C \) in the equation: \( xy' + y = \frac{3x^3}{4} + \frac{x^3}{4} + C = x^3 + C \), which is not \( x^3 \) unless C = 0. The C gets divided by the I.F. too.

Try it: put each candidate back into the equation and see which one really works.

Words to know

Linear differential equation
\( \frac{dy}{dx} + Py = Q \), with P and Q depending on x only.
Integrating factor (I.F.)
\( e^{\int P\,dx} \): the multiplier that makes the left side \( \frac{d}{dx}(y \cdot \text{I.F.}) \).
Standard form
The equation with the coefficient of \( \frac{dy}{dx} \) made 1.
Product rule
\( \frac{d}{dx}(uv) = u'v + uv' \): the reason the I.F. works.

What is the integrating factor of \( \frac{dy}{dx} - \frac{3}{x}y = x^2 \) (x > 0)?

  1. \( x^3 \)
  2. \( \frac{1}{x^3} \)
  3. \( e^{x^3/3} \)

Which equation is linear in y?

  1. \( (1 + x^2)\frac{dy}{dx} + 2xy = 1 \)
  2. \( \frac{dy}{dx} + xy^2 = 1 \)
  3. \( y\frac{dy}{dx} = x + 1 \)

Solve \( \frac{dy}{dx} + y = 3 \).

  1. \( y = 3 + C \)
  2. \( y = 3 + Ce^{-x} \)
  3. \( y = 3e^x + C \)