PhysicsScore

Runge-Kutta for first-order ODEs

  • CSIR NET · advanced
  • UP Assistant Professor

4 minute read · Updated 2026-11-15

Picking up from

In Integration by trapezoid and Simpson's rule, we saw that quadrature combines sampled values to approximate accumulated change. How do sampled slopes determine the next value in an evolving solution?

In one line

Runge–Kutta methods advance an initial-value differential equation by combining slope estimates within each step.

The idea, explained

An initial-value problem specifies a derivative rule and the starting value of an unknown function. Euler’s method advances using only the starting slope. Runge–Kutta methods sample several slopes inside the step and combine them to cancel leading errors. The classical fourth-order method uses four slopes and, for sufficiently smooth problems, has global error proportional to the fourth power of step size. High order does not guarantee stability for every step size. A rapidly decaying component can still force an explicit method to take small steps.

Each stage predicts a slope at a provisional location, rather than following the final numerical path exactly. The midpoint estimates correct the bias of using only the beginning of the interval, and the final weighted combination cancels several low-order errors. For coupled equations, every stage uses a provisional vector containing all unknown components at that stage. Updating one component permanently before evaluating another mixes stages and changes the method. The step size must also resolve the fastest relevant evolution; a visually smooth output does not prove that unstable or rapidly varying components were handled correctly.

Core ideas

  • Rewrite the problem as a first-order equation or a coupled first-order system before applying the method.
  • Here each k is a slope, not an already multiplied increment; mixing conventions creates an extra step-size factor.
  • The two midpoint slopes use different provisional states, so they are not interchangeable.
  • Classical RK4 has local truncation error of fifth order and accumulated global error of fourth order under standard smoothness assumptions.
  • Check stability as well as accuracy; explicit RK4 is not unconditionally stable for stiff decay problems.
  • Local truncation error concerns one step starting from the exact value. Global error concerns the accumulated difference after many steps over a fixed interval, so the two orders differ.
  • A second-order ODE can be converted to two first-order equations by treating the function and its first derivative as separate unknowns. Apply the same RK stages consistently to both components.

Key formulas

Classical RK4 stage slopes

k1=f(t,y),k2=f(t+h/2,y+hk1/2),k3=f(t+h/2,y+hk2/2),k4=f(t+h,y+hk3)k_1=f(t,y),\quad k_2=f(t+h/2,y+hk_1/2),\quad k_3=f(t+h/2,y+hk_2/2),\quad k_4=f(t+h,y+hk_3)

For y′=f(t,y)y'=f(t,y), hh is the time step and k1k_1 through k4k_4 are sampled slopes.

Classical RK4 weighted update

ynew=y+h6(k1+2k2+2k3+k4)y_{\mathrm{new}}=y+\frac h6(k_1+2k_2+2k_3+k_4)

The weighted average advances the current value by one RK4 step.

Write the four provisional time and state pairs before evaluating their slopes. Reuse the original state as the base of each stage, adding only that stage’s prescribed increment. Multiply by the step size once in the final weighted update. Comparing a step with two half-steps helps assess accuracy, but a stability restriction may still require a smaller step.

Quick worked example

For y′=yy'=y, start at y(0)=1y(0)=1 with h=0.1h=0.1. The slopes are 11, 1.051.05, 1.05251.0525 and 1.105251.10525. The update gives y(0.1)≈1.105170833y(0.1)\approx1.105170833, close to e0.1e^{0.1}.

Where this leads

Continue to Finite difference methods, because finite differences replace derivatives directly when solving spatial or boundary-value equations.

Related: Linear ODEs, first and second order — solution families and boundary conditions.

Related: Integration by trapezoid and Simpson's rule — weighted samples and numerical error order.

Practice this topic

Practice this topic

13 questions in Assistant Professor · Physics · Physics. Sign in and practice access may be required.