# Figuring out the Trapezoidal rule

• Jan 15th 2013, 07:23 PM
Chaim
Figuring out the Trapezoidal rule
Hi, I think I'm average on the trapezoidal rule right now, but there is one thing I'm a bit confused about.
Ok so I know the trapezoidal rule is abf(x)dx=(b-a)/2n [f(x0) + 2f(x1) and so on]

Though I'm a bit confused on it.
I'll give some examples:
02x3dx, n=4, so I know that it moves up 1/2 each up
So it's like this (2-0)/2(4)[0+2(1/2)3 until (2)3], I know the answer to this, but I was wondering why does it start off with 0

Another example is:
12(1/(x+1)2) dx, n=4, and it starts off with (1/4) + 2(1/(5/4)+1)2) and so on
Like here I'm a bit confused why it starts off with 1/4, when n is equal to 4, but then it goes up to 5 things inside the brackets [ ]
Like it started with 1/4 by itself, then went onto the function with 5/4, so can someone explain how does it start off exactly.

One more example is:
01√x√(1-x) dx, n=4, and the change in x is 1/4
But it starts off with 0 + 2√(1/4)(1-1/4) and so on...

So yeah, I know that after the starting thing inside the bracket goes through the pattern, but I was wondering how does it start off. At first I just though it started off with the pattern, but when I saw like the 3rd example started off with a 0, then went onto x1 then x2 then x3, etc.

Thanks. :)
• Jan 15th 2013, 07:51 PM
richard1234
Re: Figuring out the Trapezoidal rule
Quote:

Originally Posted by Chaim
I know the answer to this, but I was wondering why does it start off with 0

0^3 is 0.

I can't make a whole lot of sense out of your questions, but you seem to be applying the formula without knowing where it came from. The "formula" for the trapezoidal rule can be derived by simply drawing a function f(x) from x = a to x = b and splitting it into several trapezoids. By simply using geometry to find the area of each trapezoid, we will obtain

$\int_{a}^{b} f(x) \,dx \approx \sum_{i = 1}^{n} \frac{1}{2}(x_i - x_{i-1})(f(x_i) + f(x_{i-1}))$. Here, $x_i - x_{i-1}$ is the "height" of each trapezoid, and $f(x_i) + f(x_{i-1})$ is just the sum of the two bases of the trapezoid (this is why we get the coefficients of 1,2,2,...,2,1).

In the case where the $x_i's$ are evenly spaced, the sum $\sum_{i = 1}^{n} x_i - x_{i-1}$ will telescope to $x_n - x_0$, which is just $b-a$, so $x_i - x_{i-1} = \frac{b-a}{n}$, which is constant. Substitute that into the summation to obtain the formula.
• Jan 15th 2013, 08:19 PM
Chaim
Re: Figuring out the Trapezoidal rule
Quote:

Originally Posted by richard1234
0^3 is 0.

I can't make a whole lot of sense out of your questions, but you seem to be applying the formula without knowing where it came from. The "formula" for the trapezoidal rule can be derived by simply drawing a function f(x) from x = a to x = b and splitting it into several trapezoids. By simply using geometry to find the area of each trapezoid, we will obtain

$\int_{a}^{b} f(x) \,dx \approx \sum_{i = 1}^{n} \frac{1}{2}(x_i - x_{i-1})(f(x_i) + f(x_{i-1}))$. Here, $x_i - x_{i-1}$ is the "height" of each trapezoid, and $f(x_i) + f(x_{i-1})$ is just the sum of the two bases of the trapezoid (this is why we get the coefficients of 1,2,2,...,2,1).

In the case where the $x_i's$ are evenly spaced, the sum $\sum_{i = 1}^{n} x_i - x_{i-1}$ will telescope to $x_n - x_0$, which is just $b-a$, so $x_i - x_{i-1} = \frac{b-a}{n}$, which is constant. Substitute that into the summation to obtain the formula.

I think I get what you're saying, but here is an actual example I can provide without needing to type it up (click on the image below this text, looks like a bunch of little scribbles:
The image is here:Attachment 26578
So you see that it starts off with (1/4), but I'm a bit confused on why is that.
Then it goes into 5/4, 6/4, then 7/4, then 8/4
• Jan 15th 2013, 08:23 PM
richard1234
Re: Figuring out the Trapezoidal rule
Because at x = 1, that expression is equal to 1/4. Same with x = 2, 1/((2+1)^2) = 1/9.
• Jan 15th 2013, 08:28 PM
Chaim
Re: Figuring out the Trapezoidal rule
Quote:

Originally Posted by richard1234
Because at x = 1, that expression is equal to 1/4. Same with x = 2, 1/((2+1)^2) = 1/9.

Oh I see now,
Thanks :)

Yeah, at first I thought to myself "Why isn't it following the pattern and so out of place"
But I guess I see how come :O I think.
• Jan 15th 2013, 08:47 PM
richard1234
Re: Figuring out the Trapezoidal rule
I'm guessing the author didn't want to waste space by putting $\frac{1}{(1+1)^2}$ and $\frac{1}{(2+1)^2}$...