Topic · Differential Equations

ODE Basics

An ordinary differential equation is a sentence about an unknown function written in the language of its derivatives. Solving one means recovering the function from its rate law — a kind of integration with extra structure. Most of physics, biology, and economics is phrased this way, because nature is most naturally specified through change, not state.

What you'll leave with

  • What an ODE actually is — an equation, but its unknown is a function, not a number.
  • How to classify any ODE by order, degree, and linearity at a glance.
  • The difference between the general solution and a particular solution — and why initial conditions are what pin one down.
  • Slope fields as a way to see solutions before solving anything.
  • An informal statement of the existence and uniqueness theorem — and how it can fail.
  • Three modelling templates: exponential growth, Newton's cooling, and falling with drag.

1. What is an ODE?

Ordinary differential equation (ODE)

An equation relating an unknown function of a single variable — call it $y(x)$ — to one or more of its derivatives $y', y'', y''', \ldots$ The general form is

$$ F(x,\, y,\, y',\, y'',\, \ldots,\, y^{(n)}) = 0. $$

A solution is any function $y(x)$ that, when substituted into $F$, makes the equation an identity on some interval.

The shift in mindset compared with algebra is the whole point. In $3x + 7 = 19$, the unknown is a number. In $y'' + y = 0$, the unknown is a function — the entire history of $y$ as $x$ varies. You're not searching for a value; you're searching for a curve whose shape obeys a local rule about its own slope and curvature.

That local rule is the reason ODEs are everywhere. Most natural laws describe how things change in the next instant:

  • Newton's second law relates acceleration (second derivative of position) to force.
  • Bacteria reproduce in proportion to their current population — a rate proportional to a state.
  • Heat flows from hot to cold at a rate proportional to the temperature difference.
  • A capacitor discharges through a resistor at a rate proportional to its remaining voltage.

None of those laws tell you the answer outright. They tell you the slope of the answer at every instant, and an ODE is what you write down when you're trying to recover the full function from that slope information.

An ODE is a rate law. Solving it is recovering the trajectory from the rate.

2. Classifying ODEs: order, degree, linearity

Three structural features decide which technique you'll reach for. Train your eye to read them off in seconds.

Order

The order is the highest derivative that appears.

EquationOrder
$y' = xy + 1$1
$y'' + 3y' + 2y = 0$2
$y''' + y' = 0$3
$y^{(4)} + 4y = 0$  (beam equation)4

Degree

Once the equation is written as a polynomial in its derivatives (no roots, no derivatives in denominators, no derivatives inside transcendental functions), the degree is the exponent of the highest-order derivative. Most ODEs you'll meet are degree 1 — but the distinction matters when it isn't.

  • $(y')^3 + y = x$ — order 1, degree 3.
  • $y'' + (y')^2 = 0$ — order 2, degree 1 (the squared term is on $y'$, not the highest derivative).
  • $\sin(y') + y = 0$ — order 1, degree undefined (can't be made polynomial in $y'$).

Linearity

An ODE is linear if the unknown function and its derivatives appear only to the first power, never multiplied together, and never inside a nonlinear function. The general form of a linear ODE of order $n$ is

$$ a_n(x)\, y^{(n)} + a_{n-1}(x)\, y^{(n-1)} + \cdots + a_1(x)\, y' + a_0(x)\, y \;=\; g(x). $$

The coefficients $a_k(x)$ can be wild — they're allowed to depend on $x$ in any way. What's not allowed is for the dependence on $y$ or its derivatives to be anything other than linear. If $g(x) \equiv 0$, the equation is homogeneous; otherwise it's non-homogeneous (or "forced").

Linear
  • $y' + 3y = 0$  (homogeneous)
  • $y' + xy = \sin x$  (non-homogeneous, variable coefficient)
  • $y'' + 5y' + 6y = e^x$
  • $y^{(4)} + 4y = 0$
Nonlinear
  • $y'' + y^2 = 0$  ($y^2$)
  • $y' = y \cdot y'$  (product of unknowns)
  • $\theta'' + \omega^2 \sin\theta = 0$  ($\sin\theta$; the pendulum)
  • $(y')^2 + y = x$  (derivative squared)
Why this trio matters

Linear equations have structure — solutions form a vector space, superposition holds, and tidy closed forms exist (integrating factors, characteristic equations). Nonlinear equations rarely do; expect special tricks, qualitative analysis, or numerics. Order tells you how many initial conditions you'll need: exactly one per order.

3. ODE vs PDE

"Ordinary" is the word that distinguishes the family. Compare:

ODEPDE
Variables the unknown depends onOne ($y(x)$)Several ($u(x, t)$, $u(x, y, z, t)$, …)
Derivatives in the equationOrdinary ($y', y''$)Partial ($u_t, u_{xx}, u_{xy}$)
Typical example$y'' + y = 0$$u_t = u_{xx}$ (heat equation)
What "solution" looks likeA curve $y(x)$A surface $u(x, t)$

PDEs describe fields — temperature distributed through a room, displacement of a vibrating membrane, the electromagnetic field in space. They're a richer, harder world, and they come later. Everything on this page is about the one-independent-variable case.

4. What counts as a solution

A function $y(x)$ is a solution of an ODE if substituting it into the equation produces a true identity for every $x$ in some interval. Two checks, applied honestly, settle it every time:

  1. Differentiate the candidate as many times as the equation calls for.
  2. Plug $y$ and its derivatives into both sides and confirm they agree.

Take $y' - 2y = 0$ and the candidate $y(x) = e^{2x}$:

$$ y'(x) = 2e^{2x}, \qquad 2y(x) = 2e^{2x}, \qquad y' - 2y = 0. \;\checkmark $$

It works. Notice what verification does not require: solving the equation. You can check a proposed solution even when you have no idea how to derive one — and that habit pays off constantly.

Note

Verification is cheap; derivation is expensive. When a textbook hands you a solution, the right first move is almost always to differentiate it and plug it in. If the equation balances, you're free to move on; if it doesn't, you've found a bug before it spreads.

5. General vs particular solutions

The simplest ODE is also the most revealing. Consider

$$ y' = 2x. $$

Integrating both sides with respect to $x$ gives $y = x^2 + C$. The constant $C$ is not optional — it's the price of integration. Every parabola $y = x^2 + C$ has the same derivative $2x$, and the ODE has no way to distinguish them.

General solution

The full family of solutions to an ODE, parameterised by arbitrary constants. An $n$-th-order ODE has $n$ constants in its general solution — one per integration.

To single out one curve from that family, you need extra information. Usually it's an initial condition: the value of $y$ (and possibly its derivatives) at one particular $x$. An ODE together with initial conditions is called an initial value problem (IVP).

For our example: $y' = 2x$ with the extra fact $y(0) = 3$ forces $0^2 + C = 3$, so $C = 3$, and the particular solution is

$$ y(x) = x^2 + 3. $$
Particular solution

A specific member of the general-solution family, with all constants pinned down by auxiliary conditions.

How many conditions do you need? Exactly as many as there are arbitrary constants — exactly as many as the order. A second-order ODE wants two: usually $y(x_0)$ and $y'(x_0)$. A fourth-order beam equation wants four.

IVP vs BVP

When all the conditions are specified at the same point, it's an IVP. When they're split across two or more points — say, the temperatures at both ends of a rod — it's a boundary value problem (BVP). IVPs and BVPs share an ODE but have very different solution theories: IVPs almost always have a unique solution; BVPs can have zero, one, or infinitely many.

Pitfall

Forgetting the $+\,C$ when integrating $y' = 2x$ is the single most common bug in introductory ODEs. A student who writes "$y = x^2$" has thrown away every solution except one — and almost certainly not the one the problem wanted.

6. Slope fields: seeing solutions without solving

For a first-order ODE in the form $y' = f(x, y)$, the equation tells you something concrete at every point of the plane: it tells you the slope a solution must have at that point. Sketch that slope as a short line segment over a grid of $(x, y)$ values, and you get a slope field (also called a direction field) — a portrait of all possible solutions drawn before solving anything.

Here's the slope field for $y' = y - x$, together with one solution curve threaded through it:

−4 −2 2 4 3 1 −1 −3 x y y′ = y − x solution through (0, 0.5): y = −½ eˣ + x + 1

Each short stroke shows the slope an integral curve must follow at that grid point. The orange curve is one particular solution; an infinite family of parallel-looking curves shares the same slope field.

Three things the picture tells you before solving anything:

  • Isoclines. Wherever the slope is the same, segments are parallel. For $y' = y - x$, the slope is $c$ when $y - x = c$ — i.e., on the line $y = x + c$. The "zero-slope" isocline is $y = x$ itself: along that line, every segment is horizontal.
  • Direction. Above the line $y = x$, slopes are positive (solutions rise); below it, slopes are negative (solutions fall).
  • Long-term behaviour. Solutions look like they all peel off toward $\pm\infty$ exponentially for large $|x|$, except for one borderline curve $y = x + 1$ (the case $C = 0$) that stays linear forever.
Mental model

Drop a feather onto the plane; the slope field is the wind that pushes it. The trajectory it traces — always tangent to the local wind — is a solution. Different starting points give different trajectories, but they all share the same wind.

7. Existence and uniqueness

When you write down an IVP, two reasonable questions come first — even before you try to solve it:

  1. Does a solution exist?
  2. Is it the only one?

For a first-order IVP $y' = f(x, y)$, $y(x_0) = y_0$, the standard answer is the Picard–Lindelöf theorem:

Picard–Lindelöf (informal)

If $f(x, y)$ is continuous in $x$ and "not too steep" in $y$ near $(x_0, y_0)$ — formally, Lipschitz continuous in $y$, which in practice means $\partial f / \partial y$ is bounded — then the IVP has a unique solution on some open interval containing $x_0$.

Two pieces of fine print are worth keeping in mind. First, "some open interval" can be small — the solution might exist only for a short while before blowing up. Second, the Lipschitz condition is not just decoration: it's what fails when uniqueness fails.

When uniqueness fails

Consider $y' = \sqrt{|y|}$ with $y(0) = 0$. The right-hand side $f(y) = \sqrt{|y|}$ is continuous, so a solution exists by a weaker theorem (Peano's). But $\partial f / \partial y = 1 / (2\sqrt{|y|})$ blows up at $y = 0$, so Picard's Lipschitz hypothesis fails. And in fact uniqueness does fail — at least two solutions pass through $(0, 0)$:

  • The trivial solution $y(x) \equiv 0$: differentiate to get $0 = \sqrt 0$. ✓
  • The non-trivial solution $y(x) = x^2 / 4$ for $x \ge 0$: $y' = x/2 = \sqrt{x^2/4} = \sqrt{|y|}$. ✓

Worse: you can stick on $y \equiv 0$ for any amount of time and then "peel off" onto the parabola. Infinitely many solutions share the same initial condition. This isn't a mathematical curiosity — it's a warning. Before trusting an ODE to predict the future of anything, you'd like to know that the future it predicts is unique.

Continuity is not enough

Continuity of $f$ guarantees a solution exists (Peano). It does not guarantee that solution is unique. For uniqueness you need a quantitative smoothness condition — Lipschitz continuity in $y$ — and the cleanest practical check is that $\partial f / \partial y$ stays bounded near $(x_0, y_0)$.

8. Why this matters: three models

Three first-order ODEs make most of an introductory course's case for why the whole subject is worth your time. Each captures a different shape of natural law.

Exponential growth: $y' = k y$

Suppose the rate of change of a quantity is proportional to the quantity itself. Bacteria reproducing in plentiful conditions; money compounding continuously; radioactive isotopes decaying. The ODE

$$ \frac{dy}{dt} = k y $$

with $k > 0$ for growth and $k < 0$ for decay has general solution $y(t) = C e^{kt}$. The constant $C$ is fixed by the initial condition $y(0) = y_0$: $C = y_0$, so $y(t) = y_0 e^{kt}$.

A bacterial colony with $k = 0.3$ per hour and $y_0 = 500$ reaches $500 \cdot e^{3} \approx 10{,}043$ in 10 hours — a 20-fold increase. In 30 hours it would top 8 million. That's the brutal arithmetic of unchecked exponential growth, and it's the simplest non-trivial ODE in modelling.

Newton's law of cooling: $T' = -k(T - T_\infty)$

A hot coffee on a cold counter cools fast at first, then slowly, then asymptotically. Newton's observation: the rate of cooling is proportional to how much hotter the object is than its surroundings. Let $T(t)$ be the coffee's temperature and $T_\infty$ the room's:

$$ \frac{dT}{dt} = -k\,(T - T_\infty), \qquad k > 0. $$

Substitute $u = T - T_\infty$ and the equation becomes $u' = -k u$ — the decay version of exponential growth. Solution: $u(t) = u_0 e^{-kt}$, so

$$ T(t) = T_\infty + (T_0 - T_\infty)\, e^{-kt}. $$

The temperature approaches $T_\infty$ exponentially. The same equation describes a discharging capacitor (with voltage and ground), a drug clearing from the bloodstream (with concentration and zero), and any system relaxing toward equilibrium — which is enough situations that the shape $A + B e^{-kt}$ becomes one of the most pattern-matched curves in applied math.

Falling with drag: $v' = g - \frac{c}{m} v$

A parachutist in free fall. Gravity pulls down; air resistance pushes up, increasing with speed. Taking downward as positive and modelling drag as linear in $v$ (a decent approximation at moderate speeds):

$$ \frac{dv}{dt} = g - \frac{c}{m}\, v, $$

where $g \approx 9.8$ m/s², $m$ is mass, and $c$ is a drag coefficient. This is a first-order linear non-homogeneous ODE. Its solution approaches a finite limit — the terminal velocity — given by setting $dv/dt = 0$:

$$ v_{\mathrm{terminal}} = \frac{mg}{c}. $$

The full solution, with $v(0) = 0$, is

$$ v(t) = \frac{mg}{c} \left(1 - e^{-(c/m)\,t}\right). $$

Same exponential shape, different physics. The ODE doesn't care that one example is hot coffee and another is a sky-diver; what it sees is the structural fact "rate proportional to (state minus equilibrium)," and that pattern lets you transport intuition across wildly different domains. Recognising it is half of applied mathematics.

Pattern recognition

Any time a system's rate of change depends linearly on how far it is from equilibrium, you're looking at the cooling / discharge / terminal-velocity template. The solution is always "equilibrium plus an exponentially-decaying gap." This shape is so common that it's worth memorising the form rather than re-deriving it each time.

9. Common pitfalls

Forgetting the constant of integration

Integrating $y' = 2x$ to get $y = x^2$ throws away every solution except one. The "$+\,C$" is not punctuation — it's the entire general solution. Every $n$-th order ODE has $n$ such constants; lose them and you lose the family.

Misreading linearity

"Linear" means linear in $y$ and its derivatives, not linear in $x$. The equation $y' + x^7 y = \cos x$ is linear (in $y$); the equation $y' + y^2 = x$ is nonlinear (because of $y^2$), even though it's polynomial in $x$ on the right.

IVP vs BVP confusion

An $n$-th order ODE needs $n$ conditions to single out a unique solution, but it matters where those conditions live. All at one point → IVP, almost always uniquely solvable. Split between two points → BVP, which may have zero, one, or infinitely many solutions depending on the geometry.

Assuming Picard always applies

The existence-and-uniqueness theorem has hypotheses, and they aren't optional. When $f(x, y)$ has a vertical tangent in $y$ (like $\sqrt{|y|}$ at $y = 0$), or blows up, or otherwise misbehaves, multiple solutions can pass through the same initial point. Always check Lipschitz before betting the model on uniqueness.

10. Worked examples

Try each one before opening the solution. The aim is to see whether your moves match the recipe, not to memorise final numbers.

Example 1 · Classify $y'' + xy' + (\sin x)\, y = e^x$

Order. Highest derivative is $y''$ — order 2.

Linearity. $y$, $y'$, $y''$ all appear to the first power; coefficients $x$ and $\sin x$ are functions of the independent variable only (allowed); the right-hand side $e^x$ is a function of $x$ alone. Linear.

Homogeneity. RHS is $e^x \neq 0$. Non-homogeneous.

Verdict. Second-order linear non-homogeneous ODE with variable coefficients.

Example 2 · Verify $y(x) = C_1 \cos x + C_2 \sin x$ solves $y'' + y = 0$

Differentiate twice:

$$ y' = -C_1 \sin x + C_2 \cos x, \qquad y'' = -C_1 \cos x - C_2 \sin x. $$

Substitute:

$$ y'' + y = (-C_1 \cos x - C_2 \sin x) + (C_1 \cos x + C_2 \sin x) = 0. \;\checkmark $$

The function works for every choice of $C_1, C_2$ — exactly the two-parameter family you'd expect for a second-order ODE.

Example 3 · IVP for exponential decay: $y' = -3y$, $y(0) = 5$

Step 1. General solution. The equation $y' = ky$ has solution $y = C e^{kx}$. Here $k = -3$:

$$ y(x) = C e^{-3x}. $$

Step 2. Apply the initial condition $y(0) = 5$:

$$ y(0) = C e^{0} = C = 5. $$

Step 3. Particular solution:

$$ y(x) = 5 e^{-3x}. $$

Check. $y'(x) = -15 e^{-3x}$ and $-3 y(x) = -15 e^{-3x}$. They agree. ✓

Example 4 · Newton's cooling: how long until the coffee is drinkable?

A cup of coffee at $90$°C sits in a $20$°C room and obeys $dT/dt = -k(T - 20)$ with $k = 0.05$ per minute. When does it reach $60$°C?

Step 1. Substitute $u = T - 20$, so $u' = -0.05\,u$ with $u(0) = 70$. General solution: $u(t) = 70 e^{-0.05 t}$, hence

$$ T(t) = 20 + 70\, e^{-0.05 t}. $$

Step 2. Solve $T(t) = 60$ for $t$:

$$ 60 = 20 + 70\, e^{-0.05 t} \;\Longrightarrow\; e^{-0.05 t} = \tfrac{40}{70} = \tfrac{4}{7}. $$ $$ t = \frac{-\ln(4/7)}{0.05} = \frac{\ln(7/4)}{0.05} \approx \frac{0.5596}{0.05} \approx 11.2\text{ min}. $$

So you wait about 11 minutes. Cooling slows as $T$ approaches $T_\infty$ — getting from $90$ to $60$ takes 11 minutes, but getting from $60$ to $30$ would take much longer.

Example 5 · A nonlinear IVP that blows up: $y' = y^2$, $y(0) = 1$

The equation is separable: $dy / y^2 = dx$. Integrate both sides:

$$ -\frac{1}{y} = x + C. $$

Apply $y(0) = 1$: $-1 = 0 + C$, so $C = -1$. Solve for $y$:

$$ -\frac{1}{y} = x - 1 \;\Longrightarrow\; y(x) = \frac{1}{1 - x}. $$

The solution exists only for $x < 1$ — at $x = 1$ it diverges to $+\infty$. This is a finite-time blow-up, characteristic of superlinear ODEs. Picard–Lindelöf only promised a solution on "some interval" around the initial point; it didn't promise that interval was the whole real line.

Example 6 · Reading the slope field for $y' = -y$

The slope at any point $(x, y)$ is $-y$. So:

  • On the $x$-axis ($y = 0$), every segment is horizontal — and the constant function $y \equiv 0$ is indeed a solution.
  • Above the axis ($y > 0$), slopes are negative — solutions decay toward zero.
  • Below the axis ($y < 0$), slopes are positive — solutions rise toward zero.

The slope field tells you, without any algebra, that every solution approaches $y = 0$ as $x \to \infty$. Solving the ODE confirms it: the general solution is $y = C e^{-x}$, which decays to $0$ for any $C$.

Sources & further reading

The content above is synthesised from standard references on ordinary differential equations. If anything reads ambiguously, the primary sources are the ground truth — and the "going deeper" links are where to turn when this page has served its purpose.

Test your understanding

A quiz that builds from easy to hard. Pick an answer to get instant feedback and a worked explanation. Your progress is saved in this browser — come back anytime to continue.

Question 1 of 24
0 correct