Skip to content

Differential Equations

Introduction to Differential Equations (CED Unit 7)

A differential equation (DE) is an equation that relates a function to one or more of its Derivatives. The order of a DE is the highest derivative that appears. A first-order DE involves Only dydx\frac{dy}{dx}; a second-order DE involves d2ydx2\frac{d^2y}{dx^2}.

A solution to a DE is a function that satisfies the equation. A general solution contains Arbitrary constants ( equal to the order of the DE), while a particular solution Satisfies additional initial conditions. Together, the DE and its initial conditions form an initial value problem (IVP).

Why differential equations matter. Nearly every physical system whose state evolves continuously In time is modelled by a DE: orbital mechanics, circuit analysis, fluid dynamics, population Biology, heat transfer, and pharmacokinetics all reduce to DEs at their core. The reason is simple: If a quantity yy changes at a rate that depends on the current state, then by definition dydt=f(t,y)\frac{dy}{dt} = f(t, y)And that is a differential equation.

First-Order Separable Equations

A first-order DE is separable if it can be written in the form:

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

The strategy is mechanical: move all terms involving yy (including dydy) to one side and all terms Involving xx (including dxdx) to the other, then integrate both sides.

1h(y)dy=g(x)dx\int \frac{1}{h(y)}\, dy = \int g(x)\, dx

This works because dydy and dxdx are related through the chain rule: dydx=g(x)h(y)\frac{dy}{dx} = g(x)h(y) Rewrites as 1h(y)dydx=g(x)\frac{1}{h(y)}\frac{dy}{dx} = g(x)And integrating both sides with respect to xx Gives 1h(y)dydxdx=g(x)dx\int \frac{1}{h(y)}\frac{dy}{dx}\,dx = \int g(x)\,dxWhich is exactly the separated form Above.

Separability Test

Not every first-order DE is separable. The key diagnostic: can you algebraically factor the RHS into A product of a function of xx alone and a function of yy alone? For example, dydx=x+y\frac{dy}{dx} = x + y is not separable, because x+yx + y cannot be factored into g(x)h(y)g(x)h(y).

Example

Solve dydx=xy\displaystyle\frac{dy}{dx} = \frac{x}{y} with y(0)=2y(0) = 2.

Separate: ydy=xdxy\, dy = x\, dx.

Integrate: ydy=xdx    y22=x22+C\displaystyle\int y\, dy = \int x\, dx \implies \frac{y^2}{2} = \frac{x^2}{2} + C.

Apply the initial condition: 42=0+C    C=2\displaystyle\frac{4}{2} = 0 + C \implies C = 2.

y22=x22+2    y2=x2+4    y=x2+4\frac{y^2}{2} = \frac{x^2}{2} + 2 \implies y^2 = x^2 + 4 \implies y = \sqrt{x^2 + 4}

(We take the positive root since y(0)=2>0y(0) = 2 \gt 0.)

Example

Solve dydx=2xy\displaystyle\frac{dy}{dx} = 2xy with y(0)=3y(0) = 3.

Separate: dyy=2xdx\displaystyle\frac{dy}{y} = 2x\, dx.

Integrate: lny=x2+C\displaystyle\ln|y| = x^2 + C.

Apply the initial condition: ln3=0+C    C=ln3\ln 3 = 0 + C \implies C = \ln 3.

lny=x2+ln3    y=ex2+ln3=3ex2    y=3ex2\ln|y| = x^2 + \ln 3 \implies |y| = e^{x^2 + \ln 3} = 3e^{x^2} \implies y = 3e^{x^2}

Worked Example: Separation with Partial Fractions

Solve dydx=y2+1x2+1\displaystyle\frac{dy}{dx} = \frac{y^2 + 1}{x^2 + 1} with y(1)=1y(1) = 1.

Separate:

dyy2+1=dxx2+1\frac{dy}{y^2 + 1} = \frac{dx}{x^2 + 1}

Integrate both sides:

arctany=arctanx+C\arctan y = \arctan x + C

Apply y(1)=1y(1) = 1: arctan1=arctan1+C    C=0\arctan 1 = \arctan 1 + C \implies C = 0.

Therefore arctany=arctanx\arctan y = \arctan xSo y=xy = x.

Worked Example: Trigonometric Separation

Solve dydx=cosxsin2y\displaystyle\frac{dy}{dx} = \frac{\cos x}{\sin^2 y} with y(0)=π4y(0) = \frac{\pi}{4}.

Separate: sin2ydy=cosxdx\sin^2 y\, dy = \cos x\, dx.

Use the identity sin2y=1cos2y2\sin^2 y = \frac{1 - \cos 2y}{2}:

1cos2y2dy=cosxdx\int \frac{1 - \cos 2y}{2}\, dy = \int \cos x\, dx y2sin2y4=sinx+C\frac{y}{2} - \frac{\sin 2y}{4} = \sin x + C

Apply y(0)=π4y(0) = \frac{\pi}{4}: π814=0+C\frac{\pi}{8} - \frac{1}{4} = 0 + CSo C=π814C = \frac{\pi}{8} - \frac{1}{4}.

The particular solution is:

y2sin2y4=sinx+π814\frac{y}{2} - \frac{\sin 2y}{4} = \sin x + \frac{\pi}{8} - \frac{1}{4}

This cannot be solved explicitly for yy in closed form, but it is a valid implicit solution.

Exponential Growth and Decay

Many natural phenomena are modelled by the DE:

dydt=ky\frac{dy}{dt} = ky

Where kk is a constant.

  • If k>0k \gt 0: exponential growth
  • If k<0k \lt 0: exponential decay

Why This DE Is Ubiquitous

The equation dydt=ky\frac{dy}{dt} = ky says: “the rate of change is proportional to the current Quantity.” This is the simplest possible feedback loop. If you have a population of bacteria, each Bacterium divides independently, so the total growth rate is proportional to how many bacteria Exist. If you have a radioactive sample, each atom decays independently, so the total decay rate is Proportional to how many atoms remain. This single assumption generates the exponential.

Solution

dyy=kdt    lny=kt+C    y=y0ekt\frac{dy}{y} = k\, dt \implies \ln|y| = kt + C \implies y = y_0 e^{kt}

Where y0=y(0)y_0 = y(0).

Proof that the solution is unique. The function f(t,y)=kyf(t, y) = ky is continuous everywhere and fy=k\frac{\partial f}{\partial y} = k is also continuous everywhere. By the existence and uniqueness Theorem, the IVP has exactly one solution on any interval containing t0=0t_0 = 0.

Half-Life

For exponential decay with half-life T1/2T_{1/2}:

Y(t)=y02t/T1/2Y(t) = y_0 \cdot 2^{-t/T_{1/2}}

Alternatively, since 12y0=y0ekT1/2\frac{1}{2}y_0 = y_0 e^{kT_{1/2}}We get k=ln2T1/2k = -\frac{\ln 2}{T_{1/2}}.

The half-life is a constant: no matter when you start measuring, the time for the quantity to halve Is always T1/2T_{1/2}. This is a direct consequence of the exponential’s scale-invariance.

Example

Carbon-14 has a half-life of approximately 5730 years. A bone fragment contains 25% of its original Carbon-14. How old is the fragment?

0.25=ekt    ln0.25=kt0.25 = e^{kt} \implies \ln 0.25 = ktK=ln257300.000121K = -\frac{\ln 2}{5730} \approx -0.000121T = \frac{\ln 0.25}{k} = \frac{-1.386}{-0.000121} \approx 11460 \mathrm{ years

(Equivalently, 25%=14=2225\% = \frac{1}{4} = 2^{-2}So t=2×5730=11460t = 2 \times 5730 = 11460 years.)

Doubling Time

For exponential growth with doubling time TdT_d:

Y0ekTd=2y0    k=ln2TdY_0 e^{kT_d} = 2y_0 \implies k = \frac{\ln 2}{T_d}

Logistic Growth (CED Unit 7.8)

The logistic differential equation models growth with a carrying capacity LL:

dydt=ky ⁣(1yL)\frac{dy}{dt} = ky\!\left(1 - \frac{y}{L}\right)
  • When yy is small relative to LLGrowth is approximately exponential (the factor 1yL11 - \frac{y}{L} \approx 1).
  • As yLy \to LThe growth rate 0\to 0.
  • The carrying capacity LL is a horizontal asymptote.
  • If y>Ly \gt LThe growth rate is negative, pulling yy back toward LL.

Solution

The general solution is:

Y(t)=L1+AektY(t) = \frac{L}{1 + Ae^{-kt}}

Where A=Ly0y0A = \frac{L - y_0}{y_0} depends on the initial condition.

Derivation

Starting with dydt=ky ⁣(1yL)\frac{dy}{dt} = ky\!\left(1 - \frac{y}{L}\right)Separate:

Ly(Ly)dy=kdt\int \frac{L}{y(L - y)}\, dy = \int k\, dt

Use partial fractions: Ly(Ly)=1y+1Ly\frac{L}{y(L-y)} = \frac{1}{y} + \frac{1}{L - y}.

1ydy+1Lydy=kt+C\int \frac{1}{y}\, dy + \int \frac{1}{L - y}\, dy = kt + C lnylnLy=kt+C\ln|y| - \ln|L - y| = kt + C lnyLy=kt+C\ln\left|\frac{y}{L - y}\right| = kt + C yLy=Cekt\frac{y}{L - y} = Ce^{kt}

Solving for yy: y=Cekt(Ly)    y(1+Cekt)=CektLy = Ce^{kt}(L - y) \implies y(1 + Ce^{kt}) = Ce^{kt}LSo:

Y=CektL1+Cekt=L1+1Cekt=L1+AektY = \frac{Ce^{kt}L}{1 + Ce^{kt}} = \frac{L}{1 + \frac{1}{C}e^{-kt}} = \frac{L}{1 + Ae^{-kt}}

Properties of the Logistic Curve

  • Inflection point at y=L2y = \frac{L}{2}: the curve changes from concave up to concave down.
  • The maximum growth rate occurs at the inflection point.
  • dydty=L/2=kL4\displaystyle\left.\frac{dy}{dt}\right|_{y = L/2} = \frac{kL}{4}

Example

A population of bacteria grows logistically with carrying capacity 1000. Initially, there are 100 Bacteria, and after 1 hour there are 200. Find the population after 3 hours.

Y(t)=10001+AektY(t) = \frac{1000}{1 + Ae^{-kt}}

At t=0t = 0: 100=10001+A    1+A=10    A=9100 = \frac{1000}{1 + A} \implies 1 + A = 10 \implies A = 9.

Y(t)=10001+9ektY(t) = \frac{1000}{1 + 9e^{-kt}}

At t=1t = 1: 200=10001+9ek    1+9ek=5    ek=49    k=ln94200 = \frac{1000}{1 + 9e^{-k}} \implies 1 + 9e^{-k} = 5 \implies e^{-k} = \frac{4}{9} \implies k = \ln\frac{9}{4}.

Y(3)=10001+9(49)3=10001+964729=10001+576729=10007291305558.6Y(3) = \frac{1000}{1 + 9\left(\frac{4}{9}\right)^3} = \frac{1000}{1 + 9 \cdot \frac{64}{729}} = \frac{1000}{1 + \frac{576}{729}} = \frac{1000 \cdot 729}{1305} \approx 558.6

So approximately 559 bacteria.

Slope Fields

A slope field (or direction field) is a graphical representation of a first-order DE dydx=f(x,y)\frac{dy}{dx} = f(x, y). At each point (x,y)(x, y) on a grid, a short line segment is drawn with Slope f(x,y)f(x, y). Think of it as a vector field for the flow of solutions: each tiny line segment Shows the direction a solution curve must pass through that point.

Constructing Slope Fields

For any given grid point (xi,yj)(x_i, y_j)Compute f(xi,yj)f(x_i, y_j) and draw a short segment with that Slope. The density of the grid determines how accurately the field represents the DE.

Interpreting Slope Fields

  • The general shape of solution curves can be visualized by following the direction of the line segments.
  • Equilibrium solutions (horizontal lines) occur where f(x,y)=0f(x, y) = 0 for all xx.
  • The slope field is unique to the DE, but multiple solution curves pass through different points.
  • Solution curves cannot cross (by the uniqueness theorem).

Example

For dydx=x+y\displaystyle\frac{dy}{dx} = x + y:

  • At (0,0)(0, 0): slope = 00
  • At (1,0)(1, 0): slope = 11
  • At (0,1)(0, 1): slope = 11
  • At (1,1)(-1, -1): slope = 2-2

The slopes increase as you move to the upper-right and decrease as you move to the lower-left.

Example

For dydx=xy\displaystyle\frac{dy}{dx} = \frac{x}{y}:

When y>0y \gt 0: slopes have the same sign as xx. When y<0y \lt 0: slopes have the opposite sign of xx. When y=0y = 0: slopes are undefined (vertical line segments).

The solution curves are hyperbolas y2x2=Cy^2 - x^2 = CConsistent with our earlier analytic solution.

Euler’s Method (CED Unit 7.6)

Euler’s method approximates the solution to dydx=f(x,y)\frac{dy}{dx} = f(x, y) with y(x0)=y0y(x_0) = y_0 using a Simple iterative scheme:

Yn+1=yn+f(xn,yn)ΔxY_{n+1} = y_n + f(x_n, y_n) \cdot \Delta x Xn+1=xn+ΔxX_{n+1} = x_n + \Delta x

Where Δx=h\Delta x = h is the step size.

Why Euler’s Method Works

The definition of the derivative gives us dydxxnyn+1ynΔx\frac{dy}{dx}\big|_{x_n} \approx \frac{y_{n+1} - y_n}{\Delta x}, so yn+1yn+f(xn,yn)Δxy_{n+1} \approx y_n + f(x_n, y_n) \cdot \Delta x. This is a first-order Taylor expansion: we are Approximating the curve locally by its tangent line at each step.

Error Analysis

  • Euler’s method is first-order accurate: the global error is proportional to Δx\Delta x.
  • Local truncation error per step is O(Δx2)O(\Delta x^2)But errors accumulate over n=baΔxn = \frac{b-a}{\Delta x} steps, giving a global error of O(Δx)O(\Delta x).
  • Smaller step sizes produce more accurate approximations but require more computation.
  • The method can diverge if the step size is too large, especially for rapidly changing solutions.

Example

Use Euler’s method with Δx=0.5\Delta x = 0.5 to approximate y(2)y(2) for dydx=x+y\frac{dy}{dx} = x + y y(1)=0y(1) = 0.

Stepxnx_nyny_nf(xn,yn)=xn+ynf(x_n, y_n) = x_n + y_nyn+1=yn+fΔxy_{n+1} = y_n + f \cdot \Delta x
01.001.00+1.0(0.5)=0.50 + 1.0(0.5) = 0.5
11.50.52.00.5+2.0(0.5)=1.50.5 + 2.0(0.5) = 1.5
22.01.5

So y(2)1.5y(2) \approx 1.5.

(The exact solution is y=ex1x1y = e^{x-1} - x - 1Giving y(2)=e30.282y(2) = e - 3 \approx -0.282. The Approximation is poor due to the large step size. With Δx=0.1\Delta x = 0.1The result is much closer.)

Worked Example: More Steps

Use Euler’s method with Δx=0.25\Delta x = 0.25 to approximate y(1)y(1) for dydx=x2+y\frac{dy}{dx} = x^2 + y y(0)=1y(0) = 1.

Stepxnx_nyny_nf(xn,yn)f(x_n, y_n)yn+1y_{n+1}
00.001.0001.0001.250
10.251.2501.3131.578
20.501.5781.8282.035
30.752.0352.6132.688
41.002.688

So y(1)2.688y(1) \approx 2.688.

Applications

Newton’s Law of Cooling

dTdt=k(TTs)\frac{dT}{dt} = -k(T - T_s)

Where TT is the temperature of the object, TsT_s is the surrounding temperature, and k>0k \gt 0.

Intuition: the rate of cooling is proportional to the temperature difference between the object And its surroundings. A large temperature difference drives rapid cooling; as the object approaches Room temperature, cooling slows down.

Solution:

T(t)=Ts+(T0Ts)ektT(t) = T_s + (T_0 - T_s)e^{-kt}

This is an exponential decay toward TsT_s. The object asymptotically approaches the surrounding Temperature but never quite reaches it.

Example

A cup of coffee at 90^\circ\mathrm{C is placed in a room at 20^\circ\mathrm{C. After 10 minutes, The coffee is 60^\circ\mathrm{C. When will the coffee reach 35^\circ\mathrm{C?

T(t)=20+70ektT(t) = 20 + 70e^{-kt}

At t=10t = 10: 60=20+70e10k    40=70e10k    e10k=47    k=ln(7/4)1060 = 20 + 70e^{-10k} \implies 40 = 70e^{-10k} \implies e^{-10k} = \frac{4}{7} \implies k = \frac{\ln(7/4)}{10}.

For T=35T = 35:

35=20+70ekt    15=70ekt    ekt=31435 = 20 + 70e^{-kt} \implies 15 = 70e^{-kt} \implies e^{-kt} = \frac{3}{14}T = \frac{\ln(14/3)}{k} = \frac{10\ln(14/3)}{\ln(7/4)} \approx \frac{10 \times 1.540}{0.5596} \approx 27.5 \mathrm{ minutes

Mixing Problems

A tank contains VV liters of water with Q0Q_0 kg of dissolved substance. Solution with Concentration cic_i kg/L flows in at rate rir_i L/min, and the mixture flows out at rate ror_o L/min.

The rate of change of the amount QQ of dissolved substance is:

\frac{dQ}{dt} = \underbrace{r_i c_i}_{\mathrm{rate in} - \underbrace{\frac{r_o}{V} Q}_{\mathrm{rate out}

The term QV\frac{Q}{V} is the current concentration in the tank, so roVQ\frac{r_o}{V}Q is the rate at Which substance leaves.

Example

A tank holds 100 L of pure water. Brine with 0.5 kg/L salt flows in at 5 L/min, and the mixture Flows out at 5 L/min. Find the salt content after 20 minutes.

Since ri=ro=5r_i = r_o = 5The volume stays at 100 L.

dQdt=5(0.5)5100Q=2.50.05Q\frac{dQ}{dt} = 5(0.5) - \frac{5}{100}Q = 2.5 - 0.05Q

This is separable: dQ2.50.05Q=dt\displaystyle\frac{dQ}{2.5 - 0.05Q} = dt.

dQ2.50.05Q=dt    10.05ln2.50.05Q=t+C\int \frac{dQ}{2.5 - 0.05Q} = \int dt \implies -\frac{1}{0.05}\ln|2.5 - 0.05Q| = t + C

With Q(0)=0Q(0) = 0: 20ln2.5=C-20\ln 2.5 = C.

Q(t)=2.50.05(1e0.05t)=50(1e0.05t)Q(t) = \frac{2.5}{0.05}\left(1 - e^{-0.05t}\right) = 50(1 - e^{-0.05t})Q(20) = 50(1 - e^{-1}) \approx 50(1 - 0.368) \approx 31.6 \mathrm{ kg

Worked Example: Mixing with Variable Volume

A tank initially contains 200 L of pure water. Brine with 0.3 kg/L salt flows in at 4 L/min, and the Mixture flows out at 3 L/min. Find the salt content after 60 minutes.

Since riror_i \neq r_oThe volume changes: V(t)=200+(43)t=200+tV(t) = 200 + (4 - 3)t = 200 + t.

dQdt=4(0.3)3200+tQ=1.23Q200+t\frac{dQ}{dt} = 4(0.3) - \frac{3}{200 + t}Q = 1.2 - \frac{3Q}{200 + t}

This is a first-order linear DE:

dQdt+3200+tQ=1.2\frac{dQ}{dt} + \frac{3}{200 + t}Q = 1.2

The integrating factor is:

μ(t)=e3200+tdt=e3ln(200+t)=(200+t)3\mu(t) = e^{\int \frac{3}{200+t}\, dt} = e^{3\ln(200+t)} = (200 + t)^3 ddt[(200+t)3Q]=1.2(200+t)3\frac{d}{dt}[(200 + t)^3 Q] = 1.2(200 + t)^3

Integrate:

(200+t)3Q=1.2(200+t)44+C=0.3(200+t)4+C(200 + t)^3 Q = 1.2 \cdot \frac{(200 + t)^4}{4} + C = 0.3(200 + t)^4 + C

With Q(0)=0Q(0) = 0: 20030=0.32004+C    C=0.32004200^3 \cdot 0 = 0.3 \cdot 200^4 + C \implies C = -0.3 \cdot 200^4.

Q(t)=0.3(200+t)0.32004(200+t)3Q(t) = 0.3(200 + t) - \frac{0.3 \cdot 200^4}{(200 + t)^3}

At t=60t = 60: Q(60) = 0.3(260) - \frac{0.3 \cdot 200^4}{260^3} = 78 - \frac{0.3 \cdot 1.6 \times 10^9}{1.7576 \times 10^7} \approx 78 - 27.3 = 50.7 \mathrm{ kg.

Qualitative Analysis of Differential Equations

Existence and Uniqueness

If f(x,y)f(x, y) and fy\frac{\partial f}{\partial y} are continuous on a rectangle containing (x0,y0)(x_0, y_0)Then the IVP dydx=f(x,y)\frac{dy}{dx} = f(x, y), y(x0)=y0y(x_0) = y_0 has a unique solution in some Interval around x0x_0.

Consequences:

  • Solution curves cannot cross (if they did, the IVP at the crossing point would have two solutions).
  • The conditions are sufficient but not necessary: some IVPs without continuous partial derivatives still have unique solutions.

Equilibrium Solutions

An equilibrium solution (or constant solution) satisfies dydt=0\frac{dy}{dt} = 0 for all tt.

For autonomous equations dydt=f(y)\frac{dy}{dt} = f(y):

  • Find equilibrium solutions by solving f(y)=0f(y) = 0.
  • Classify stability by checking the sign of f(y)f(y) near each equilibrium.
Sign of f(y)f(y) near equilibriumStability
f(y)>0f(y) \gt 0 below, f(y)<0f(y) \lt 0 aboveStable (attractor)
f(y)<0f(y) \lt 0 below, f(y)>0f(y) \gt 0 aboveUnstable (repeller)
Same sign on both sidesSemi-stable

Phase Line Analysis

For an autonomous DE dydt=f(y)\frac{dy}{dt} = f(y)The phase line is a one-dimensional diagram of the yy-axis with arrows indicating the direction of flow.

  • Draw the yy-axis and mark the equilibrium points (zeros of ff).
  • In each interval between equilibria, test a point to determine the sign of f(y)f(y).
  • Draw rightward arrows where f(y)>0f(y) \gt 0 (increasing) and leftward arrows where f(y)<0f(y) \lt 0 (decreasing).

Example

Analyse dydt=y(y2)(y5)\displaystyle\frac{dy}{dt} = y(y - 2)(y - 5).

Equilibria: y=0y = 0, y=2y = 2, y=5y = 5.

IntervalTest pointf(y)f(y)Direction
y<0y \lt 01-1()()()<0(-)(-)(-) \lt 0Decreasing
0<y<20 \lt y \lt 211(+)()()>0(+)(-)(-) \gt 0Increasing
2<y<52 \lt y \lt 533(+)(+)()<0(+)(+)(-) \lt 0Decreasing
y>5y \gt 566(+)(+)(+)>0(+)(+)(+) \gt 0Increasing
  • y=0y = 0: arrows point away — unstable
  • y=2y = 2: arrows point inward — stable
  • y=5y = 5: arrows point away — unstable

Bifurcation Analysis (CED Unit 7.9)

A bifurcation occurs when a small change in a parameter of the DE causes a qualitative change in The equilibrium structure.

Consider the one-parameter family:

dydt=y2+c\frac{dy}{dt} = y^2 + c
  • When c>0c \gt 0: f(y)=y2+c>0f(y) = y^2 + c \gt 0 for all yy. No equilibria. All solutions increase monotonically.
  • When c=0c = 0: f(y)=y2f(y) = y^2. One semi-stable equilibrium at y=0y = 0. Solutions with y<0y \lt 0 decrease toward -\infty; solutions with y>0y \gt 0 increase toward ++\infty.
  • When c<0c \lt 0: f(y)=y2+c=0f(y) = y^2 + c = 0 has two equilibria at y=±cy = \pm\sqrt{-c}. The equilibrium at y=cy = -\sqrt{-c} is unstable; the one at y=cy = \sqrt{-c} is stable.

The parameter value c=0c = 0 is a bifurcation point: as cc passes through zero, the system Transitions from having no equilibria to having two.

Numerical Methods: Beyond Euler

Euler’s method is the simplest numerical ODE solver, but it is rarely used in practice because Higher-order methods achieve the same accuracy with far fewer steps.

Improved Euler’s Method (Heun’s Method)

  1. Compute the “predictor”: yn+1=yn+f(xn,yn)Δxy_{n+1}^* = y_n + f(x_n, y_n) \cdot \Delta x
  2. Compute the average slope: m=f(xn,yn)+f(xn+1,yn+1)2m = \frac{f(x_n, y_n) + f(x_{n+1}, y_{n+1}^*)}{2}
  3. Compute the “corrector”: yn+1=yn+mΔxy_{n+1} = y_n + m \cdot \Delta x

This is second-order accurate: the global error is O(Δx2)O(\Delta x^2).

Fourth-Order Runge-Kutta (RK4)

The gold standard for general-purpose ODE solving:

K1=f(xn,yn)K_1 = f(x_n, y_n) K2=f ⁣(xn+h2,yn+h2k1)K_2 = f\!\left(x_n + \frac{h}{2},\, y_n + \frac{h}{2}k_1\right) K3=f ⁣(xn+h2,yn+h2k2)K_3 = f\!\left(x_n + \frac{h}{2},\, y_n + \frac{h}{2}k_2\right) K4=f(xn+h,yn+hk3)K_4 = f(x_n + h,\, y_n + hk_3) Yn+1=yn+h6(k1+2k2+2k3+k4)Y_{n+1} = y_n + \frac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4)

RK4 is fourth-order accurate: the global error is O(Δx4)O(\Delta x^4). For most AP-level problems, Euler’s method with small step size suffices, but understanding that more sophisticated methods Exist provides useful context.

RK4 Example

Use RK4 with h=0.5h = 0.5 to approximate y(1)y(1) for dydx=x+y\frac{dy}{dx} = x + y, y(0)=1y(0) = 1.

Step 1 (x0=0x_0 = 0, y0=1y_0 = 1):

k1=0+1=1k_1 = 0 + 1 = 1

k2=(0.25)+(1+0.25)=1.5k_2 = (0.25) + (1 + 0.25) = 1.5

k3=(0.25)+(1+0.75)=2.0k_3 = (0.25) + (1 + 0.75) = 2.0

k4=(0.5)+(1+1.0)=2.5k_4 = (0.5) + (1 + 1.0) = 2.5

y1=1+0.56(1+3+4+5)=1+0.5×136=1+1.0833=2.0833y_1 = 1 + \frac{0.5}{6}(1 + 3 + 4 + 5) = 1 + \frac{0.5 \times 13}{6} = 1 + 1.0833 = 2.0833

Step 2 (x1=0.5x_1 = 0.5, y1=2.0833y_1 = 2.0833):

k1=0.5+2.0833=2.5833k_1 = 0.5 + 2.0833 = 2.5833

k2=(0.75)+(2.0833+0.6458)=3.4791k_2 = (0.75) + (2.0833 + 0.6458) = 3.4791

k3=(0.75)+(2.0833+0.8698)=3.7031k_3 = (0.75) + (2.0833 + 0.8698) = 3.7031

k4=(1.0)+(2.0833+1.8516)=4.9349k_4 = (1.0) + (2.0833 + 1.8516) = 4.9349

y2=2.0833+0.56(2.5833+6.9582+7.4062+9.8698)=2.0833+2.2263=4.3096y_2 = 2.0833 + \frac{0.5}{6}(2.5833 + 6.9582 + 7.4062 + 9.8698) = 2.0833 + 2.2263 = 4.3096

So y(1)4.3096y(1) \approx 4.3096. The exact answer is y=2exx1y = 2e^x - x - 1So y(1)=2e23.4366y(1) = 2e - 2 \approx 3.4366. Even RK4 with this large step size has significant error, but it is far more accurate than Euler’s Method would be.

Common Pitfalls

  1. Forgetting the constant of integration. Always include +C+C and use the initial condition to find it. Every separable DE integration produces an arbitrary constant; dropping it means you have a family of curves, not the particular solution.

  2. Incorrectly separating variables. All yy terms (including dydy) must be on one side, and all xx terms (including dxdx) on the other. If you cannot algebraically factor f(x,y)f(x, y) into g(x)h(y)g(x)h(y)The equation is not separable and you need a different technique.

  3. Not checking the domain of the solution. Some solutions may only be valid on a restricted interval. For example, the solution to dydx=xy\frac{dy}{dx} = \frac{x}{y} is y2=x2+Cy^2 = x^2 + CBut if C<0C \lt 0Then yy is undefined for x<C|x| \lt \sqrt{-C}.

  4. Confusing the logistic growth equation with exponential growth. The logistic equation has the additional factor (1yL)\left(1 - \frac{y}{L}\right) that caps growth at the carrying capacity.

  5. Sign errors in Euler’s method. Remember: yn+1=yn+f(xn,yn)Δxy_{n+1} = y_n + f(x_n, y_n) \cdot \Delta xNot minus. The slope at the current point tells you which direction to step.

  6. Identifying the wrong carrying capacity. In dydt=ky(1y/L)\frac{dy}{dt} = ky(1 - y/L)The carrying capacity is LLNot 1L\frac{1}{L} or kLkL. Check: setting dydt=0\frac{dy}{dt} = 0 gives y=0y = 0 or y=Ly = L.

  7. Forgetting that equilibrium solutions cannot be found by separation of variables (since you would divide by zero). Always check f(y)=0f(y) = 0 separately before separating.

  8. Applying Euler’s method with too large a step size. The approximation can diverge significantly from the true solution. When in doubt, halve the step size and check convergence.

Practice Questions

  1. Solve dydx=x2+1y\displaystyle\frac{dy}{dx} = \frac{x^2 + 1}{y} with y(0)=1y(0) = 1.

  2. A population grows according to dPdt=0.02P ⁣(1P50000)\displaystyle\frac{dP}{dt} = 0.02P\!\left(1 - \frac{P}{50000}\right) with P(0)=1000P(0) = 1000. Find the population after 50 years.

  3. Use Euler’s method with Δx=0.25\Delta x = 0.25 and two steps to approximate y(0.5)y(0.5) for dydx=x2+y\frac{dy}{dx} = x^2 + y, y(0)=1y(0) = 1.

  4. A body at 80^\circ\mathrm{C is placed in a room at 25^\circ\mathrm{C. After 30 minutes, the body is at 50^\circ\mathrm{C. When will it reach 30^\circ\mathrm{C?

  5. For dydx=y(y2)(y5)\displaystyle\frac{dy}{dx} = y(y - 2)(y - 5)Find all equilibrium solutions and classify their stability. Draw the phase line.

  6. Sketch the slope field for dydx=xy\displaystyle\frac{dy}{dx} = \frac{x}{y} and identify the equilibrium solutions (if any).

  7. A tank initially contains 200 L of water with 10 kg of salt. Pure water flows in at 3 L/min and the mixture flows out at 3 L/min. How much salt remains after 60 minutes?

  8. Show that the solution to the logistic equation dydt=ky(1y/L)\displaystyle\frac{dy}{dt} = ky(1 - y/L) with y(0)=y0y(0) = y_0 is y=L1+Ly0y0ekt\displaystyle y = \frac{L}{1 + \frac{L - y_0}{y_0} e^{-kt}}.

  9. Use Euler’s method with Δx=0.2\Delta x = 0.2 and four steps to approximate y(0.8)y(0.8) for dydx=xy\frac{dy}{dx} = xy, y(0)=1y(0) = 1. Compare your result with the exact solution.

  10. A tank contains 100 L of brine with 20 kg of salt. Fresh water flows in at 5 L/min and the mixture flows out at 5 L/min. How long does it take for the salt content to drop to 5 kg?

  11. Analyse the bifurcation diagram for dydt=y22y+c\frac{dy}{dt} = y^2 - 2y + c. Find the bifurcation point and describe the equilibrium structure on either side.

  12. Use the improved Euler method (Heun’s method) with h=0.5h = 0.5 and two steps to approximate y(1)y(1) for dydx=xy\frac{dy}{dx} = x - y, y(0)=0y(0) = 0. Compare with the exact solution.

Practice Problems

Question 1: Separable differential equation

Solve the differential equation dydx=xyx2+1\frac{dy}{dx} = \frac{xy}{x^2 + 1} with the initial condition y(0)=2y(0) = 2.

Answer

Separate variables: dyy=xx2+1dx\frac{dy}{y} = \frac{x}{x^2 + 1} \, dx.

Integrate: lny=12ln(x2+1)+C\ln|y| = \frac{1}{2}\ln(x^2 + 1) + C.

y=eCx2+1=Ax2+1y = e^C \sqrt{x^2 + 1} = A\sqrt{x^2 + 1} where A=eCA = e^C.

Using y(0)=2y(0) = 2: 2=A1=A2 = A\sqrt{1} = ASo A=2A = 2.

y=2x2+1y = 2\sqrt{x^2 + 1}.

Question 2: Logistic growth model

A population grows according to the logistic equation dPdt=0.05P ⁣(1P1000)\frac{dP}{dt} = 0.05P\!\left(1 - \frac{P}{1000}\right) with P(0)=100P(0) = 100. Find (a) the population at t=50t = 50And (b) the time when the population reaches half the carrying capacity.

Answer

Carrying capacity K=1000K = 1000Growth rate r=0.05r = 0.05.

Logistic solution: P(t)=K1+AertP(t) = \frac{K}{1 + Ae^{-rt}} where A=KP0P0=1000100100=9A = \frac{K - P_0}{P_0} = \frac{1000 - 100}{100} = 9.

P(t)=10001+9e0.05tP(t) = \frac{1000}{1 + 9e^{-0.05t}}.

(a) P(50)=10001+9e2.5=10001+9(0.0821)=10001+0.739=10001.739=575P(50) = \frac{1000}{1 + 9e^{-2.5}} = \frac{1000}{1 + 9(0.0821)} = \frac{1000}{1 + 0.739} = \frac{1000}{1.739} = 575.

(b) Half carrying capacity: P=500=10001+9e0.05tP = 500 = \frac{1000}{1 + 9e^{-0.05t}}.

1 + 9e^{-0.05t} = 2$$9e^{-0.05t} = 1$$e^{-0.05t} = 1/9.

t=ln90.05=2.1970.05=43.9t = \frac{\ln 9}{0.05} = \frac{2.197}{0.05} = 43.9 time units.

Question 3: Second-order linear DE

Solve y5y+6y=0y'' - 5y' + 6y = 0 with y(0)=1y(0) = 1 and y(0)=0y'(0) = 0.

Answer

Characteristic equation: r^2 - 5r + 6 = 0$$(r-2)(r-3) = 0. r=2,3r = 2, 3.

General solution: y=C1e2x+C2e3xy = C_1 e^{2x} + C_2 e^{3x}.

y(0)=C1+C2=1y(0) = C_1 + C_2 = 1. y(0)=2C1+3C2=0y'(0) = 2C_1 + 3C_2 = 0.

From the second equation: C1=3C2/2C_1 = -3C_2/2. Substituting: -3C_2/2 + C_2 = 1$$-C_2/2 = 1$$C_2 = -2$$C_1 = 3.

y=3e2x2e3xy = 3e^{2x} - 2e^{3x}.

Question 4: Slope field interpretation

The differential equation dydx=xy\frac{dy}{dx} = x - y has a slope field. Identify the isocline (line where slopes are zero) and describe the long-term behaviour of solutions.

Answer

Zero slopes: xy=0x - y = 0So y=xy = x. This is the isocline where all slopes are zero (horizontal).

For y>xy \gt x (above the line y=xy = x): dy/dx=xy<0dy/dx = x - y \lt 0So solutions decrease.

For y<xy \lt x (below the line y=xy = x): dy/dx=xy>0dy/dx = x - y \gt 0So solutions increase.

All solutions approach the line y=x1y = x - 1 as xx \to \infty (this can be verified by solving the DE: the general solution is y=x1+Cexy = x - 1 + Ce^{-x}Which approaches x1x - 1).

The line y=x1y = x - 1 is a stable equilibrium solution.

Question 5: Euler's method

Use Euler’s method with step size h=0.5h = 0.5 to approximate y(2)y(2) for \frac{dy}{dx} = x + y$$y(1) = 0.

Answer

x_0 = 1$$y_0 = 0$$h = 0.5. Need 2 steps.

Step 1: y1=y0+hf(x0,y0)=0+0.5(1+0)=0.5y_1 = y_0 + h \cdot f(x_0, y_0) = 0 + 0.5(1 + 0) = 0.5 at x1=1.5x_1 = 1.5.

Step 2: y2=y1+hf(x1,y1)=0.5+0.5(1.5+0.5)=0.5+1.0=1.5y_2 = y_1 + h \cdot f(x_1, y_1) = 0.5 + 0.5(1.5 + 0.5) = 0.5 + 1.0 = 1.5 at x2=2.0x_2 = 2.0.

Euler’s method approximation: y(2)1.5y(2) \approx 1.5.


:::tip Diagnostic Test Ready to test your understanding of Differential Equations? The contains the hardest questions within the AP specification for this topic, each with a full worked solution.

Unit tests probe edge cases and common misconceptions. Integration tests combine Differential Equations with other AP Calculus topics to test synthesis under exam conditions.

See for instructions on self-marking and building a personal test matrix. :::

Summary

This topic covers the mathematical techniques and concepts related to differential equations, including key theorems, methods, and problem-solving approaches.

Key concepts include:

  • sine, cosine, and tangent functions
  • trigonometric identities
  • solving trigonometric equations
  • the sine and cosine rules
  • radian measure and arc length

Regular practice with a variety of question types is essential to build fluency and confidence in applying these mathematical techniques.

Worked Examples

Worked examples demonstrating the application of key concepts are covered in the detailed sub-pages linked above.