Home > Numerical methods > Numerical Differential Equation > Euler method example

11. Runge-Kutta 4 method (second order differential equation) example ( Enter your problem )
  1. Formula & Example-1 : `y''=1+2xy-x^2z`
  2. Example-2 : `y''=xz^2-y^2`
  3. Example-3 : `y''=-4z-4y`
  4. Formula-2 & Example-1 : `y''=1+2xy-x^2z`
  5. Example-2 : `y''=xz^2-y^2`
  6. Example-3 : `y''=-4z-4y`

3. Example-3 : `y''=-4z-4y`





Find y(0.2) for `y''=-4z-4y`, `x_0=0, y_0=0, z_0=1`, with step length 0.1 using Runge-Kutta 4 method (second order differential equation)

Solution:
Given `y^('')=-4z-4y, y(0)=0, y'(0)=1, h=0.1, y(0.2)=?`

put `(dy)/(dx)=z` and differentiate w.r.t. x, we obtain `(d^2y)/(dx^2)=(dz)/(dx)`

We have system of equations
`(dy)/(dx)=z=f(x,y,z)`

`(dz)/(dx)=-4z-4y=g(x,y,z)`

Fourth order Runge-Kutta (RK4) method for second order differential equation formula
`k_1=hf(x_n,y_n,z_n)`

`l_1=hg(x_n,y_n,z_n)`

`k_2=hf(x_n+h/2,y_n+k_1/2,z_n+l_1/2)`

`l_2=hg(x_n+h/2,y_n+k_1/2,z_n+l_1/2)`

`k_3=hf(x_n+h/2,y_n+k_2/2,z_n+l_2/2)`

`l_3=hg(x_n+h/2,y_n+k_2/2,z_n+l_2/2)`

`k_4=hf(x_n+h,y_n+k_3,z_n+l_3)`

`l_4=hg(x_n+h,y_n+k_3,z_n+l_3)`

`y_(n+1)=y_n+1/6(k_1+2k_2+2k_3+k_4)`

`z_(n+1)=z_n+1/6(l_1+2l_2+2l_3+l_4)`



for `n=0,x_0=0,y_0=0,z_0=1`

`k_1=hf(x_0,y_0,z_0)`

`=(0.1)*f(0,0,1)`

`=(0.1)*(1)`

`=0.1`

`l_1=hg(x_0,y_0,z_0)`

`=(0.1)*g(0,0,1)`

`=(0.1)*(-4)`

`=-0.4`

`k_2=hf(x_0+h/2,y_0+k_1/2,z_0+l_1/2)`

`=(0.1)*f(0.05,0.05,0.8)`

`=(0.1)*(0.8)`

`=0.08`

`l_2=hg(x_0+h/2,y_0+k_1/2,z_0+l_1/2)`

`=(0.1)*g(0.05,0.05,0.8)`

`=(0.1)*(-3.4)`

`=-0.34`

`k_3=hf(x_0+h/2,y_0+k_2/2,z_0+l_2/2)`

`=(0.1)*f(0.05,0.04,0.83)`

`=(0.1)*(0.83)`

`=0.083`

`l_3=hg(x_0+h/2,y_0+k_2/2,z_0+l_2/2)`

`=(0.1)*g(0.05,0.04,0.83)`

`=(0.1)*(-3.48)`

`=-0.348`

`k_4=hf(x_0+h,y_0+k_3,z_0+l_3)`

`=(0.1)*f(0.1,0.083,0.652)`

`=(0.1)*(0.652)`

`=0.0652`

`l_4=hg(x_0+h,y_0+k_3,z_0+l_3)`

`=(0.1)*g(0.1,0.083,0.652)`

`=(0.1)*(-2.94)`

`=-0.294`

Now,
`y_1=y_0+1/6(k_1+2k_2+2k_3+k_4)`

`=0+1/6[0.1+2(0.08)+2(0.083)+(0.0652)]`

`=0.0819`

`z_1=z_0+1/6(l_1+2l_2+2l_3+l_4)`

`=1+1/6[-0.4+2(-0.34)+2(-0.348)+(-0.294)]`

`=0.655`

`x_1=x_0+h=0+0.1=0.1`



for `n=1,x_1=0.1,y_1=0.0819,z_1=0.655`

`k_1=hf(x_1,y_1,z_1)`

`=(0.1)*f(0.1,0.0819,0.655)`

`=(0.1)*(0.655)`

`=0.0655`

`l_1=hg(x_1,y_1,z_1)`

`=(0.1)*g(0.1,0.0819,0.655)`

`=(0.1)*(-2.9475)`

`=-0.2947`

`k_2=hf(x_1+h/2,y_1+k_1/2,z_1+l_1/2)`

`=(0.1)*f(0.15,0.1146,0.5076)`

`=(0.1)*(0.5076)`

`=0.0508`

`l_2=hg(x_1+h/2,y_1+k_1/2,z_1+l_1/2)`

`=(0.1)*g(0.15,0.1146,0.5076)`

`=(0.1)*(-2.489)`

`=-0.2489`

`k_3=hf(x_1+h/2,y_1+k_2/2,z_1+l_2/2)`

`=(0.1)*f(0.15,0.1072,0.5306)`

`=(0.1)*(0.5306)`

`=0.0531`

`l_3=hg(x_1+h/2,y_1+k_2/2,z_1+l_2/2)`

`=(0.1)*g(0.15,0.1072,0.5306)`

`=(0.1)*(-2.5512)`

`=-0.2551`

`k_4=hf(x_1+h,y_1+k_3,z_1+l_3)`

`=(0.1)*f(0.2,0.1349,0.3999)`

`=(0.1)*(0.3999)`

`=0.04`

`l_4=hg(x_1+h,y_1+k_3,z_1+l_3)`

`=(0.1)*g(0.2,0.1349,0.3999)`

`=(0.1)*(-2.1392)`

`=-0.2139`

Now,
`y_2=y_1+1/6(k_1+2k_2+2k_3+k_4)`

`=0.0819+1/6[0.0655+2(0.0508)+2(0.0531)+(0.04)]`

`=0.1341`

`x_2=x_1+h=0.1+0.1=0.2`

`:.y(0.2)=0.1341`

`n``x_n``y_n``z_n``k_1``l_1``k_2``l_2``k_3``l_3``k_4``l_4``x_(n+1)``y_(n+1)``z_(n+1)`
00010.1-0.40.08-0.340.083-0.3480.0652-0.2940.10.08190.655
10.10.08190.6550.0655-0.29470.0508-0.24890.0531-0.25510.04-0.21390.20.1341





This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then Submit Here





Share this solution or page with your friends.
 
 
Copyright © 2026. All rights reserved. Terms, Privacy
 
 

.