---
title: Separable and Exact Equations
module: First-Order Equations
moduleNumber: 2
lessonNumber: 2
order: 202
summary: >
  Two nonlinear first-order classes solve by direct integration. A separable
  equation splits so that each variable can be integrated on its own side, giving
  an implicit relation. An exact equation is the total differential of a hidden
  potential function, recognized by a symmetry test on its coefficients; when the
  test fails, an integrating factor can sometimes restore exactness. A change of
  variable brings homogeneous equations into the separable class.
topics: [First-Order Equations]
draft: false
sources:
  - book: Boyce
    ref: "§2.2 Separable Differential Equations; §2.6 Exact Differential Equations and Integrating Factors"
  - book: Simmons
    ref: "Ch. 2 §8 Exact Equations; §9 Integrating Factors; §7 Homogeneous Equations"
---

Outside the linear class, no single method solves every first-order equation. Two
important families are solved by direct integration: **separable** equations, in
which the two variables can be separated onto opposite sides, and **exact**
equations, which are the differential of a hidden function. Both produce solutions defined _implicitly_, by
a relation $F(x,y) = c$ rather than a formula $y = \phi(x)$, and pulling out an
explicit solution is often impossible. The independent variable is written $x$
throughout.

## Separable equations

Write the general first-order equation $\frac{\d y}{\d x} = f(x,y)$ in the symmetric
form

$$
M(x,y) + N(x,y)\,\frac{\d y}{\d x} = 0,
$$

which is always possible by taking $M = -f$ and $N = 1$. The equation is
**separable** when $M$ depends on $x$ alone and $N$ on $y$ alone, so it reads
$M(x) + N(y)\,\frac{\d y}{\d x} = 0$, or in differential form

$$
M(x)\,\d x + N(y)\,\d y = 0.
$$

> **Definition (Separable equation).** A first-order equation is separable if it
> can be written $M(x)\,\d x + N(y)\,\d y = 0$, with each coefficient a function of a
> single variable. Its solutions satisfy $H_1(x) + H_2(y) = c$, where $H_1' = M$
> and $H_2' = N$.

The justification is the chain rule. If $H_1$ and $H_2$ are antiderivatives of $M$
and $N$, then $M(x) + N(y)\,y' = H_1'(x) + H_2'(y)\,y' = \frac{\d}{\d x}\big[H_1(x) +
H_2(y)\big]$, so the equation says this total derivative is zero and
$H_1(x) + H_2(y) = c$. In practice one integrates the $x$-term against $\d x$ and the
$y$-term against $\d y$ and adds a single constant.

> **Worked example.** Solve $\frac{\d y}{\d x} = \frac{x^2}{1 - y^2}$.
> Cross-multiplying, $(1 - y^2)\,\d y = x^2\,\d x$, and integrating each side gives
> $y - \tfrac{1}{3}y^3 = \tfrac{1}{3}x^3 + c$, or after clearing denominators
>
> $$
> -x^3 + 3y - y^3 = c.
> $$
>
> Each value of $c$ names one **integral curve**. The curve through a chosen point
> $(x_0, y_0)$ is found by substituting to fix $c$. The relation cannot be solved
> for $y$ in elementary terms, so it stands as the answer.

$$
% caption: Integral curves of a separable equation are level sets F(x,y)=c of the
% first integral; each constant picks out one curve, and the curve through a given
% point fixes the constant.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=0.95]
  \definecolor{acc}{HTML}{4A6FA5}
  \draw[->, black] (-2.6,0) -- (2.6,0) node[right] {$x$};
  \draw[->, black] (0,-2.4) -- (0,2.4) node[above] {$y$};
  % several nested level curves (schematic closed-ish loops via ellipses/rotated)
  \draw[black, thick] (0,0) ellipse (0.7 and 1.4);
  \draw[black, thick] (0,0) ellipse (1.25 and 1.95);
  \draw[black, thick] (0,0) ellipse (1.85 and 2.3);
  % selected curve
  \draw[acc, very thick] (0,0) ellipse (1.0 and 1.7);
  \fill[acc] ({1.0*cos(50)},{1.7*sin(50)}) circle (2pt);
  \node[acc, anchor=south west] at ({1.0*cos(50)},{1.7*sin(50)}) {($x_0$, $y_0$)};
  \node[black, anchor=west] at (1.9,-1.6) {$F(x$, $y) = c$};
\end{tikzpicture}
$$

> **Worked example.** Solve $\frac{\d y}{\d x} = \frac{3x^2 + 4x + 2}{2(y-1)}$
> with $y(0) = -1$. Separating, $2(y-1)\,\d y = (3x^2 + 4x + 2)\,\d x$, and
> integrating,
>
> $$
> y^2 - 2y = x^3 + 2x^2 + 2x + c.
> $$
>
> The condition $y(0) = -1$ gives $c = 3$. This relation is quadratic in $y$, so it
> can be solved explicitly: completing the square,
> $y = 1 - \sqrt{x^3 + 2x^2 + 2x + 4}$, where the minus sign is forced by the
> initial value. The solution exists only where the radicand is positive. Its
> single real root is $x = -2$, so the interval is $x > -2$; at $x = -2$ the
> tangent line is vertical and the solution stops. Unlike the linear case, this
> boundary comes from the solution itself, not from any discontinuity in the
> equation.

**Constant solutions.** A separable equation $\frac{\d y}{\d x} = f(x,y)$ may have a
constant solution $y = y_0$ whenever $f(x, y_0) = 0$ for all $x$. Separating the
variables requires dividing by such a factor, which can drop these solutions; they
must be restored by inspection. For $\frac{\d y}{\d x} = \frac{(y-3)\cos x}{1 + 2y^2}$,
the constant $y = 3$ is a solution that separation would discard.

## Homogeneous equations by substitution

A first-order equation is **homogeneous** when the right side depends only on the
ratio $y/x$:

$$
\frac{\d y}{\d x} = F\!\left(\frac{y}{x}\right).
$$

This is not separable as written, but the substitution $v = y/x$, i.e. $y = x v$,
makes it so.[^simmons-hom] Then $\frac{\d y}{\d x} = v + x\frac{\d v}{\d x}$, and the
equation becomes

$$
v + x\,\frac{\d v}{\d x} = F(v)
\qquad\Longrightarrow\qquad
\frac{\d v}{F(v) - v} = \frac{\d x}{x},
$$

which is separable in $v$ and $x$. Integrate, then replace $v$ by $y/x$ to recover
the solution. Because the slope depends only on $y/x$, the direction field is
constant along each ray through the origin, and the integral curves are symmetric
about it.

$$
% caption: The homogeneous substitution converts an equation whose slope depends
% only on y/x into a separable equation in v and x; solving and back-substituting
% returns the answer.
\begin{tikzpicture}[>=stealth, font=\footnotesize,
  box/.style={draw, minimum width=40mm, minimum height=11mm, align=center}]
  \definecolor{acc}{HTML}{4A6FA5}
  \node[box] (a) at (0,0) {$\dfrac{dy}{dx} = F(\tfrac{y}{x})$};
  \node[box] (b) at (0,-1.6) {set $v = \tfrac{y}{x}$, so $y = xv$};
  \node[box, draw=acc, text=acc] (c) at (0,-3.2) {now separable in $v$ and $x$};
  \node[box] (d) at (0,-4.8) {integrate, then restore $v = \tfrac{y}{x}$};
  \draw[->, acc, thick] (a) -- (b);
  \draw[->, acc, thick] (b) -- (c);
  \draw[->, acc, thick] (c) -- (d);
\end{tikzpicture}
$$

> **Worked example.** Solve $\dfrac{\d y}{\d x} = \dfrac{x^2 + xy + y^2}{x^2}$.
> The right side is $1 + \tfrac{y}{x} + (\tfrac{y}{x})^2$, a function of $y/x$
> alone. Set $v = y/x$, so $y = xv$ and $y' = v + x\,v'$. Substituting,
>
> $$
> v + x\,\frac{\d v}{\d x} = 1 + v + v^2
> \qquad\Longrightarrow\qquad
> x\,\frac{\d v}{\d x} = 1 + v^2.
> $$
>
> This is separable. Dividing and integrating,
>
> $$
> \int \frac{\d v}{1 + v^2} = \int \frac{\d x}{x}
> \qquad\Longrightarrow\qquad
> \arctan v = \ln|x| + c.
> $$
>
> Replacing $v$ by $y/x$ gives the implicit solution
>
> $$
> \arctan\!\frac{y}{x} = \ln|x| + c.
> $$

$$
% caption: For a homogeneous equation the slope depends only on y/x, so the
% direction field repeats identically along every ray from the origin; each
% integral curve meets a given ray at the same inclination.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
  \definecolor{acc}{HTML}{4A6FA5}
  \draw[->, black] (-2.9,0) -- (2.9,0) node[right] {$x$};
  \draw[->, black] (0,-2.3) -- (0,2.7) node[above] {$y$};
  \foreach \a in {28,58,120,152} {
    \draw[black] (0,0) -- (\a:2.7);
    \foreach \r in {0.9,1.6,2.3} {
      \draw[acc, thick]
        ({\r*cos(\a) - 0.26*cos(\a+40)},{\r*sin(\a) - 0.26*sin(\a+40)})
        -- ({\r*cos(\a) + 0.26*cos(\a+40)},{\r*sin(\a) + 0.26*sin(\a+40)});
    }
  }
  \node[black, anchor=west] at (0.35,-1.85) {slope constant on each ray};
\end{tikzpicture}
$$

The related **Bernoulli equation** $y' + p(t)\,y = q(t)\,y^n$ is nonlinear but
linearizes under $v = y^{1-n}$ for $n \neq 0, 1$, a substitution Leibniz found in
1696; it returns to the
[integrating-factor method](/differential-equations/first-order/linear-first-order-integrating-factors).

## Exact equations

Return to the symmetric form $M(x,y) + N(x,y)\,y' = 0$ with both coefficients now
depending on _both_ variables. Suppose there is a function $\psi(x,y)$ whose
partial derivatives are exactly $M$ and $N$:

$$
\frac{\partial \psi}{\partial x} = M(x,y),
\qquad
\frac{\partial \psi}{\partial y} = N(x,y).
$$

Then, by the chain rule,
$M + N y' = \psi_x + \psi_y\,y' = \frac{\d}{\d x}\psi\big(x, \phi(x)\big)$, so the
equation reads $\frac{\d}{\d x}\psi(x,y) = 0$ and its solutions are the level curves

$$
\psi(x,y) = c.
$$

> **Definition (Exact equation).** The equation $M(x,y) + N(x,y)\,y' = 0$ is exact
> on a region $R$ if there is a **potential function** $\psi(x,y)$ with
> $\psi_x = M$ and $\psi_y = N$. Its solutions are the level curves
> $\psi(x,y) = c$.

For $2x + y^2 + 2xy\,y' = 0$, the function $\psi = x^2 + x y^2$ has
$\psi_x = 2x + y^2 = M$ and $\psi_y = 2xy = N$, so the equation is exact and its
solutions are $x^2 + x y^2 = c$. The trouble is recognizing $\psi$ when it is less
obvious. A symmetry test settles when one exists.

> **Theorem (Exactness test).** Let $M$, $N$, $M_y$, $N_x$ be continuous on a
> rectangle $R$. Then $M(x,y) + N(x,y)\,y' = 0$ is exact on $R$ if and only if
>
> $$
> \frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}
> \quad\text{at every point of } R.
> $$

One direction is immediate: if $\psi_x = M$ and $\psi_y = N$, then
$M_y = \psi_{xy}$ and $N_x = \psi_{yx}$, and continuity forces the mixed partials
to agree. The converse is constructive and gives the solution method.[^boyce-26]

$$
% caption: The exactness test compares the two mixed partials $M_y = \partial
% M/\partial y$ and $N_x = \partial N/\partial x$; equality across the region
% certifies a potential exists, inequality rules it out until a factor is applied.
\begin{tikzpicture}[>=stealth, font=\footnotesize,
  cell/.style={draw, minimum width=30mm, minimum height=14mm, align=center}]
  \definecolor{acc}{HTML}{4A6FA5}
  \node[cell, draw=acc] (m) at (0,0) {$M_y$};
  \node[cell, draw=acc] (n) at (4,0) {$N_x$};
  \node at (2,0) {$=\,?$};
  \node[align=center, black] at (2,-1.5) {equal: exact\\unequal: f\/ind a factor};
\end{tikzpicture}
$$

**Recovering the potential.** Once $M_y = N_x$ confirms exactness, integrate
$\psi_x = M$ in $x$, keeping an arbitrary _function_ of $y$ in place of a constant:

$$
\psi(x,y) = \int M(x,y)\,\d x + h(y).
$$

Differentiate in $y$ and set the result equal to $N$, which determines $h'(y)$; the
exactness condition guarantees $h'$ comes out a function of $y$ alone. Integrate
$h$ and assemble $\psi$.

For $(y\cos x + 2x e^y) + (\sin x + x^2 e^y - 1)\,y' = 0$, the test gives
$M_y = \cos x + 2x e^y = N_x$, so it is exact. Integrating $M$ in $x$,

$$
\psi = y\sin x + x^2 e^y + h(y),
\qquad
\psi_y = \sin x + x^2 e^y + h'(y) = N,
$$

which forces $h'(y) = -1$, so $h(y) = -y$. The solutions are

$$
y\sin x + x^2 e^y - y = c.
$$

Geometrically, the solution curves lie at constant height on the surface
$z = \psi(x,y)$; each level $c$ is one integral curve.

$$
% caption: An exact equation traces level curves of a potential surface z = psi;
% each contour holds psi constant, so a solution curve is a path of unchanging
% height.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=0.95]
  \definecolor{acc}{HTML}{4A6FA5}
  \draw[->, black] (-2.6,0) -- (2.6,0) node[right] {$x$};
  \draw[->, black] (0,-2.2) -- (0,2.2) node[above] {$y$};
  % contour set: nested rounded contours
  \foreach \s in {0.55,1.0,1.5,2.05}
    \draw[black, thick] plot[domain=0:360, samples=80]
      ({\s*cos(\x)*1.15},{\s*sin(\x)*0.85 + 0.12*\s*cos(2*\x)});
  \draw[acc, very thick] plot[domain=0:360, samples=80]
    ({1.25*cos(\x)*1.15},{1.25*sin(\x)*0.85 + 0.12*1.25*cos(2*\x)});
  \node[acc, anchor=west] at (1.7,1.55) {height $= c$};
  \node[black, anchor=west] at (1.5,-1.9) {level curves};
\end{tikzpicture}
$$

## Integrating factors that restore exactness

When $M_y \neq N_x$ the equation is not exact, but multiplying by a factor
$\mu(x,y)$ may make it so, exactly as with linear equations. The product
$\mu M + \mu N y' = 0$ is exact when $(\mu M)_y = (\mu N)_x$, which expands to the
partial differential equation

$$
M\,\mu_y - N\,\mu_x + (M_y - N_x)\,\mu = 0.
$$

In general this is as hard as the original equation. It becomes tractable when
$\mu$ depends on one variable only. If $\dfrac{M_y - N_x}{N}$ is a function of $x$
alone, call it $R(x)$, then $\mu$ depends on $x$ alone and satisfies the separable,
linear equation

$$
\frac{\d\mu}{\d x} = R(x)\,\mu,
\qquad
\mu(x) = \exp\!\left(\int R(x)\,\d x\right).
$$

A symmetric test in $y$ handles factors depending only on $y$: if
$\dfrac{N_x - M_y}{M}$ is a function of $y$ alone, an integrating factor
$\mu(y) = \exp\!\big(\int \frac{N_x - M_y}{M}\,\d y\big)$ exists.

> **Worked example.** The equation $(3xy + y^2) + (x^2 + xy)\,y' = 0$ has
> $M_y = 3x + 2y$ and $N_x = 2x + y$, so it is not exact. But
>
> $$
> \frac{M_y - N_x}{N} = \frac{(3x + 2y) - (2x + y)}{x^2 + xy} = \frac{x + y}{x(x+y)} = \frac{1}{x},
> $$
>
> a function of $x$ alone. Then $\mu' = \mu/x$ gives $\mu = x$. Multiplying through,
>
> $$
> (3x^2 y + x y^2) + (x^3 + x^2 y)\,y' = 0,
> $$
>
> which is exact, with potential $\psi = x^3 y + \tfrac{1}{2}x^2 y^2$. The
> solutions are $x^3 y + \tfrac{1}{2}x^2 y^2 = c$. Integrating factors are not
> unique: a second factor $\mu = 1/[xy(2x+y)]$ solves the same equation, with more
> effort.

The four methods so far cover most first-order equations that yield closed-form
solutions.

| Class | Recognized by | Method | Solution form |
| --- | --- | --- | --- |
| Linear | $y' + p(x)y = g(x)$ | integrating factor $e^{\int p}$ | explicit $y = \phi(x)$ |
| Separable | $M(x)\,\d x + N(y)\,\d y = 0$ | integrate each side | implicit $H_1 + H_2 = c$ |
| Exact | $M_y = N_x$ | recover potential $\psi$ | implicit $\psi = c$ |
| Homogeneous | $y' = F(y/x)$ | substitute $v = y/x$ | back-substituted implicit |

## Summary

- A **separable** equation splits into $M(x)\,\d x + N(y)\,\d y = 0$ and integrates
  side by side into an implicit first integral; watch for constant solutions lost
  in the split, and read the interval of existence off the solution.
- An **exact** equation is $\d\psi = 0$ for a potential $\psi$, certified by
  $M_y = N_x$; recover $\psi$ by integrating $M$ in $x$ and matching $N$.
- When exactness fails, an **integrating factor** in one variable can restore it,
  found by testing whether $(M_y - N_x)/N$ or $(N_x - M_y)/M$ depends on a single
  variable.
- The **homogeneous** substitution $v = y/x$ moves an equation into the separable
  class.

These direct methods run out quickly; most first-order equations admit no
elementary solution at all.

[^simmons-hom]: **Simmons**, _Differential Equations_, Ch. 2 §7 — Homogeneous Equations: the substitution $y = vx$ reducing a ratio-dependent slope to a separable equation. The exact-equation and integrating-factor development follows §8–§9.
[^boyce-26]: **Boyce**, _Elementary Differential Equations_, §2.6 — Exact Differential Equations: Theorem 2.6.1 (the $M_y = N_x$ criterion) with the constructive recovery of $\psi$, and the reduction of the integrating-factor PDE to a single-variable ODE. Separable equations follow §2.2.
