---
title: "RK-4: y'' - 3y' + y = sin x"
subject: "Numerical Method"
chapter: 6
key: "semester_4/numerical_method:rk4-second-order-ivp-y12"
source: https://www.bctengineer.com/q/semester_4/numerical_method/rk4-second-order-ivp-y12
site: BCT Engineering
---

# RK-4: y'' - 3y' + y = sin x

Numerical Method · Chapter 6: Solution of ordinary differential equations

- Asked in: 2070 Bhadra, 6 marks
- Video: [RK4 Runge-Kutta | Differential Equations | Full Calculation](https://www.youtube.com/watch?v=Javfe8nFILI) — Mathematics Tutor
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/numerical_method/rk4-second-order-ivp-y12
- Whole chapter: https://www.bctengineer.com/md/semester_4/numerical_method/chapter-6

## Question

Solve the following initial value problem for y(1.2) using the Runge-Kutta fourth order method.
y'' - 3y' + y = sin x;  y(1) = 1.2;  y'(1) = 0.5

## Short answer

Write the second-order equation as y'=z, z'=3z-y+sin x. Using fourth-order Runge-Kutta with h=0.1 over two steps gives y(1.2) approximately 1.3281 and y'(1.2) approximately 0.8104.

## Answer

Put z = y'. Then y'' = 3y' − y + sin x gives the system

```text
dy/dx = z                    = f(x, y, z)
dz/dx = 3z − y + sin x       = g(x, y, z)
x₀ = 1, y₀ = 1.2, z₀ = 0.5
```
The step size is not given; take h = 0.1 (two steps to x = 1.2). RK-4 for the system:

```text
k₁ = h·f(x, y, z)                              l₁ = h·g(x, y, z)
k₂ = h·f(x+h/2, y+k₁/2, z+l₁/2)                l₂ = h·g(x+h/2, y+k₁/2, z+l₁/2)
k₃ = h·f(x+h/2, y+k₂/2, z+l₂/2)                l₃ = h·g(x+h/2, y+k₂/2, z+l₂/2)
k₄ = h·f(x+h, y+k₃, z+l₃)                      l₄ = h·g(x+h, y+k₃, z+l₃)
yₙ₊₁ = yₙ + (k₁+2k₂+2k₃+k₄)/6                  zₙ₊₁ = zₙ + (l₁+2l₂+2l₃+l₄)/6
```
(sin x is in radians.)

**Step 1** (x = 1 → 1.1), starting values y = 1.2000, z = 0.5000

|  | k (for y) | l (for z) |
|---|---|---|
| 1 | 0.0500 | 0.1141 |
| 2 | 0.0557 | 0.1314 |
| 3 | 0.0566 | 0.1337 |
| 4 | 0.0634 | 0.1536 |

```text
y(1.1) = 1.2000 + (0.0500 + 2(0.0557) + 2(0.0566) + 0.0634)/6 = 1.2563
z(1.1) = 0.5000 + (0.1141 + 2(0.1314) + 2(0.1337) + 0.1536)/6 = 0.6330
```
**Step 2** (x = 1.1 → 1.2), starting values y = 1.2563, z = 0.6330

|  | k (for y) | l (for z) |
|---|---|---|
| 1 | 0.0633 | 0.1534 |
| 2 | 0.0710 | 0.1754 |
| 3 | 0.0721 | 0.1783 |
| 4 | 0.0811 | 0.2037 |

```text
y(1.2) = 1.2563 + (0.0633 + 2(0.0710) + 2(0.0721) + 0.0811)/6 = 1.3281
z(1.2) = 0.6330 + (0.1534 + 2(0.1754) + 2(0.1783) + 0.2037)/6 = 0.8104
```

**Answer: y(1.2) ≈ 1.3281** (and y'(1.2) ≈ 0.8104); y(1.1) ≈ 1.2563.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is y'' - 3y' + y = sin x converted to first-order equations?
   A. dy/dx = z, dz/dx = y - 3z + sin x
   B. dy/dx = 3z - y + sin x, dz/dx = z
   C. dy/dx = z, dz/dx = 3z - y + sin x
   D. dy/dx = z, dz/dx = 3z + y + sin x
   Answer: C. Solving for y'' gives 3y' - y + sin x. (Key point: System)

2. The step size was not given; how many steps are taken to reach 1.2 from 1 with h = 0.1?
   A. 1
   B. 4
   C. 12
   D. 2
   Answer: D. (1.2 - 1)/0.1 = 2. (Key point: Step size)

3. What is y(1.2) obtained?
   A. About 1.2563
   B. About 1.3281
   C. About 0.8104
   D. About 1.2000
   Answer: B. Step 2 gives y(1.2) = 1.3281 (y(1.1) = 1.2563; z(1.2) = 0.8104). (Key point: Result)

## Related in Numerical Method

- [Program for RK-4 second order IVP](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-program-second-order) — Numerical Method, chapter 6
- [RK-2: y' = sin x + cos y](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark2-sinx-cosy) — Numerical Method, chapter 6
- [Program for RK-4 first order IVP](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-program-first-order) — Numerical Method, chapter 6
- [RK-2: y' = 4e^(0.8x) - 0.5y](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark2-xy-prime) — Numerical Method, chapter 6
- [RK-2: simultaneous equations](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark2-simultaneous) — Numerical Method, chapter 6
- [RK-2: y'' = y - x y'](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark2-y-double-prime-y-xy) — Numerical Method, chapter 6, asked 2×

## Related in other subjects

- [Initial value problem y''−4y'+3y](https://www.bctengineer.com/question.md?key=semester_2%2Fmathematics%3Ainitial-value-problem-y-4y) — Mathematics, chapter 4, asked 3×
- [Initial value problem y''+2y'+5y=0](https://www.bctengineer.com/question.md?key=semester_2%2Fmathematics%3Ainitial-value-problem-y-2y) — Mathematics, chapter 4, asked 3×
- [Solve ODE by Laplace transform y''+2y'−3y=sint](https://www.bctengineer.com/question.md?key=semester_3%2Fmathematics_iii%3Asolve-ode-by-laplace-transform-y) — Mathematics III, chapter 3, asked 14×
- [Solve y''+3y'+2y=e^(2x) sin x](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Ade-d2-3d-2-e2x-sinx) — Mathematics I, chapter 4, asked 2×
