NZ Level 8 (NZC) Level 3 (NCEA) [In development]
topic badge
Solve DE's of the form dy/dx = f(x)g(y) using separation of variables
Lesson

 

When can we use it?

The method of separation of variables can be applied to first order differential equations of the form $\frac{dy}{dx}=f(x)g(y)$dydx=f(x)g(y). This includes equations like $\frac{dy}{dx}=xy$dydx=xy$\frac{dy}{dx}=(x^2+1)(y^2+1)$dydx=(x2+1)(y2+1), or even simpler examples like $\frac{dy}{dx}=y$dydx=y where $f(x)$f(x) can be taken as the constant $1$1

To get a handle on the method, we'll look at two ways to solve a simple example first. This will allow us to compare and contrast the strategies involved in solving the differential equation.  

Suppose we wish to solve the differential equation given by $\frac{dy}{dx}=y$dydx=y where $y(0)=C_0$y(0)=C0.

One way to proceed, without knowing anything about separation of variables, is to manipulate the equation so that both sides can be integrated with respect to $y$y as follows: 

$\frac{dy}{dx}$dydx $=$= $y$y
$\therefore\frac{dx}{dy}$dxdy  $=$= $\frac{1}{y}$1y
$\int\frac{dx}{dy}dy$dxdydy $=$= $\int\frac{1}{y}dy$1ydy
$\int dx$dx $=$= $\ln y+c$lny+c
$x-c$xc $=$= $\ln y$lny
$\therefore$   $y$y $=$= $e^{x-c}=e^x\times e^c=Ae^x$exc=ex×ec=Aex

Thus with $y=Ae^x$y=Aex, and with the boundary value $y(0)=C_0$y(0)=C0, we have that $C_0=A$C0=A and so our solution becomes $y=C_0e^x$y=C0ex

This method might seem familiar to you. However a more efficient method (namely the method of separation of variables) has been established that in practise is easier to use and apply. 

The method of separation of variables proceeds differently. It's a method that separates $x$x from $y$y completely, so that integrals with respect to $x$x and to $y$y are developed on each side of the equation before being dealt with separately. 

What follows may seem reasonable at first glance, however, as you may notice, the method contains a step that seems rather mischievous in nature. We shall discuss this fully after the demonstration, but before we do, have a look at the way the problem is solved using the new method:

$\frac{dy}{dx}$dydx $=$= $y$y
$\int\frac{dy}{y}$dyy $=$= $\int1dx$1dx
$\ln y$lny $=$= $x+c$x+c
$\therefore$  $y$y $=$= $e^{x+c}=e^x\times e^c=Ae^x$ex+c=ex×ec=Aex
$\therefore$  $y$y $=$= $C_0e^x$C0ex
     

It appears that in the second line, after dividing both sides by $y$y, we have separated the $dx$dx from the $dy$dy by multiplying both sides of the equation by $dx$dx. At the same time we have taken integrals on both sides.

Whilst our answer agrees with that of the first method, we have some explaining to do.

Recalling that $dx$dx and $dy$dy are infinitesimal quantities, what justifies their separation like this! The expression $\frac{dy}{dx}$dydx has meaning as a ratio of infinitesimals but $dy$dy and $dx$dx on their own are quite meaningless. So why does the method work, even though we appear to be multiplying both sides of the equation by an infinitesimal? 

We need to justify the method carefully, and the justification is quite tricky. We do however need to show it, so we will use the last example to carefully establish the result. For the sake of clarity, we will omit constants of integration and this omission doesn't effect any of the results. 

 

Justification of the second line

Starting with $\frac{dy}{dx}=y$dydx=y we divide both sides by $y$y and then take integrals with respect to $x$x so that:

RESULT 1: $\int\frac{1}{y}\frac{dy}{dx}dx=\int1dx$1ydydxdx=1dx.

 

Now  $\int\frac{1}{y}dy=\ln y$1ydy=lny  so that $\frac{d}{dy}(\ln y)=\frac{1}{y}$ddy(lny)=1y

By the chain rule we know that $\frac{d}{dx}(\ln y)=\frac{d}{dy}(\ln y)\frac{dy}{dx}=\frac{1}{y}\frac{dy}{dx}$ddx(lny)=ddy(lny)dydx=1ydydx.

Thus we have $\frac{1}{y}\frac{dy}{dx}=\frac{d}{dx}(\ln y)$1ydydx=ddx(lny).

Integrating both sides with respect to $x$x, we arrive at:

 

RESULT 2:$\int\frac{1}{y}\frac{dy}{dx}dx=\int\frac{d}{dx}(\ln y)dx=\ln y$1ydydxdx=ddx(lny)dx=lny.

 

Comparing the two results, we see that we have two separate expressions for $\int\frac{1}{y}\frac{dy}{dx}dx$1ydydxdx, so we can immediately conclude that both right hand sides are equal, namely that $\ln y=\int1dx$lny=1dx:

.

Since $\int\frac{1}{y}dy=\ln y$1ydy=lny, we can finally write that:

$\int\frac{1}{y}dy=\int1dx$1ydy=1dx

Look back and see that this final result is the second line of the separation of variables technique. We have demonstrated carefully that what looks like an algebraic "separation of infinitesimals" is in fact a mathematically justified statement following the first line.

The good news is that it is true in general, so that if $\frac{dy}{dx}=f(x)g(y)$dydx=f(x)g(y), then we can immediately write down that $\int\frac{dy}{g(y)}=\int f(x)dx$dyg(y)=f(x)dx

 

examples

We will demonstrate the separation of variables method with three interesting examples:

 

Example 1

Solve the first order differential equation given by $y'+2xy=x$y+2xy=x with the boundary value. $y(0)=\frac{3}{2}$y(0)=32

Putting $y'=\frac{dy}{dx}$y=dydx and rearranging the equation we have:

$y'+2xy$y+2xy $=$= $x$x
$\frac{dy}{dx}$dydx $=$= $x-2xy$x2xy
$\frac{dy}{dx}$dydx $=$= $x(1-2y)$x(12y)
     

This shows that the differential equation is of the form $\frac{dy}{dx}=f(x)\times g(y)$dydx=f(x)×g(y) and is therefore separable. Thus we have that:

$\int\frac{dy}{1-2y}$dy12y $=$= $\int xdx$xdx
$-\frac{1}{2}\int\frac{-2dy}{1-2y}$122dy12y $=$= $\int xdx$xdx
$-\frac{1}{2}\ln(1-2y)$12ln(12y) $=$= $\frac{1}{2}x^2+C_1$12x2+C1
$\ln(1-2y)$ln(12y) $=$= $-x^2+C_2$x2+C2
$\therefore$  $1-2y$12y $=$= $e^{-x^2+C_2}=e^{-x^2}\times e^{C_2}=C_3e^{-x^2}$ex2+C2=ex2×eC2=C3ex2
     

We are almost there, but note carefully how the constant of integration was tidied up as we went through. This sort of simplification is very typical in most problems. 

We continue by rearranging:

$2y$2y $=$= $1-C_3e^{-x^2}$1C3ex2
$\therefore$  $y$y $=$= $\frac{1}{2}+C_4e^{-x^2}$12+C4ex2
     

Hence we could simply express the solution as $y=\frac{1}{2}+Ce^{-x^2}$y=12+Cex2.

We could also check our solution by directly differentiating the result:

Hence:  

$\frac{dy}{dx}$dydx $=$= $-2x\times Ce^{-x^2}$2x×Cex2
  $=$= $-2x(y-\frac{1}{2})$2x(y12)
  $=$= $x-2xy$x2xy
$\therefore$  $y'+2xy$y+2xy $=$= $x$x
     

Now since $y(0)=\frac{3}{2}$y(0)=32, we have on substitution that $\frac{3}{2}=\frac{1}{2}+Ce^0$32=12+Ce0, and hence we have $C=1$C=1. The particular solution is given by $y=\frac{1}{2}+e^{-x^2}$y=12+ex2 shown graphically here: 

The solution function is related to the normal curve used in statistics. This graph peaks at $(0,1.5)$(0,1.5) and becomes asymptotic to $y=1$y=1 as $x\rightarrow\pm\infty$x±.

 

Example 2

Solve the differential equation $\frac{dy}{dx}=3x^2y$dydx=3x2y

Without a boundary value, we cannot determine the constant of integation. We proceed as follows: 

$\frac{dy}{dx}$dydx $=$= $3x^2y$3x2y
$\int\frac{dy}{y}$dyy $=$= $\int3x^2dx$3x2dx
$\ln y$lny $=$= $x^3+C$x3+C
$y$y $=$= $$
$\therefore$  $y$y $=$= $Ae^{x^3}$Aex3
     

Note that in this example, $f(x)=3x^2$f(x)=3x2 and the solution became $y=Ae^{x^3}$y=Aex3. It is not hard to see that the differential equation given by $\frac{dy}{dx}=nx^{n-1}y$dydx=nxn1y is given by $y=Ae^{x^n}$y=Aexn

Example 3

Solve the differential equation given by $\frac{dy}{dx}=4y(1-y)$dydx=4y(1y), with boundary value $y(0)=\frac{1}{2}$y(0)=12.

Using separation of variables, we have:

$\frac{dy}{dx}$dydx $=$= $4y(1-y)$4y(1y)
$\int\frac{dy}{y(1-y)}$dyy(1y) $=$= $\int4dx$4dx
     

Now the integrand on the left hand side needs to be split up into the sum of two separate fractions. We can do this by setting $\frac{1}{y(1-y)}=\frac{A}{y}+\frac{B}{1-y}$1y(1y)=Ay+B1y and solving for $A$A and $B$B.

$\frac{1}{y(1-y)}$1y(1y) $=$= $\frac{A}{y}+\frac{B}{1-y}$Ay+B1y
$\therefore$  $1$1 $=$= $A(1-y)+By$A(1y)+By
     

Putting $y=1$y=1 shows $B=1$B=1. Putting $y=0$y=0 shows $A=1$A=1. Thus $\frac{1}{y(1-y)}=\frac{1}{y}+\frac{1}{1-y}$1y(1y)=1y+11y

Continuing with our integration, we now have:

$\int\frac{1}{y}+\frac{1}{1-y}dy$1y+11ydy $=$= $\int4dx$4dx
$\ln y-\ln(1-y)$lnyln(1y) $=$= $4x+C$4x+C
$\ln(\frac{y}{1-y})$ln(y1y) $=$= $4x+C$4x+C
$\frac{y}{1-y}$y1y $=$= $e^{4x+C}=Ae^{4x}$e4x+C=Ae4x
     

For clarity, we have avoided subscripts with the constant of integration. 

Continuing, we have:

$y$y $=$= $Ae^{4x}-yAe^{4x}$Ae4xyAe4x
$y+yAe^{4x}$y+yAe4x $=$= $Ae^{4x}$Ae4x
$y(1+Ae^{4x})$y(1+Ae4x) $=$= $Ae^{4x}$Ae4x
$\therefore$  $y$y $=$= $\frac{Ae^{4x}}{1+Ae^{4x}}$Ae4x1+Ae4x
     

Since $y(0)=\frac{1}{2}$y(0)=12, we have that $\frac{1}{2}=\frac{A}{1+A}$12=A1+A and thus $A=1$A=1.

Hence our specific solution becomes $y=\frac{e^{4x}}{1+e^{4x}}$y=e4x1+e4x and the graph becomes:

We can also put our solution equation into alternative form by dividing top and bottom by $e^{4x}$e4x so that $y=\frac{e^{4x}}{1+e^{4x}}$y=e4x1+e4x becomes $y=\frac{1}{1+e^{-4x}}$y=11+e4x

This is a particular case of the logistic growth curve, often referred to as the Sigmoid or S curve, utilised in the study of epidemics and learning theory. It has the more general form given by $y=\frac{L}{1+e^{-k(x-x_0)}}$y=L1+ek(xx0) where $L$L, $k$k and $x_0$x0 are transformation constants that can be chosen to have the curve align as necessary to become useful for specific applications.

We could for example transform this basic logistic curve to one that has its $x$x axis as a time period and its $y$y axis as a certain population's influenza infection rate. The shape of the curve is telling, because, in the case of infections, the rate of infection begins slowly but reaches a maximum midway through the period, and then slows toward saturation after that.

The growth of a contained population behaves similarly. At first the growth might appear exponential, but as the room to grow becomes restricted, the growth rate slows. 

 

   

Outcomes

M8-12

Form differential equations and interpret the solutions

91579

Apply integration methods in solving problems

What is Mathspace

About Mathspace