The math optional, made finite. Daily Practice

Runge-Kutta methods (RK2/RK4)

At a Glance

Why This Chapter Matters

RK4 appears in Section B at 10–15 marks in four of the last nine years, always as a pure computation: apply the four-stage formula to advance the ODE solution one or two steps. There is no theory to derive — the formula is the entire job. The skill is working through the arithmetic carefully at 4 decimal places without sign or rounding errors. The 2022 question has two steps (final answer accumulates error over two applications).

Minimum Theory

RK4 formula. For dy/dx=f(x,y)dy/dx=f(x,y) with y(x0)=y0y(x_0)=y_0 and step size hh: k1=hf(xn,yn),k_1=h\,f(x_n,y_n), k2=hf ⁣(xn+h2,  yn+k12),k_2=h\,f\!\left(x_n+\tfrac{h}{2},\;y_n+\tfrac{k_1}{2}\right), k3=hf ⁣(xn+h2,  yn+k22),k_3=h\,f\!\left(x_n+\tfrac{h}{2},\;y_n+\tfrac{k_2}{2}\right), k4=hf(xn+h,  yn+k3),k_4=h\,f(x_n+h,\;y_n+k_3), yn+1=yn+16(k1+2k2+2k3+k4).y_{n+1}=y_n+\tfrac{1}{6}(k_1+2k_2+2k_3+k_4).

Weights: 1:2:2:11:2:2:1 (sum =6=6). Node pattern: k1k_1 at (xn,yn)(x_n,y_n); k2,k3k_2,k_3 at the midpoint xn+h/2x_n+h/2; k4k_4 at the endpoint xn+hx_n+h.

Key structure: k2k_2 uses k1/2k_1/2; k3k_3 uses k2/2k_2/2; k4k_4 uses k3k_3 (full step, not k3/2k_3/2).

RK4 stage nodes: k_1 at start, k_2 and k_3 at midpoint, k_4 at end

Question Archetypes

ArchetypeRecognition
runge-kutta”Using RK4, solve y=f(x,y)y'=f(x,y), y(x0)=y0y(x_0)=y_0, at x=x0+hx=x_0+h” (one or two steps)

runge-kutta (4 question(s); 2014, 2015, 2019, 2022)

Recognition Cues — Explicit ODE y=f(x,y)y'=f(x,y) with one initial condition; asked to find yy at a specific xx using “Runge-Kutta method of fourth order.”

Solution Template

  1. Identify f(x,y)f(x,y), x0x_0, y0y_0, hh.
  2. Compute k1k_1 at (x0,y0)(x_0,y_0).
  3. Compute k2k_2 at (x0+h/2,  y0+k1/2)(x_0+h/2,\;y_0+k_1/2).
  4. Compute k3k_3 at (x0+h/2,  y0+k2/2)(x_0+h/2,\;y_0+k_2/2).
  5. Compute k4k_4 at (x0+h,  y0+k3)(x_0+h,\;y_0+k_3).
  6. Update: y1=y0+16(k1+2k2+2k3+k4)y_1=y_0+\tfrac{1}{6}(k_1+2k_2+2k_3+k_4).
  7. Repeat for a second step if required, using y1y_1 and x1=x0+hx_1=x_0+h as the new starting point.

Worked Example 1 (one step)

2019 Paper 2, 2019-P2-Q5d (10 marks)

Using RK4, solve dy/dx=(y2x2)/(y2+x2)dy/dx=(y^2-x^2)/(y^2+x^2), y(0)=1y(0)=1, at x=0.2x=0.2 with h=0.2h=0.2.

f(x,y)=(y2x2)/(y2+x2)f(x,y)=(y^2-x^2)/(y^2+x^2), x0=0x_0=0, y0=1y_0=1, h=0.2h=0.2.

k1=0.2f(0,1)=0.21=0.2000k_1=0.2\cdot f(0,1)=0.2\cdot1=0.2000.

k2=0.2f(0.1,1.1)=0.2(1.210.01)/(1.21+0.01)=0.2(1.20/1.22)=0.20.9836=0.1967k_2=0.2\cdot f(0.1,1.1)=0.2\cdot(1.21-0.01)/(1.21+0.01)=0.2\cdot(1.20/1.22)=0.2\cdot0.9836=0.1967.

k3=0.2f(0.1,1.0984)=0.2(1.20640.01)/(1.2064+0.01)0.20.9836=0.1967k_3=0.2\cdot f(0.1,1.0984)=0.2\cdot(1.2064-0.01)/(1.2064+0.01)\approx0.2\cdot0.9836=0.1967.

k4=0.2f(0.2,1.1967)=0.2(1.43210.04)/(1.4321+0.04)=0.20.9457=0.1891k_4=0.2\cdot f(0.2,1.1967)=0.2\cdot(1.4321-0.04)/(1.4321+0.04)=0.2\cdot0.9457=0.1891.

y1=1+16(0.2000+20.1967+20.1967+0.1891)=1+16(1.1759)1.1960y_1=1+\tfrac{1}{6}(0.2000+2\cdot0.1967+2\cdot0.1967+0.1891)=1+\tfrac{1}{6}(1.1759)\approx1.1960.

y(0.2)1.1960.\boxed{y(0.2)\approx1.1960.}

Worked Example 2 (two steps)

2022 Paper 2, 2022-P2-Q8b (15 marks)

Using RK4, solve dy/dx=x+y2dy/dx=x+y^2, y(0)=1y(0)=1, at x=0.2x=0.2 with h=0.1h=0.1.

Step 1 (x=00.1x=0\to0.1):

k1=0.1(0+1)=0.1000k_1=0.1(0+1)=0.1000. k2=0.1(0.05+1.052)=0.11.1525=0.1153k_2=0.1(0.05+1.05^2)=0.1\cdot1.1525=0.1153. k3=0.1(0.05+1.05762)0.11.1686=0.1169k_3=0.1(0.05+1.0576^2)\approx0.1\cdot1.1686=0.1169. k4=0.1(0.1+1.11692)0.11.3474=0.1347k_4=0.1(0.1+1.1169^2)\approx0.1\cdot1.3474=0.1347.

y1=1+16(0.1000+0.2306+0.2338+0.1347)=1+16(0.6991)=1+0.1165=1.1165y_1=1+\tfrac16(0.1000+0.2306+0.2338+0.1347)=1+\tfrac16(0.6991)=1+0.1165=1.1165.

Step 2 (x=0.10.2x=0.1\to0.2):

k1=0.1(0.1+1.11652)=0.11.3466=0.1347k_1=0.1(0.1+1.1165^2)=0.1\cdot1.3466=0.1347. k2=0.1(0.15+1.18392)0.11.5516=0.1552k_2=0.1(0.15+1.1839^2)\approx0.1\cdot1.5516=0.1552. k3=0.1(0.15+1.19412)0.11.5759=0.1576k_3=0.1(0.15+1.1941^2)\approx0.1\cdot1.5759=0.1576. k4=0.1(0.2+1.27412)0.11.8233=0.1823k_4=0.1(0.2+1.2741^2)\approx0.1\cdot1.8233=0.1823.

y2=1.1165+16(0.1347+0.3104+0.3152+0.1823)=1.1165+16(0.9426)=1.1165+0.1571=1.2736y_2=1.1165+\tfrac16(0.1347+0.3104+0.3152+0.1823)=1.1165+\tfrac16(0.9426)=1.1165+0.1571=1.2736.

y(0.2)1.2736.\boxed{y(0.2)\approx1.2736.}

Common Traps

Marks-Aware Writing

Show all four kk-values explicitly (each as a formula and a decimal). Display the weighted average k1+2k2+2k3+k4k_1+2k_2+2k_3+k_4, divide by 6, and add to yny_n. For a two-step question, repeat all four stages for the second step. The examiners give process marks for the correct formula applied correctly — getting a slightly wrong numerical answer because of rounding still earns most marks if the method is shown correctly.

Practice Set

We've mapped all 13 years of this exam. Get new chapters, tools, and solutions as we release them — free.