Runge-Kutta Methods

Work in progress. This note is still being written and incomplete.

4 min read Last updated Sun Sep 06 2026 13:01:26 GMT+0000 (Coordinated Universal Time)

Runge-Kutta methods approximate IVP solutions using higher-order Taylor expansions, without evaluating derivatives of ff.

The order-nn Taylor expansion of yy needs derivatives of ff up to order n1n-1. These are costly to compute and may not exist everywhere. Runge-Kutta methods replace each derivative term with values of ff at selected (t,y)(t, y) points.

Mesh points are ti=a+iht_i = a + ih with h=baNh = \dfrac{b - a}{N}, as in Euler’s method.

Midpoint Method

Second-order Taylor, with the derivative term replaced using

f(t,y)+h2f(t,y)=f(t+h2, y+h2f(t,y))+O(h2)f(t, y) + \frac{h}{2} f'(t, y) = f\left( t + \frac{h}{2},\ y + \frac{h}{2} f(t, y) \right) + O(h^2) w0=αwi+1=wi+hf(ti+h2, wi+h2f(ti,wi))\begin{aligned} w_0 &= \alpha \\ w_{i+1} &= w_i + h\, f\left( t_i + \frac{h}{2},\ w_i + \frac{h}{2} f(t_i, w_i) \right) \end{aligned}

Local error O(h2)O(h^2).

Modified Euler Method

Third-order Taylor, with the derivative term replaced by an average of the endpoint slopes.

w0=αwi+1=wi+h2[f(ti,wi)+f(ti+1, wi+hf(ti,wi))]\begin{aligned} w_0 &= \alpha \\ w_{i+1} &= w_i + \frac{h}{2}\left[ f(t_i, w_i) + f\big(t_{i+1},\ w_i + h f(t_i, w_i)\big) \right] \end{aligned}

Local error O(h3)O(h^3).

Order 4 Runge-Kutta

w0=αk1=hf(ti,wi)k2=hf(ti+h2, wi+12k1)k3=hf(ti+h2, wi+12k2)k4=hf(ti+1, wi+k3)wi+1=wi+16(k1+2k2+2k3+k4)\begin{aligned} w_0 &= \alpha \\ k_1 &= h\, f(t_i, w_i) \\ k_2 &= h\, f\left( t_i + \tfrac{h}{2},\ w_i + \tfrac{1}{2} k_1 \right) \\ k_3 &= h\, f\left( t_i + \tfrac{h}{2},\ w_i + \tfrac{1}{2} k_2 \right) \\ k_4 &= h\, f\left( t_{i+1},\ w_i + k_3 \right) \\ w_{i+1} &= w_i + \tfrac{1}{6}\left( k_1 + 2k_2 + 2k_3 + k_4 \right) \end{aligned}

for i=0,1,,N1i = 0, 1, \ldots, N-1. Local error O(h4)O(h^4).

Error Orders

MethodAsymptotic error bound
EulerO(h)O(h)
MidpointO(h2)O(h^2)
Modified EulerO(h3)O(h^3)
Order 4 Runge-KuttaO(h4)O(h^4)

Higher order gives a better approximation for the same hh.

Memorization

All four have the form wi+1=wi+h×(slope estimate)w_{i+1} = w_i + h \times (\text{slope estimate}). They differ only in how the slope is estimated.

  • Euler
    Slope at the left end, f(ti,wi)f(t_i, w_i). Nothing else.
  • Midpoint
    Half-step to the middle with Euler, then take the slope there. One evaluation at (ti+h2, wi+h2f(ti,wi))\left(t_i + \tfrac{h}{2},\ w_i + \tfrac{h}{2} f(t_i, w_i)\right).
  • Modified Euler
    Average of the two end slopes. Left slope f(ti,wi)f(t_i, w_i), right slope at the full Euler-predicted point (ti+1, wi+hf(ti,wi))\left(t_{i+1},\ w_i + h f(t_i, w_i)\right), weight 12\tfrac{1}{2} each.
  • Order 4 Runge-Kutta
    Weighted average of four slopes with weights 1,2,2,11, 2, 2, 1 over 66 (Simpson’s rule). Sample points step through ti, ti+h2, ti+h2, ti+1t_i,\ t_i + \tfrac{h}{2},\ t_i + \tfrac{h}{2},\ t_{i+1}, and each kjk_j feeds the yy-argument of the next: k1k_1 into k2k_2, k2k_2 into k3k_3, k3k_3 into k4k_4, all with factor 12\tfrac{1}{2} except k3k4k_3 \to k_4 which uses the full k3k_3.

Worked Example

IVP y(t)=yt2+1y'(t) = y - t^2 + 1, 0t20 \leq t \leq 2, y(0)=0.5y(0) = 0.5, with N=4N = 4, so h=0.5h = 0.5 and f(t,y)=yt2+1f(t, y) = y - t^2 + 1. Exact solution y(t)=(t+1)20.5ety(t) = (t+1)^2 - 0.5 e^t, giving y(2)5.3055y(2) \approx 5.3055.

Midpoint

w1=w0+0.5f(0.25, 0.5+0.25f(0,0.5))=0.5+0.5f(0.25, 0.875)=1.4063w2=2.5977,w3=3.9399,w4=5.2149\begin{aligned} w_1 &= w_0 + 0.5\, f\big(0.25,\ 0.5 + 0.25 f(0, 0.5)\big) = 0.5 + 0.5\, f(0.25,\ 0.875) = 1.4063 \\ w_2 &= 2.5977, \quad w_3 = 3.9399, \quad w_4 = 5.2149 \end{aligned}

Modified Euler

w1=w0+0.25[f(0,0.5)+f(0.5, 0.5+0.5f(0,0.5))]=0.5+0.25[1.5+2.0]=1.375w2=2.5156,w3=3.7754,w4=4.9163\begin{aligned} w_1 &= w_0 + 0.25\left[ f(0, 0.5) + f\big(0.5,\ 0.5 + 0.5 f(0, 0.5)\big) \right] = 0.5 + 0.25\,[1.5 + 2.0] = 1.375 \\ w_2 &= 2.5156, \quad w_3 = 3.7754, \quad w_4 = 4.9163 \end{aligned}

Order 4 Runge-Kutta

First step, t0=0t_0 = 0, w0=0.5w_0 = 0.5

k1=0.5f(0, 0.5)=0.75k2=0.5f(0.25, 0.5+0.375)=0.9063k3=0.5f(0.25, 0.5+0.4531)=0.9453k4=0.5f(0.5, 0.5+0.9453)=1.0977w1=0.5+16(k1+2k2+2k3+k4)=1.4251\begin{aligned} k_1 &= 0.5\, f(0,\ 0.5) = 0.75 \\ k_2 &= 0.5\, f(0.25,\ 0.5 + 0.375) = 0.9063 \\ k_3 &= 0.5\, f(0.25,\ 0.5 + 0.4531) = 0.9453 \\ k_4 &= 0.5\, f(0.5,\ 0.5 + 0.9453) = 1.0977 \\ w_1 &= 0.5 + \tfrac{1}{6}(k_1 + 2k_2 + 2k_3 + k_4) = 1.4251 \end{aligned}

Continuing, w2=2.6396w_2 = 2.6396, w3=4.0068w_3 = 4.0068, w4=5.3016w_4 = 5.3016.

Methodw4y(2)w_4 \approx y(2)Error
Euler4.43754.43750.8680.868
Midpoint5.21495.21490.0910.091
Modified Euler4.91634.91630.3890.389
Order 4 Runge-Kutta5.30165.30160.0040.004
Was this helpful?