Welcome to Numerical Differentiation!

In your standard A Level Maths course, you learned how to differentiate functions like \(x^2\) or \(\sin(x)\) using algebra. But what happens when you have a function that is too complex to differentiate normally, or if you only have a table of data points instead of an equation?
That’s where Numerical Differentiation comes in! In this chapter, you will learn how to estimate the gradient of a curve at a specific point using simple arithmetic. It’s a bit like being a detective—using nearby points to figure out what’s happening at the point you're interested in.

The Big Idea: Back to Basics

Before we dive in, let’s do a quick review of a prerequisite concept. Remember the formula for the gradient of a straight line between two points \((x_1, y_1)\) and \((x_2, y_2)\)?
\( \text{Gradient} = \frac{y_2 - y_1}{x_2 - x_1} \)
Numerical differentiation uses this exact same logic. We take a tiny step, which we call \(h\) (the step-length), and use it to find the "slope" between two very close points.

Did you know? This is exactly how your phone or GPS calculates your speed! It doesn't have a magic "speed equation"; it just looks at your position now and your position a fraction of a second ago to find the rate of change.


1. The Forward Difference Method

The Forward Difference Method is the simplest way to estimate a derivative. As the name suggests, it looks "forward" from the point you are interested in.

The Formula

To estimate the derivative \(f'(x)\), we use:
\( f'(x) \approx \frac{f(x+h) - f(x)}{h} \)

How it works (Step-by-Step)

1. Start at your target point \(x\).
2. Take a tiny step forward to \(x + h\).
3. Find the difference in the \(y\)-values: \(f(x+h) - f(x)\).
4. Divide that difference by the step-length \(h\).

Example: If \(f(x) = x^3\), and we want to find the gradient at \(x=2\) with a step-length \(h=0.1\):
\( f(2) = 2^3 = 8 \)
\( f(2.1) = 2.1^3 = 9.261 \)
\( f'(2) \approx \frac{9.261 - 8}{0.1} = 12.61 \)
(The real answer is 12, so this is a decent estimate!)

Key Takeaway: The Forward Difference Method is easy to use but isn't always the most accurate because it only looks at one side of the point.


2. The Central Difference Method

If the Forward Difference is a "good" estimate, the Central Difference Method is the "great" estimate. Instead of just looking forward, it looks half a step back and half a step forward, putting our target point right in the middle.

The Formula

\( f'(x) \approx \frac{f(x+h) - f(x-h)}{2h} \)

Common Mistake Alert! Notice the denominator is \(2h\). Because you went from \(-h\) to \(+h\), the total "width" of your step is two \(h\)'s. Don't forget that 2!

An Everyday Analogy

Imagine you are trying to find the "average" slope of a hill while standing on it.
- Forward Difference: You look at your feet and a spot 1 meter in front of you.
- Central Difference: You look at a spot 1 meter behind you and a spot 1 meter in front of you. This usually gives a much fairer representation of the slope exactly where you are standing.

Key Takeaway: The Central Difference Method is generally much more accurate than the Forward Difference Method for the same value of \(h\).


3. Accuracy and the "Order" of a Method

In Numerical Methods, we talk about the Order of Accuracy. This tells us how quickly the error disappears as we make our step-length \(h\) smaller.

  • Forward Difference is a First Order Method, written as \(O(h)\). This means if you halve your step-length (\(h \to 0.5h\)), your error roughly halves.
  • Central Difference is a Second Order Method, written as \(O(h^2)\). This is the "magic" part: if you halve your step-length (\(h \to 0.5h\)), your error roughly quarters (\(0.5^2 = 0.25\))!

Quick Review Box:
- Smaller \(h\) = More accuracy (usually).
- Central Difference wins because it is a higher-order method.

Key Takeaway: Choosing a second-order method like Central Difference allows you to get very accurate results without needing ridiculously small steps.


4. Using Technology and Accuracy Limits

In your exam, you might be asked to look at spreadsheet output. When using spreadsheets to calculate these differences, you'll notice that as \(h\) gets smaller and smaller, the estimate gets better... up to a point.

The Balancing Act

Don't worry if this seems counter-intuitive, but you can actually make \(h\) too small.
Computers and calculators have a limit to how many decimal places they can store (this is called precision). If \(h\) is tiny, the values of \(f(x+h)\) and \(f(x)\) become so similar that the computer might round the difference to zero. This is a common error in numerical work!

Step-by-Step Spreadsheet Strategy

1. Create a column for \(h\) (e.g., 0.1, 0.05, 0.025...).
2. Create columns for your estimates using the formulas above.
3. Look for convergence: when the digits in your answer stop changing as \(h\) gets smaller, you have found your solution to that many decimal places.

Key Takeaway: To justify the accuracy of a solution, show that using a smaller \(h\) doesn't change the first few decimal places of your answer anymore.


Summary Checklist

1. Forward Difference: \( \frac{f(x+h) - f(x)}{h} \) (First Order)
2. Central Difference: \( \frac{f(x+h) - f(x-h)}{2h} \) (Second Order)
3. Accuracy: Central is usually better; halving \(h\) quarters the error in Central Difference.
4. Convergence: Keep reducing \(h\) until the answer settles down, but watch out for calculator rounding errors if \(h\) is too tiny!

You've got this! Numerical differentiation is just about finding the slope of a very, very small secant line. Keep practicing those formulas!