As we know, Taylor’s series is a numerical method used for solving differential equations and is limited by the work to be done in finding the derivatives of the higher-order. To overcome this, we can use a new category of numerical methods called **Runge-Kutta methods** to solve differential equations. These will give us higher accuracy without performing more calculations. These methods coordinate with the solution of Taylor’s series up to the term in h_{r}, where r varies from method to method, representing the order of that method. One of the most significant advantages of Runge-Kutaa formulae is that it requires the function’s values at some specified points.

Before learning about the **Runge-Kutta RK4 method**, let’s have a look at the formulas of the first, second and third-order Runge-Kutta methods.

Consider an ordinary differential equation of the form dy/dx = f(x, y) with initial condition y(x_{0}) = y_{0}. For this, we can define the formulas for Runge-Kutta methods as follows.

**1st Order Runge-Kutta method**

y_{1} = y_{0} + hf(x_{0}, y_{0}) = y_{0} + hy’_{0} {since y’ = f(x, y)}

This formula is same as the Euler’s method

**2nd Order Runge-Kutta method**

y_{1} = y_{0} + (½) (k_{1} + k_{2})

Here,

k_{1} = hf(x_{0}, y_{0})

k_{2} = hf(x_{0} + h, y_{0} + k_{1})

**3rd Order Runge-Kutta method**

y_{1} = y_{0} + (⅙) (k_{1} + 4k_{2} + k_{3})

Here,

k_{1} = hf(x_{0}, y_{0})

k_{2} = hf[x_{0} + (½)h, y_{0} + (½)k_{1}]

k_{3} = hf(x_{0} + h, y_{0} + k^{1}) such that k^{1} = hf(x_{0} + h, y_{0} + k_{1})

## What is Fourth Order RK Method?

The most commonly used Runge Kutta method to find the solution of a differential equation is the RK4 method, i.e., the fourth-order Runge-Kutta method. The Runge-Kutta method provides the approximate value of y for a given point x. Only the first order ODEs can be solved using the Runge Kutta RK4 method.

**Runge-Kutta Fourth Order Method Formula**

The formula for the fourth-order Runge-Kutta method is given by:

y_{1} = y_{0} + (⅙) (k_{1} + 2k_{2} + 2k_{3} + k_{4})

Here,

k_{1} = hf(x_{0}, y_{0})

k_{2} = hf[x_{0} + (½)h, y_{0} + (½)k_{1}]

k_{3} = hf[x_{0} + (½)h, y_{0} + (½)k_{2}]

k_{4} = hf(x_{0} + h, y_{0} + k_{3})

**Read more:**

- Ordinary differential equations
- Exact differential equation
- First order differential equation

## Runge-Kutta RK4 Method Solved Examples

**Example 1:**

Consider an ordinary differential equation dy/dx = x^{2} + y^{2}, y(1) = 1.2. Find y(1.05) using the fourth order Runge-Kutta method.

**Solution:**

Given,

dy/dx = x^{2} + y^{2}, y(1) = 1.2

So, f(x, y) = x^{2} + y^{2}

x0 = 1 and y0 = 1.2

Also, h = 0.05

Let us calculate the values of k_{1}, k_{2}, k_{3} and k_{4}.

k_{1} = hf(x_{0}, y_{0})

= (0.05) [x_{0}^{2} + y_{0}^{2}]

= (0.05) [(1)^{2} + (1.2)^{2}]

= (0.05) (1 + 1.44)

= (0.05)(2.44)

= 0.122

k_{2} = hf[x_{0} + (½)h, y_{0} + (½)k_{1}]

= (0.05) [f(1 + 0.025, 1.2 + 0.061)] {since h/2 = 0.05/2 = 0.025 and k_{1}/2 = 0.122/2 = 0.061}

= (0.05) [f(1.025, 1.261)]

= (0.05) [(1.025)^{2} + (1.261)^{2}]

= (0.05) (1.051 + 1.590)

= (0.05)(2.641)

= 0.1320

k_{3} = hf[x_{0} + (½)h, y_{0} + (½)k_{2}]

= (0.05) [f(1 + 0.025, 1.2 + 0.066)] {since h/2 = 0.05/2 = 0.025 and k_{2}/2 = 0.132/2 = 0.066}

= (0.05) [f(1.025, 1.266)]

= (0.05) [(1.025)^{2} + (1.266)^{2}]

= (0.05) (1.051 + 1.602)

= (0.05)(2.653)

= 0.1326

k_{4} = hf(x_{0} + h, y_{0} + k_{3})

= (0.05) [f(1 + 0.05, 1.2 + 0.1326)]

= (0.05) [f(1.05, 1.3326)]

= (0.05) [(1.05)^{2} + (1.3326)^{2}]

= (0.05) (1.1025 + 1.7758)

= (0.05)(2.8783)

= 0.1439

By RK4 method, we have;

y_{1} = y_{0} + (⅙) (k_{1} + 2k_{2} + 2k_{3} + k_{4})

y_{1} = y(1.05) = y_{0} + (⅙) (k_{1} + 2k_{2} + 2k_{3} + k_{4})

By substituting the values of y_{0}, k_{1}, k_{2}, k_{3} and k_{4}, we get;

y(1.05) = 1.2 + (⅙) [0.122 + 2(0.1320) + 2(0.1326) + 0.1439]

= 1.2 + (⅙) (0.122 + 0.264 + 0.2652 + 0.1439)

= 1.2 + (⅙) (0.7951)

= 1.2 + 0.1325

= 1.3325

**Example 2:**

Find the value of k_{1} by Runge-Kutta method of fourth order if dy/dx = 2x + 3y^{2} and y(0.1) = 1.1165, h = 0.1.

**Solution:**

Given,

dy/dx = 2x + 3y^{2} and y(0.1) = 1.1165, h = 0.1

So, f(x, y) = 2x + 3y^{2}

x_{0} = 0.1, y_{0} = 1.1165

By Runge-Kutta method of fourth order , we have

k_{1} = hf(x_{0}, y_{0})

= (0.1) f(0.1, 1.1165)

= (0.1) [2(0.1) + 3(1.1165)^{2}]

= (0.1) [0.2 + 3(1.2465)]

= (0.1)(0.2 + 3.7395)

= (0.1)(3.9395)

= 0.39395

### Runge-Kutta RK4 Method Problems

- Using the Runge-Kutta method of order 4, find y(0.2) if dy/dx = (y – x)/(y + x), y(0) = 1 and h = 0.2.
- Find the value of y(0.3) from the differential equation dy/dx = 3e
^{x}+ 2y; y(0) = 0, h = 0.3 by the fourth order Runge-Kutta method. - Using RK4 method to find y(0.2) and y(0.4) if dy/dx = 1 + y + x
^{2}; y(0) = 0.5

## Frequently Asked Questions on Runge-Kutta RK4 Method

Q1

### What is the formula of the Runge-Kutta fourth order method?

The formula of the Runge-Kutta fourth order method is given as:

y_{1} = y_{0} + (⅙) (k_{1} + 2k_{2} + 2k_{3} + k_{4})

Q2

### What order is RK4?

The name RK4 itself indicates that it is the fourth order Runge-Kutta method. That means, the order is 4.

Q3

### How many gradient evaluations are required for each iteration of a fourth-order Runge Kutta algorithm?

Four gradient evaluations are required for each iteration of a fourth-order Runge Kutta algorithm.