Skip to main content
Mathematics LibreTexts

3.2: Separable Equations

  • Page ID
    90402
  • \( \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}\)

    View tutorial on YouTube

    A first-order ode is separable if it can be written in the form \[\label{eq:1}g(y)\frac{dy}{dx}=f(x),\quad y(x_0)=y_0,\] where the function \(g(y)\) is independent of \(x\) and \(f(x)\) is independent of \(y\). Integration from \(x_0\) to \(x\) results in \[\int_{x_0}^xg(y(x))y'(x)dx=\int_{x_0}^xf(x)dx.\nonumber\]

    The integral on the left can be transformed by substituting \(u = y(x),\: du = y'(x)dx\), and changing the lower and upper limits of integration to \(y(x_0) = y_0\) and \(y(x) = y\). Therefore, \[\int_{y_0}^yg(u)du=\int_{x_0}^xf(x)dx,\nonumber\] and since \(u\) is a dummy variable of integration, we can write this in the equivalent form \[\label{eq:2}\int_{y_0}^yg(y)dy=\int_{x_0}^xf(x)dx.\]

    A simpler procedure that also yields \(\eqref{eq:2}\) is to treat \(dy/dx\) in \(\eqref{eq:1}\) like a fraction. Multiplying \(\eqref{eq:1}\) by \(dx\) results in \[g(y)dy=f(x)dx,\nonumber\] which is a separated equation with all the dependent variables on the left-side, and all the independent variables on the right-side. Equation \(\eqref{eq:2}\) then results directly upon integration.

    Example \(\PageIndex{1}\)

    Solve \(\frac{dy}{dx}+\frac{1}{2}y=\frac{3}{2}\), with \(y(0)=2\).

    Solution

    We first manipulate the differential equation to the form \[\label{eq:3}\frac{dy}{dx}=\frac{1}{2}(3-y),\] and then treat \(dy/dx\) as if it was a fraction to separate variables:

    \[\frac{dy}{3-y}=\frac{1}{2}dx.\nonumber\]

    We integrate the right-side from the initial condition \(x = 0\) to \(x\) and the left-side from the initial condition \(y(0) = 2\) to \(y\). Accordingly, \[\label{eq:4}\int_2^y\frac{dy}{3-y}=\frac{1}{2}\int_0^xdx.\]

    The integrals in \(\eqref{eq:4}\) need to be done. Note that \(y(x) < 3\) for finite \(x\) or the integral on the left-side diverges. Therefore, \(3 − y > 0\) and integration yields \[\begin{aligned} -\ln (3-y)]_2^y&=\frac{1}{2}x]_0^x, \\ \ln(3-y)&=-\frac{1}{2}x, \\ 3-y&=e^{-\frac{1}{2}x}, \\ y&=3-e^{-\frac{1}{2}x}.\end{aligned}\]

    Since this is our first nontrivial analytical solution, it is prudent to check our result. We do this by differentiating our solution:

    \[\begin{aligned}\frac{dy}{dx}&=\frac{1}{2}e^{-\frac{1}{2}x} \\ &=\frac{1}{2}(3-y);\end{aligned}\] and checking the initial conditions, \(y(0) = 3 − e^0 = 2\). Therefore, our solution satisfies both the original ode and the initial condition.

    Example \(\PageIndex{2}\)

    Solve \(\frac{dy}{dx}+\frac{1}{2}y=\frac{3}{2},\) with \(y(0)=4\).

    Solution

    This is the identical differential equation as before, but with different initial conditions. We will jump directly to the integration step:

    \[\int_4^y\frac{dy}{3-y}=\frac{1}{2}\int_0^xdx.\nonumber\]

    Now \(y(x) > 3\), so that \(y − 3 > 0\) and integration yields \[\begin{aligned}-\ln (y-3)]_4^y&=\frac{1}{2}x]_0^x, \\ \ln(y-3)&=-\frac{1}{2}x, \\ y-3&=e^{-\frac{1}{2}x}, \\ y&=3+e^{-\frac{1}{2}x}.\end{aligned}\]

    clipboard_e2f0a71d2779b0ed9bb8aa4e96767a0b0.png
    Figure \(\PageIndex{1}\): Solution of the following ODE: \(\frac{dy}{dx}+\frac{1}{2}y=\frac{3}{2}\).

    The solution curves for a range of initial conditions is presented in Fig. \(\PageIndex{1}\). All solutions have a horizontal asymptote at \(y = 3\) at which \(dy/dx = 0\). For \(y(0) = y_0\), the general solution can be shown to be \(y(x) = 3 + (y_0 − 3) \text{exp}(−x/2)\).

    Example \(\PageIndex{3}\)

    Solve \(\frac{dy}{dx}=\frac{2\cos 2x}{3+2y}\), with \(y(0)=-1\).

    1. For what values of \(x>0\) does the solution exist?
    2. For what value of \(x>0\) is \(y(x)\) maximum?

    Solution

    Notice that the derivative of \(y\) diverges when \(y = −3/2\), and that this may cause some problems with a solution.

    We solve the ode by separating variables and integrating from initial conditions:

    \[\begin{aligned} (3+2y)dy&=2\cos 2xdx \\ \int_{-1}^y(3+2y)dy&=2\int_0^x\cos 2xdx \\ 3y+y^2]_{-1}^y&=\sin 2x]_0^x \\ y^2+3y+2-\sin 2x&=0 \\ y_{\pm} &=\frac{1}{2}[-3\pm\sqrt{1+4\sin 2x}].\end{aligned}\]

    Solving the quadratic equation for \(y\) has introduced a spurious solution that does not satisfy the initial conditions. We test:

    \[y_{\pm}(0)=\frac{1}{2}[-3\pm 1]=\left\{\begin{array}{c}-1; \\ -2.\end{array}\right.\nonumber\]

    Only the \(+\) root satisfies the initial condition, so that the unique solution to the ode and initial condition is \[\label{eq:5} y=\frac{1}{2}[-3+\sqrt{1+4\sin 2x}].\]

    To determine (i) the values of \(x > 0\) for which the solution exists, we require \[1+4\sin 2x\geq 0,\nonumber\] or \[\label{eq:6}\sin 2x\geq -\frac{1}{4}.\]

    Notice that at \(x = 0\), we have \(\sin 2x = 0\); at \(x = π/4\), we have \(\sin 2x = 1;\) at \(x = π/2\), we have \(\sin 2x = 0\); and at \(x = 3π/4\), we have \(\sin 2x = −1\). We therefore need to determine the value of \(x\) such that \(\sin 2x = −1/4\), with \(x\) in the range \(π/2 < x < 3π/4\). The solution to the ode will then exist for all \(x\) between zero and this value.

    To solve \(\sin 2x = −1/4\) for \(x\) in the interval \(π/2 < x < 3π/4\), one needs to recall the definition of \(\text{arcsin}\), or \(\sin^{−1}\), as found on a typical scientific calculator. The inverse of the function \[f(x)=\sin x,\quad -\pi /2\leq x\leq \pi /2\nonumber\] is denoted by \(\text{arcsin}\). The first solution with \(x > 0\) of the equation \(\sin 2x = −1/4\) places \(2x\) in the interval \((π, 3π/2)\), so to invert this equation using the \(\text{arcsine}\) we need to apply the identity \(\sin (π − x) = \sin x\), and rewrite \(\sin 2x = −1/4\) as \(\sin (π − 2x) = −1/4\). The solution of this equation may then be found by taking the \(\text{arcsine}\), and is \[\pi -2x=\text{arcsin}(-1/4),\nonumber\] or \[x=\frac{1}{2}\left(\pi +\text{arcsin}\frac{1}{4}\right).\nonumber\]

    Therefore the solution exists for \(0 ≤ x ≤ (π + \text{arcsin} (1/4)) /2 = 1.6971\ldots\), where we have used a calculator value (computing in radians) to find \(\text{arcsin}(0.25) = 0.2527\ldots\). At the value \((x, y) = (1.6971\ldots , −3/2)\), the solution curve ends and \(dy/dx\) becomes infinite.

    To determine (ii) the value of \(x\) at which \(y = y(x)\) is maximum, we examine \(\eqref{eq:5}\) directly. The value of \(y\) will be maximum when \(\sin 2x\) takes its maximum value over the interval where the solution exists. This will be when \(2x = π/2\), or \(x = π/4 = 0.7854\ldots\).

    The graph of \(y=y(x)\) is shown in Fig. 3.3.1.


    This page titled 3.2: Separable Equations is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Jeffrey R. Chasnov via source content that was edited to the style and standards of the LibreTexts platform.