Source: Lecture 3, Experimental Physics and Engineering Lab (Texas A&M University)
Tags: finite differences, forward difference, backward difference, centered difference, numerical differentiation, finite difference approximation, numerical derivative, PHYS 216, ENGR 216, step size, truncation error, percent error
Finite difference methods approximate derivatives using discrete data points rather than continuous functions. The three core approaches, forward, backward and centered, each use neighbouring data points but differ in accuracy and which direction they "look." Centered differences are the most accurate for a given step size because their truncation error is second-order.
Finite difference
A numerical approximation of a derivative that replaces the continuous limit (dx) with a discrete step (Δx or Δt), calculated from tabulated data points.
Forward finite difference
Approximates the derivative at a point by looking at the current point and the next point ahead. First-order accurate (error proportional to Δx).
Backward finite difference
Approximates the derivative at a point by looking at the current point and the one behind it. Also first-order accurate.
Centered finite difference (first-order derivative)
Averages the forward and backward slopes by using the points on either side of the point of interest. Second-order accurate (error proportional to Δx²), making it more precise for the same step size.
Second-order centered finite difference
A centered difference formula that achieves second-order accuracy for the first derivative. Uses data points symmetrically placed around the evaluation point.
Step size (Δx or Δt or Δy)
The spacing between adjacent data points. Smaller step sizes generally yield better approximations but may amplify rounding errors in measured data.
Truncation error
The error introduced by replacing a true derivative with a finite difference approximation. Forward and backward methods have O(Δx) truncation error; centered methods have O(Δx²).
Percent error
A measure of how far an estimated value deviates from the true value, expressed as a percentage: ε = |true value − estimated value| / |true value| × 100%
These are the foundational formulas. In all cases, f(x) is the function value at point x and Δx (or h) is the step size.
Forward finite difference
f′(x) ≈ [f(x + Δx) − f(x)] / Δx
Uses the current point and the next one
Error: O(Δx), first-order
Backward finite difference
f′(x) ≈ [f(x) − f(x − Δx)] / Δx
Uses the current point and the previous one
Error: O(Δx), first-order
Centered finite difference
f′(x) ≈ [f(x + Δx) − f(x − Δx)] / (2Δx)
Uses the points on either side, skipping the centre point itself
Error: O(Δx²), second-order
This is the average of the forward and backward approximations
Forward: when you only have data ahead of the point (e.g. the very first data point in a table)
Backward: when you only have data behind the point (e.g. the very last data point)
Centered: whenever you have data on both sides, this is the preferred choice due to higher accuracy
The same logic extends to second derivatives. To approximate f″(x):
Centered second derivative
f″(x) ≈ [f(x + Δx) − 2f(x) + f(x − Δx)] / (Δx)²
For velocity-to-acceleration problems, you first compute velocity estimates using one of the three methods above, then apply a finite difference again to the velocity values.
Reducing Δx improves the finite difference approximation, but there are practical limits:
With measured (noisy) data, very small Δx can amplify measurement noise
Centered differences reach a given accuracy with a larger Δx than forward or backward methods need
For forward/backward to match the percent error of a centered difference at Δx = 0.25, you typically need a noticeably smaller step size (the homework confirms this)
First derivative approximations (summary)
Method | Formula | Error Order |
|---|---|---|
Forward | [f(x+Δx) − f(x)] / Δx | O(Δx) |
Backward | [f(x) − f(x−Δx)] / Δx | O(Δx) |
Centered | [f(x+Δx) − f(x−Δx)] / (2Δx) | O(Δx²) |
Second derivative (centered)
f″(x) ≈ [f(x+Δx) − 2f(x) + f(x−Δx)] / (Δx)²
Percent error
ε = |true value − estimated value| / |true value| × 100%
Newton's viscosity law
τ = μ (du/dy)
where τ is shear stress (N/m²), μ is dynamic viscosity (Ns/m²), and du/dy is the velocity gradient estimated via finite differences.
⚠️ The centered difference formula divides by 2Δx, not Δx. This is easily confused in a hurry.
⚠️ Forward and backward are first-order accurate; centered is second-order. This distinction drives the entire accuracy comparison in Problem 4.
⚠️ When computing velocity then acceleration from position data, keep your methods consistent and be clear about which time points correspond to each derivative.
⚠️ In the viscosity problem, the data points are not equally spaced in y. The centered difference formula still works, but Δy changes depending on which points you pick (you use the points on either side: Δy = y_{i+1} − y_{i−1}).
⚠️ Excel stores times as decimal fractions of a day. Converting clock times to decimal hours is a common source of error in Problem 1.
Q: Write the forward finite difference formula for f′(x) and state its error order.
A: f′(x) ≈ [f(x + Δx) − f(x)] / Δx. The truncation error is O(Δx), meaning it is first-order accurate.
Q: Why is the centered finite difference more accurate than forward or backward for the same step size?
A: The centered difference cancels out the first-order error term in the Taylor expansion. Its leading error term is proportional to Δx², so it converges faster as the step size shrinks.
Q: If your data table only gives values at t = 0 through t = 8 (integer seconds), which method must you use to estimate the derivative at t = 0? At t = 4? At t = 8?
A: At t = 0, forward (no data before it). At t = 4, centered (data on both sides). At t = 8, backward (no data after it).
Q: In Newton's viscosity law τ = μ(du/dy), what does each variable represent?
A: τ is the shear stress (N/m²), μ is the dynamic viscosity of the fluid (Ns/m²), and du/dy is the velocity gradient perpendicular to the surface, estimated here by a finite difference.
Q: What is the percent error formula?
A: ε = |true value − estimated value| / |true value| × 100%.
finite differences, numerical differentiation, forward difference, backward difference, centered difference, central difference, first derivative approximation, second derivative approximation, truncation error, discretisation error, step size, mesh spacing, Newton's viscosity law, shear stress, velocity gradient, dynamic viscosity, Taylor series error, O(h) error, O(h²) error, PHYS 216, ENGR 216, experimental physics, Texas A&M, finite difference table, average speed from odometer, numerical methods for derivatives