$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

# 2.2: Separable Equations

• • Contributed by William F. Trench
• Andrew G. Cowles Distinguished Professor Emeritus (Mathamatics) at Trinity University
$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

A first order differential equation is separable if it can be written as

$\label{eq:2.2.1} h(y)y'=g(x),$

where the left side is a product of $$y'$$ and a function of $$y$$ and the right side is a function of $$x$$. Rewriting a separable differential equation in this form is called separation of variables. In Section 2.1, we used separation of variables to solve homogeneous linear equations. In this section we’ll apply this method to nonlinear equations.

To see how to solve Equation \ref{eq:2.2.1}, let’s first assume that $$y$$ is a solution. Let $$G(x)$$ and $$H(y)$$ be antiderivatives of $$g(x)$$ and $$h(y)$$; that is,

$\label{eq:2.2.2} H'(y)=h(y) \quad \text{and} \quad G'(x)=g(x).$

Then, from the chain rule,

${d\over dx}H(y(x))=H'(y(x))y'(x)=h(y)y'(x).\nonumber$

Therefore Equation \ref{eq:2.2.1} is equivalent to

${d\over dx}H(y(x))={d\over dx}G(x).\nonumber$

Integrating both sides of this equation and combining the constants of integration yields

$\label{eq:2.2.3} H(y(x))=G(x)+c.$

Although we derived this equation on the assumption that $$y$$ is a solution of Equation \ref{eq:2.2.1}, we can now view it differently: Any differentiable function $$y$$ that satisfies Equation \ref{eq:2.2.3} for some constant $$c$$ is a solution of Equation \ref{eq:2.2.1}. To see this, we differentiate both sides of Equation \ref{eq:2.2.3}, using the chain rule on the left, to obtain

$H'(y(x))y'(x)=G'(x), \nonumber$

which is equivalent to

$h(y(x))y'(x)=g(x) \nonumber$

because of Equation \ref{eq:2.2.2}.

In conclusion, to solve Equation \ref{eq:2.2.1} it suffices to find functions $$G=G(x)$$ and $$H=H(y)$$ that satisfy Equation \ref{eq:2.2.2}. Then any differentiable function $$y=y(x)$$ that satisfies Equation \ref{eq:2.2.3} is a solution of Equation \ref{eq:2.2.1}.

Example $$\PageIndex{1}$$

Solve the equation

$y'=x(1+y^2). \nonumber$

Solution

Separating variables yields

${y'\over 1+y^2}=x. \nonumber$

Integrating yields

$\tan^{-1}y={x^2\over2}+c \nonumber$

Therefore

$y=\tan\left({x^2\over2}+c\right). \nonumber$

Example $$\PageIndex{2}$$

1. Solve the equation $\label{eq:2.2.4} y'=-{x\over y}.$
2. Solve the initial value problem $\label{eq:2.2.5} y'=-{x\over y}, \quad y(1)=1.$
3. Solve the initial value problem $\label{eq:2.2.6} y'=-{x\over y}, \quad y(1)=-2.$

Solution a

Separating variables in Equation \ref{eq:2.2.4} yields

$yy'=-x. \nonumber$

Integrating yields

${y^2\over2}=-{x^2\over2}+c, \quad \text{or equivalently} \quad x^2+y^2=2c. \nonumber$

The last equation shows that $$c$$ must be positive if $$y$$ is to be a solution of Equation \ref{eq:2.2.4} on an open interval. Therefore we let $$2c=a^2$$ (with $$a > 0$$) and rewrite the last equation as

$\label{eq:2.2.7} x^2+y^2=a^2.$

This equation has two differentiable solutions for $$y$$ in terms of $$x$$:

$\label{eq:2.2.8} y=\phantom{-} \sqrt{a^2-x^2}, \quad -a < x < a,$

and

$\label{eq:2.2.9} y= - \sqrt{a^2-x^2}, \quad -a < x < a.$

The solution curves defined by Equation \ref{eq:2.2.8} are semicircles above the $$x$$-axis and those defined by Equation \ref{eq:2.2.9} are semicircles below the $$x$$-axis (Figure $$\PageIndex{1}$$).

Solution b

The solution of Equation \ref{eq:2.2.5} is positive when $$x=1$$; hence, it is of the form Equation \ref{eq:2.2.8}. Substituting $$x=1$$ and $$y=1$$ into Equation \ref{eq:2.2.7} to satisfy the initial condition yields $$a^2=2$$; hence, the solution of Equation \ref{eq:2.2.5} is

$y=\sqrt{2-x^2}, \quad - \sqrt{2}< x < \sqrt{2}. \nonumber$

Solution c

The solution of Equation \ref{eq:2.2.6} is negative when $$x=1$$ and is therefore of the form Equation \ref{eq:2.2.9}. Substituting $$x=1$$ and $$y=-2$$ into Equation \ref{eq:2.2.7} to satisfy the initial condition yields $$a^2=5$$. Hence, the solution of Equation \ref{eq:2.2.6} is

$y=- \sqrt{5-x^2}, \quad -\sqrt{5} < x < \sqrt{5}. \nonumber$ Figure $$\PageIndex{1}$$: (a) $$y=\sqrt{2-x^{2}}$$,  $$-\sqrt{2} ## Implicit Solutions of Separable Equations In Examples \(\PageIndex{1}$$ and $$\PageIndex{2}$$ we were able to solve the equation $$H(y)=G(x)+c$$ to obtain explicit formulas for solutions of the given separable differential equations. As we’ll see in the next example, this isn’t always possible. In this situation we must broaden our definition of a solution of a separable equation. The next theorem provides the basis for this modification. We omit the proof, which requires a result from advanced calculus called as the implicit function theorem.

Theorem $$\PageIndex{1}$$: implicit function theorem

Suppose $$g=g(x)$$ is continous on $$(a,b)$$ and $$h=h(y)$$ are continuous on $$(c,d).$$ Let $$G$$ be an antiderivative of $$g$$ on $$(a,b)$$ and let $$H$$ be an antiderivative of $$h$$ on $$(c,d).$$ Let $$x_0$$ be an arbitrary point in $$(a,b),$$ let $$y_0$$ be a point in $$(c,d)$$ such that $$h(y_0)\ne0,$$ and define

$\label{eq:2.2.10} c=H(y_0)-G(x_0).$

Then there’s a function $$y=y(x)$$ defined on some open interval $$(a_1,b_1),$$ where $$a\le a_1<x_0<b_1\le b,$$ such that $$y(x_0)=y_0$$ and

$\label{eq:2.2.11} H(y)=G(x)+c$

for $$a_1<x<b_1$$. Therefore $$y$$ is a solution of the initial value problem

$\label{eq:2.2.12} h(y)y'=g(x),\quad y(x_0)=x_0.$

It’s convenient to say that Equation \ref{eq:2.2.11} with $$c$$ arbitrary is an implicit solution of $$h(y)y'=g(x)$$. Curves defined by Equation \ref{eq:2.2.11} are integral curves of $$h(y)y'=g(x)$$. If $$c$$ satisfies Equation \ref{eq:2.2.10}, we’ll say that Equation \ref{eq:2.2.11} is an implicit solution of the initial value problem Equation \ref{eq:2.2.12}. However, keep these points in mind:

• For some choices of $$c$$ there may not be any differentiable functions $$y$$ that satisfy Equation \ref{eq:2.2.11}.
• The function $$y$$ in Equation \ref{eq:2.2.11} (not Equation \ref{eq:2.2.11} itself) is a solution of $$h(y)y'=g(x)$$.

Example $$\PageIndex{3}$$

1. Find implicit solutions of $\label{eq:2.2.13} y'={2x+1\over5y^4+1}.$
2. Find an implicit solution of $\label{eq:2.2.14} y'={2x+1\over5y^4+1},\quad y(2)=1.$

Solution a

Separating variables yields

$(5y^4+1)y'=2x+1. \nonumber$

Integrating yields the implicit solution

$\label{eq:2.2.15} y^5+y=x^2+x+ c.$

of Equation \ref{eq:2.2.13}.

Solution b

Imposing the initial condition $$y(2)=1$$ in Equation \ref{eq:2.2.15} yields $$1+1=4+2+c$$, so $$c=-4$$. Therefore

$y^5+y=x^2+x-4 \nonumber$

is an implicit solution of the initial value problem Equation \ref{eq:2.2.14}. Although more than one differentiable function $$y=y(x)$$ satisfies Equation \ref{eq:2.2.13} near $$x=1$$, it can be shown that there is only one such function that satisfies the initial condition $$y(1)=2$$. Figure $$\PageIndex{2}$$ shows a direction field and some integral curves for Equation \ref{eq:2.2.13}. Figure $$\PageIndex{2}$$: A direction field and integral curves for $$y'= {\frac{2x+1}{5y^{4}+1}}$$

## Constant Solutions of Separable Equations

An equation of the form

$y'=g(x)p(y) \nonumber$

is separable, since it can be rewritten as

${1\over p(y)}y'=g(x). \nonumber$

However, the division by $$p(y)$$ is not legitimate if $$p(y)=0$$ for some values of $$y$$. The next two examples show how to deal with this problem.

Example $$\PageIndex{4}$$

Find all solutions of

$\label{eq:2.2.16} y'=2xy^2.$

Solution

Here we must divide by $$p(y)=y^2$$ to separate variables. This isn’t legitimate if $$y$$ is a solution of Equation \ref{eq:2.2.16} that equals zero for some value of $$x$$. One such solution can be found by inspection: $$y \equiv 0$$. Now suppose $$y$$ is a solution of Equation \ref{eq:2.2.16} that isn’t identically zero. Since $$y$$ is continuous there must be an interval on which $$y$$ is never zero. Since division by $$y^2$$ is legitimate for $$x$$ in this interval, we can separate variables in Equation \ref{eq:2.2.16} to obtain

${y'\over y^2}=2x. \nonumber$

Integrating this yields

$-{1\over y}=x^2+c, \nonumber$

which is equivalent to

$\label{eq:2.2.17} y=-{1\over x^2+c}.$

We’ve now shown that if $$y$$ is a solution of Equation \ref{eq:2.2.16} that is not identically zero, then $$y$$ must be of the form Equation \ref{eq:2.2.17}. By substituting Equation \ref{eq:2.2.17} into Equation \ref{eq:2.2.16}, you can verify that Equation \ref{eq:2.2.17} is a solution of Equation \ref{eq:2.2.16}. Thus, solutions of Equation \ref{eq:2.2.16} are $$y\equiv0$$ and the functions of the form Equation \ref{eq:2.2.17}. Note that the solution $$y\equiv0$$ isn’t of the form Equation \ref{eq:2.2.17} for any value of $$c$$.

Figure $$\PageIndex{3}$$ shows a direction field and some integral curves for Equation \ref{eq:2.2.16} Figure $$\PageIndex{3}$$: A direction field and integral curves for $$y'=2xy^{2}$$

Example $$\PageIndex{5}$$

Find all solutions of

$\label{eq:2.2.18} y'={1\over2}x(1-y^2).$

Here we must divide by $$p(y)=1-y^2$$ to separate variables. This isn’t legitimate if $$y$$ is a solution of Equation \ref{eq:2.2.18} that equals $$\pm1$$ for some value of $$x$$. Two such solutions can be found by inspection: $$y \equiv 1$$ and $$y\equiv-1$$. Now suppose $$y$$ is a solution of Equation \ref{eq:2.2.18} such that $$1-y^2$$ isn’t identically zero. Since $$1-y^2$$ is continuous there must be an interval on which $$1-y^2$$ is never zero. Since division by $$1-y^2$$ is legitimate for $$x$$ in this interval, we can separate variables in Equation \ref{eq:2.2.18} to obtain

${2y'\over y^2-1}=-x. \nonumber$

A partial fraction expansion on the left yields

$\left[{1\over y-1}-{1\over y+1}\right]y'=-x, \nonumber$

and integrating yields

$\ln\left|{y-1\over y+1}\right|=-{x^2\over2}+k; \nonumber$

hence,

$\left|{y-1\over y+1}\right|=e^ke^{-x^2/2}. \nonumber$

Since $$y(x)\ne\pm1$$ for $$x$$ on the interval under discussion, the quantity $$(y-1)/(y+1)$$ cannot change sign in this interval. Therefore we can rewrite the last equation as

${y-1\over y+1}=ce^{-x^2/2}, \nonumber$

where $$c=\pm e^k$$, depending upon the sign of $$(y-1)/(y+1)$$ on the interval. Solving for $$y$$ yields

$\label{eq:2.2.19} y={1+ce^{-x^2/2}\over 1-ce^{-x^2/2}}.$

We’ve now shown that if $$y$$ is a solution of Equation \ref{eq:2.2.18} that is not identically equal to $$\pm1$$, then $$y$$ must be as in Equation \ref{eq:2.2.19}. By substituting Equation \ref{eq:2.2.19} into Equation \ref{eq:2.2.18} you can verify that Equation \ref{eq:2.2.19} is a solution of Equation \ref{eq:2.2.18}. Thus, the solutions of Equation \ref{eq:2.2.18} are $$y\equiv1$$, $$y\equiv-1$$ and the functions of the form Equation \ref{eq:2.2.19}. Note that the constant solution $$y \equiv 1$$ can be obtained from this formula by taking $$c=0$$; however, the other constant solution, $$y \equiv -1$$, cannot be obtained in this way.

Figure $$\PageIndex{4}$$ shows a direction field and some integrals for Equation \ref{eq:2.2.18}. Figure $$\PageIndex{4}$$: A direction field and integral curves for $$y'= {\frac{x(1-y^2)}{2}}$$

## Differences Between Linear and Nonlinear Equations

Theorem 2.1.2 states that if $$p$$ and $$f$$ are continuous on $$(a,b)$$ then every solution of

$y'+p(x)y=f(x) \nonumber$

on $$(a,b)$$ can be obtained by choosing a value for the constant $$c$$ in the general solution, and if $$x_0$$ is any point in $$(a,b)$$ and $$y_0$$ is arbitrary, then the initial value problem

$y'+p(x)y=f(x),\quad y(x_0)=y_0 \nonumber$

has a solution on $$(a,b)$$.

The not true for nonlinear equations. First, we saw in Examples $$\PageIndex{4}$$ and $$\PageIndex{5}$$ that a nonlinear equation may have solutions that cannot be obtained by choosing a specific value of a constant appearing in a one-parameter family of solutions. Second, it is in general impossible to determine the interval of validity of a solution to an initial value problem for a nonlinear equation by simply examining the equation, since the interval of validity may depend on the initial condition. For instance, in Example $$\PageIndex{2}$$ we saw that the solution of

${dy\over dx}=-{x\over y},\quad y(x_0)=y_0 \nonumber$

is valid on $$(-a,a)$$, where $$a=\sqrt{x_0^2+y_0^2}$$.

Example $$\PageIndex{6}$$

Solve the initial value problem

$y'=2xy^2, \quad y(0)=y_0 \nonumber$

and determine the interval of validity of the solution.

Solution

First suppose $$y_0\ne0$$. From Example $$\PageIndex{4}$$, we know that $$y$$ must be of the form

$\label{eq:2.2.20} y=-{1\over x^2+c}.$

Imposing the initial condition shows that $$c=-1/y_0$$. Substituting this into Equation \ref{eq:2.2.20} and rearranging terms yields the solution

$y= {y_0\over 1-y_0x^2}. \nonumber$

This is also the solution if $$y_0=0$$. If $$y_0<0$$, the denominator isn’t zero for any value of $$x$$, so the the solution is valid on $$(-\infty,\infty)$$. If $$y_0>0$$, the solution is valid only on $$(-1/\sqrt{y_0},1/\sqrt{y_0})$$.