# Separable differential equation

## Definition

### Form of the differential equation

The term separable is used for a first-order differential equation that, up to basic algebraic manipulation, is of the form:

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

where $x$ is the independent variable and $y$ is the dependent variable.

Separable differential equations can be described as first-order first-degree differential equations where the expression for the derivative in terms of the variables is a multiplicatively separable function of the two variables.

This means that we also consider a differential equation separable if it is first-order first-degree but not in explicit form, and which becomes separable when converted to explicit form. For instance, $xy' = 2y$ is separable because when it is written in explicit form $y' = 2y/x$, the expression for $y'$ is multiplicatively separable in $x$ and $y$.

### Solution method and formula: general solution

It can be solved by rearranging and integrating:

$\int \frac{dy}{g(y)} = \int f(x) \, dx$

It suffices to have just one freely floating additive constant (i.e., one parameter) in the answer because the additive constants coming from the two integrals can be merged into one by taking the difference between them.

In general, the solution to this is a relational solution family, i.e., for each numerical value of the free parameter, the corresponding solution is a relational solution, i.e., the dependent variable $y$ is described as an implicit function of $x$ rather than as an explicit function of $x$. However, it may be possible to manipulate the solution in order to write $y$ explicitly as a function of $x$. The general idea behind doing this is to (locally) invert the function of $y$ obtained upon integration of $1/g$ and then compose that inverse with the function obtained upon integration of $f$.

This method of solving separable differential equations is sometimes termed separation of variables or separate and integrate to indicate that the functions of each variable are separated and then integrated with respect to the corresponding variables.

### Stationary solutions

In addition to the above formula of general solutions, it is also possible that there exist additional solutions that are stationary solutions. Stationary solutions are also called equilibrium solutions. These are solutions of the form:

$y = k, \qquad \mbox{where } g(k) = 0$

The reason these solutions get missed out from the general solution procedure is that the general solution procedure requires division by $g(y)$, hence it overlooks the solution functions where $g(y) = 0$.

This family of solutions is usually a discrete, often finite (and possibly empty), family of solutions. It may be possible to find an elegant way of writing the general solution that also manages to encompass the stationary solutions without making cases.

The term general solution is somewhat ambiguous. Some people use it to refer to the solutions obtained by the solution method of integration, even if that excludes the stationary solutions. Others use the term to refer to all solutions, inclusive of the stationary solutions.

### Partly stationary solutions and other mixed solutions

In some cases, it is possible to have solutions that are stationary for part of the domain and non-stationary (described by the separation of variables method) for the rest of the domain. Such solutions may be called partly stationary.

The theoretical reason behind the emergence of partly stationary solutions is that it may so happen that $g(y)$ is neither identically zero nor identically nonzero, but rather, it is zero for some points and nonzero for other points. The integration method (using separation of variables) works for parts of the domain where it is nonzero everywhere, and the stationary solutions work for parts of the domain where it is zero everywhere. Partly stationary solutions work by combining these phenomena.

For separable differential equations that are not in explicit form (i.e., equations such as $xy' = 2y$, where there is a coefficient on the $y'$ to begin with) it is also possible to have mixed solutions that are not partly stationary. These solutions change definition from one function to another at a stationary value. For more, see the #Theory and #Examples sections.

## Particular cases

### Where the derivative depends only on the dependent variable

This is the case of a first-order autonomous differential equation of degree one:

$\frac{dy}{dx} = g(y)$

Here, we get:

$\int \frac{dy}{g(y)} = \int 1 \, dx$

Note that performing the integration expresses $x$ in terms of $y$. We need to then do algebraic manipulation to express $y$ explicitly in terms of $x$.

Again, we need to take care of the stationary solutions, i.e., additional solutions of the form:

$y = k, \qquad \mbox{where } g(k) = 0$

Note that the standard notation for autonomous differential equations uses $t$ for the independent variable and $x$ for the dependent variable; however, in this page, we use the convention for separable differential equations in general to better understand how it fits in with the rest of the page.

### Where the derivative depends only on the independent variable

This is a situation where the function depends only on $x$:

$\frac{dy}{dx} = f(x)$

We get:

$y = \int f(x) \, dx$

This is a straightforward explicit functional description.

Note that in this case, there are no additional solutions that we need to worry about.

## Examples

### Example without stationary solutions

Consider the differential equation:

$\frac{dy}{dx} = (x^2 + 1)(y^2 + 4)$

Note first that $y^2 + 4 = 0$ has no solution, so the differential equation has no stationary functional solutions. We rearrange to get the general solution:

$\int \frac{dy}{y^2 + 4} = \int (x^2 + 1) \, dx$

Integrating, we get:

$\frac{1}{2} \arctan(y/2) = \frac{x^3}{3} + x + C$

Note that the constant $C$ is only put at one place rather than separate constants for each integration, because the multiple constants can be absorbed into a single one.

The above gives a family of relational solutions. If we wish, we could convert these to functional solutions, though we need to be somewhat careful when doing so in general. In this case, a naive manipulation would give:

$y = 2\tan\left(2\frac{x^3}{3} + 2x + 2C \right)$

We do lose some information in the process (namely that $2\frac{x^3}{3} + 2x + 2C$ is in the range of $\arctan$) but that information was artificial anyway so this is not an issue.

### Example with stationary solutions

Consider the differential equation:

$\frac{dy}{dx} = (x+1)(y+1)$

This has a stationary solution $y = -1$ (a constant function). Assuming $y \ne -1$, we can rearrange to get:

$\int \frac{dy}{y + 1} = \int (x + 1) \, dx$

This integrates to give:

$\ln|y + 1| = \frac{x^2}{2} + x + C$

Exponentiating both sides, we get:

$|y + 1| = e^C \exp\left(\frac{x^2}{2} + x \right)$

Let $k = e^C\operatorname{sgn}(y + 1)$. Note that $k \ne 0$. We get:

$y + 1 = k \exp\left(\frac{x^2}{2} + x \right)$

Rearranging, we can get $y$ as an explicit function of $x$:

$y = k \exp\left(\frac{x^2}{2} + x \right) - 1$

Note that currently we have the restriction $k \ne 0$. However, we see that allowing $k = 0$ gives the stationary solution, so that we can combine the stationary solution into the general solution and get, with $k \in \R$ a parameter:

$y = k \exp\left(\frac{x^2}{2} + x \right) - 1$

### Example with partly stationary solutions

Since the example we consider here is an autonomous differential equation, we use somewhat different notation: we denote the depedent variable by $x$ and the independent variable by $t$. The differential equation is:

$\frac{dx}{dt} = \sqrt{1 - x^2}$

This differential equation has two stationary solutions: $x = 1$ and $x = -1$.

We first make a couple of observations:

• $x$ must be a non-decreasing function of $t$ everywhere on its domain, because the derivative is nonnegative.
• $x \in [-1,1]$ for all $t$, because that is necessary for the right side to make sense.
• In particular, if $x = -1$ at a given value $t = t_0$, we must have $x = -1$ for all $t \le t_0$, and if $x = 1$ at a given value $t = t_1$, we must have $x = 1$ for all $t \ge t_1$.

Solving for non-stationary solutions, we get:

$\arcsin x = t + C$

This gives:

$x = \sin(t + C), \qquad t \in (-C - \pi/2, -C + \pi/2)$

The solution extends continuously to the boundary points, so we get:

$x = \sin(t + C), \qquad t \in [-C - \pi/2, -C + \pi/2]$

Now, at the endpoint $-C - \pi/2$, $x = -1$. By the observations made above, $x$ must be equal to -1 for all $t \le -C - \pi/2$, and $x$ must be equal to 1 for all $t \ge -C +\pi/2$. The general non-stationary solution is thus:

$x = \left\lbrace\begin{array}{rr} -1, & t \le -C - \pi/2 \\ \sin(t + C), & -C - \pi/2 < t < -C + \pi/2 \\ 1, & t \ge -C + \pi/2 \\\end{array}\right.,\qquad C \in \R$

The complete list of global solutions is the above general solution family and the two stationary solutions $x = -1$ and $x = 1$.

## Theory

### Justification of integrating with respect to both variables

The step:

$\frac{dy}{dx} = f(x)g(y) \implies \int \frac{dy}{g(y)} = \int f(x) \, dx$

requires justification, since it's not clear how we can integrate with respect to variables $x$ and $y$. One justification is that the actual integration is happening with respect to $x$, not $y$. Here's how:

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

Dividing both sides by $g(y)$, we get:

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

We now integrate both sides with respect to $x$, and get:

$\int \frac{1}{g(y)} \frac{dy}{dx} \, dx = \int f(x) \, dx$

We now use integration by substitution to convert the integration on the left to $\int \frac{1}{g(y)} \, dy$, keeping in mind that $y$ is a (not yet known) function of $x$.

### Explanation as a special case of an exact differential equation

The solution method for the separable differential equation:

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

can be viewed as a special case of the theory of first-order exact differential equations. Concretely, the equation is not itself exact. However, it has an integrating factor $1/g(y)$ and multiplication by this integrating factor makes it exact. Explicitly:

$\frac{1}{g(y)} \frac{dy}{dx} - f(x) = 0$

Now, the expression on the left is precisely the derivative of $\int \frac{dy}{g(y)} - \int f(x) \, dx$, hence it is exact.

### Relation with factorization method

The process of separating out stationary solutions can be thought of as a special case of the factorization method for solving differential equations. Explicitly, we are doing:

$y' = f(x)g(y) \implies g(y)\left(\frac{y'}{g(y)} - f(x) \right) = 0$

and solving each factor separately. The solutions to $g(y) = 0$ give the stationary solutions; the solutions to the other factor give the relational solution family.

The partly stationary solutions can be understood in this context as the mixed solutions that arise during the factorization method for solving differential equations.

### Continuity, differentiability, existence, and uniqueness

Here are some key facts:

• A separable differential equation of the form:

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

has a unique solution locally for any initial value problem $(x_0,y_0)$ if $g(y_0) \ne 0$ and $f$ and $g$ are continuous functions around $x_0$ and $y_0$ respectively. This solution is part of the general solution family, obtained by plugging in the initial value condition. Moreover, the solution function is a continuously differentiable function.

• With assumptions as above, if $f$ and $g$ are $n$ times continuously differentiable around $x_0$ and $y_0$, then the solution function to the initial value problem is $(n + 1)$ times continuously differentiable around the point $x_0$. In particular, if $f$ and $g$ are infinitely differentiable, so is the solution function.
• The uniqueness behavior can be extended to open intervals for $y$ where $g$ is nonzero.
• As a general principle, partly stationary solutions may not be as nicely differentiable as the pure stationary and the pure non-stationary solutions. In particular, there is no guarantee for partly stationary solutions being more than once differentiable at points of transitioning between the stationary and non-stationary parts of the domain.

## Equations reducible to separable form

### Separable but not explicit

These are first-order first-degree equations that are already separable but not in explicit form. They typically look like:

$A(x,y)y' = B(x,y)$

where $B(x,y)/A(x,y)$ is multiplicatively separable in $x$ and $y$. We solve these pretty much the same way as we solve explicit separable equations. As usual, we have to worry about stationary solutions.

### Separable after some manipulation to factor

Here are some examples. We have only indicated how to convert the equation to a separable form, and not included solutions:

Differential equation Separable form
$y' + y = xy - x + 1$ $y' = (x - 1)(y - 1)$
$y' = e^{x + y}(\cos(x + y) + \cos(x - y))$ $y' = 2(e^x\cos x)(e^y \cos y)$
$xy' = \frac{e^{x - y}}{y^2 + 1}$ $y' = \left(\frac{e^x}{x}\right)\left(\frac{e^{-y}}{y^2 + 1}\right)$

### Separable after function application

This includes examples of differential equations that are first-order but not necessarily first-degree. They need not even be polynomial in $y'$. The idea is to apply a function that inverts whatever function is being applied to $y'$ to make it first-degree in $y'$ and then write the expression in $x$ and $y$ in multiplicatively separable form.

Differential equation Function applied to both sides Separable differential equation obtained
$(y')^3 = xy$ cube root function $y' = x^{1/3}y^{1/3}$
$y = \arctan(xy')$ tangent function $\tan y = xy' \implies y' = \frac{1}{x}(\tan y)$ (there are some issues of loss of information here, because when we take $\tan$, we lose the information that $xy'$ is in the range of $\arctan$. This information would need to be plugged back at the end).

### Separable after substitution

For examples of this, see substitution method for solving differential equations.

### Separable after factorization

For examples of this, see factorization method for solving differential equations.