MathLabs

Differential equations and dynamical systems

First-order differential equations

Equations relating a function to its first derivative, solved by separation of variables or integrating factors.

IntuitionHow fast is it changing right now?

Many phenomena are easiest to describe not by a formula for the quantity itself, but by a rule for how fast that quantity is changing: a population grows in proportion to its current size, a hot cup of coffee cools at a rate proportional to how much hotter it is than the room, a charging capacitor's voltage rises more slowly the closer it gets to full. A first-order differential equation is exactly such a rule — it relates an unknown function y(x)y(x) to its own derivative y′(x)y'(x) — and solving it means recovering the full function from the rule for its rate of change.

Interactive cubic curve widget illustrating the right-hand side of a directly integrable first-order equation.
Slope field of a first-order ODE y′=y−cx2y' = y - c x^2 with three solution curves starting from different initial values y(t0)=y0y(t_0) = y_0.

UndergraduateSeparable and linear equations

Definition: Separable equation

A first-order equation is separable when it can be written as dydx=f(x)g(y)\frac{dy}{dx}=f(x)g(y): the right-hand side factors into a part depending only on xx and a part depending only on yy. Moving all yy-terms to one side and all xx-terms to the other turns the equation into two ordinary integrals, ∫dyg(y)=∫f(x) dx\int \frac{dy}{g(y)}=\int f(x)\,dx.

dydx=f(x)g(y)\frac{dy}{dx}=f(x)g(y)

For instance, the autonomous equation dydx=g(y)\frac{dy}{dx}=g(y) (where the rate of change depends only on the current value yy, not on xx) is the special case f(x)=1f(x)=1; its equilibrium solutions occur exactly where g(y)=0g(y)=0, and these constant solutions are easy to lose if one divides by g(y)g(y) carelessly.

dydx+P(x)y=Q(x)\frac{dy}{dx}+P(x)y=Q(x)
Types of first-order equations
TypeStandard formSolution method
Separabledydx=f(x)g(y)\frac{dy}{dx}=f(x)g(y)integrate both sides: ∫dyg(y)=∫f(x) dx\int \frac{dy}{g(y)}=\int f(x)\,dx
Linear first-orderdydx+P(x)y=Q(x)\frac{dy}{dx}+P(x)y=Q(x)multiply by μ(x)=e∫P(x) dx\mu(x)=e^{\int P(x)\,dx}, then integrate
Autonomousdydx=g(y)\frac{dy}{dx}=g(y)special separable case; equilibria at g(y)=0g(y)=0

UndergraduateSolving and guaranteeing a solution exists

If P(x)P(x) and Q(x)Q(x) are continuous on an interval and μ(x)=e∫P(x) dx\mu(x)=e^{\int P(x)\,dx}, then every solution of the linear equation dydx+P(x)y=Q(x)\frac{dy}{dx}+P(x)y=Q(x) is given by y(x)=1μ(x)(∫μ(x)Q(x) dx+C)y(x) = \frac{1}{\mu(x)}\left(\int \mu(x) Q(x)\,dx + C\right).

Why is it true?

The trick is analogous to completing the square: we multiply the whole equation by a cleverly chosen factor μ(x)\mu(x) so that the left-hand side collapses into the derivative of a single product μ(x)y(x)\mu(x)y(x), turning a differential equation into something we can integrate directly.

Proof

Define μ(x)=e∫P(x) dx\mu(x)=e^{\int P(x)\,dx}; differentiating with the chain rule gives μ′(x)=P(x)μ(x)\mu'(x)=P(x)\mu(x), since the derivative of the exponent ∫P(x) dx\int P(x)\,dx is P(x)P(x).

Multiply both sides of dydx+P(x)y=Q(x)\frac{dy}{dx}+P(x)y=Q(x) by μ(x)\mu(x): this gives μ(x)y′+μ(x)P(x)y=μ(x)Q(x)\mu(x)y' + \mu(x)P(x)y = \mu(x)Q(x).

By the product rule, ddx[μ(x)y(x)]=μ(x)y′(x)+μ′(x)y(x)\frac{d}{dx}[\mu(x)y(x)] = \mu(x)y'(x) + \mu'(x)y(x), and since μ′(x)=P(x)μ(x)\mu'(x)=P(x)\mu(x), this equals exactly μ(x)y′+μ(x)P(x)y\mu(x)y' + \mu(x)P(x)y — the left-hand side above. So the equation becomes ddx[μ(x)y(x)]=μ(x)Q(x)\frac{d}{dx}[\mu(x)y(x)] = \mu(x)Q(x).

Integrating both sides with respect to xx gives μ(x)y(x)=∫μ(x)Q(x) dx+C\mu(x)y(x) = \int \mu(x)Q(x)\,dx + C for an arbitrary constant CC. Dividing through by μ(x)\mu(x) (which is never zero, being an exponential) yields y(x)=1μ(x)(∫μ(x)Q(x) dx+C)y(x) = \frac{1}{\mu(x)}\left(\int \mu(x) Q(x)\,dx + C\right).

Suppose f(x,y)f(x,y) is continuous on a rectangle around (x0,y0)(x_0,y_0) and satisfies a Lipschitz condition in yy: ∣f(x,y1)−f(x,y2)∣≤L∣y1−y2∣|f(x,y_1)-f(x,y_2)|\le L|y_1-y_2| for some constant LL. Then the initial value problem y′=f(x,y), y(x0)=y0y'=f(x,y),\ y(x_0)=y_0 has a unique solution on some interval containing x0x_0.

Why is it true?

The Lipschitz condition bounds how steeply ff can vary in the yy-direction, which prevents nearby solution trajectories from splitting apart or crossing: it is exactly the condition needed to guarantee a well-defined flow, with precisely one trajectory passing through each point.

Proof

Rewriting the initial value problem as an integral equation, a continuous function y(x)y(x) solves y′=f(x,y), y(x0)=y0y'=f(x,y),\ y(x_0)=y_0 if and only if it solves y(x)=y0+∫x0xf(t,y(t)) dty(x) = y_0 + \int_{x_0}^x f(t,y(t))\,dt; this equivalence follows from the fundamental theorem of calculus.

Define the Picard iteration operator TT on continuous functions by T[y](x)=y0+∫x0xf(t,y(t)) dtT[y](x) = y_0 + \int_{x_0}^x f(t,y(t))\,dt, restricted to a small interval I=[x0−h,x0+h]I=[x_0-h,x_0+h] chosen so that ff stays in the rectangle where the hypotheses hold.

For two continuous functions y1,y2y_1,y_2 on II, the Lipschitz condition gives ∣T[y1](x)−T[y2](x)∣≤∫x0x∣f(t,y1(t))−f(t,y2(t))∣ dt≤L h sup⁡t∈I∣y1(t)−y2(t)∣|T[y_1](x)-T[y_2](x)| \le \int_{x_0}^x |f(t,y_1(t))-f(t,y_2(t))|\,dt \le L\,h\,\sup_{t\in I}|y_1(t)-y_2(t)|. Choosing hh small enough that Lh<1Lh<1 makes TT a contraction mapping in the supremum norm.

By the Banach fixed-point theorem, a contraction on a complete metric space (the continuous functions on II with the supremum norm) has exactly one fixed point yy, satisfying y=T[y]y=T[y]. This fixed point is precisely the unique solution of the original initial value problem on II.

UndergraduateReal-World Applications and Worked Examples

First-order equations model population growth capped by limited resources (logistic growth in ecology and epidemiology), charging and discharging RC circuits in electronics, Newton's law of cooling in thermodynamics, radioactive decay in physics and carbon dating, and continuously compounding interest with a time-varying rate in finance. The two worked examples below solve the most common patterns end to end.

Example: Logistic population growth

A population P(t)P(t) grows according to the logistic model dPdt=rP(1−PK)\frac{dP}{dt}=rP\left(1-\frac{P}{K}\right) with initial population P(0)=P0P(0)=P_0. Find P(t)P(t).

Solution

This equation is separable: it rearranges to dPP(1−P/K)=r dt\frac{dP}{P(1-P/K)}=r\,dt.

The partial fraction decomposition 1P(1−P/K)=1P+1/K1−P/K\frac{1}{P(1-P/K)}=\frac1P+\frac{1/K}{1-P/K} lets us integrate the left side term by term, giving ln⁡∣P∣−ln⁡∣1−P/K∣=rt+C1\ln|P|-\ln|1-P/K|=rt+C_1, i.e. ln⁡∣PK−P∣=rt+C2\ln\left|\frac{P}{K-P}\right|=rt+C_2 after combining constants and multiplying by KK.

Exponentiating gives PK−P=Aert\frac{P}{K-P}=Ae^{rt} for a constant AA; evaluating at t=0t=0 with P(0)=P0P(0)=P_0 gives A=P0K−P0A=\frac{P_0}{K-P_0}.

Solving for PP and simplifying produces the closed form P(t)=KP0ertK+P0(ert−1)P(t) = \frac{K P_0 e^{rt}}{K + P_0(e^{rt}-1)}, which starts near P0P_0 and approaches the carrying capacity KK as t→∞t\to\infty, exactly the S-shaped curve seen in real population data.

Example: Charging an RC circuit

A capacitor charging through a resistor from a constant voltage source VV satisfies dQdt+QRC=VR\frac{dQ}{dt} + \frac{Q}{RC} = \frac{V}{R} with Q(0)=0Q(0)=0, where Q(t)Q(t) is the charge at time tt. Find Q(t)Q(t).

Solution

This is linear with P(t)=1RCP(t)=\frac{1}{RC} and source term VR\frac{V}{R}, so the integrating factor is μ(t)=et/(RC)\mu(t)=e^{t/(RC)}.

Multiplying through gives ddt[et/(RC)Q]=VRet/(RC)\frac{d}{dt}\left[e^{t/(RC)}Q\right] = \frac{V}{R}e^{t/(RC)}; integrating both sides yields et/(RC)Q=VC et/(RC)+C1e^{t/(RC)}Q = VC\,e^{t/(RC)} + C_1 for a constant C1C_1.

Dividing by et/(RC)e^{t/(RC)} gives Q(t)=VC+C1e−t/(RC)Q(t) = VC + C_1 e^{-t/(RC)}. Applying Q(0)=0Q(0)=0 gives C1=−VCC_1=-VC.

So Q(t)=CV(1−e−t/(RC))Q(t)=CV\left(1-e^{-t/(RC)}\right): the charge rises from 00 toward its final value CVCV, with the approach governed by the time constant RCRC — slower for a larger resistor or capacitor.

What is the integrating factor for the linear first-order equation dydx+P(x)y=Q(x)\frac{dy}{dx}+P(x)y=Q(x)?

In the logistic growth model dPdt=rP(1−PK)\frac{dP}{dt}=rP\left(1-\frac{P}{K}\right), what does the constant KK represent?

Solve the separable equation dydx=xy\frac{dy}{dx}=xy with y(0)=1y(0)=1.

Which condition guarantees the Picard–Lindelöf theorem gives a unique solution to y′=f(x,y), y(x0)=y0y'=f(x,y),\ y(x_0)=y_0?

References

  1. William E. Boyce, Richard C. DiPrima, Douglas B. Meade (2017). Elementary Differential Equations and Boundary Value Problems
  2. Morris Tenenbaum, Harry Pollard (1985). Ordinary Differential Equations