First Order Linear Differential Equations

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 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 dy dx , not d 2 y dx 2 or d 3 y dx 3 etc

Linear

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

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:

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

dy dx = u dv dx + v du dx

Steps

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

Let's try an example to see:

Example 1: Solve this:

dy dxy x = 1

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

dy dx + P(x)y = Q(x)
where P(x) = − 1 x and Q(x) = 1

So let's follow the steps:

Step 1: Substitute y = uv, and dy dx = u dv dx + v du dx

So this: dy dxy x = 1 Becomes this: u dv dx + v du dxuv x = 1

Step 2: Factor the parts involving v

Factor v: u dv dx + v( du dxu x ) = 1

Step 3: Put the v term equal to zero

v term equal to zero: du dxu x = 0 So: du dx = u x

Step 4: Solve using separation of variables to find u

Separate variables: du u = dx x Put integral sign: ∫ du u = ∫ dx x Integrate: ln(u) = ln(x) + C Make C = ln(k): ln(u) = ln(x) + ln(k) And so: u = kx

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

(Remember v term equals 0 so can be ignored): kx dv dx = 1

Step 6: Solve this to find v

Separate variables: k dv = dx x Put integral sign: ∫ k dv = ∫ dx x Integrate: kv = ln(x) + C Make C = ln(c): kv = ln(x) + ln(c) And so: kv = ln(cx) And so: v = 1 k ln(cx)

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

y = uv: y = kx 1 k ln(cx) Simplify: y = x ln(cx)

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 dy dxy x = 1

Anywhere on any of those curves
the slope minus 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 ( dy dx ) dy dxy x
A 0.6 −0.6 0 0 − −0.6 0.6 = 0 + 1 = 1
B 1.6 0 1 1 − 0 1.6 = 1 − 0 = 1
C 2.5 1 1.4 1.4 − 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:

dy dx3y x = x

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

dy dx + P(x)y = Q(x)
where P(x) = − 3 x and Q(x) = x

So let's follow the steps:

Step 1: Substitute y = uv, and dy dx = u dv dx + v du dx

So this: dy dx3y x = x Becomes this: u dv dx + v du dx3uv x = x

Step 2: Factor the parts involving v

Factor v: u dv dx + v( du dx3u x ) = x

Step 3: Put the v term equal to zero

v term = zero: du dx3u x = 0 So: du dx = 3u x

Step 4: Solve using separation of variables to find u

Separate variables: du u = 3 dx x Put integral sign: ∫ du u = 3 ∫ dx x Integrate: ln(u) = 3 ln(x) + C Make C = −ln(k): ln(u) + ln(k) = 3ln(x) Then: uk = x 3 And so: u = x 3 k

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

(Remember v term equals 0 so can be ignored): ( x 3 k ) dv dx = x

Step 6: Solve this to find v

Separate variables: dv = k x -2 dx Put integral sign: ∫ dv = ∫ k x -2 dx Integrate: v = −k x -1 + D

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

y = uv: y = x 3 k ( −k x -1 + D ) Simplify: y = −x 2 + D k x 3 Replace 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:

dy dx + 2xy= −2x 3

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

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 dy dx = u dv dx + v du dx

So this: dy dx + 2xy= −2x 3 Becomes this: u dv dx + v du dx + 2xuv = −2x 3

Step 2: Factor the parts involving v

Factor v: u dv dx + v( du dx + 2xu ) = −2x 3

Step 3: Put the v term equal to zero

v term = zero: du dx + 2xu = 0

Step 4: Solve using separation of variables to find u

Separate variables: du u = −2x dx Put integral sign: ∫ du u = −2 ∫ x dx Integrate: ln(u) = −x 2 + C Make C = −ln(k): ln(u) + ln(k) = −x 2 Then: uk = e -x 2 And so: u = e -x 2 k

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

(Remember v term equals 0 so can be ignored): ( e -x 2 k ) dv dx = −2x 3

Step 6: Solve this to find v

Separate variables: dv = −2k x 3 e x 2 dx Put integral sign: ∫ dv = ∫ −2k x 3 e x 2 dx Integrate: v = oh no! this is hard!

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:

First pull out k: v = k ∫ −2x 3 e x 2 dx R = −x 2 and S = 2x e x 2 : v = k ∫ (−x 2 )(2xe x 2 ) dx Now integrate by parts: v = kR ∫ S dx − k ∫ R' ( ∫ S dx) dx

Put in R = −x 2 and S = 2x e x 2

And also R' = −2x and ∫ S dx = e x 2

So it becomes: v = −kx 2 ∫ 2x e x 2 dx − k ∫ −2x (e x 2 ) dx Now Integrate: v = −kx 2 e x 2 + k e x 2 + D Simplify: v = ke x 2 (1−x 2 ) + D

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

y = uv: y = e -x 2 k ( ke x 2 (1−x 2 ) + D ) Simplify: y =1 − x 2 + ( D k )e - x 2 Replace D/k with a single constant c: y = 1 − x 2 + c e - x 2

And we get this nice family of curves:


y = 1 − x 2 + c e - x 2 for various values of c