---
title: "BVP: y'' = x + y"
subject: "Numerical Method"
chapter: 6
key: "semester_4/numerical_method:bvp-finite-difference-x-plus-y"
source: https://www.bctengineer.com/q/semester_4/numerical_method/bvp-finite-difference-x-plus-y
site: BCT Engineering
---

# BVP: y'' = x + y

Numerical Method · Chapter 6: Solution of ordinary differential equations

- Asked in: 2068 Bhadra, 6 marks; 2068 Magh, 6 marks (asked 2 times)
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/numerical_method/bvp-finite-difference-x-plus-y
- Whole chapter: https://www.bctengineer.com/md/semester_4/numerical_method/chapter-6

## Question

Solve the following boundary value problem using the finite difference method, by dividing the interval into four sub-intervals. d²y/dx² = x + y, y(0) = y(1) = 0.

## Short answer

Discretizing y''=x+y with central differences, h=0.25, and y(0)=y(1)=0 yields: y(0.25)≈-0.0349, y(0.5)≈-0.0563, y(0.75)≈-0.0500.

## Answer

Replace y'' by the central difference (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h² at each interior node.

#### Set up
n = 4 on [0, 1], so h = 0.25; nodes x = 0, 0.25, 0.5, 0.75, 1 with y₀ = y₄ = 0. Unknowns y₁, y₂, y₃.

```text
(yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h² = xᵢ + yᵢ
yᵢ₋₁ − (2 + h²)yᵢ + yᵢ₊₁ = h²·xᵢ
yᵢ₋₁ − 2.0625 yᵢ + yᵢ₊₁ = 0.0625 xᵢ
```

#### Equations
```text
i=1 (x=0.25):  y₀ − 2.0625y₁ + y₂ = 0.0625(0.25) →  −2.0625y₁ +  y₂           = 0.015625
i=2 (x=0.50):  y₁ − 2.0625y₂ + y₃ = 0.0625(0.50) →   y₁ − 2.0625y₂ + y₃        = 0.031250
i=3 (x=0.75):  y₂ − 2.0625y₃ + y₄ = 0.0625(0.75) →   y₂ − 2.0625y₃              = 0.046875
```

#### Solution
```text
y₁ = -0.0349
y₂ = -0.0563
y₃ = -0.0500
```
Check: the exact solution y = sinh x / sinh 1 − x gives y(0.25) = -0.0350, y(0.5) = -0.0566, y(0.75) = -0.0503.

**Answer: y(0.25) ≈ -0.0349, y(0.5) ≈ -0.0563, y(0.75) ≈ -0.0500**

## Check yourself

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

1. What is h?
   A. 0.25
   B. 0.5
   C. 0.2
   D. 1
   Answer: A. 1/4. (Key point: h)

2. Which node equation results?
   A. y(i-1) - 1.9375yi + y(i+1) = 0.0625xi
   B. y(i-1) - 2.0625yi + y(i+1) = 0.0625xi
   C. y(i-1) - 2yi + y(i+1) = xi
   D. y(i-1) - 2.0625yi + y(i+1) = 0.25xi
   Answer: B. Move h²yi to the left: -(2+h²). (Key point: Equation)

3. What kind of system is formed?
   A. Nonlinear
   B. One equation
   C. Tridiagonal linear system in y1, y2, y3
   D. Differential
   Answer: C. Each equation couples neighbours. (Key point: System)

4. Why are the answers negative?
   A. Sign mistake
   B. Boundary is negative
   C. h is negative
   D. Solution y = sinh x/sinh 1 - x is negative on (0,1)
   Answer: D. Exact values match. (Key point: Sign)

## Close variants set in other exams

- [BVP: y'' = e^x + 2y' - y](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Abvp-finite-difference-e-x-2y) — Numerical Method, chapter 6, asked 4×

## Related in Numerical Method

- [BVP: y'' + 3y' = y + x²](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Abvp-fd-y-double-prime-3y) — Numerical Method, chapter 6
- [BVP: xy'' + y = 0](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Abvp-fd-xy-double-prime) — Numerical Method, chapter 6

## Related in other subjects

- [Finite difference nodal temperatures in a square plate](https://www.bctengineer.com/question.md?key=semester_5%2Fheat_transfer%3Atwo-dimensional-conduction-nodal-temperatures) — Heat Transfer, chapter 2
- [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×
- [Finite difference method; explicit and implicit schemes](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Afdm-explicit-implicit) — Computational Techniques in Civil Engineering, chapter 5, asked 2×
