Runge-Kutta Method — Definition, Formula & Examples
The Runge-Kutta method is a numerical technique for approximating solutions to ordinary differential equations when an exact analytical solution is difficult or impossible to find. The most widely used version, called RK4 (fourth-order Runge-Kutta), computes four weighted slope estimates at each step to achieve high accuracy.
Given an initial value problem with , the classical fourth-order Runge-Kutta method advances the solution from to by computing a weighted average of four intermediate slope evaluations , yielding a local truncation error of order and a global error of order .
Key Formula
y_{n+1} = y_n + \frac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4)$$
$$k_1 = f(t_n,\, y_n)$$
$$k_2 = f\!\left(t_n + \frac{h}{2},\, y_n + \frac{h}{2}k_1\right)$$
$$k_3 = f\!\left(t_n + \frac{h}{2},\, y_n + \frac{h}{2}k_2\right)$$
$$k_4 = f(t_n + h,\, y_n + h\,k_3)
Where:
- = Approximate solution value at step n
- = Current value of the independent variable
- = Step size
- = The derivative function from y' = f(t, y)
- = Slope estimates at different points in the interval
How It Works
At each step, you evaluate the slope at four strategic points within the interval. First, uses the slope at the current point. Then and each use slopes at the midpoint of the interval, but based on different estimates. Finally, uses the slope at the end of the interval. The next -value is a weighted combination that gives the midpoint slopes four times the weight of the endpoint slopes. You repeat this process for as many steps as needed to cover your desired range of .
Worked Example
Problem: Use one step of RK4 with h = 0.1 to approximate y(0.1), given y' = t + y, y(0) = 1.
Compute k₁: Evaluate f at the starting point.
Compute k₂: Evaluate f at the midpoint using k₁.
Compute k₃: Evaluate f at the midpoint using k₂.
Compute k₄: Evaluate f at the endpoint using k₃.
Combine: Apply the RK4 formula.
Answer: y(0.1) ≈ 1.11034. The exact solution is y = 2e^t − t − 1, giving y(0.1) ≈ 1.11034, so RK4 is extremely accurate even in one step.
Why It Matters
RK4 is the default numerical ODE solver taught in differential equations courses and used in engineering, physics simulations, and computational biology. Many software tools (MATLAB's ode45, Python's scipy.integrate) build on Runge-Kutta variants. Understanding it prepares you for any field where differential equations lack closed-form solutions.
Common Mistakes
Mistake: Using k₁ instead of k₂ when computing k₃.
Correction: Each k-value feeds into the next: k₃ depends on k₂ (not k₁), and k₄ depends on k₃. Follow the chain carefully.
