# 1.3 Separable Equations

When a differential equation is of the form \(y' = f(x)\), we can just integrate: \(y = \int f(x) dx + C\). Unfortunately this method no longer works for the general form of the equation \(y' = f(x, y)\). Integrating both sides yields

\[y = \int f(x, y) dx + C\]

Notice the dependence on \(y\) in the integral.

#### 1.3.1 Separable equations

Let us suppose that the equation is *separable*. That is, let us consider

\[y' = f(x)g(y),\]

for some functions \(f(x)\) and \(g(y)\). Let us write the equation in the Leibniz notation

\[\frac{dy}{dx} = f(x)g(y)\]

Then we rewrite the equation as

\[\frac{dy}{g(y)} = f(x) dx\]

Now both sides look like something we can integrate. We obtain

\[\int \frac{dy}{g(y)} = \int f(x) dx + C\]

If we can find closed form expressions for these two integrals, we can, perhaps, solve for \(y.\)

Example \(\PageIndex{1}\):

Take the equation

\[ y' = xy\]

First note that \(y = 0\) is a solution, so assume \(y \ne 0\) from now on. Write the equation as \(\frac{dy}{dx} = xy,\) then

\[\int \frac{dy}{y} = \int x dx + C.\]

We compute the antiderivatives to get

\[\ln \left \vert y \right \vert = \frac{x^2}{2} + C\]

Or

\[\left \vert y \right \vert = e^{\frac{x^2}{2}} e^{C} = De^{\frac{x^2}{2}} \]

where \(D > 0\) is some constant. Because \(y = 0\) is a solution and because of the absolute value we actually can write:

\(y = De^{\frac{x^2}{2}} \)

for any number \(D\) (including zero or negative).

We check:

\[y' = Dxe^{\frac{x^2}{2}} = x \left ( De^{\frac{x^2}{2}} \right ) = xy\]

We should be a little bit more careful with this method. You may be worried that we were integrating in two different variables. We seemed to be doing a different operation to each side. Let us work this method out more rigorously.

\[\frac{dy}{dx} = f(x)g(y)\]

We rewrite the equation as follows. Note that \(y = y(x)\) is a function of \(x\) and so is \(\frac{dy}{dx}!\)

\[\frac{1}{g(y)} \frac{dy}{dx} = f(x)\]

We integrate both sides with respect to \(x.\)

\[\int \frac{1}{g(y)} \frac{dy}{dx} dx = \int f(x) dx + C\]

We can use the change of variables formula.

\[\int \frac{1}{g(y)} dy = \int f(x) dx + C\]

And we are done.

### 1.3.2 Implicit solutions

It is clear that we might sometimes get stuck even if we can do the integration. For example, take the separable equation

\[y' = \frac{xy}{y^2 + 1}\]

We separate variables,

\[\frac{y^2 + 1}{y} dy = \left ( y + \frac{1}{y} \right ) dy = x dx\]

We integrate to get

\[\frac{y^2}{2} + ln \left \vert y \right \vert = \frac{x^2}{2} + C\]

or perhaps the easier looking expression (where \(D = 2C\))

\[y^2 + 2ln \left \vert y \right \vert = x^2 + D\]

It is not easy to find the solution explicitly as it is hard to solve for \(y\). We, therefore, leave the solution in this form and call it an implicit solution. It is still easy to check that an implicit solution satisfies the differential equation. In this case, we differentiate to get

\[y' \left ( 2y + \frac{2}{y} \right ) = 2x\]

It is simple to see that the differential equation holds. If you want to compute values for \(y\), you might have to be tricky. For example, you can graph \(x\) as a function of \(y\), and then flip your paper. Computers are also good at some of these tricks.

We note that the above equation also has the solution \(y = 0\). The general solution is \(y^2 + 2ln \left \vert y \right \vert = x^2 + C\) together with \(y = 0\). These outlying solutions such as \(y = 0\) are sometimes called *singular solutions*.

Example \(\PageIndex{2}\):

Solve \(x^2y' = 1 - x^2 + y^2 -x^2y^2\), \(y(1) = 0.\)

First factor the right hand side to obtain

\[x^2y' = \left ( 1- x^2 \right ) \left ( 1 + y^2 \right )\]

We separate variables, integrate and solve for \(y\)

\[\frac{y'}{1 + y^2} = \frac {1 - x^2}{x^2},\]

\[\frac{y'}{1 + y^2} = \frac {1}{ x^2} -1,\]

\[\text{arctan}(y) = -\frac{1}{x^2} - x + C,\]

\[y = \tan \left( -\frac{1}{x} - x + C \right )\]

\[y = \tan \left( -\frac{1}{x} - x + C \right )\]

Example \(\PageIndex{3}\):

Bob made a cup of coffee, and Bob likes to drink coffee only once it will not burn him at 60 degrees. Initially at time \(t = 0\) minutes, Bob measured the temperature and the coffee was 89 degrees Celsius. One minute later, Bob measured the coffee again and it had 85 degrees. The temperature of the room (the ambient temperature) is 22 degrees. When should Bob start drinking?

Let \(T\) be the temperature of the coffee, and let \(A\) be the ambient (room) temperature. Newton’s law of cooling states that the rate at which the temperature of the coffee is changing is proportional to the difference between the ambient temperature and the temperature of the coffee. That is,

\[\frac{dT}{dt} = k(A - T),\]

for some constant \(k\). For our setup \( A = 22\), \(T(0) = 89\), \(T(1) = 85\). We separate variables and integrate (let \(C\) and \(D\) denote arbitrary constants)

\[\frac{1}{T -A} \frac {dT}{dt} = -k,\]

\[\ln (T - A) = -kt + C, \, \, \, \, \, \left ( \text {note that} T - A > 0 \right )\]

\[ T - A = De^{-kt},\]

\[ T = A + De^{-kt}\]

Example \(\PageIndex{4}\):

\[ -\frac {3}{y^2} y' = x ,\]

\[ \frac {3}{y} = \frac {x^2}{2} + C,\]

\[ y = \frac {3}{ \frac{x^2}{2} + C} = \frac {6}{x^2 + 2C}.\]

### Contributors

- Jiří Lebl (Oklahoma State University).These pages were supported by NSF grants DMS-0900885 and DMS-1362337.