Approximate the derivative of f(x) using the central difference formula: D = (f(x+h) - f(x-h)) / (2h). Example: f(x)=x³, x=2, h=1 gives D=13; true derivative=12, error=1.

The error is O(h²) — more accurate than forward difference for the same step size.

Example

Approximate a derivative using centered function values.

highlighted = computed this step

Step 1 — Set up

Set up the central difference.

f(x)=x3x=2h=1f(x)= x^{3} \quad x= 2 \quad h= 1

Step 2 — Function values

Evaluate the two centered function values.

f(x+h)=f(3)=27f(xh)=f(1)=1f(x+h)=f( 3 )= \hl{27} \quad f(x-h)=f( 1 )= \hl{1}

Step 3 — Central difference

Subtract centered values and divide by 2h.

D=(271)/2=13D= ( 27 - 1 )/ 2 = \hl{13}

Step 4 — Result

State the central-difference estimate.

D=13D= \hl{13}
central-difference The central difference formula approximates f'(x) symmetrically: D = (f(x+h) - f(x-h)) / (2h)