Why this shape? Each ki is an estimate of h⋅(slope) at a sample point. We tune the constants ai,ci,bij so the whole thing agrees with the Taylor series of the true solution up to h4.
Expanding k2,k3,k4 as 2-variable Taylor series and forcing the weighted sum to equal the exact expansion above produces a system of order conditions. The classic solution (there are infinitely many; this is the elegant symmetric one) is:
c2=c3=21,c4=1,a1=a4=61,a2=a3=31,
and b21=b32=21, b43=1, all others zero.
Why these numbers? The weights (61,31,31,61) are exactly Simpson's rule weights — because when f depends only on x, RK4 reduces to Simpson's 6h(k1+2k2+2k3+k4)-style integration, which is O(h5) accurate. RK4 is Simpson's rule generalized to y-dependence!
Verify:2.70833 vs 2.71828, error ≈0.01 even with a huge step h=1. Notice y1=1+1+21+61+241 = the first five terms of ex's series — direct proof RK4 matches Taylor to h4.
You want to walk across a hill in the fog and land at the right height. Euler checks the ground slope only where he starts and walks straight — he overshoots. RK4 is smarter: he peeks at the slope at the start, then guesses the middle, checks it, re-checks the middle, then checks the far end — and takes a cleverly weighted average of all four peeks (the two middle peeks count twice). That average almost perfectly matches the real curved path. So even with big steps, he lands almost exactly on target.
Dekho, RK4 ka core idea bahut simple hai. Jab humein y′=f(x,y) solve karna hota hai lekin exact formula nahi milta, tab hum step-by-step aage badhte hain. Euler method sirf shuru ki slope dekh kar seedha chal deta hai — isliye galat direction mein overshoot ho jata hai, kyunki slope to raste mein badalti rehti hai. RK4 smart hai: wo char jagah slope check karta hai — start pe (k1), do baar beech mein (k2,k3), aur end pe (k4).
Phir in char slopes ka ek weighted average leta hai: formula yn+1=yn+61(k1+2k2+2k3+k4). Notice karo ki beech wali slopes (k2,k3) ko do-do baar count kiya — kyunki midpoint interval ka sabse accha representative hota hai. Ye weights 1,2,2,1 actually Simpson's rule se aate hain! Isliye RK4 ko "Simpson's rule for ODEs" bhi kehte hain.
Kyun itna accurate? Kyunki ye weighted combination true solution ke Taylor series ko h4 tak exactly match karta hai — bina koi derivative calculate kiye. Derivatives ki jagah bas extra function evaluations use hote hain. Result: local error O(h5), global error O(h4). Matlab step chhota karoge to error bahut tezi se girega. Exam mein RK4 favourite isliye hai kyunki bade step pe bhi answer exact ke kareeb aata hai — jaise humne dekha y′=y mein h=1 pe bhi e ke bahut paas nikla.
Yaad rakho: k1 left, k2-k3 middle, k4 right, aur middles ko double weight — bas yehi RK4 ki poori kahani hai.