3.2: Separable Equations
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.
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.
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}\]
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)\).
Solve \(\frac{dy}{dx}=\frac{2\cos 2x}{3+2y}\), with \(y(0)=-1\).
- For what values of \(x>0\) does the solution exist?
- 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.