DIFFERENTIAL EQUATIONS 04

First-Order Linear Equations

A first-order linear differential equation can be solved systematically using an integrating factor.

The main idea

A first-order linear differential equation has the standard form

\[ \boxed{ \frac{dy}{dx}+P(x)y=Q(x) } \]

The unknown function \(y\) and its first derivative appear only to the first power.

1. Why it is called linear

The equation is linear in \(y\) because it contains terms such as

\[ y \]

and

\[ \frac{dy}{dx}, \]

but not nonlinear expressions such as

\[ y^2, \qquad \sin y, \qquad y\frac{dy}{dx}. \]

For example,

\[ \frac{dy}{dx}+2y=x \]

is linear.

But

\[ \frac{dy}{dx}+y^2=x \]

is not.

2. The integrating factor

For

\[ \frac{dy}{dx}+P(x)y=Q(x), \]

define the integrating factor

\[ \boxed{ \mu(x) = e^{\int P(x)\,dx} } \]

The symbol \(\mu\) is commonly read as “mu”.

3. Why multiply by an integrating factor?

Multiply the entire differential equation by \(\mu(x)\):

\[ \mu\frac{dy}{dx} + \mu P(x)y = \mu Q(x). \]

The integrating factor is chosen so that the left side becomes the derivative of a product:

\[ \boxed{ \frac{d}{dx}\bigl(\mu y\bigr) = \mu\frac{dy}{dx} + \mu' y } \]

So we want

\[ \mu'=\mu P(x). \]

That is exactly what the integrating factor satisfies.

4. Why \(\mu'=P\mu\)

Since

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

differentiate using the chain rule:

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

Therefore,

\[ \boxed{ \mu'=P(x)\mu } \]

5. The equation becomes simpler

After multiplying by the integrating factor,

\[ \mu\frac{dy}{dx} + \mu P(x)y = \mu Q(x). \]

Because

\[ \mu'=P(x)\mu, \]

the left side becomes

\[ \mu\frac{dy}{dx} + \mu' y. \]

By the product rule,

\[ \mu\frac{dy}{dx} + \mu' y = \frac{d}{dx}(\mu y). \]

So the differential equation becomes

\[ \boxed{ \frac{d}{dx}(\mu y) = \mu Q(x) } \]

6. Integrate both sides

Now integrate:

\[ \int \frac{d}{dx}(\mu y)\,dx = \int \mu Q(x)\,dx. \]

Therefore,

\[ \mu y = \int \mu Q(x)\,dx + C. \]

Finally,

\[ \boxed{ y = \frac{1}{\mu(x)} \left[ \int \mu(x)Q(x)\,dx + C \right] } \]

7. Simple example

Solve

\[ \frac{dy}{dx}+2y=4. \]

Here

\[ P(x)=2, \qquad Q(x)=4. \]

The integrating factor is

\[ \mu(x) = e^{\int2\,dx} = e^{2x}. \]

8. Multiply the equation

Multiply everything by \(e^{2x}\):

\[ e^{2x}\frac{dy}{dx} + 2e^{2x}y = 4e^{2x}. \]

The left side is

\[ \frac{d}{dx} \left( e^{2x}y \right). \]

Therefore,

\[ \frac{d}{dx} \left( e^{2x}y \right) = 4e^{2x}. \]

9. Integrate

Integrating gives

\[ e^{2x}y = \int4e^{2x}\,dx+C. \]

Since

\[ \int4e^{2x}\,dx = 2e^{2x}, \]

we obtain

\[ e^{2x}y = 2e^{2x}+C. \]

Divide by \(e^{2x}\):

\[ \boxed{ y=2+Ce^{-2x} } \]

10. Check the solution

Differentiate:

\[ y'= -2Ce^{-2x}. \]

Then

\[ y'+2y = -2Ce^{-2x} + 2(2+Ce^{-2x}). \]

So

\[ y'+2y=4. \]

The solution satisfies the differential equation.

11. Apply an initial condition

Suppose

\[ y(0)=5. \]

Using

\[ y=2+Ce^{-2x}, \]

set \(x=0\):

\[ 5=2+C. \]

Therefore,

\[ C=3. \]

The particular solution is

\[ \boxed{ y=2+3e^{-2x} } \]

12. Example with variable \(P(x)\)

Solve

\[ \frac{dy}{dx} + \frac{1}{x}y = x, \qquad x>0. \]

Here

\[ P(x)=\frac1x. \]

So

\[ \mu(x) = e^{\int1/x\,dx}. \]

Since

\[ \int\frac1x\,dx=\ln x \]

for \(x>0\),

\[ \mu(x)=e^{\ln x}=x. \]

13. Multiply by the integrating factor

Multiply the equation by \(x\):

\[ x\frac{dy}{dx} + y = x^2. \]

The left side is

\[ \frac{d}{dx}(xy). \]

So

\[ \frac{d}{dx}(xy)=x^2. \]

14. Integrate

Integrating gives

\[ xy = \frac{x^3}{3}+C. \]

Therefore,

\[ \boxed{ y = \frac{x^2}{3} + \frac{C}{x} } \]

15. Put the equation into standard form first

Sometimes the equation is not initially written as

\[ \frac{dy}{dx}+P(x)y=Q(x). \]

For example,

\[ 2\frac{dy}{dx}+4y=x. \]

First divide by \(2\):

\[ \frac{dy}{dx}+2y=\frac{x}{2}. \]

Now we can identify

\[ P(x)=2. \]

Only after reaching standard form should the integrating factor be calculated.

16. Linear does not mean constant coefficients

The equation

\[ \frac{dy}{dx}+x^2y=\sin x \]

is still a first-order linear equation.

Here

\[ P(x)=x^2 \]

and

\[ Q(x)=\sin x. \]

The coefficients may depend on \(x\).

17. Homogeneous first-order linear equation

If

\[ Q(x)=0, \]

the equation becomes

\[ \frac{dy}{dx}+P(x)y=0. \]

This is separable:

\[ \frac{1}{y}dy = -P(x)\,dx. \]

So first-order linear and separable methods can overlap for some equations.

18. The deeper reason the method works

The difficulty in

\[ y'+P(x)y=Q(x) \]

is that the left side is not immediately a single derivative.

The integrating factor changes it into one:

\[ \boxed{ y'+Py \quad\xrightarrow{\times\mu}\quad (\mu y)' } \]

The equation then becomes directly integrable.

19. The practical method

\[ \boxed{ 1.\; \text{Write } y'+P(x)y=Q(x) } \] \[ \boxed{ 2.\; \mu(x)=e^{\int P(x)\,dx} } \] \[ \boxed{ 3.\; \text{Multiply the whole equation by }\mu } \] \[ \boxed{ 4.\; \text{Recognise } (\mu y)'=\mu Q } \] \[ \boxed{ 5.\; \text{Integrate} } \] \[ \boxed{ 6.\; \text{Solve for }y } \] \[ \boxed{ 7.\; \text{Apply any initial condition} } \]

20. The central idea

\[ \boxed{ \frac{dy}{dx}+P(x)y=Q(x) } \] \[ \downarrow\;\times\mu(x) \] \[ \boxed{ \frac{d}{dx}[\mu(x)y] = \mu(x)Q(x) } \] \[ \downarrow\;\int \] \[ \boxed{ y(x) } \]

The integrating factor turns a first-order linear equation into a form that can be integrated directly.