• LOGIN
  • No products in the cart.

MTH61: SOLVING DIFFERENTIAL EQUATIONS 1

This unit is about solving differential equations

SOLVING DIFFERENTIAL EQUATIONS 1

Separation of Variables

Separation of Variables is a special method to solve some Differential Equations

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

dy/dx = 5xy
Example: an equation with the function y and its derivative dydx 

When Can I Use it?

Separation of Variables: dy/dx = 5xy becomes dy/y = 5x dx

Separation of Variables can be used when:

All the y terms (including dy) can be moved to one side of the equation, and

All the x terms (including dx) to the other side.

Method

Three Steps:

  • Step 1 Move all the y terms (including dy) to one side of the equation and all the x terms (including dx) to the other side.
  • Step 2 Integrate one side with respect to y and the other side with respect to x. Don’t forget “+ C” (the constant of integration).
  • Step 3 Simplify

Example: Solve this (k is a constant):

  dydx = ky

Step 1 Separate the variables by moving all the y terms to one side of the equation and all the x terms to the other side:

Multiply both sides by dx: dy = ky dx
Divide both sides by y:dyy = k dx

Step 2 Integrate both sides of the equation separately:

Put the integral sign in front: dyy =  k dx
Integrate left side: ln(y) + C =  k dx
Integrate right side: ln(y) + C = kx + D

C is the constant of integration. And we use D for the other, as it is a different constant.

Step 3 Simplify:

We can roll the two constants into one (a=D−C): ln(y) = kx + a
e(ln(y)) = y , so let’s take exponents on both sides:y = ekx + a
And ekx + a = ekx ea so we get:y = ekx ea
ea is just a constant so we replace it with c:y = cekx

We have solved it:

y = cekx

This is a general type of first order differential equation which turns up in all sorts of unexpected places in real world examples.

We used y and x, but the same method works for other variable names, like this:

rabbits

Example: Rabbits!

The more rabbits you have the more baby rabbits you will get. Then those rabbits grow up and have babies too! The population will grow faster and faster.

The important parts of this are:

  • the population N at any time t
  • the growth rate r
  • the population’s rate of change dNdt

The rate of change at any time equals the growth rate times the population:

dN dt = rN

But hey! This is the same as the equation we just solved! It just has different letters:

  • N instead of y
  • t instead of x
  • r instead of k

So we can jump to a solution:

N = cert

And here is an example, the graph of N = 0.3e2t:

exponential growth
Exponential Growth

There are other equations that follow this pattern such as continuous compound interest.

More Examples

OK, on to some different examples of separating the variables:

Example: Solve this:

dydx = 1y

Step 1 Separate the variables by moving all the y terms to one side of the equation and all the x terms to the other side:

Multiply both sides by dx:dy = (1/y) dx
Multiply both sides by y:y dy = dx

Step 2 Integrate both sides of the equation separately:

Put the integral sign in front: y dy =  dx
Integrate each side: (y2)/2 = x + C

We integrated both sides in the one line.

We also used a shortcut of just one constant of integration C. This is perfectly OK as we could have +D on one, +E on the other and just say that C = E−D.

Step 3 Simplify:

Multiply both sides by 2:y2 = 2(x + C)
Square root of both sides:y = ±√(2(x + C))

Note: This is not the same as y = √(2x) + C, because the C was added before we took the square root. This happens a lot with differential equations. We cannot just add the C at the end of the process. It is added when doing the integration.

We have solved it:

y = ±√(2(x + C))

A harder example:

Example: Solve this:

dydx = 2xy1+x2

Step 1 Separate the variables:

Multiply both sides by dx, divide both sides by y:

1y dy = 2x1+x2dx

Step 2 Integrate both sides of the equation separately:

1y dy = 2x1+x2dx

The left side is a simple logarithm, the right side can be integrated using substitution:

Let u = 1 + x2, so du = 2x dx:1y dy = 1udu
Integrate:ln(y) = ln(u) + C
Then we make C = ln(k):ln(y) = ln(u) + ln(k)
So we can get this:y = uk
Now put u = 1 + x2 back again:y = k(1 + x2)

Step 3 Simplify:

It is already as simple as can be. We have solved it:

y = k(1 + x2)

An even harder example: the famous Verhulst Equation

rabbits

Example: Rabbits Again!

Remember our growth Differential Equation:

dNdt = rN

Well, that growth can’t go on forever as they will soon run out of available food.

A guy called Verhulst included k (the maximum population the food can support) to get:

dNdt = rN(1−N/k)

The Verhulst Equation

Can this be solved?

Yes, with the help of one trick …

Step 1 Separate the variables:

Multiply both sides by dt: dN = rN(1−N/k) dt
Divide both sides by N(1-N/k):1N(1−N/k)dN = r dt

Step 2 Integrate:

1N(1−N/k)dN =  r dt

Hmmm… the left side looks hard to integrate. In fact it can be done with a little trick from Partial Fractions … we rearrange it like this:

We start with this:1N(1−N/k)
Multiply top and bottom by k:kN(k−N)
Now here is the trick, add N and −N to the top:N+k−NN(k−N)
and split it into two fractions:NN(k−N) + k−NN(k−N)
Simplify each fraction:1k−N + 1N

Now it is a lot easier to solve. We can integrate each term separately, like this:

Our full equation is now:1k−NdN + 1NdN =  r dt
Integrate:−ln(k−N) + ln(N) = rt + C

(Why did that become minus ln(k−N)? Because we are integrating with respect to N.)

Step 3 Simplify:

Negative of all terms:ln(k−N) − ln(N) = −rt − C
Combine ln():ln((k−N)/N) = −rt − C
Now take exponents on both sides:(k−N)/N = e−rt−C
Separate the powers of e:(k−N)/N = e−rt e−C
e−C is a constant, we can replace it with A:(k−N)/N = Ae−rt

We are getting close! Just a little more algebra to get N on its own:

Separate the fraction terms:(k/N)−1 = Ae−rt
Add 1 to both sides:k/N = 1 + Ae−rt
Divide both by k:1/N = (1 + Ae−rt)/k
Reciprocal of both sides:N = k/(1 + Ae−rt)

And we have our solution:

N = k1 + Ae−rt

Here is an example, the graph of 401 + 5e−2t

verhulst
It starts rising exponentially,
then flattens out as it reaches k=40

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:

y + dy/dx = 5x
Example: an equation with the function y and its derivative dydx 

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 dydx , not d2ydx2 or d3ydx3 etc

Linear

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

dydx + 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) ):

dydx = udvdx + vdudx

Steps

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

  • 1. Substitute y = uv, and

    dydx = udvdx + vdudx

    into

    dydx + 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:

  dydx − yx = 1

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

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

So let’s follow the steps:

Step 1: Substitute y = uv, and   dydx = u dvdx + v dudx

So this:dydx − yx = 1
Becomes this:udvdx + vdudx − uvx = 1

Step 2: Factor the parts involving v

Factor v:dvdx + v( dudx − ux ) = 1

Step 3: Put the v term equal to zero

v term equal to zero:dudx − ux = 0
So:dudx = ux

Step 4: Solve using separation of variables to find u

Separate variables:duu = dxx
Put integral sign: duu =  dxx
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 dvdx = 1

Step 6: Solve this to find v

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

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

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

And it produces this nice family of curves:

differential equation at 0.2, 0.4, 0.6, 0.8 and 1.0
y = x ln(cx)
 for various values of c

What is the meaning of those curves? They are the solution to the equation   dydx − yx = 1

In other words:

Anywhere on any of those curves
the slope minus yx equals 1

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

differential equation graph and points

Estmating off the graph (to 1 decimal place):

Point x y Slope (dydx) dydx − yx
A 0.6 −0.6 0 0 − −0.60.6 = 0 + 1 = 1
B 1.6 0 1 1 − 01.6 = 1 − 0 = 1
C 2.5 1 1.4 1.4 − 12.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:

  dydx − 3yx = x

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

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

So let’s follow the steps:

Step 1: Substitute y = uv, and   dydx = u dvdx + v dudx

So this:dydx − 3yx = x
Becomes this: u dvdx + v dudx − 3uvx = x

Step 2: Factor the parts involving v

Factor v:dvdx + v( dudx − 3ux ) = x

Step 3: Put the v term equal to zero

v term = zero:dudx − 3ux = 0
So:dudx = 3ux

Step 4: Solve using separation of variables to find u

Separate variables:duu = 3 dxx
Put integral sign: duu = 3  dxx
Integrate:ln(u) = 3 ln(x) + C
Make C = −ln(k):ln(u) + ln(k) = 3ln(x)
Then:uk = x3
And so:u = x3k

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

(Remember v term equals 0 so can be ignored):x3k ) dvdx = 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 = x3k ( −k x−1 + D )
Simplify:y = −x2 + Dk x3
Replace D/k with a single constant c:y = c x− x2

And it produces this nice family of curves:

differential equation at 0.2, 0.4, 0.6 and 0.8
y = c x− x2
 for various values of c

And one more example, this time even harder:

Example 3: Solve this:

  dydx + 2xy= −2x3

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

dydx + P(x)y = Q(x)
where P(x) = 2x and Q(x) = −2x3

So let’s follow the steps:

Step 1: Substitute y = uv, and   dydx = u dvdx + v dudx

So this:dydx + 2xy= −2x3
Becomes this: u dvdx + v dudx + 2xuv = −2x3

Step 2: Factor the parts involving v

Factor v:dvdx + v( dudx + 2xu ) = −2x3

Step 3: Put the v term equal to zero

v term = zero:dudx + 2xu = 0

Step 4: Solve using separation of variables to find u

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

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

(Remember v term equals 0 so can be ignored):e−x2k ) dvdx = −2x3

Step 6: Solve this to find v

Separate variables:dv = −2k x3 ex2 dx
Put integral sign: dv =  −2k x3 ex2 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:

  • R = −x2 and
  • S = 2x ex2

So let’s go:

First pull out k:v = k  −2x3 ex2 dx
R = −x2 and S = 2x ex2:v = k  (−x2)(2xex2) dx
Now integrate by parts:v = kR  S dx − k  R’ ( ∫ S dx) dx

Put in R = −x2 and S = 2x ex2

And also R’ = −2x and  S dx = ex2

So it becomes:v = −kx2  2x ex2 dx − k  −2x (ex2) dx
Now Integrate:v = −kx2 ex2 + k ex2 + D
Simplify:v = kex2 (1−x2) + D

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

y = uv:y = e−x2k ( kex2 (1−x2) + D )
Simplify:y =1 − x2 + ( Dk)ex2
Replace D/k with a single constant c:y = 1 − x2 + c ex2

And we get this nice family of curves:

differential equation
y = 1 − x2 + c ex2 
for various values of c

Assignment

SOLVING DES1 ASSIGNMENT

ASSIGNMENT : SOLVING DES1 ASSIGNMENT MARKS : 30  DURATION : 1 week, 3 days

 

Courses

Featured Downloads