1. Which technique do I try first?
Before you can solve a first-order ODE, you have to classify it. The four techniques below are roughly ordered by how much work they take: separable is the cheapest, substitution the most involved. The flowchart is a decision rule: walk down it and pick the first match.
Each "no" pushes you further down. In practice most ODEs you'll meet in a first course fall out at the separable or linear stage. Exact and substitution are the second tier; numerical methods are the safety net when symbolic algebra runs out of road.
2. Separable equations
An equation $\dfrac{dy}{dx} = g(x) h(y)$ in which the right side factors into a function of $x$ alone times a function of $y$ alone.
The point of separability is that the $x$ and $y$ pieces never tangle. You can move all of the $y$ to one side and all of the $x$ to the other, then integrate each side on its own:
$$ \frac{dy}{h(y)} = g(x)\, dx \quad\Longrightarrow\quad \int \frac{dy}{h(y)} \;=\; \int g(x)\, dx + C. $$That single constant $C$ is doing real work — it carries the entire family of solutions, parameterised by initial condition.
Worked example · $\dfrac{dy}{dx} = xy$
Step 1. The right side already factors as $x \cdot y$, so the equation is separable. Move $y$ to the left:
$$ \frac{dy}{y} = x\, dx. $$Step 2. Integrate both sides:
$$ \int \frac{dy}{y} = \int x\, dx \quad\Longrightarrow\quad \ln|y| = \frac{x^2}{2} + C. $$Step 3. Exponentiate and absorb the sign into the constant:
$$ y = A\, e^{x^2 / 2}, \qquad A = \pm e^C. $$Check. Differentiate: $y' = A \cdot x \cdot e^{x^2/2} = x y$. ✓
Dividing by $h(y)$ silently assumes $h(y) \neq 0$. For $y' = y^2$, separating gives $\int dy/y^2 = \int dx$, but the constant function $y \equiv 0$ also solves the equation — and you lost it the moment you divided. Always check $h(y) = 0$ as a candidate before you separate.
3. Linear first-order & the integrating factor
An equation that can be put into the form $\dfrac{dy}{dx} + P(x)\, y = Q(x)$, where $P$ and $Q$ are functions of $x$ only. The unknown $y$ appears to the first power and is not inside any other function.
This is the workhorse case. Almost every "rate plus proportional loss" model in physics, chemistry, and finance fits this template: $Q$ is the input, $P$ is the rate at which the system bleeds.
Why the integrating factor has to be $e^{\int P\,dx}$
Notice what the product rule does to $\mu(x) \cdot y$ for any differentiable $\mu$:
$$ \frac{d}{dx}\big[\mu(x)\, y\big] \;=\; \mu'(x)\, y \;+\; \mu(x)\, y'. $$Now multiply the ODE through by $\mu$:
$$ \mu\, y' + \mu\, P\, y \;=\; \mu\, Q. $$If we could just choose $\mu$ so that $\mu P = \mu'$, the left side would collapse exactly into $\frac{d}{dx}(\mu y)$ by the product rule above. So we demand:
$$ \mu'(x) \;=\; P(x)\, \mu(x). $$That's a separable equation for $\mu$ — and a friendly one. $d\mu/\mu = P\, dx$ gives $\ln|\mu| = \int P\, dx$, so
$$ \boxed{\;\mu(x) \;=\; e^{\int P(x)\, dx}.\;} $$(No constant of integration needed — any nonzero scalar multiple of $\mu$ works equally well, and the choice $C = 0$ is the simplest.) Once $\mu$ is in hand, the multiplied equation is
$$ \frac{d}{dx}\big[\mu(x)\, y\big] \;=\; \mu(x)\, Q(x), $$and you finish by integrating both sides and dividing by $\mu$:
$$ y(x) \;=\; \frac{1}{\mu(x)}\left[ \int \mu(x)\, Q(x)\, dx \;+\; C \right]. $$The integrating factor turns an awkward derivative ($y'$ tangled up with a $y$ term) into a clean derivative of a single product. You're not solving a different equation — you're rewriting the same equation in a form whose left side is visibly the derivative of something.
Worked example · $y' + 2y = e^x$
Step 1. Read off $P(x) = 2$ and $Q(x) = e^x$. The integrating factor is
$$ \mu(x) = e^{\int 2\, dx} = e^{2x}. $$Step 2. Multiply the equation by $\mu$:
$$ e^{2x} y' + 2 e^{2x} y = e^{2x} \cdot e^x \;=\; e^{3x}. $$The left side is exactly $\dfrac{d}{dx}\!\left(e^{2x}\, y\right)$, by construction. So:
$$ \frac{d}{dx}\big(e^{2x}\, y\big) \;=\; e^{3x}. $$Step 3. Integrate both sides:
$$ e^{2x}\, y \;=\; \tfrac{1}{3} e^{3x} + C. $$Step 4. Divide through by $e^{2x}$:
$$ y(x) \;=\; \tfrac{1}{3} e^{x} \;+\; C\, e^{-2x}. $$Check. $y' = \tfrac{1}{3} e^x - 2C e^{-2x}$, so $y' + 2y = \tfrac{1}{3} e^x - 2C e^{-2x} + \tfrac{2}{3} e^x + 2C e^{-2x} = e^x$. ✓
4. Exact equations
Write the ODE in differential form:
$$ M(x, y)\, dx \;+\; N(x, y)\, dy \;=\; 0. $$If — and this is a real "if" — there exists a function $\Psi(x, y)$ such that
$$ \frac{\partial \Psi}{\partial x} = M, \qquad \frac{\partial \Psi}{\partial y} = N, $$then the differential form is literally $d\Psi = 0$, and the implicit solution is just $\Psi(x, y) = C$. We say the equation is exact.
The test: does $\Psi$ exist?
By Clairaut's theorem, mixed partials of a smooth $\Psi$ agree: $\Psi_{xy} = \Psi_{yx}$. So if the equation is exact, then
$$ \frac{\partial M}{\partial y} \;=\; \frac{\partial N}{\partial x}. $$On a simply connected region, the converse also holds — the equality of these partials is both necessary and sufficient for $\Psi$ to exist. So that one check decides the whole game.
Reconstructing $\Psi$
Once you've confirmed exactness, build $\Psi$ in two passes:
- Integrate $M$ with respect to $x$, treating $y$ as constant. The "constant" of integration is an unknown function $g(y)$: $$ \Psi(x, y) = \int M(x, y)\, dx + g(y). $$
- Differentiate the result with respect to $y$ and set it equal to $N$. That pins down $g'(y)$, which you integrate to recover $g$.
Worked example · $(2x + y)\, dx + (x + 2y)\, dy = 0$
Step 1. Read off $M = 2x + y$, $N = x + 2y$. Check exactness:
$$ M_y = 1, \qquad N_x = 1. \quad\checkmark $$Step 2. Integrate $M$ with respect to $x$:
$$ \Psi(x, y) = \int (2x + y)\, dx = x^2 + xy + g(y). $$Step 3. Differentiate with respect to $y$ and match $N$:
$$ \Psi_y = x + g'(y) \stackrel{!}{=} x + 2y \quad\Longrightarrow\quad g'(y) = 2y \quad\Longrightarrow\quad g(y) = y^2. $$Step 4. Assemble:
$$ \Psi(x, y) \;=\; x^2 + xy + y^2 \;=\; C. $$That implicit relation is the family of solutions. (You usually leave it implicit — solving for $y$ here would mean using the quadratic formula and choosing a branch.)
If $M_y \neq N_x$, you're not stuck — sometimes a factor $\mu(x, y)$ multiplied through makes the equation exact. When $(M_y - N_x)/N$ depends only on $x$, an integrating factor $\mu(x)$ exists, and you find it by solving $\mu'/\mu = (M_y - N_x)/N$. This is the same idea as the linear case, generalised.
5. Substitution: homogeneous-type & Bernoulli
Sometimes the equation isn't separable, linear, or exact — but a clever change of variables turns it into one of those. Two substitutions cover most of the cases you'll meet.
Homogeneous-type · $y' = f(y/x)$
If the right side depends only on the ratio $y/x$, substitute $v = y/x$, so $y = v x$ and
$$ y' = v + x\, v'. $$The equation becomes $v + x v' = f(v)$, i.e. $x v' = f(v) - v$, which is now separable in $v$ and $x$.
Worked example · $\dfrac{dy}{dx} = \dfrac{x^2 + y^2}{x y}$
Step 1. Divide numerator and denominator by $x^2$ to expose the ratio:
$$ \frac{dy}{dx} \;=\; \frac{1 + (y/x)^2}{y/x}. $$So the equation is homogeneous-type with $f(v) = (1 + v^2)/v = 1/v + v$.
Step 2. Substitute $y = vx$, $y' = v + x v'$:
$$ v + x v' \;=\; \frac{1}{v} + v \quad\Longrightarrow\quad x v' \;=\; \frac{1}{v}. $$Step 3. Separate and integrate:
$$ v\, dv = \frac{dx}{x} \quad\Longrightarrow\quad \frac{v^2}{2} \;=\; \ln|x| + C. $$Step 4. Back-substitute $v = y/x$:
$$ \frac{y^2}{2 x^2} \;=\; \ln|x| + C \quad\Longrightarrow\quad y^2 \;=\; 2 x^2 \big(\ln|x| + C\big). $$Bernoulli · $y' + P(x)\, y = Q(x)\, y^n$
This is "linear, but for the rogue $y^n$ on the right." For $n \neq 0, 1$, the substitution
$$ v = y^{1-n} $$linearises it. The chain rule gives $v' = (1 - n)\, y^{-n}\, y'$, so dividing the original equation by $y^n$ and rewriting in terms of $v$ produces a linear ODE in $v$, which you solve with an integrating factor.
Worked example · $y' + y = x\, y^2$
Step 1. Here $n = 2$, so substitute $v = y^{1-2} = y^{-1}$. Then
$$ v' = -y^{-2}\, y' \quad\Longrightarrow\quad y' = -y^2\, v'. $$Step 2. Divide the original equation by $y^2$ and rewrite:
$$ \frac{y'}{y^2} + \frac{1}{y} \;=\; x \quad\Longrightarrow\quad -v' + v \;=\; x \quad\Longrightarrow\quad v' - v \;=\; -x. $$This is linear in $v$.
Step 3. Solve with integrating factor $\mu = e^{-x}$. Multiplying through:
$$ \frac{d}{dx}\!\left(e^{-x}\, v\right) \;=\; -x\, e^{-x}. $$Integration by parts on the right gives $\int -x e^{-x}\, dx = x e^{-x} + e^{-x} + C_1$, so
$$ e^{-x}\, v \;=\; x e^{-x} + e^{-x} + C_1 \quad\Longrightarrow\quad v \;=\; x + 1 + C_1\, e^{x}. $$Step 4. Back-substitute $y = 1/v$:
$$ y \;=\; \frac{1}{x + 1 + C_1\, e^{x}}. $$6. When all else fails: Euler's method
Most first-order ODEs from real models don't fit any of the templates above. When the equation refuses to be solved symbolically, you settle for an approximation — numerically march forward from the initial condition in small steps. The simplest such scheme is Euler's method.
Given $y' = f(x, y)$ with $y(x_0) = y_0$, choose a step size $h$ and iterate:
$x_{n+1} = x_n + h, \qquad y_{n+1} = y_n + h \cdot f(x_n, y_n).$
Each step uses the slope at the current point to estimate where the solution will be one step ahead.
One step, worked
Consider $y' = x + y$ with $y(0) = 1$. Take $h = 0.1$. The slope at $(0, 1)$ is $f(0, 1) = 0 + 1 = 1$, so
$$ y_1 = y_0 + h \cdot f(x_0, y_0) = 1 + 0.1 \cdot 1 = 1.1, \qquad x_1 = 0.1. $$That's the next point on the approximate solution curve. Repeat: at $(0.1, 1.1)$ the slope is $0.1 + 1.1 = 1.2$, so $y_2 = 1.1 + 0.1 \cdot 1.2 = 1.22$. Keep going.
Euler's method has global error proportional to $h$ — halve the step, halve the error. That's mediocre. Production-grade ODE solvers (Runge–Kutta 4, adaptive RK45, implicit methods for stiff systems) achieve far better accuracy for the same work. Euler matters as the conceptual prototype: every more sophisticated method is a refinement of "look at the slope, take a step."
7. Common pitfalls
The single most expensive mistake is reaching for the wrong technique. Always rewrite the ODE in standard form ($y' = \ldots$ or $M\, dx + N\, dy = 0$) before classifying, and walk the flowchart in order — separable first, then linear, then exact, then substitution.
The integrating factor for $y' + P y = Q$ is $\mu = e^{\int P\, dx}$, not $e^{\int Q\, dx}$. $P$ is the coefficient of $y$; $Q$ is the forcing term. Mixing them gives an entirely wrong $\mu$ that doesn't make the left side a clean derivative.
Every indefinite integral introduces a $+C$. Drop it on the linear-equation step and you'll get one particular solution instead of the whole family. The single constant is what lets you fit an initial condition later.
Separating by dividing through by $h(y)$ silently throws out any $y$ where $h(y) = 0$ — but those constant functions can themselves be solutions. For $y' = y^2$, $y \equiv 0$ is a perfectly good solution that dividing by $y^2$ erases. Check $h = 0$ as a candidate before separating.
The substitution $v = y^{1-n}$ assumes $n \neq 0, 1$. When $n = 0$, the equation is already linear; when $n = 1$, it collapses to $y' = (Q - P) y$, which is separable. Both edge cases are easier than the substitution would be — don't reach for a hammer when the problem isn't a nail.