# Separable Equations

So far, we haven't actually gotten to solve any differential equations; we've seen solutions to a few and we've talked about numerical approximations, but we haven't actually solved any analytically. Here we get our first method to do so: **separation**. It may seem to you the first time you see this material that the methods we're going to learn are disconnected and difficult to keep straight. In principle, though, this is similar to what we saw with integration methods: we have a whole toolbox of methods, and which one we use depends on the look of the problem. We'll only have two methods for solving first-order differential equations in this class, though, so that simplifies things a lot.

As the name suggests, we're going to be separating something, but what? We'll be separating the variables; if we can do it, we want to have all of the $x$'s on one side of the equation and all of the $y$'s on the other side. If we can do that, and if $dx$ and $dy$ are on the appropriate sides, we can integrate each side.

# Procedure

Let's illustrate with an example: $y' = \dfrac{x^2}{y^2}$

First of all, we need to rewrite this with Liebniz's notation, using $dy/dx$ instead of $y'.$ Usually the notation we use doesn't matter that much, but when it comes to separation, it's crucial in order to see what we're doing. $\dfrac{dy}{dx} = \dfrac{x^2}{y^2}.$

Now comes the separation: $y^2\ dy = x^2\ dx$

Since each side only has one variable present, as well as the appropriate differential, we can integrate both sides: $\begin{aligned} \int y^2\ dy &= \int x^2\ dx\ \dfrac{1}{3}y^3 &= \dfrac{1}{3}x^3 + C \end{aligned}$

(notice that we only included one arbitrary constant; if we put one on both sides, we could subtract the left-hand constant from both sides and get to where we are now).

As simple as that seemed, we've solved this differential equation. Now, if possible, we'd like to have an answer explicitly written in terms of $y,$ and we can do that here. You should check the algebra and verify that the solution is $\ans{y = \sqrt[3]{x^3+3C}}$

This is the general solution, and if we were given an initial condition, we could find the specific solution. Say, for example, that we were given the initial condition $y(0)=2.$

We can plug this into the solution: $\begin{aligned} 2 &= \sqrt[3]{0^3+3C}\ 2 &= \sqrt[3]{3C}\ 8 &= 3C \end{aligned}$

Plugging this into the general solution, we get the following specific (or particular) solution: $\ans{y = \sqrt[3]{x^3+8}}$

If you like, you can pause here, and check this answer by finding $dy/dx$ and plugging that and $y$ into the differential equation and verifying that it checks out.

## In General

Separation works in the case where we can write a differential equation in terms of the product of a function of $x$ and a function of $y$: $\dfrac{dy}{dx} = f(x)g(y).$

This may or may not be entirely obvious, because we may have to do a little algebra to get it written in this form. If we can, though, then we can separate by rearranging terms: $\dfrac{1}{g(y)}\ dy = f(x)\ dx.$

At this point, we can integrate: $\int \dfrac{1}{g(y)}\ dy = \int f(x)\ dx.$

After integrating, we have the answer, and if possible, we solve for $y$ to get the explicit solution (if not, we just leave it in implicit form). Finally, if we were given an initial condition, we can substitute that in to find the arbitrary constant that arose when we integrated.

## Population Model

Solve the following differential equation. $\dfrac{dP}{dt} = kP$

### Solution

Notice that we already saw the solution to this one in the introduction to diff eq, but now we'll see how to get to that solution. Separate the variables and integrate:

$\begin{aligned} \dfrac{dP}{dt} &= kP\ \dfrac{1}{P}\ dP &= k\ dt\ \int \dfrac{1}{P}\ dP &= \int k\ dt\ \ln P &= kt + C\ P &= e^{kt+C} = e^{kt} \cdot e^C\ \end{aligned}$

$\ans{P = ae^{kt}}$

Be careful not to forget the integration constant; that completely changes the answer.

## Initial Value Problem

Solve the following differential equation. $xy' + y = y^2, \textrm{ where } y(1)=-1$

### Solution

The way this one is set up, it doesn't look separable. But with a little algebra, we can write this as a product of a function of $x$ and a function of $y$: $\begin{aligned} xy'+y &= y^2\ xy' &= y^2−y\ y' &= \dfrac{1}{x}(y^2−y) \end{aligned}$

Now we can separate and integrate. The only wrinkle is that the integration in this one requires partial fraction decomposition. I'll skip some of the details of that process, but you should verify them. $\begin{aligned} y' &= \dfrac{1}{x}(y^2-y)\ \dfrac{1}{y^2-y} \ dy &= \dfrac{1}{x}\ dx\ \int \dfrac{1}{y^2-y}\ dy &= \int \dfrac{1}{x}\ dx\ \int -\dfrac{1}{y}+\dfrac{1}{y-1}\ dy &= \int \dfrac{1}{x}\ dx\ -\ln y + \ln |y-1| &= \ln x + C\ \ln \left|\dfrac{y-1}{y}\right| &= \ln x + C\ \dfrac{y-1}{y} &= e^{\ln x + C} = e^{\ln x} \cdot e^C\ \dfrac{y-1}{y} &= kx\ y-1 &= kxy\ y-kxy &= 1\ y(1-kx) &= 1\ y &= \dfrac{1}{1-kx} \end{aligned}$

Substitute the initial condition in to find $k$: $−1 = \dfrac{1}{1−k(1)} \longrightarrow k=2$ $\ans{y = \dfrac{1}{1-2x}}$

## Newton's Law of Cooling

$T'=−k(T−T_m)$ A man was found dead at 10:06 pm, at which time his body temperature was 77.9°F. The thermostat was set at 72°F. At 11:06 pm, his body temperature was 75.6°F. If his normal body temperature was 98.6°F, at what time did he die?

### Solution

First, notice that $T_m,$ the temperature of the medium, is set by the thermostat at 72°F: $\dfrac{dT}{dt}=−k(T−72)$

Now separate and integrate: $\begin{aligned} \dfrac{1}{T-72}\ dT &= -k\ dt\ \ln |T-72| &= -kt + C\ T - 72 &= Ae^{-kt}\ T &= 72 + Ae^{-kt} \end{aligned}$

There are two unknowns ($A$ and $k$), which is why we need two pieces of information: the man's initial temperature and his temperature an hour later. $\begin{aligned} T(0) &= 77.9\ T(1) &= 75.6 \end{aligned}$

Using the first condition: $\begin{aligned} 77.9 &= 72 + Ae^{-k(0)}\ 5.9 &= A \end{aligned}$

With the second condition, we can find $k$: $\begin{aligned} 75.6 &= 72 + 5.9e^{-k}\ 3.6 &= 5.9e^{-k}\ \dfrac{3.6}{5.9} &= e^{-k}\ \ln \dfrac{3.6}{5.9} &= -k\ -\ln \dfrac{3.6}{5.9} &= k\ 0.494 &\approx k \end{aligned}$

The full model, then, is $T = 72 + 5.9e^{-0.494t}$

The final question is to find when the man died, or in other words, when his temperature was 98.6°F: $\begin{aligned} 98.6 &= 72 + 5.9e^{-0.494t}\ t &= -3.05 \end{aligned}$

Therefore, the man died $3.05$ hours before he was found. The time of death, then, was $\ans{\textrm{7:03 pm}}$

Solve the following differential equation. $\dfrac{dy}{dx} = \dfrac{x}{y} \hspace{0.5in} y(0)=3$

Solve the following differential equation. $P' = \sqrt{Pt} \hspace{0.5in} P(1)=2$

Solve the following differential equation. $\dfrac{dy}{dx} = \dfrac{y \cos x}{1+y^2} \hspace{0.5in} y(0)=1$

Solve the following differential equation. $y' = y^2 \sin x \hspace{0.5in} y(0)=\dfrac{1}{3}$

$y = \sqrt{x^2+9}$

$P(t) = \left(\dfrac{1}{3}t^{3/2} + \sqrt{2} - \dfrac{1}{3}\right)^2$

$\ln y + \dfrac{1}{2}y^2 = \sin x + \dfrac{1}{2}$

$y = \dfrac{1}{\cos x + 2}$

# Mixing Problem Example

A classic differential equations problem is a mixing problem, where a fluid mixture flows into a tank, is mixed, and flows out. It can be a proxy for other kinds of applications.

## Mixing Problem

A tank initially contains 20 kg of salt dissolved in 5000 L of water. Brine (another word for salt water) that contains 0.03 kg of salt per liter of water enters the tank at a rate of 25 L/min. The solution in the tank is kept thoroughly mixed and drains from the tank at 25 L/min as well. Find a solution for $y(t),$ the amount of salt in the tank after $t$ minutes, and use this to predict how much salt will be in the tank after 30 minutes.

### Solution

The key to setting this one up is noting that the rate of change of salt in the tank is the difference between the rate in and the rate out: $\dfrac{dy}{dt} = \textrm{rate in} - \textrm{rate out}$

Next, the rate of salt into the tank is the concentration times the flowrate, and the rate out is the same: $\begin{aligned} \textrm{rate in} &= \left(0.03\ \dfrac{kg}{L}\right)\left(25\ \dfrac{L}{min}\right)\ \textrm{rate out} &= \left(\textrm{concentration of salt}\right)\left(25\ \dfrac{L}{min}\right) \end{aligned}$

What's the concentration of salt in the tank? The concentration, just like with the inlet, is the amount of salt divided by the volume of brine. The key here is that the amount of salt in the tank is the unknown $y.$ Also, note that the volume of brine is consistent at 5000 L, since the flowrates into and out of the tank are equal. $\textrm{concentration of salt} = \dfrac{y}{5000}\ \dfrac{kg}{L}$

Thus, the differential equation is $\begin{aligned} \dfrac{dy}{dt} &= (0.03)(25) - \left(\dfrac{y}{5000}\right)(25)\ \dfrac{dy}{dt} &= 0.75 - \dfrac{y}{200} \end{aligned}$

Now, to solve this by separation, we need to rewrite this as a single fraction: $\dfrac{dy}{dt} = \dfrac{150-y}{200}$

To solve, separate and integrate: $\begin{aligned} \dfrac{1}{150-y}\ dy &= \dfrac{1}{200}\ dt\ -\ln |150-y| &= \dfrac{t}{200} + C\ \ln |150-y| &= -\dfrac{t}{200} - C\ 150-y &= ke^{-t/200}\ y &= 150 - ke^{-t/200} \end{aligned}$

To find $k,$ plug in the initial condition: $y(0)=20.$ $\begin{aligned} 20 &= 150-ke^{0}\ k &= 130 \end{aligned}$

Therefore, the solution is $\ans{y(t)=150−130e^{−t/200}}$

After 30 minutes, there are $\begin{aligned} y(30) &= 150 - 130e^{-30/200}\ &= \ans{38.1\ \textrm{kg}} \end{aligned}$ of salt in the tank.

### Observations

What if we changed the problem?

- What if the tank initially was full of pure water? In that case, all that would change would be the initial condition: $y(0)=0.$
- What if there were more inlets? In that case, we would simply add the rates in together.
- What if the flowrate in and out were different? This is the one that significantly changes the problem. For instance, if the flowrate out were 20 L/min, the volume of brine in the tank would be rising by 5 L each minute (since 25 liters come in and 20 liters go out), so instead of $\dfrac{y}{5000}$ we'd have $\dfrac{y}{5000+5t}.$ And of course, if more were going out than coming in, we'd subtract instead of adding. It turns out that this problem cannot be done by separation; we need the method from the next section to do it, so we'll revisit mixing problems then.