Separation of Variables

by Justin Skycak on

The simplest differential equations can be solved by separation of variables, in which we move the derivative to one side of the equation and take the antiderivative.

This post is a chapter in the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Separation of Variables. Justin Math: Calculus. https://justinmath.com/separation-of-variables/


In differential equations, we are given an equation in terms of the derivative(s) of some function, and we need to solve for the function that makes the equation true.

For example, a simple differential equation is $y’=2x$, and its solution is just the antiderivative $y=x^2+C$.

$\begin{align*} y' &= 2x \\ (x^2+C)' &= 2x \\ 2x &= 2x \end{align*}$


The simplest differential equations can be solved by separation of variables, in which we move the derivative to one side of the equation and take the antiderivative.

$\begin{align*} 3y' + \cos x &= 6x^2 + y' \\ 2y' + \cos x &= 6x^2 \\ 2y' &= 6x^2 - \cos x \\ y' &= 3x^2 - \frac{1}{2} \cos x \\ y &= \int 3x^2 - \frac{1}{2}\cos x \, dx \\ y&= x^3 - \frac{1}{2} \sin x + C \end{align*}$


Equations with a Higher-Order Derivative

This method can be used to solve simple equations with higher-order derivatives, as well.

$\begin{align*} y''' + x &= 1 \\ y''' &= -x + 1 \\ y'' &= \int -x+1 \, dx \\ y'' &= -\frac{1}{2}x^2 + x + C_1 \\ y' &= \int -\frac{1}{2}x^2 + x + C_1 \, dx \\ y' &= -\frac{1}{6}x^3 + \frac{1}{2}x^2 + C_1 x + C_2 \\ y &= \int -\frac{1}{6}x^3 + \frac{1}{2}x^2 + C_1 x + C_2 \, dx \\ y &= -\frac{1}{24}x^4 + \frac{1}{6}x^3 + C_1 x^2 + C_2 x + C_3 \end{align*}$


Note that, although the antiderivative of $C_1$ is $\frac{C_1}{2}x^2$, the term $\frac{C_1}{2}$ is itself just a constant: $\frac{C_1}{2}x^2$ just means any constant multiplied by $x^2$. But $C_1 x^2$ also means any constant multiplied by $x^2$, so writing the fraction in $\frac{C_1}{2}x^2$ is redundant. To keep the notation simple and free of redundancy, we just write $C_1 x^2$.

Equations with Both Function and Derivative

When differential equations contain $y$ terms as well as $y’$ terms, we can still separate variables by using the differential notation for the derivative and treating it as a fraction.

$\begin{align*} y' y &= x \\ \frac{dy}{dx}y &= x \\ dy \, y &= x \, dx \\ y \, dy &= x \, dx \\ \int y \, dy &= \int x\, dx \\ \frac{1}{2}y^2 &= \frac{1}{2} x^2 + C \\ y^2 &= x^2 + C \\ y &= \pm \sqrt{x^2 + C} \end{align*}$


Even differential equations that contain two different variables multiplied together can sometimes be solved by separation of variables.

$\begin{align*} y' e^y \cos^2x &= 1 \\ y' e^y &= \sec^2 x \\ \frac{dy}{dx}e^y &= \sec^2 x \\ dy \, e^y &= \sec^2 x \, dx \\ e^y \, dy &= \sec^2 x \, dx \\ \int e^y \, dy &= \int \sec^2 x \, dx \\ e^y &= \tan x + C \\ y &= \ln ( \tan x + C) \end{align*}$


But other times, there is no way to separate the variables from each other completely. We will learn more advanced methods to solve such non-separable differential equations in the coming chapters.

$\begin{align*} y' + y &= x \\ \frac{dy}{dx} + y &= x \\ dy + y \, dx &= x \, dx \\ \mbox{(unable to} &\mbox{ separate)} \end{align*}$


Exercises

Solve the following differential equations using separation of variables. (You can view the solution by clicking on the problem.)

$\begin{align*} 1) \hspace{.5cm} y'=4 \end{align*}$
Solution:
$\begin{align*} y=4x+C \end{align*}$


$\begin{align*} 2) \hspace{.5cm} 3y'=x^2 \end{align*}$
Solution:
$\begin{align*}y=\frac{1}{9}x^3+C \end{align*}$


$\begin{align*} 3) \hspace{.5cm} y'=x(1+xy') \end{align*}$
Solution:
$\begin{align*} y=-\frac{1}{2} \ln (x^2-1) + C \end{align*}$


$\begin{align*} 4) \hspace{.5cm} \left( \frac{y'}{x} \right)^3 = \sin^3(x^2) \end{align*}$
Solution:
$\begin{align*} y= -\frac{1}{2} \cos x^2 + C \end{align*}$


$\begin{align*} 5) \hspace{.5cm} y'y = \sin x \end{align*}$
Solution:
$\begin{align*} y= \pm \sqrt{C - 2\cos x} \end{align*}$


$\begin{align*} 6) \hspace{.5cm} y'y = \frac{1}{x}-y' \end{align*}$
Solution:
$\begin{align*} y=-1 \pm \sqrt{C + 2 \ln x} \end{align*}$


$\begin{align*} 7) \hspace{.5cm} (y+1)(1-xe^x) = xy' \end{align*}$
Solution:
$\begin{align*} y=xe^{C-e^x}-1 \end{align*}$


$\begin{align*} 8) \hspace{.5cm} y' \cos y = x \sin y \end{align*}$
Solution:
$\begin{align*} y=\sin^{-1} \left( e^{\frac{1}{2}x^2+C} \right)\end{align*}$


$\begin{align*} 9) \hspace{.5cm} y'' - 4e^{2x} = e^x \end{align*}$
Solution:
$\begin{align*} y= e^x+e^{2x}+C_1x+C_2 \end{align*}$


$\begin{align*} 10) \hspace{.5cm} y''' + \cos x = x \end{align*}$
Solution:
$\begin{align*} y=\frac{1}{24}x^4+\sin x + C_1x^2 + C_2 x + C_3 \end{align*}$



This post is a chapter in the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Separation of Variables. Justin Math: Calculus. https://justinmath.com/separation-of-variables/