# Solution of First Order Linear Differential Equations

You might like to read about Differential Equations and Separation of Variables first!

A Differential Equation is an equation with a function and one or more of its derivatives:

Example: an equation with the function **y** and its
derivative** \frac{dy}{dx} **

Here we will look at solving a special class of Differential Equations called **First Order Linear Differential Equations**

## First Order

They are "First Order" when there is only ** \frac{dy}{dx} **, not ** \frac{d^{2}y}{dx^{2}} **or ** \frac{d^{3}y}{dx^{3}} ** etc

## Linear

A **first order differential equation** is **linear** when it can be made to look like this:

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

Where **P(x)** and **Q(x)** are functions of x.

To solve it there is a special method:

- We invent two new functions of x, call them
**u**and**v**, and say that**y=uv**. - We then solve to find
**u**, and then find**v**, and tidy up and we are done!

And we also use the derivative of **y=uv** (see Derivative Rules (Product Rule) ):

\frac{dy}{dx} = u\frac{dv}{dx} + v\frac{du}{dx}

## Steps

Here is a step-by-step method for solving them:

- 1. Substitute
**y = uv**, and\frac{dy}{dx} = u\frac{dv}{dx} + v\frac{du}{dx}

into\frac{dy}{dx} + P(x)y = Q(x)

- 2. Factor the parts involving
**v** - 3. Put the
**v**term equal to zero (this gives a differential equation in**u**and**x**which can be solved in the next step) - 4. Solve using separation of variables to find
**u** - 5. Substitute
**u**back into the equation we got at step 2 - 6. Solve that to find
**v** - 7. Finally, substitute
**u**and**v**into**y = uv**to get our solution!

Let's try an example to see:

### Example 1: Solve this:

\frac{dy}{dx} − \frac{y}{x} = 1

First, is this linear? Yes, as it is in the form

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

where **P(x) = −\frac{1}{x} ** and **Q(x) = 1**

So let's follow the steps:

Step 1:
Substitute **y = uv**, and ** \frac{dy}{dx} = u \frac{dv}{dx} + v \frac{du}{dx} **

Step 2: Factor the parts involving **v**

**v**:u \frac{dv}{dx} + v( \frac{du}{dx} − \frac{u}{x} ) = 1

Step 3: Put the **v** term equal to zero

**v**term equal to zero: \frac{du}{dx} − \frac{u}{x} = 0

Step 4: Solve using separation of variables to find **u**

Step 5: Substitute **u** back into the equation at Step 2

**v**term equals 0 so can be ignored):kx \frac{dv}{dx} = 1

Step 6: Solve this to find **v**

Step 7: Substitute into **y = uv** to find the solution to the original equation.

And it produces this nice family of curves:

y = x ln(cx) for various values of **c **

What is the meaning of those curves? They are the solution to the equation ** \frac{dy}{dx} − \frac{y}{x} = 1**

In other words:

**Anywhere on any of those curves
the slope minus \frac{y}{x} equals 1 **

Let's check a few points on the **c=0.6** curve:

Estmating off the graph (to 1 decimal place):

Point | x | y | Slope (\frac{dy}{dx}) | \frac{dy}{dx} − \frac{y}{x} |
---|---|---|---|---|

A | 0.6 | −0.6 | 0 | 0 − \frac{−0.6}{0.6} = 0 + 1 = 1 |

B | 1.6 | 0 | 1 | 1 − \frac{0}{1.6} = 1 − 0 = 1 |

C | 2.5 | 1 | 1.4 | 1.4 − \frac{1}{2.5} = 1.4 − 0.4 = 1 |

Why not test a few points yourself? You can plot the curve here.

Perhaps another example to help you? Maybe a little harder?

### Example 2: Solve this:

\frac{dy}{dx} − \frac{3y}{x} = x

First, is this linear? Yes, as it is in the form

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

where **P(x) = − \frac{3}{x} ** and **Q(x) = x**

So let's follow the steps:

Step 1:
Substitute **y = uv**, and ** \frac{dy}{dx} = u \frac{dv}{dx} + v \frac{du}{dx} **

Step 2: Factor the parts involving **v**

**v**:u \frac{dv}{dx} + v( \frac{du}{dx} − \frac{3u}{x} ) = x

Step 3: Put the **v** term equal to zero

**v**term = zero: \frac{du}{dx} − \frac{3u}{x} = 0

Step 4: Solve using separation of variables to find **u**

^{3}

Step 5: Substitute **u** back into the equation at Step 2

**v**term equals 0 so can be ignored):( \frac{x^{3}}{k} ) \frac{dv}{dx} = x

Step 6: Solve this to find **v**

^{−2}dx

^{−2}dx

^{−1}+ D

Step 7: Substitute into **y = uv** to find the solution to the original equation.

^{−1}+ D )

^{2}+ \frac{D}{k} x

^{3}

**D/k**with a single constant

**c**: y = c x

^{3 }− x

^{2}

And it produces this nice family of curves:

y = c
x^{3 }− x^{2} for various values of **c **

And one more example, this time even ** harder**:

### Example 3: Solve this:

\frac{dy}{dx} + 2xy= −2x^{3}

First, is this linear? Yes, as it is in the form

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

where **P(x) = 2x ** and **Q(x) = −2x ^{3} **

So let's follow the steps:

Step 1:
Substitute **y = uv**, and ** \frac{dy}{dx} = u \frac{dv}{dx} + v \frac{du}{dx} **

^{3}

^{3}

Step 2: Factor the parts involving **v**

**v**:u \frac{dv}{dx} + v( \frac{du}{dx} + 2xu ) = −2x

^{3}

Step 3: Put the **v** term equal to zero

**v**term = zero: \frac{du}{dx} + 2xu = 0

Step 4: Solve using separation of variables to find **u**

**∫**\frac{du}{u} = −2

**∫**x dx

^{2}+ C

^{2}

^{−x2}

Step 5: Substitute **u** back into the equation at Step 2

**v**term equals 0 so can be ignored):( \frac{e^{−x2}}{k} ) \frac{dv}{dx} = −2x

^{3}

Step 6: Solve this to find **v**

^{3}e

^{x2}dx

^{3}e

^{x2}dx

Let's see ... we can integrate by parts... which says:

∫ RS dx = R ∫ S dx − ∫ R' ( ∫ S dx) dx

*(Side Note: we use R and S here, using u and v could be confusing as they already mean something else.)*

Choosing R and S is very important, this is the best choice we found:

- R = −x
^{2}and - S = 2x e
^{x2}

So let's go:

^{3}e

^{x2}dx

**R = −x**and

^{2}**S = 2x e**:v = k ∫ (−x

^{x2}^{2})(2xe

^{x2}) dx

Put in R = −x^{2} and S = 2x e^{x2}

And also R' = −2x and ∫ S dx = e^{x2}

^{2}∫ 2x e

^{x2}dx − k ∫ −2x (e

^{x2}) dx

^{2}e

^{x2}+ k e

^{x2}+ D

^{x2}(1−x

^{2}) + D

Step 7: Substitute into **y = uv** to find the solution to the original equation.

^{x2}(1−x

^{2}) + D )

^{2}+ ( \frac{D}{k})e

^{−}

^{x2}

**D/k**with a single constant

**c**: y = 1 − x

^{2}+ c e

^{−}

^{x2}

And we get this nice family of curves:

y = 1 − x^{2} +
c
e^{−}^{x2} for various values of **c **