---
title: "Boundary derivative with one-sided differences"
subject: "Applied Computational Fluid Dynamics"
chapter: 3
key: "semester_7/applied_computational_fluid_dynamics:one-sided-boundary-derivative-numerical"
source: https://www.bctengineer.com/q/semester_7/applied_computational_fluid_dynamics/one-sided-boundary-derivative-numerical
site: BCT Engineering
---

# Boundary derivative with one-sided differences

Applied Computational Fluid Dynamics · Chapter 3: Discretization Methods

- Asked in: year not given, 5 marks
- Video: [One sided finite differences🌸 in numerial methods or Analysis(part-3)](https://www.youtube.com/watch?v=HkZmrTK0SZo) — Prachi Mishra
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/applied_computational_fluid_dynamics/one-sided-boundary-derivative-numerical
- Whole chapter: https://www.bctengineer.com/md/semester_7/applied_computational_fluid_dynamics/chapter-3

## Question

Derive a second-order accurate one-sided (forward) difference formula for $df/dx$ at a boundary node $x_0$, using nodes $x_0, x_1, x_2$ with uniform spacing $h$. The temperatures at a wall and the next two points spaced 0.5 mm apart are 50, 46 and 40 °C. Estimate the wall temperature gradient using the first-order and the second-order formula, and find the heat flux if $k = 0.6$ W/m·K.

## Short answer

Second-order forward difference: f'_0 ≈ (-3f_0+4f_1-f_2)/(2h) derived by eliminating f''_0 from Taylor expansions. For T_0=50, T_1=46, T_2=40°C, h=0.5 mm: first-order gradient = -8000 K/m, second-order = -6000 K/m. Heat flux q'' = -k dT/dx = 3600 W/m² using second-order (first-order gives 4800 W/m², 33% higher).

## Answer

#### Derivation
Expand $f_1$ and $f_2$ about $x_0$:
$$
f_1=f_0+hf'_0+\frac{h^2}{2}f''_0+\frac{h^3}{6}f'''_0
$$
$$
f_2=f_0+2hf'_0+2h^2f''_0+\frac{4h^3}{3}f'''_0
$$
Eliminate $f''_0$: compute $4f_1-f_2$:
$$
4f_1-f_2=3f_0+2hf'_0-\frac{2h^3}{3}f'''_0
$$
$$
\boxed{f'_0\approx\frac{-3f_0+4f_1-f_2}{2h}},\qquad f'_0=\text{approx}+\frac{h^2}{3}f'''_0+\cdots\ \Rightarrow\ O(h^2)
$$
The first-order formula is $f'_0\approx(f_1-f_0)/h$. The second-order formula is important for evaluating wall shear stress and wall heat flux without needing a node outside the domain.

#### Numerical
Data: $f_0=50,\ f_1=46,\ f_2=40$ °C, $h=0.5\times10^{-3}$ m.

First-order:
$$
\frac{dT}{dx}\approx\frac{46-50}{0.5\times10^{-3}}=-8000\ \text{K/m}
$$
Second-order:
$$
\frac{dT}{dx}\approx\frac{-3(50)+4(46)-40}{2\times0.5\times10^{-3}}=\frac{-150+184-40}{10^{-3}}=-6000\ \text{K/m}
$$
The successive differences are -4 and -6, so the temperature curve is getting steeper away from the wall (curvature is present). The first-order formula effectively gives the slope at mid-interval (-8000 K/m), so it overestimates the magnitude of the wall slope; the second-order formula extrapolates to the wall itself.

Wall heat flux, $q''=-k\,dT/dx$:
$$
q''=-0.6\times(-6000)=3600\ \text{W/m}^2
$$
(first-order would give 4800 W/m², about 33% higher.)

**Answer:** gradient $-8000$ K/m (1st order), $-6000$ K/m (2nd order); $q''=3.6$ kW/m² (flux directed in the +x direction).

## Check yourself

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

1. Which is the second-order forward difference for f' at the boundary node x0?
   A. (f1 - f0)/h
   B. (-3f0 + 4f1 - f2)/(2h)
   C. (f1 - f0)/(2h)
   D. (3f0 - 4f1 + f2)/(2h)
   Answer: B. Eliminating f'' from the Taylor expansions via 4f1 - f2 gives f0' = (-3f0 + 4f1 - f2)/(2h), with error O(h^2). (Key point: Second-order one-sided formula)

2. In the derivation, which combination of the Taylor expansions eliminates the second derivative term?
   A. f1 + f2
   B. f2 - f1
   C. 4f1 - f2
   D. f1 - 4f2
   Answer: C. f1 has h^2/2 f'' and f2 has 2h^2 f''; 4f1 - f2 cancels the f'' terms, leaving 3f0 + 2h f0'. (Key point: Derivation step)

3. For T = 50, 46, 40 C at h = 0.5 mm, what are the first-order and second-order wall gradients?
   A. -8000 K/m and -6000 K/m
   B. -6000 K/m and -8000 K/m
   C. -8000 K/m and -12000 K/m
   D. -4 K/m and -6 K/m
   Answer: A. First order: (46-50)/0.0005 = -8000. Second order: (-150+184-40)/0.001 = -6000 K/m. (Key point: Numerical gradients)

4. Using the second-order gradient and k = 0.6 W/m.K, what is the wall heat flux q'' = -k dT/dx?
   A. 4800 W/m^2
   B. -3600 W/m^2
   C. 360 W/m^2
   D. 3600 W/m^2 in the +x direction
   Answer: D. q'' = -0.6 x (-6000) = 3600 W/m^2, positive so directed along +x; the first-order formula would give 4800 W/m^2, about 33% too high. (Key point: Heat flux)

## Related in Applied Computational Fluid Dynamics

- [Second derivative central difference scheme](https://www.bctengineer.com/question.md?key=semester_7%2Fapplied_computational_fluid_dynamics%3Asecond-derivative-central-difference) — Applied Computational Fluid Dynamics, chapter 3
- [Derive forward, backward, central differences](https://www.bctengineer.com/question.md?key=semester_7%2Fapplied_computational_fluid_dynamics%3Ataylor-series-finite-differences) — Applied Computational Fluid Dynamics, chapter 3

## 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
- [First and second order finite difference schemes](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Afd-first-second-order-schemes) — Computational Techniques in Civil Engineering, chapter 5, asked 2×
- [Derivative feedback in second order time response](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Aderivative-feedback-second-order) — Control Systems, chapter 7
- [Derive maximum overshoot of second order system](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Amp-expression-derivation) — Control Systems, chapter 3
