Tuesday 12 January 2016

What is the Trapezoid Rule?

I've been asked to write an explanation about this. Even though it's a bit off the current topic of Radiation and Matter it's a very useful mathematical tool - and a first step towards calculus - so here goes:

Working out the area under a graph is a pretty common question, and it can be a difficult one if the graph is curved like this one:


trapezoid rule 1
Figure 1: A curved graph with an unknown area underneath it.

















But there are effective methods for answering this question, and here we'll look at one called the trapezoid rule. We'll go over exactly how it works and where it comes from, because being able to show where it comes from is a common question as well! The trapezoid rule is a simple way to get an estimate of the area under this (or any other curved) graph. It's based on the idea that the shape of the graph between 2 values of X, let's say X = 0 and X = 1, can be approximated by a series of straight line segments. The more accurately you need to approximate the graph the more straight line segments you can use:


trapezoid rule 2
Figure 2: A curved graph being approximated by straight line segments.
Now let’s imagine that each of those straight line segments is one edge of a trapezoid turned on its side, like this:

trapezoid rule 3
Figure 3: The area under the graph divided into a series of sideways trapezoids.
 
Each of the trapezoids has the same 'height' of ‘h’ (remember they are lying on their sides, so their 'height' is a distance along the X -axis) and a top or bottom side of length A, B, C or D. We can estimate the area under the curve by finding the area of each of the trapezoids and adding them together. This is fairly easy, as the equation for the area of a trapezoid is nice and simple:

trapezoid rule 4
Figure 4: The equation for finding the area under a trapezoid.

Can we turn this into a more general rule? Lets go back to our curve that we’ve divided into trapezoids (figure 1). One thing we can say is that the trapezoids all have the same ‘height’ (Remember they’re lying on their sides) which is labelled ‘h’.

trapezoid rule 5
Figure 5: The graph, and the 'sideways' trapezoids that are approximating the area underneath it, with the sideways height of the trapezoids highlighted.

So, if we look at the equation for the combined area of the trapezoids...

trapezoid rule 6

...we can now factor out ‘h’ ...

trapezoid rule 7

...and we can also factor out the ½ ( because any number divided by 2 is exactly the same as that number multiplied by a 1/2)...

trapezoid rule 8

Now we've got this far we can take out some of those brackets:
 
trapezoid rule 9 

This would work as a rule, but we can make it neater and simpler with a bit more mathematical juggling. We have the lengths B and C twice, so first we can re-write the equation like this:

trapezoid rule 10

And then we can take the 2 out, as it is a common factor to B and C:

trapezoid rule 11

Then we can multiply out 1/2 and h...

trapezoid rule 12

...then simplify...

trapezoid rule 13

... and lastly we hide the multiply (x) symbols (which is standard practice in algebra) and this gives us our trapezoid rule:

trapezoid rule final

Don't be intimidated by the number of steps needed to derive the rule: Try remembering a few stages as 'stepping stones' and with a bit of practice you'll find the steps linking them will come back to you fairly easily.

No comments:

Post a Comment