Visual walkthrough — Runge-Kutta 4th order (RK4) — derivation
A picture-by-picture rebuild of the RK4 method from the ground up. Every symbol is earned before it is used. If you have only ever seen a straight-line "guess and step" method like Euler's Method, start here — we assume nothing else.
What is even the question?
We are given a rule that tells us the steepness (the slope) at any location:
Our job: from take one step of width to the right and estimate the new height at the next position. We will label positions in a chain and advance them by the fixed step:
Step 1 — Why one slope is not enough
WHAT. Euler walks in a perfectly straight line, using the steepness read only at the left edge of the step.
WHY it fails. The real hill curves. A straight line drawn from the left slope keeps that same slope for the whole width — but the true slope has already changed by the time you reach the middle. You drift away from the curve.
PICTURE. The blue curve is the truth. The orange dashed line is Euler's straight guess starting from the left slope. The vertical red gap at is the error — and it grows with .

The lesson: one reading, taken too early, misrepresents the whole interval. We need more readings, taken inside the step.
Step 2 — The honest target: the exact step as an area
WHAT. Before guessing, write down the exact answer we are chasing.
WHY. If we know exactly what "perfect" looks like, we can tune our guess to match it. The exact new height is the old height plus the accumulated slope across the step:
PICTURE. The shaded green area under the slope-curve equals the exact height gained. Any good method is just a clever way to estimate this area from a few slope samples.

This reframes everything: RK4 is a rule for approximating an area from a handful of sample heights — which is exactly what Simpson's Rule does. Hold that thought.
Step 3 — Four sample slopes inside one step
WHAT. We take four slope readings at chosen spots and package each as "a slope times ."
WHY package as ? Because slope width = a rise. Writing means each is already a height-jump, so we can add them directly with no stray floating around.
PICTURE. Four little slope-arrows planted at the left edge (blue), twice at the midpoint (orange, then green), and at the right edge (red). Each later arrow uses the previous jump to locate where to stand.

Step 4 — Combine them with weights
WHAT. Blend the four jumps into one final jump:
WHY these weights? Look back at Step 2 — the answer is an area. Simpson's rule approximates an area using endpoints once and the midpoint four times, all over : . Here the midpoint slope is split into two estimates and , so the " middle" becomes "." The divisor keeps the weights a true average.
PICTURE. A weighing-scale image: the two orange/green midpoint arrows sit on pans marked ; the blue and red edge arrows on pans marked . The balance point is the final averaged slope (the purple arrow), and marching along that slope lands us on the blue curve.

Step 5 — Why it is called "4th order" (matching Taylor, shown explicitly)
WHAT. The exact height, expanded as a Taylor series, is a sum of -powers:
WHY. The constants and the midpoints are not decorative — they are forced by matching. Let us show the mechanics on the simplest revealing case, (so , whose exact solution multiplies by each step). Expand each as a polynomial in (using ):
Now form the weighted sum term-by-term ( factored out):
Compare against the exact expansion of :
The coefficients agree exactly because the weights were solved to make them agree — that is the entire content of the "order conditions." The first mismatch is the term, hence the local error .
PICTURE. A bar chart of -powers: RK4's bars match the true Taylor bars exactly through (shown in green), and only diverge at (the small red bar) — visual proof of "4th order."

Step 6 — The degenerate case: when depends only on
WHAT. Suppose the slope machine ignores height entirely: . Then the two midpoint readings coincide ( use the same and the height-guess no longer matters).
WHY it matters. The whole update collapses into
which is exactly Simpson's Rule for . So RK4 is not a new invention out of nowhere — it is Simpson's rule generalised to slopes that also depend on height. This closes the loop opened in Step 2.
PICTURE. With , the four arrows drop onto one flat curve; the two midpoint arrows land on the same spot and merge into a single "" pan — Simpson's rule, revealed.

Step 7 — Sanity check on a real curve
WHAT. Watch RK4 vs Euler over one big step on , (truth: , so ).
WHY. A single fat step is the harshest test — it exposes how much the curvature hurts.
- Euler: one left slope (badly short).
- RK4: .
Note — the first five terms of 's series — a direct sighting of the -match from Step 5.
PICTURE. The blue curve; Euler's endpoint sits far below at , RK4's endpoint hugs the curve at , the true value marked just above.

Step 8 — The same four-slope idea for systems (vector )
WHAT. Real problems often track several quantities at once (position and velocity, several chemicals, etc.). Then becomes a vector and the slope machine returns a vector .
WHY it just works. Nothing in the derivation used "there is only one ." Every becomes a vector , and the same formulas apply component-by-component:
The addition and scaling are ordinary vector operations. Since a single high-order ODE (say ) can always be rewritten as a system of first-order ODEs, this one upgrade lets RK4 solve essentially every ODE you will meet — the four-slope picture is unchanged; only the arrows now live in higher dimensions.
The one-picture summary
Everything at once: the exact area we chase (green), the four sampled slope-arrows (blue/orange/green/red) at left–mid–mid–right, their weights , the averaged purple slope, and the landing point on the true curve.

Recall Feynman retelling — the whole walk in plain words
You are on a foggy hill and must guess your height a step ahead. Euler feels the ground only where he starts, walks straight, and overshoots because the hill curves. RK4 is patient. First he feels the slope at his feet (). Using that, he guesses where the middle is and feels the slope there (). He does not trust that guess, so he uses it to re-locate the middle and feels again (). Finally he strides to the far edge and feels the slope there (). Now he has four honest readings: two at the edges, two in the middle. He takes a weighted average — the middles count double — because the middle best represents the whole stretch. That average slope is so faithful to the real curve that even with a giant step he lands almost exactly on target. And the reason the middles count double is the same reason Simpson's rule weights the middle of an area heavily: RK4 is Simpson's rule wearing a differential-equation costume.
Active Recall
Integral in Step 2 represents?
Why guess midpoint height for ?
Source of the weights?
What does "" mean?
Global vs local error?
What does RK4 become when only?
What changes for a system of ODEs?
Connections
- Euler's Method — the single-left-slope method beaten in Steps 1 and 7.
- Modified Euler / Heun's Method — averages two edge slopes; RK4's 2nd-order sibling.
- Simpson's Rule — the area rule hiding in Steps 4 and 6.
- Taylor Series Methods — the exact target matched in Step 5.
- Local vs Global Truncation Error — the one-power drop of Step 5.
- Adaptive Step Size (RKF45) — RK4 upgraded with error control.