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

9. Runge-Kutta 2 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 2 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)`

Method-1 : Using formula `k_2=hf(x_0+h,y_0+k_1,z_0+l_1)`

Second order Runge-Kutta (RK2) 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,y_n+k_1,z_n+l_1)`

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

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

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



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,y_0+k_1,z_0+l_1)`

`=(0.1)*f(0.1,0.1,0.6)`

`=(0.1)*(0.6)`

`=0.06`

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

`=(0.1)*g(0.1,0.1,0.6)`

`=(0.1)*(-2.8)`

`=-0.28`

`y_1=y_0+(k_1+k_2)/2`

`=0+0.08`

`=0.08`

`z_1=z_0+(l_1+l_2)/2`

`=1-0.34`

`=0.66`

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



for `n=1,x_1=0.1,y_1=0.08,z_1=0.66`

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

`=(0.1)*f(0.1,0.08,0.66)`

`=(0.1)*(0.66)`

`=0.066`

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

`=(0.1)*g(0.1,0.08,0.66)`

`=(0.1)*(-2.96)`

`=-0.296`

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

`=(0.1)*f(0.2,0.146,0.364)`

`=(0.1)*(0.364)`

`=0.0364`

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

`=(0.1)*g(0.2,0.146,0.364)`

`=(0.1)*(-2.04)`

`=-0.204`

`y_2=y_1+(k_1+k_2)/2`

`=0.08+0.0512`

`=0.1312`

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

`:.y(0.2)=0.1312`

`n``x_n``y_n``z_n``k_1``l_1``k_2``l_2``x_(n+1)``y_(n+1)``z_(n+1)`
00010.1-0.40.06-0.280.10.080.66
10.10.080.660.066-0.2960.0364-0.2040.20.1312




Method-2 : Using formula `k_2=hf(x_0+h/2,y_0+k_1/2,z_0+l_1/2)`

Second order Runge-Kutta (RK2) 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)`

`y_(n+1)=y_n+k_2`

`z_(n+1)=z_n+l_2`



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`

`y_1=y_0+k_2`

`=0+0.08`

`=0.08`

`z_1=z_0+l_2`

`=1-0.34`

`=0.66`

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



for `n=1,x_1=0.1,y_1=0.08,z_1=0.66`

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

`=(0.1)*f(0.1,0.08,0.66)`

`=(0.1)*(0.66)`

`=0.066`

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

`=(0.1)*g(0.1,0.08,0.66)`

`=(0.1)*(-2.96)`

`=-0.296`

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

`=(0.1)*f(0.15,0.113,0.512)`

`=(0.1)*(0.512)`

`=0.0512`

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

`=(0.1)*g(0.15,0.113,0.512)`

`=(0.1)*(-2.5)`

`=-0.25`

`y_2=y_1+k_2`

`=0.08+0.0512`

`=0.1312`

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

`:.y(0.2)=0.1312`

`n``x_n``y_n``z_n``k_1``l_1``k_2``l_2``x_(n+1)``y_(n+1)``z_(n+1)`
00010.1-0.40.08-0.340.10.080.66
10.10.080.660.066-0.2960.0512-0.250.20.1312





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
 
 

.