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 xx's on one side of the equation and all of the yy's on the other side. If we can do that, and if dxdx and dydy are on the appropriate sides, we can integrate each side.


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

First of all, we need to rewrite this with Liebniz's notation, using dy/dxdy/dx instead of y.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. dydx=x2y2.\dfrac{dy}{dx} = \dfrac{x^2}{y^2}.

Now comes the separation: y2 dy=x2 dxy^2\ dy = x^2\ dx

Since each side only has one variable present, as well as the appropriate differential, we can integrate both sides: y2 dy=x2 dx13y3=13x3+C\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,y, and we can do that here. You should check the algebra and verify that the solution is y=x3+3C3\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.y(0)=2.

We can plug this into the solution: 2=03+3C32=3C38=3C\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: y=x3+83\ans{y = \sqrt[3]{x^3+8}}

If you like, you can pause here, and check this answer by finding dy/dxdy/dx and plugging that and yy 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 xx and a function of yy: dydx=f(x)g(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: 1g(y) dy=f(x) dx.\dfrac{1}{g(y)}\ dy = f(x)\ dx.

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

After integrating, we have the answer, and if possible, we solve for yy 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. dPdt=kP\dfrac{dP}{dt} = kP


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:

dPdt=kP1P dP=k dt1P dP=k dtlnP=kt+CP=ekt+C=ekteC\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}

P=aekt\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=y2, where y(1)=1xy' + y = y^2, \textrm{ where } y(1)=-1


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 xx and a function of yy: xy+y=y2xy=y2yy=1x(y2y)\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. y=1x(y2y)1y2y dy=1x dx1y2y dy=1x dx1y+1y1 dy=1x dxlny+lny1=lnx+Clny1y=lnx+Cy1y=elnx+C=elnxeCy1y=kxy1=kxyykxy=1y(1kx)=1y=11kx\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 kk: 1=11k(1)k=2−1 = \dfrac{1}{1−k(1)} \longrightarrow k=2 y=112x\ans{y = \dfrac{1}{1-2x}}

Newton's Law of Cooling

T=k(TTm)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?


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

Now separate and integrate: 1T72 dT=k dtlnT72=kt+CT72=AektT=72+Aekt\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 (AA and kk), which is why we need two pieces of information: the man's initial temperature and his temperature an hour later. T(0)=77.9T(1)=75.6\begin{aligned} T(0) &= 77.9\ T(1) &= 75.6 \end{aligned}

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

With the second condition, we can find kk: 75.6=72+5.9ek3.6=5.9ek3.65.9=ekln3.65.9=kln3.65.9=k0.494k\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.9e0.494tT = 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: 98.6=72+5.9e0.494tt=3.05\begin{aligned} 98.6 &= 72 + 5.9e^{-0.494t}\ t &= -3.05 \end{aligned}

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

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

  2. y=x2+9y = \sqrt{x^2+9}

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

  4. P(t)=(13t3/2+213)2P(t) = \left(\dfrac{1}{3}t^{3/2} + \sqrt{2} - \dfrac{1}{3}\right)^2

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

  6. lny+12y2=sinx+12\ln y + \dfrac{1}{2}y^2 = \sin x + \dfrac{1}{2}

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

  8. y=1cosx+2y = \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),y(t), the amount of salt in the tank after tt minutes, and use this to predict how much salt will be in the tank after 30 minutes.


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: dydt=rate inrate 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: rate in=(0.03 kgL)(25 Lmin)rate out=(concentration of salt)(25 Lmin)\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.y. Also, note that the volume of brine is consistent at 5000 L, since the flowrates into and out of the tank are equal. concentration of salt=y5000 kgL\textrm{concentration of salt} = \dfrac{y}{5000}\ \dfrac{kg}{L}

Thus, the differential equation is dydt=(0.03)(25)(y5000)(25)dydt=0.75y200\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: dydt=150y200\dfrac{dy}{dt} = \dfrac{150-y}{200}

To solve, separate and integrate: 1150y dy=1200 dtln150y=t200+Cln150y=t200C150y=ket/200y=150ket/200\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,k, plug in the initial condition: y(0)=20.y(0)=20. 20=150ke0k=130\begin{aligned} 20 &= 150-ke^{0}\ k &= 130 \end{aligned}

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

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


What if we changed the problem?

  1. 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.y(0)=0.
  2. What if there were more inlets? In that case, we would simply add the rates in together.
  3. 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 y5000\dfrac{y}{5000} we'd have y5000+5t.\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.