Skip to main content
Mathematics LibreTexts

7.2: Separable Equations

  • Page ID
    96171
  • \( \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

    \[g(y) \frac{d y}{d x}=f(x), \quad y\left(x_{0}\right)=y_{0} \nonumber \]

    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}}^{x} g(y(x)) y^{\prime}(x) d x=\int_{x_{0}}^{x} f(x) d x \nonumber \]

    The integral on the left can be transformed by substituting \(u=y(x), d u=y^{\prime}(x) d x\), and changing the lower and upper limits of integration to \(y\left(x_{0}\right)=y_{0}\) and \(y(x)=y\). Therefore,

    \[\int_{y_{0}}^{y} g(u) d u=\int_{x_{0}}^{x} f(x) d x, \nonumber \]

    and since \(u\) is a dummy variable of integration, we can write this in the equivalent form

    \[\int_{y_{0}}^{y} g(y) d y=\int_{x_{0}}^{x} f(x) d x \nonumber \]

    A simpler procedure that also yields Equation \ref{7.3} is to treat \(d y / d x\) in Equation \ref{7.2} like a fraction. Multiplying Equation \ref{7.2} by \(d x\) results in

    \[g(y) d y=f(x) d x, \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 Equation \ref{7.3} then results directly upon integration.

    Example \(\PageIndex{1}\)

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

    Solution

    We first manipulate the differential equation to the form

    \[\frac{d y}{d x}=\frac{1}{2}(3-y) \nonumber \]

    and then treat \(d y / d x\) as if it was a fraction to separate variables:

    \[\frac{d y}{3-y}=\frac{1}{2} d x \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,

    \[\int_{2}^{y} \frac{d y}{3-y}=\frac{1}{2} \int_{0}^{x} d x \nonumber \]

    The integrals in Equation \ref{7.5} 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{gathered} \left.-\ln (3-y)]_{2}^{y}=\frac{1}{2} x\right]_{0^{\prime}}^{x} \\ \ln (3-y)=-\frac{1}{2} x \\ 3-y=e^{-x / 2} \\ y=3-e^{-x / 2} \end{gathered} \nonumber \]

    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{d y}{d x} &=\frac{1}{2} e^{-x / 2} \\ &=\frac{1}{2}(3-y) \end{aligned} \nonumber \]

    and checking the initial condition, \(y(0)=3-e^{0}=2\). Therefore, our solution satisfies both the original ode and the initial condition.

    Example \(\PageIndex{2}\)

    Solve \(\frac{d y}{d x}+\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{d y}{3-y}=\frac{1}{2} \int_{0}^{x} d x . \nonumber \]

    Now \(y(x)>3\), so that \(y-3>0\) and integration yields

    \[\begin{gathered} \left.-\ln (y-3)]_{4}^{y}=\frac{1}{2} x\right]_{0^{\prime}}^{x} \\ \ln (y-3)=-\frac{1}{2} x \\ y-3=e^{-x / 2} \\ y=3+e^{-x / 2} \end{gathered} \nonumber \]

    Screen Shot 2022-05-29 at 8.25.26 PM.png
    Figure 7.2: Solution of the following ode: \(\frac{d y}{d x}+\frac{1}{2} y=\frac{3}{2}\).

    The solution curves for a range of initial conditions is presented in Fig. 7.2. All solutions have a horizontal asymptote at \(y=3\) at which \(d y / d x=0\). For \(y(0)=y_{0}\), the general solution can be shown to be \(y(x)=3+\left(y_{0}-3\right) \exp (-x / 2)\).

    Example \(\PageIndex{3}\)

    Solve \(\frac{d y}{d x}=\frac{2 \cos 2 x}{3+2 y}\), with \(y(0)=-1\). (i) For what values of \(x>0\) does the solution exist? (ii) 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{gathered} (3+2 y) d y=2 \cos 2 x d x \\ \int_{-1}^{y}(3+2 y) d y=2 \int_{0}^{x} \cos 2 x d x \\ \left.\left.3 y+y^{2}\right]_{-1}^{y}=\sin 2 x\right]_{0}^{x} \\ y^{2}+3 y+2-\sin 2 x=0 \\ y_{\pm}=\frac{1}{2}[-3 \pm \sqrt{1+4 \sin 2 x}] \end{gathered} \nonumber \]

    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}{l} -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

    \[y=\frac{1}{2}[-3+\sqrt{1+4 \sin 2 x}] . \nonumber \]

    To determine (i) the values of \(x>0\) for which the solution exists, we require

    \[1+4 \sin 2 x \geq 0 \nonumber \]

    or

    \[\sin 2 x \geq-\frac{1}{4} \nonumber \]

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

    To solve \(\sin 2 x=-1 / 4\) for \(x\) in the interval \(\pi / 2<x<3 \pi / 4\), one needs to recall the definition of 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 arcsin. The first solution with \(x>0\) of the equation \(\sin 2 x=-1 / 4\) places \(2 x\) in the interval \((\pi, 3 \pi / 2)\), so to invert this equation using the arcsine we need to apply the identity \(\sin (\pi-x)=\sin x\), and rewrite \(\sin 2 x=-1 / 4\) as \(\sin (\pi-2 x)=-1 / 4\). The solution of this equation may then be found by taking the arcsine, and is

    \[\pi-2 x=\arcsin (-1 / 4), \nonumber \]

    \[x=\frac{1}{2}\left(\pi+\arcsin \frac{1}{4}\right) . \nonumber \]

    Therefore the solution exists for \(0 \leq x \leq(\pi+\arcsin (1 / 4)) / 2=1.6971 \ldots\), where we have used a calculator value (computing in radians) to find \(\arcsin Equation \ref{0.25}=\) \(0.2527 \ldots\) At the value \((x, y)=(1.6971 \ldots,-3 / 2)\), the solution curve ends and \(d y / d x\) becomes infinite.

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

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


    This page titled 7.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.