What the relationship means
The initial-value problem y′=f(t,y), y(t0)=y0 must be uniquely solvable in the region and sufficiently smooth for the order claim. h has the independent variable’s unit; each ki has units of y per t. The calculator explicitly treats only y′=λy with a constant real rate. Negative h represents directed backward stepping, not negative absolute physical time.
RK4 provides a transparent entry to numerical dynamics and smooth, nonstiff models. Comparison with the Taylor series explains its order; the exponential function supplies an independent growth or decay reference. For coupled linear ODE systems the four stages are vectors, rather than separately updated components that ignore their coupling.
Derive it step by step
A single Euler step sees only the initial slope. RK4 additionally probes two different midpoint states and one endpoint state. Its weights are chosen to match the exact solution’s Taylor expansion through fourth order. These four probes are not already known points on the exact solution.
- Start at (tn,yn) and calculate k1=f(tn,yn). Here the k-values are slopes; h is not included yet.
- Use k1 to form the first midpoint state yn+h·k1/2. Its slope k2 gives the second midpoint state yn+h·k2/2 for k3.
- Probe the endpoint slope k4=f(tn+h,yn+h·k3). This is a separate evaluation, not a weighted mean.
- Add h(k1+2k2+2k3+k4)/6 to the initial value. For sufficiently smooth solutions and suitable stability, local error is O(h5), while global error over a fixed time interval is O(h4).
Two worked examples
Growth with a large demonstration step
- Given
- Author calculation: y′=y/s, y(0)=1, h=1 s.
- Find
- Calculate four stages and compare with e.
Initially k1=1 s−1. The first midpoint state is 1+1/2=1.5, hence k2=1.5 s−1.
The second midpoint state is 1+1.5/2=1.75. Thus k3=1.75 s−1 and the endpoint slope is k4=1+1.75=2.75 s−1.
The weighted update is 1+(1+3+3.5+2.75)/6=65/24. The exact endpoint solution is e.
Result: RK4 gives 2.708333333; signed error relative to e is about −0.009948495.
Check: All stages are slopes and receive h only in the final update. The result is consistent in scale with e≈2.71828.
Decay with a smaller step
- Given
- Author calculation: λ=−2 s−1, y0=2, h=0.25 s.
- Find
- Find a stable positive decay result.
k1=−4 s−1; midpoint 2+0.125·(−4)=1.5, so k2=−3 s−1.
Using k2 gives 1.625 and k3=−3.25 s−1. The endpoint probe state is 1.1875, hence k4=−2.375 s−1.
Substitution with the weights gives 233/192. The comparison value is 2·exp(−0.5).
Result: Result 1.213541667; exact value 1.213061319; absolute error about 0.000480347.
Check: z=λh=−0.5 lies in the stable region; the state decreases from 2 to a positive value.
Recall the method later with the formula’s flashcards.
11 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Limits and result checks
Four function evaluations do not constitute an error estimate. Classical RK4 has no built-in adaptive controller. Stiff equations may require very small explicit steps even for smooth solutions. For y′=λy, yn+1=R4(λh)yn; on the negative real axis, |R4|≤1 is needed to keep a decaying mode from growing numerically. The existing graphic’s intermediate points are correct stage probes and may lie off the exact curve.
- The k-values include h and receive h again in the outer update. Use either slopes ki=f or increments Ki=h·f consistently.
- Negative λ guarantees a stable decay step. Check |R4(λh)|; large explicit steps may grow.
- Order four means four correct decimal places. Order describes an asymptotic error power in h.
Five exercises with solutions
Calculate · Foundation
For y′=y/s, y0=3 and h=0.5 s, calculate one RK4 step.
Show hint
Use R4(0.5).
Learning goal: Evaluate the stability polynomial
Show solution and calculation
R4(0.5)=1+1/2+1/8+1/48+1/384=211/128.
With y0=3, y1=633/128=4.9453125.
Rearrange · Foundation
For y′=λy, y0=3 and k1=−6 s−1 are known. Find λ.
Show hint
k1=λy0 provided y0≠0.
Learning goal: Recover the rate from the first stage
Show solution and calculation
λ=k1/y0=−6/3=−2 s−1.
At y0=0 this rearrangement is not unique: every λ gives k1=0.
Interpret · Application
Why does halving h often reduce global RK4 error about 16-fold rather than 32-fold?
Show hint
Compare a fixed total interval with one step.
Learning goal: Distinguish local and global error
Show solution and calculation
One-step local error is O(h5).
Over a fixed interval the number of steps grows proportionally to 1/h; under smoothness and stability the global error is O(h4).
Halving h therefore gives the asymptotic factor 24=16.
Outside this regime it is not a guaranteed measured ratio.
Error analysis · Application
A solution sets k1=h·f(tn,yn), then uses yn+1=yn+h(k1+2k2+2k3+k4)/6. What is wrong?
Show hint
Check the units of the k-values.
Learning goal: Keep slopes and increments separate
Show solution and calculation
h is counted twice.
With slopes ki=f(...), h appears outside; with increments Ki=h·f(...), the outer update is only (K1+2K2+2K3+K4)/6.
The inner stages must use the same convention.
Transfer · Challenge
For λ=−3 s−1 and h=1 s, RK4 gives the factor 11/8. Is this a useful decay scheme?
Show hint
Compare |R4(−3)| with 1 and e−3.
Learning goal: Recognize numerical instability
Show solution and calculation
No.
R4(−3)=1−3+9/2−27/6+81/24=11/8>1.
Numerical states grow even though the exact solution shrinks by e−3≈0.049787 per step.
Reduce h or use an appropriately stable method.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Sources for this explanation
Quanta · Updated November 8, 2026
- Universität Ulm: Angewandte Numerik II, Abschnitt 3.4
- MIT OpenCourseWare: Classical Runge-Kutta and ODE4
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added a full article with model limits, independently calculated examples, five exercise paths and source references.
Cite this reference page
Quanta. Classical Fourth-Order Runge-Kutta Method (RK4). Updated November 8, 2026. https://quanta-study.de/en/formula-sheet/runge-kutta-verfahren-vierter-ordnung
When citing a specific scientific statement, also cite the specialist source linked to that statement.