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

# BVP: y'' = e^x + 2y' - y

Numerical Method · Chapter 6: Solution of ordinary differential equations

- Asked in: 2074 Bhadra, 8 marks; 2070 Magh, 8 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-e-x-2y
- 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.
y'' = e^x + 2y' - y;  y(0) = 1.5;  y(2) = 2.5

## Short answer

Using central differences with h=0.5 for y''-2y'+y=e^x, boundary conditions give: y(0.5)≈1.3487, y(1.0)≈1.0447, y(1.5)≈0.9695.

## Answer

Write the equation as y'' − 2y' + y = eˣ and replace the derivatives by central differences at each interior node:

y''ᵢ = (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h²,  y'ᵢ = (yᵢ₊₁ − yᵢ₋₁)/(2h)

#### Set up
n = 4 sub-intervals on [0, 2], so h = 0.5 and the nodes are x₀ = 0, x₁ = 0.5, x₂ = 1.0, x₃ = 1.5, x₄ = 2.0, with y₀ = 1.5 and y₄ = 2.5. Unknowns: y₁, y₂, y₃.

Substituting at node i:

```text
(yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/0.25 − 2(yᵢ₊₁ − yᵢ₋₁)/1 + yᵢ = e^xᵢ
Multiply out:  (4+2)yᵢ₋₁ + (−8+1)yᵢ + (4−2)yᵢ₊₁ = e^xᵢ
               6yᵢ₋₁ − 7yᵢ + 2yᵢ₊₁ = e^xᵢ
```

#### Equations
```text
i=1 (x=0.5):  6(1.5) − 7y₁ + 2y₂ = e^0.5 = 1.6487   →  −7y₁ + 2y₂         = -7.3513
i=2 (x=1.0):  6y₁ − 7y₂ + 2y₃     = e^1.0 = 2.7183   →   6y₁ − 7y₂ + 2y₃    = 2.7183
i=3 (x=1.5):  6y₂ − 7y₃ + 2(2.5)  = e^1.5 = 4.4817   →   6y₂ − 7y₃          = -0.5183
```
(Right sides: 1.6487 − 9 = -7.3513, and 4.4817 − 5 = -0.5183.)

#### Solve (Gaussian elimination)
```text
y₁ = 1.3487
y₂ = 1.0447
y₃ = 0.9695
```
| x | 0 | 0.5 | 1.0 | 1.5 | 2.0 |
|---|---|---|---|---|---|
| y | 1.5000 | 1.3487 | 1.0447 | 0.9695 | 2.5000 |

**Answer: y(0.5) ≈ 1.3487, y(1.0) ≈ 1.0447, y(1.5) ≈ 0.9695**

## Check yourself

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

1. How are derivatives replaced?
   A. Forward differences only
   B. Taylor to 4th order
   C. Central differences for y'' and y'
   D. Simpson
   Answer: C. Both are central differences. (Key point: Replacement)

2. With four sub-intervals on [0, 2], what is h and the unknowns?
   A. h = 0.4; y1..y4
   B. h = 0.5; y0..y4
   C. h = 2; y1
   D. h = 0.5; unknowns y1, y2, y3
   Answer: D. y0 and y4 are boundary values. (Key point: Step)

3. What is the node equation?
   A. 6y(i-1) - 7yi + 2y(i+1) = e^xi
   B. 6y(i-1)+7yi+2y(i+1) = e^xi
   C. 2y(i-1)-7yi+6y(i+1) = e^xi
   D. y(i-1)-2yi+y(i+1) = e^xi
   Answer: A. (4+2), (-8+1), (4-2). (Key point: Equation)

4. How do boundary values enter?
   A. They are unknowns
   B. They move to the right-hand sides of first and last equations
   C. They are ignored
   D. They become coefficients
   Answer: B. E.g. 6(1.5) moves across. (Key point: Boundaries)

## Close variants set in other exams

- [BVP: y'' = x + y](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Abvp-finite-difference-x-plus-y) — 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

- [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''+3y'+2y=e^(−t)](https://www.bctengineer.com/question.md?key=semester_3%2Fmathematics_iii%3Asolve-ode-by-laplace-transform-y-two) — Mathematics III, chapter 3, asked 18×
- [Solve ODE by Laplace transform y''+2y'+2y=5sinx](https://www.bctengineer.com/question.md?key=semester_3%2Fmathematics_iii%3Asolve-ode-by-laplace-transform-y-17) — Mathematics III, chapter 3, asked 17×
- [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×
