Differential Equations

First-Order Differential Equations

Five types, five recipes — identify, then solve

A first-order ODE relates a function y(x) to its first derivative y'(x) but no higher. Five canonical types — separable, linear, exact, Bernoulli, and Riccati — cover the bulk of solvable cases, and each has its own recipe: separation of variables, integrating factors, exactness check, or substitution. Half of solving an ODE is identifying its type.

  • General formy' = f(x, y)
  • Separabley' = g(x) h(y)
  • Lineary' + p(x) y = q(x)
  • Exact test∂M/∂y = ∂N/∂x
  • Initial value problemy(x₀) = y₀

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

What a first-order ODE is

An ordinary differential equation is an equation involving an unknown function and its derivatives. "First-order" means only the first derivative appears. The most general form is

y' = f(x, y).

You can read this geometrically: at every point (x, y), the equation prescribes a slope f(x, y). Drawing those slopes as little dashes is a slope field — and a solution is any curve whose tangent always matches the local dash. An initial value problem (IVP) pins down a specific solution by fixing one point: y(x₀) = y₀.

Most physical processes that involve "rate of change" produce first-order ODEs: radioactive decay (dN/dt = −λN), Newton's law of cooling (dT/dt = −k(T − T_room)), simple population growth (dP/dt = rP), and RC circuits all fit this template.

Type 1: Separable

The right side factors as a product y' = g(x) h(y). Move all y to one side and all x to the other:

dy / h(y) = g(x) dx,

integrate both sides, and solve for y. Worked example — exponential growth:

dy/dx = y → dy/y = dx → ln|y| = x + C → y = Ce^x.

An initial condition y(0) = y₀ determines C = y₀, giving y = y₀ e^x. Every "doubling time" or "half-life" computation reduces to this.

Type 2: Linear

A first-order linear ODE has the standard form y' + p(x) y = q(x). It's "linear in y and y'" with no y² or y · y' terms. The trick is the integrating factor:

μ(x) = exp(∫ p(x) dx).

Multiplying through by μ turns the left side into a single derivative:

(μy)' = μ q(x),

so y = (1/μ) [ ∫ μ(x) q(x) dx + C ]. Worked example: y' + 2y = e^{−x}. Here p = 2, μ = e^{2x}. Then (e^{2x} y)' = e^{2x} · e^{−x} = e^x, so e^{2x} y = e^x + C and y = e^{−x} + C e^{−2x}.

Type 3: Exact

An equation in differential form M(x,y) dx + N(x,y) dy = 0 is exact when there exists a potential function F(x,y) with ∂F/∂x = M and ∂F/∂y = N. The exactness test:

∂M/∂y = ∂N/∂x.

If true, integrate M with respect to x to get F(x,y) = ∫ M dx + g(y), then differentiate with respect to y and match to N to find g(y). The solutions are level curves F(x, y) = C. If the test fails, you can sometimes find an integrating factor μ(x,y) that makes it exact.

Type 4: Bernoulli

A Bernoulli equation has the form y' + p(x) y = q(x) y^n with n ≠ 0, 1 (those reduce to linear or separable). The substitution u = y^{1−n} turns it into a linear ODE in u:

u' + (1 − n) p(x) u = (1 − n) q(x).

Solve with the integrating-factor method, then back-substitute y = u^{1/(1−n)}. The classic example is the logistic equation y' = ay − by², which is Bernoulli with n = 2.

Type 5: Riccati

A Riccati equation is y' = p(x) + q(x) y + r(x) y² — a first-order ODE with a quadratic right side. There's no general closed-form solution, but if you happen to know one particular solution y₁(x), the substitution y = y₁ + 1/u turns it into a linear equation in u. Riccati equations show up in optimal control (algebraic Riccati equation) and in the WKB approximation of quantum mechanics.

Five types compared

TypeFormRecipeExample
Separabley' = g(x) h(y)Separate, integrate both sidesy' = y → y = Ce^x
Lineary' + p(x) y = q(x)μ = e^{∫p dx}, multiply, integratey' + y = x → y = (x−1) + Ce^{−x}
ExactM dx + N dy = 0 with M_y = N_xFind F with F_x = M, F_y = N; F = C(2xy + y²) dx + (x² + 2xy) dy = 0
Bernoulliy' + p y = q y^nu = y^{1−n}; reduces to lineary' = y − y² (logistic)
Riccatiy' = p + qy + ry²If y₁ known, y = y₁ + 1/u → lineary' = y² − x²
Homogeneous (degree)y' = f(y/x)v = y/x reduces to separabley' = (x+y)/(x−y)

Worked application: Newton's law of cooling

A coffee at temperature T(t) sits in a room at T_r. The cooling rate is proportional to the difference:

dT/dt = −k (T − T_r).

This is separable. Let u = T − T_r; then du/dt = −ku, so u = u₀ e^{−kt}. In original variables,

T(t) = T_r + (T₀ − T_r) e^{−kt}.

The temperature approaches T_r exponentially, with time constant 1/k. The half-life of the temperature gap is ln(2)/k. The same equation governs RC circuit decay (with T replaced by voltage) and radioactive cooldown — first-order linear behavior is everywhere.

Worked application: logistic growth

Population growth with a carrying capacity K obeys

dP/dt = r P (1 − P/K).

This is Bernoulli with n = 2, but it's also separable. After partial fractions and integration,

P(t) = K / (1 + A e^{−rt}),

where A = (K − P₀)/P₀. Early on (P ≪ K) it grows exponentially; late on, it saturates at K. The same equation models autocatalytic reactions, viral spread, and adoption curves.

Existence and uniqueness

The Picard–Lindelöf theorem guarantees that an IVP y' = f(x, y), y(x₀) = y₀ has a unique solution on some interval around x₀ provided f and ∂f/∂y are continuous near (x₀, y₀). Without continuity of ∂f/∂y, multiple solutions can pass through the same initial point — the classic example is y' = √y, which has both y = (x/2)² and y = 0 starting from (0, 0).

Common mistakes

  • Sign errors when separating variables. When integrating dy/y, you get ln|y|, not ln(y). The absolute value matters whenever y can change sign.
  • Forgetting the constant of integration. Every first-order ODE has a one-parameter family of solutions. Drop the +C and you've lost all but one curve.
  • Missing equilibrium solutions. Dividing by h(y) in a separable ODE assumes h(y) ≠ 0. Roots of h(y) = 0 give constant solutions you must check separately.
  • Wrong integrating factor. The standard form for the linear method is y' + p(x) y = q(x) — coefficient of y' must be 1 before computing μ. Otherwise divide first.
  • Skipping the exactness test. Trying to find a potential F before checking ∂M/∂y = ∂N/∂x wastes time on equations that aren't exact. The two-line check costs nothing.
  • Bernoulli with wrong substitution. Use u = y^{1−n}, not u = y^n. Getting the sign of (1 − n) wrong flips the sign on every coefficient in the resulting linear equation.

Frequently asked questions

What is a first-order differential equation?

An equation that relates an unknown function y(x) and its first derivative y'(x), but no higher derivatives. Geometrically, y' = f(x, y) prescribes a slope at every point — solutions are curves that follow that slope field.

How do I solve dy/dx = y?

It's separable. Rewrite as dy/y = dx, integrate to ln|y| = x + C, exponentiate to y = Ce^x. The classic exponential-growth solution.

What is an integrating factor?

A function μ(x) you multiply through a linear ODE y' + p(x) y = q(x) so the left side becomes a perfect derivative. Choosing μ = exp(∫ p dx) turns it into (μy)' = μ q, which integrates directly.

When is a differential equation exact?

M dx + N dy = 0 is exact when ∂M/∂y = ∂N/∂x. That equality means M dx + N dy is the total differential of some F(x,y), and the solutions are level curves F = C.

What's the difference between Bernoulli and Riccati equations?

Bernoulli: y' + p y = q y^n. Substitute u = y^{1−n} to make it linear. Riccati: y' = p + qy + ry² with quadratic y² term. Generally needs a known particular solution to reduce to Bernoulli (and from there to linear).

Do all first-order ODEs have closed-form solutions?

No. Riccati often has no elementary solution. In practice many ODEs are solved numerically (Euler, Runge–Kutta) or studied qualitatively with slope fields and phase plots.