# Separable Differential Equations

## Introduction

Differential Equations are equations involving a function and one or more of its derivatives.

For example, the differential equation below involves the function $y$ and its first derivative $\dfrac{dy}{dx}$.

Let's consider an important real-world problem that probably won't make it into your calculus text book:

A plague of feral caterpillars has started to attack the cabbages in Gus the snail's garden. Gus observes that the cabbage leaves are being eaten at the rate

$\dfrac{d \text{cabbage}}{dt} = 5t \cdot \text{cabbage}$,
where $t$ is the time in days after the initial infestation. He knows that $6$ cabbage leaves were eaten during the initial infestation, and wants to know how many cabbage leaves will be eaten on the first day after the infestation.
Gus has written down a separable differential equation. This means that we can split it up to pull all the parts of the equation involving $\text{cabbage}$ onto one side of the equation, and the parts of the equation involving $t$ onto the other side of the equation:
$\dfrac{1}{\text{cabbage}}\; d \text{cabbage} = 5t \; dt$.
To work out how many cabbage leaves will be eaten on day $1$, he needs to solve his differential equation and plug in $t= 1$. But how can he solve the equation? Separable differentiable equations are one of the easiest types of differential equations to solve. We solve them using a method called separation of variables. It only works for separable differential equations like this one.

## Separation of Variables

Solving differential functions involves finding a single function, or a collection of functions that satisfy the equation.

Separable differential equations are one class of differential equations that can be easily solved. We use the technique called separation of variables to solve them.

For example, the differential equation

$\dfrac{dy}{dx} = 6x^2 y$
is a separable differential equation:

You can solve a differential equation using separation of variables when the equation is separable

That is, when you can move all the terms in $y$ (including $dy$) to one side of the equation, and

all the terms in $x$ (including $dx$) to the other.

### Steps in the Method

The method of separation of variables involves three steps:

1. Move all the terms in $y$, including $dy$, to one side of the equation and all the terms in $x$, including $dx$, to the other.
2. Integrate both sides: the $y$-side with respect to $y$, and the $x$-side with respect to $x$.
That sounds fair enough, doesn't it? Let's see it in action:

### Example:

Solve the equation

$\dfrac{dy}{dx} = 6x^2 y$
using separation of variables.

Step 1: Separate the variables by moving all the terms in $y$, including $dy$, to one side of the equation and all the terms in $x$, including $dx$, to the other.

$\dfrac{1}{y} (dy) = 6x^2 \; dx$

Step 2: Integrate both sides of the equation.

\begin{align*} \int \dfrac{1}{y} \;dy &= \int 6x^2 \; dx\\ \ln|y| &= 2x^3 + C \end{align*}

Step 3: Simplify the equation (get rid of the log by taking exponentials of each side).

\begin{align*} e^{\ln |y|} &= e^{2x^3 + C}\\ y &= e^{2x^3 + C}\;\;\;\;\;\;\; \ln \text{ and } e^x \text{ are inverse functions }\\ y &= e^{2x^3} e^C \;\;\;\;\;\;\; \text{ since } e^{a + b} = e^a e^b \text{ by the index laws}\\ &= A e^{2x^3} \;\;\;\;\;\;\;\; \text{ where } A = e^C \text{ is another constant.} \end{align*}
So, the solution is
$y = A e^{2x^3}$

### Example (Fruit flies)

You've probably encountered fruit flies before. They're the pesky little things that seem to materialise out of thin air and buzz around the stoned fruit in the summer. Biologists are interested in fruit flies because they breed quickly and easily, and are useful for exploring the transmission of genetic traits.

Biologists are also interested in modelling the growth of populations, and fruit fly populations certainly grow! You need fruit flies to produce more fruit flies, and as you get more fruit flies, the fruit fly population increases more and more rapidly. So, if I want to model the growth of the fruit fly population in and around my fruit bowl, I need to come up with some parameters (variables) for my model. I think the following will be helpful:

• The time, $t$.
• The number of fruit flies present and any time $t$. Let's call it $F$.
• The rate of change of the fruit fly population, $\dfrac{dF}{dt}$.

My fruit fly population is constantly, annoyingly, increasing, and I want to model its growth at any time. The rate of change (at any time) of the fruit fly population is equal to the population's growth rate times the number of fruit flies present at that time, so we can set up the following differential equation:

$\dfrac{dF}{dt} = kF.$
The above equation is a separable differential equation, so we can solve it using separation of variables. It doesn't matter that the variable names are different. We can use the method anyway.

Step 1: Separate the variables by moving all the terms in $F$, including $dF$, to one side of the equation and all the terms in $t$, including $dt$, to the other.

$\dfrac{1}{F} (dF) = k \; dt$

Step 2: Integrate both sides of the equation.

\begin{align*} \int \dfrac{1}{F} \;dF &= \int k \; dt\\ \ln|F| &= kt + C \end{align*}

Step 3: Simplify the equation (get rid of the log by taking exponentials of each side).

\begin{align*} e^{\ln |F|} &= e^{kt + C}\\ F &= e^{kt + C}\;\;\;\;\;\;\; \ln \text{ and } e^x \text{ are inverse functions }\\ F &= e^{kt} e^C \;\;\;\;\;\;\; \text{ since } e^{a + b} = e^a e^b \text{ by the index laws}\\ &= A e^{kt} \;\;\;\;\;\;\;\; \text{ where } A = e^C \text{ is another constant.} \end{align*}
So, the solution is (drum roll, please) ... :
$F = A e^{kt}$
Here, $A$ and $k$ are constants.

Just for fun, let's choose some values of $A$ and $k$, say $A = 0.7$, and $k = 0.9$, and have a look at the graph:

Note: The differential equation in this example crops up all over the place when we're modeling the growth of populations or investments, or things like radioactive decay. In fact, Gus' differential equation has this type. Let's solve it!

### Solving Gus' Feral Caterpillar Problem

If you recall, Gus' garden has been infested with caterpillars, and they are eating his cabbages. He's modelled the situation using the differential equation:

$\dfrac{d \text{cabbage}}{dt} = 5t \cdot \text{cabbage},$
where $t$ is the time in days after the initial infestation. He knows that $6$ cabbage leaves were eaten during the initial infestation, and wants to know how many cabbage leaves will be eaten on day $1$. He needs to solve the differential equation, work out the value of $A$, and plug in $t = 1$.

Well, the first step has already been done for us. If we plug $F = \text{cabbage}$ and $k = 5$ into the above equation, we get Gus' equation, and its solution is

$\text{cabbage} = A e^{5t}$.
So, now we need to find the value of $A$. We're told that $6$ cabbage leaves were eaten during the initial infestation. This is an example of an initial condition and we can use it to find the value of $A$. Plug $t = 0$ and $\text{cabbage} = 6$ into our equation to give:
\begin{align*} 6 &= A e^{5(0)}\\ 6 &= Ae^0\\ 6 &= A \end{align*}
That was easy! So, now we have the particular solution of Gus' equation that he requires:
$\text{cabbage} = 6e^{5t}.$
We can plug in $t = 1$ to find out how many leaves were eaten on day $1$ after the infestation:
$\text{cabbage}(1) = 6e^{5(1)} = 6e^5 \approx 890.5 \text{ leaves}.$
That's a lot of cabbage. No wonder Gus is so worried!

## Some More Examples

Let's finish with three more examples. Each of them will be slightly harder than the previous one, so it's a good idea to look at them in order.

### Example 1

Solve the differential equation $\dfrac{dy}{dx} = \dfrac{1}{y^2}$.

At first glance, this doesn't look like a separable differential equation (there's no $x$, but it is (the function of $x$ is just the constant function, $1$). Let's separate away:

Step 1: Separate the variables by moving all the terms in $x$, including $dx$, to one side of the equation and all the terms in $y$, including $dy$, to the other.

$y^2 \; dy = dx$

Step 2: Integrate both sides of the equation.

\begin{align*} \int y^2 \; dy &= \int \; dx\\ \frac{y^3}{3} &= x + C \end{align*}

Step 3: Simplify the equation:

\begin{align*} y^3 &= 3 (x + C) \;\;\;\;\;\;\;\;\;\;\;\;\; \text{ multiplying both sides by } 3\\ y &= \sqrt[3]{3(x + C)}\;\;\;\;\;\;\;\;\;\; \text{ taking the cube root of both sides} \end{align*}

Note: You need to be careful with constants and differential equations. This solution is not the same as $y = \sqrt[3]{3x} + C$. We need to add the constant during integration, not at the end of the procedure.

### Example 2

Solve the differential equation $\dfrac{dy}{dx} = \dfrac{3x^2 y}{4 + x^3}$.

This one is definitely separable. Let's set to work:

Step 1: Separate the variables by moving all the terms in $x$, including $dx$, to one side of the equation and all the terms in $y$, including $dy$, to the other.

$\dfrac{1}{y} \; dy = \dfrac{3x^2}{4 + x^3} \;dx$

Step 2: Integrate both sides of the equation.

\begin{align*} \int \dfrac{1}{y} \; dy = \int \dfrac{3x^2}{4 + x^3} \;dx \end{align*}
The left hand side is just $\ln |y|$. We'll need to use integration by substitution to integrate the right hand side:
Let $u = 4 + x^3$. Then $du = 3x^2 \; dx$. So, we have
\begin{align*} \int \dfrac{1}{y} \; dy &= \int \dfrac{1}{u}\; du\\ \ln(y) &= \ln(u) + C\\ \ln(y) &= \ln (u ) + \ln(k) \;\;\;\;\;\;\;\;\;\;\;\text{ setting } C = \ln (k)\\ &= \ln (uk) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\text{ by rules of logarithms}\\ y &= uk \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\text{ taking exponentials of both sides}\\ y &= k(4 + x^3) \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\text{ plugging } u = 4 + x^3 \text{ back in} \end{align*}

Step 3: Simplify the equation:
There's no more work to be done, so the solution is

\begin{align*} y = k(4 + x^3). \end{align*}

### Example 3: The Verhulst Equation and the Carrying Capacity of Environments

#### Back to Our Fruit Flies

Our original model for the rate of change of the fruit fly population wasn't quite realistic enough because it failed to take into account the fact that a given environment (like my fruit bowl) only has enough food in it to support a certain population. This maximum population that an environment can support is called the carrying capacity of the environment.

A Belgian mathematician, Pierre Francois Verhulst, figured this out in 1838, and his work was later modified by American scientists Raymond Pearl and Lowell Reed to produce the Verhulst equation:

$\dfrac{dP}{dt} = r P\left( 1 - \dfrac{P}{K}\right)$,
in which $P(t)$ represents the population at time $t$, $r$ is the growth rate and $K$ is the carrying capacity of the environment. Pretty clever, huh?

Let's write it using the variable names we had before:

$\dfrac{dF}{dt} = k F\left( 1 - \dfrac{F}{K}\right)$,
where $F(t)$ is the fruit fly population at time $t$, $k$ is the growth rate, and $K$ is the carrying capacity of the fruit bowl environment.

This equation can be solved using the separation of variables method, but we need to get a bit tricky:

Step 1: Separate the variables by moving all the terms in $F$, including $dF$, to one side of the equation and all the terms in $t$, including $dt$, to the other. We'll do this in two stages:

\begin{align*} dF &= kF\left( 1 - \dfrac{F}{K}\right) \; dt\\ \dfrac{dF}{F\left(1 - \dfrac{F}{K}\right)} &= k\;dt \end{align*}

Step 2: Integrate both sides of the equation. We'll need to work on the left hand side a little first using partial fractions.

\begin{align*} \dfrac{1}{F\left( 1 - \dfrac{F}{K}\right)} &= \dfrac{K}{F(K - F)} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \text{ multiplying top and bottom by } K\\ &= \dfrac{F + K - F}{F(K - F)} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\text{ using sneaky trick number 1 - often used in partial fractions}\\ &= \dfrac{F}{F(K - F)} + \dfrac{(K-F)}{(K - F)} \;\;\;\;\;\; \text{ splitting it up into two fractions}\\ &= \dfrac{1}{(K -F)} + \dfrac{1}{F} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \text{ cancelling stuff out.} \end{align*}
Now, it's much easier to integrate. Let's hop to it (fly to it, perhaps?)
\begin{align*} \int \dfrac{1}{(K - F)} \; dF + \int \dfrac{1}{F}\; dF &= \int k\; dt\\ - \ln (K - F ) + \ln (F) &= kt + C \;\;\;\;\; \text{ the minus sign in front of \ln (K - F) comes from the minus sign in front of the $F$ in $(K - F)$} \end{align*}

Step 3: Simplify the equation. There are more sneaky tricks to come!

\begin{align*} \ln (K - F) - \ln (F) &= -kt + D \;\;\;\;\;\; \text{ where } D = -C\\ \ln \left(\dfrac{K - F}{F}\right) &= -kt + D \;\;\;\;\;\;\; \text{ using logarithm laws}\\ \dfrac{K - F}{F} &= e^{-kt + D}\;\;\;\;\;\;\;\;\;\;\; \text{ taking exponentials of both sides}\\ \dfrac{K - F}{F} &= e^{-kt}e^D \;\;\;\;\;\;\;\;\;\;\;\text{ using index laws}\\ \dfrac{K - F}{F} &= A e^{-kt} \;\;\;\;\;\;\;\;\;\;\;\;\text{ writing A = e^D. Both are constants, so why not? } \end{align*}
We could leave it there, but it doesn't look very pretty. We want to get $F$ on its own as the subject of the formula.

Time for some more sneaky algebra tricks!

\begin{align*} \dfrac{K - F}{F} &= A e^{-kt} \\ \dfrac{K}{F} - \dfrac{F}{F} &= Ae^{-kt} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\text{ splitting up the fraction }\\ \dfrac{K}{F} - 1 &= Ae^{-kt}\\ \dfrac{K}{F} &= 1 + Ae^{-kt} \;\;\;\;\;\;\;\;\;\; \text{ adding 1 to both sides}\\ \dfrac{1}{F} &= \dfrac{1 + Ae^{-kt}}{K} \;\;\;\;\;\;\;\;\;\text{ dividing both sides by }K\\ F &= \dfrac{K}{1 + Ae^{-kt}} \;\;\;\;\;\;\;\;\;\text{ taking reciprocals of both sides} \end{align*}

Phew, that was a bit of a marathon! So, our solution is

$F = \dfrac{K}{1 + Ae^{-kt}}$

Let's see what it looks like with $K = 30$, $A = 7$, and $k = 3$:

$K$ is on the vertical axis and $t$ is on the horizontal axis. The graph initially rises like an exponential function, but then flattens out as $K$ gets closer to $30$.

### Description

Calculus is the branch of mathematics that deals with the finding and properties of derivatives and integrals of functions, by methods originally based on the summation of infinitesimal differences. The two main types are differential calculus and integral calculus.

### Environment

It is considered a good practice to take notes and revise what you learnt and practice it.

### Audience

You must be logged in as Student to ask a Question.