Derivation: fourth-order Runge-Kutta

Applying Simpson's rule to the integral form of the IVP and approximating the unknown slopes with chained internal evaluations produces the classical RK4 and explains its 1, 2, 2, 1 weights.

Simpson on the integral form

tₖtₖ+h/2tₖ₊₁k₁k₂k₃k₄internal stagesweights 1, 2, 2, 1
The four RK4 stages replace Simpson's exact slopes by chained internal evaluations.
Expand diagram

The four RK4 stages replace Simpson's exact slopes by chained internal evaluations.

  1. First integrate the differential equation over the subinterval [tk,tk+1][t_k,t_{k+1}]:

    tktk+1y(τ)dτ=tktk+1f(τ,y(τ))dτ\int_{t_k}^{t_{k+1}} y'(\tau)\,d\tau=\int_{t_k}^{t_{k+1}} f\bigl(\tau,y(\tau)\bigr)\,d\tau
  2. Applying the Fundamental Theorem of Calculus to the left-hand side gives the exact integral form of the IVP:

    y(tk+1)=y(tk)+tktk+1f(τ,y(τ))dτy(t_{k+1})=y(t_k)+\int_{t_k}^{t_{k+1}} f\bigl(\tau,y(\tau)\bigr)\,d\tau
  3. Approximate the integral with Simpson's rule, which uses the endpoints and the midpoint tk+12=tk+h2t_{k+\frac12}=t_k+\frac{h}{2}:

    tktk+1fdτh6(f(tk,yk)+4f(tk+12,yk+12)+f(tk+1,yk+1))\int_{t_k}^{t_{k+1}} f\,d\tau\approx\frac{h}{6}\Bigl(f(t_k,y_k)+4f\bigl(t_{k+\frac12},y_{k+\frac12}\bigr)+f(t_{k+1},y_{k+1})\Bigr)
  4. Problem: we know neither yk+12y_{k+\frac12} nor yk+1y_{k+1}. Runge-Kutta's solution is to estimate them with chained internal slopes, each built by advancing with the previous one:

    k1=f(tk,yk)k2=f(tk+h2,yk+h2k1)k3=f(tk+h2,yk+h2k2)k4=f(tk+h,yk+hk3)\begin{aligned} k_1&=f(t_k,\,y_k)\\ k_2&=f\bigl(t_k+\tfrac{h}{2},\,y_k+\tfrac{h}{2}k_1\bigr)\\ k_3&=f\bigl(t_k+\tfrac{h}{2},\,y_k+\tfrac{h}{2}k_2\bigr)\\ k_4&=f(t_k+h,\,y_k+h\,k_3) \end{aligned}
  5. Simpson's central slope is approximated by averaging the two midpoint estimates, and the final one by k4k_4:

    f(tk+12,yk+12)k2+k32,f(tk+1,yk+1)k4f\bigl(t_{k+\frac12},y_{k+\frac12}\bigr)\approx\frac{k_2+k_3}{2},\qquad f(t_{k+1},y_{k+1})\approx k_4
  6. Substituting into Simpson, the midpoint weight 44 splits as 4k2+k32=2k2+2k34\cdot\frac{k_2+k_3}{2}=2k_2+2k_3, and the classical RK4 appears with its 1,2,2,11,2,2,1 weights:

    yk+1=yk+h6(k1+2k2+2k3+k4)y_{k+1}=y_k+\frac{h}{6}\bigl(k_1+2k_2+2k_3+k_4\bigr)
  7. A Taylor analysis analogous to Heun's (but up to fourth order) confirms that these internal approximations preserve the O(h5)\mathcal{O}(h^5) local error, so the method is fourth order.