7C

Separable differential equations

Solving separable differential equations dy/dx = f(x)g(y) by separating the variables and integrating both sides, finding constant solutions first, handling absolute values, and using initial conditions.

A huge number of real models, from population growth to draining tanks, have the gradient split into an "$x$ part" times a "$y$ part". These separable equations are the main type you solve exactly in this course, and the method is short: get all the $y$ on one side, all the $x$ on the other, and integrate.

The method

Why does this work? If $\dfrac{1}{g(y)}\dfrac{dy}{dx} = f(x)$, integrate both sides with respect to $x$. By the chain rule (substitution in reverse), $\displaystyle\int \frac{1}{g(y)}\frac{dy}{dx}\,dx = \int \frac{dy}{g(y)}$.

Example 1●●

Solve $\dfrac{dy}{dx} = 2xy$, given $y = 3$ when $x = 0$.

Constant solution $y = 0$ (not the one we want).
g(y) = y is zero at y = 0, so y = 0 is a constant solution. It doesn't pass through (0, 3), so we can assume y ≠ 0.
$\displaystyle\int \frac{dy}{y} = \int 2x\,dx$, so $\ln|y| = x^2 + C$.
Divide by y, then integrate.
$|y| = e^C e^{x^2}$, so $y = Ae^{x^2}$.
Exponentiate. e^C is a positive constant; the ± from the absolute value can be absorbed into a single constant A.
$A = 3$, so $y = 3e^{x^2}$.
Substitute (0, 3).

More examples

Example 2●●

Solve $\dfrac{dy}{dx} = \dfrac{x}{y}$, given $y = 2$ when $x = 0$.

$\displaystyle\int y\,dy = \int x\,dx$, so $\dfrac{y^2}{2} = \dfrac{x^2}{2} + C$.
Multiply both sides by y.
$C = 2$, so $y^2 = x^2 + 4$.
At (0, 2): 2 = 0 + C.
$y = \sqrt{x^2 + 4}$
Choose the root that passes through the initial point, where y is positive.
Example 3●●●

Solve $\dfrac{dy}{dx} = e^{x - y}$, given $y = \ln3$ when $x = 0$.

$\dfrac{dy}{dx} = e^x e^{-y}$, so $\displaystyle\int e^y\,dy = \int e^x\,dx$.
Index laws split the right side into an x part and a y part.
$e^y = e^x + C$. At $x = 0$: $3 = 1 + C$, so $C = 2$.
$y = \ln(e^x + 2)$
Example 4●●

Find the general solution of $\dfrac{dy}{dx} = x(1 + y^2)$.

$\displaystyle\int \frac{dy}{1 + y^2} = \int x\,dx$
1 + y² is never zero, so there are no constant solutions.
$\tan^{-1}y = \dfrac{x^2}{2} + C$, so $y = \tan\left(\dfrac{x^2}{2} + C\right)$.
The left side is a standard inverse tan integral from 5D.

Your turn

Solve $\dfrac{dy}{dx} = y\cos x$, given $y = 2$ when $x = 0$.

Show the working

$\displaystyle\int \frac{dy}{y} = \int \cos x\,dx$, so $\ln|y| = \sin x + C$ and $y = Ae^{\sin x}$. At $x = 0$: $2 = Ae^0$, so $A = 2$ and $y = 2e^{\sin x}$.

Flashcards
Separable DE
$\dfrac{dy}{dx} = f(x)g(y)$, solved by $\displaystyle\int \frac{dy}{g(y)} = \int f(x)\,dx$.
Before dividing by $g(y)$
Check for constant solutions where $g(y) = 0$.
$ln|y| = h(x) + C$ becomes
$y = Ae^{h(x)}$
Practice
  1. Which differential equation is separable?

  2. Solve $\dfrac{dy}{dx} = 3x^2y$ with $y = 2$ when $x = 0$. Find $y$ when $x = 1$, correct to $2$ decimal places.

  3. Solve $\dfrac{dy}{dx} = \dfrac{x}{y}$ with $y = 3$ when $x = 0$. Find $y$ when $x = 4$.

  4. Separating the variables in $\dfrac{dy}{dx} = \dfrac{1 + y^2}{x}$ gives:

  5. Solve $\dfrac{dy}{dx} = e^{x - y}$ with $y = \ln2$ when $x = 0$. Find $y$ when $x = 1$, correct to $2$ decimal places.

  6. Find the constant solution of $\dfrac{dy}{dx} = x(y - 4)$.

  7. Solve $\dfrac{dy}{dx} = x(1 + y^2)$ with $y = 0$ when $x = 0$. Find $y$ when $x = 1$, correct to $2$ decimal places.

  8. From $\ln|y| = 2x + C$, the general solution is:

  9. Exam style: solve $\dfrac{dy}{dx} = \dfrac{y^2}{x^2}$ with $y = \tfrac12$ when $x = 1$. Find $y$ when $x = 3$.

  10. Exam style: water drains from a tank so that its depth $h$ (cm) satisfies $\dfrac{dh}{dt} = -0.5\sqrt h$, with $h = 16$ at $t = 0$. When is the tank empty?

Formula sheet