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

# RK-2: y'' + x y' + y = 0

Numerical Method · Chapter 6: Solution of ordinary differential equations

- Asked in: 2072 Asoj, 6 marks; 2069 Bhadra, 10 marks (asked 2 times)
- Video: [Runge kutta method second order differential equation simple example(PART-1)](https://www.youtube.com/watch?v=Fs1cRieo8XM) — EASY MATHS EASY TRICKS
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/numerical_method/rk2-second-order-ivp
- Whole chapter: https://www.bctengineer.com/md/semester_4/numerical_method/chapter-6

## Question

Solve y'' + xy' + y = 0; y(0) = 1, y'(0) = 0 for x = 0(0.1)0.2 using the RK2 method.

## Short answer

Convert to first-order system y'=z, z'=-xz-y. With h=0.1, Heun's method gives y(0.1)=0.9950, y(0.2)=0.9801.

## Answer

Convert the 2nd-order equation to two first-order equations. Let z = y', then

```text
dy/dx = z                = f₁(x, y, z)
dz/dx = −x·z − y         = f₂(x, y, z)
y(0) = 1, z(0) = 0, h = 0.1
```
The second-order Runge–Kutta (Heun / modified Euler) formulas are:

```text
k₁ = h·f(xₙ, yₙ)
k₂ = h·f(xₙ + h, yₙ + k₁)
yₙ₊₁ = yₙ + ½(k₁ + k₂)
```

applied to y and z together: k₁(y) and k₂(y) use f₁, k₁(z) and k₂(z) use f₂, and in k₂ both y and z are advanced by their own k₁ values.

#### Step 1 (x₀ = 0 → 0.1)
```text
k₁(y) = 0.1·z₀ = 0.1(0) = 0.0000
k₁(z) = 0.1(−0·0 − 1) = -0.1000
k₂(y) = 0.1(z₀ + k₁(z)) = 0.1(0 − 0.1) = -0.0100
k₂(z) = 0.1[−0.1(−0.1) − (1 + 0)] = -0.0990
y₁ = 1 + ½(0 − 0.01) = 0.9950
z₁ = 0 + ½(−0.1 − 0.0990) = -0.0995
```
#### Step 2 (x₁ = 0.1 → 0.2)
```text
k₁(y) = 0.1(−0.0995) = -0.0100
k₁(z) = 0.1[−0.1(−0.0995) − 0.995] = -0.0985
k₂(y) = -0.0198,  k₂(z) = -0.0945
y₂ = 0.9801,  z₂ = -0.1960
```
#### Summary table
| step | x | y | z=y' | k₁(y) | k₁(z) | k₂(y) | k₂(z) | yₙ₊₁ | zₙ₊₁ |
|---|---|---|---|---|---|---|---|---|---|
| 0 | 0.0000 | 1.0000 | 0.0000 | 0.0000 | -0.1000 | -0.0100 | -0.0990 | 0.9950 | -0.0995 |
| 1 | 0.1000 | 0.9950 | -0.0995 | -0.0100 | -0.0985 | -0.0198 | -0.0945 | 0.9801 | -0.1960 |

**Answer: y(0.1) ≈ 0.9950, y(0.2) ≈ 0.9801** (with y'(0.1) ≈ -0.0995, y'(0.2) ≈ -0.1960). The exact solution y = e^(−x²/2) gives 0.9950 and 0.9802.

## Check yourself

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

1. How is y'' + xy' + y = 0 converted?
   A. z = y'', y' = z
   B. z = y, z' = y
   C. z = y', y' = z, z' = -xz - y
   D. y' = -xy
   Answer: C. A system of two first-order equations. (Key point: Reduction)

2. What is RK2 update?
   A. yn + k1
   B. yn + (k1+2k2+2k3+k4)/6
   C. yn + k2
   D. y(n+1) = yn + (k1+k2)/2, k2 = h f(x+h, y+k1)
   Answer: D. Heun's method. (Key point: RK2)

3. What is y at 0.1?
   A. 0.9950
   B. 1.0000
   C. 0.9900
   D. 0.9801
   Answer: A. 1 + (0 - 0.01)/2. (Key point: Step 1 y)

4. How are y and z advanced?
   A. Independently
   B. Both use updated k's together at the same step
   C. z first for all steps
   D. Only y
   Answer: B. k2 uses y+k1 and z+l1. (Key point: Both variables)

## Related in Numerical Method

- [RK-2: y' = xy + y²](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark2-xy-y2) — Numerical Method, chapter 6, asked 2×
- [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-4: (y²-x²)/(y²+x²)](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-y-prime-y2-x2) — Numerical Method, chapter 6
- [RK-4: dy/dx = (1+x²)y](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-y-1-x2) — 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

- [Solve x dy/dx + y log y = xy eˣ](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Ade-x-dy-dx-y-log-y) — Mathematics I, chapter 4, asked 4×
- [Solve xy(p²+2)=2py³+x³](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Ade-xy-p2-plus-2) — Mathematics I, chapter 4, asked 2×
- [Solve x²y''−xy'+2y=x log x](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Ade-cauchy-x2y2-minus-xy1-plus-2y-x-log-x) — Mathematics I, chapter 4, asked 4×
- [Solve x²y''−xy'+y=log x](https://www.bctengineer.com/question.md?key=semester_1%2Fmathematics_i%3Ade-cauchy-x2y2-minus-xy1-plus-y-log-x) — Mathematics I, chapter 4, asked 2×
