Skip to main content
Mathematics LibreTexts

1.3 Separable Equations

  • Page ID
    32171
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\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]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\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]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    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 \nonumber \]

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

    Separable equations

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

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

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

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

    Then we rewrite the equation as

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

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

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

    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 \nonumber \]

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

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

    We compute the antiderivatives to get

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

    Or

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

    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}} \nonumber \]

    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 \nonumber \]

    Yay!

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

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

    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) \nonumber \]

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

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

    We use the change of variables formula (substitution) on the left hand side:

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

    And we are done.

    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} \nonumber \]

    We separate variables,

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

    We integrate to get

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

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

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

    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 with respect to \(x\), and remember that \(y\) is a function of \(x\), to get

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

    Multiply both sides by \(y\) and divide by \(2(y^2+1)\) and you will get exactly the differential equation. We leave this computation to the reader.

    If you have an implicit solution, and you want to compute values for \(y\), you might have to be tricky. You might get multiple solutions \(y\) for each \(x\), so you have to pick one. Sometimes you can graph \(x\) as a function of \(y\), and then flip your paper. Sometimes you have to do more.

    Computers are also good at some of these tricks. More advanced mathematical software usually has some way of plotting solutions to implicit equations. For example, for \(C=0\) if you plot all the points \((x,y)\) that are solutions to \(y^2+2\ln|y|=x^2\), you find the two curves in Figure \(\PageIndex{1}\). This is not quite a graph of a function. For each \(x\) there are two choices of \(y\). To find a function you would have to pick one of these two curves. You pick the one that satisfies your initial condition if you have one. For example, the top curve satisfies the condition \(y(1)=1\). So for each \(C\) we really got two solutions. As you can see, computing values from an implicit solution can be somewhat tricky. But sometimes, an implicit solution is the best we can do.

    clipboard_eba55f129cf3fd9e1e101bb9b100c5d09.png
    Figure \(\PageIndex{1}\): The implicit solution \(y^{2}+2\ln |y|=x^{2}\) to \(y'=\frac{xy}{y^{2}+1}\).

    The equation above also has the solution \(y=0\). So the general solution is \[y^2 + 2 \ln \, \lvert y \rvert = x^2 + C, \qquad \text{and} \qquad y=0. \nonumber \] 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.\)

    Solution

    First factor the right hand side to obtain

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

    Separate variables, integrate, and solve for \(y\)

    \[\begin{align}\begin{aligned} \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 )\end{aligned}\end{align} \nonumber \]

    Solve for the initial condition, \(0 = \tan(-2+C)\) to get \(C=2\) (or \(C = 2 + \pi\), or \(C = 2 + 2\pi\), etc.). The particular solution we seek is, therefore, \[y = \tan \left(\frac{-1}{x} - x + 2 \right) . \nonumber \]

    Example \(\PageIndex{3}\)

    Bob made a cup of coffee, and Bob likes to drink coffee only once reaches 60 degrees Celsius and will not burn him. 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?

    Solution

    Let \(T\) be the temperature of the coffee in degrees Celsius, and let \(A\) be the ambient (room) temperature, also in degrees Celsius. 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), \nonumber \]

    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)

    \[\begin{align}\begin{aligned} \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}\end{aligned}\end{align} \nonumber \]

    That is, \(T = 22 + D\, e^{-kt}\). We plug in the first condition: \(89 = T(0) = 22 + D\), and hence \(D = 67\). So \(T = 22 + 67\, e^{-kt}\). The second condition says \(85 = T(1) = 22 + 67\, e^{-k}\). Solving for \(k\) we get \(k = - \ln \frac{85-22}{67} \approx 0.0616\). Now we solve for the time \(t\) that gives us a temperature of 60 degrees. Namely, we solve \[60 = 22 + 67 e^{-0.0616t} \nonumber \] to get \(t = - \frac{\ln \frac{60-22}{67}}{0.0616} \approx 9.21\) minutes. So Bob can begin to drink the coffee at just over 9 minutes from the time Bob made it. That is probably about the amount of time it took us to calculate how long it would take. See Figure \(\PageIndex{2}\).

    clipboard_ea8140ebca402b2edc47f7e68af109227.png
    Figure \(\PageIndex{2}\): Graphs of the coffee temperature function \(T(t)\). On the left, horizontal lines are drawn at temperatures \(60\), \(85\), and \(89\). Vertical lines are drawn at \(t=1\) and \(t=9.21\). Notice that the temperature of the coffee hits \(85\) at \(t=1\), and \(60\) at \(t\approx 9.21\). On the right, the graph is over a longer period of time, with a horizontal line at the ambient temperature \(22\).
    Example \(\PageIndex{4}\)

    Find the general solution to \(y' = \frac{-xy^2}{3}\) (including singular solutions).

    Solution

    First note that \(y=0\) is a solution (a singular solution). Now assume that \(y \not= 0\). \[\begin{align}\begin{aligned} -\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}.\end{aligned}\end{align} \nonumber \] So the general solution is, \[y=\frac{6}{x^{2}+2C},\quad\text{and}\quad y=0. \nonumber \]


    This page titled 1.3 Separable Equations is shared under a not declared license and was authored, remixed, and/or curated by Jiří Lebl.

    • Was this article helpful?