# Proving Simpsons rule

1. Dec 15, 2015

### lampCable

1. The problem statement, all variables and given/known data
Consider the ansatz
$$\frac{1}{b-a}\int_a^bf(x)dx \approx \alpha_1f(a)+\alpha_2f(\frac{b-a}{2})+\alpha_3f(b)$$
We can determine the values of $\alpha_1,\alpha_2,\alpha_3$ by requiring the approximation to be exact for quadratic polynomials, which yeilds Simpsons rule.

Why there is no loss of generality in assuming that $a = -1$ and $b = 1$?
2. Relevant equations

3. The attempt at a solution

2. Dec 15, 2015

### Buzz Bloom

Hi lampCable:

Here is a hint.

You can make a linear substitution y = px+q such that y(a) = -1 and y(b) = +1. Since f(x) is a quadratic polynomial in e, f(y) will also be a quadratic polynomial of y.

Hope that helps.

Regards,
Buzz

3. Dec 15, 2015

### Ray Vickson

Surely the middle term should be $\alpha_2 f(\frac{a+b}{2})$?

BTW: Simpson's rule is valid for cubics as well; that becomes clear upon taking a = -1 and b = 1, but only after you have found $\alpha_1, \alpha_2, \alpha_3$.

4. Dec 16, 2015

### lampCable

Yes, I'm quite sure that the middle term is correct. Or what do you mean?

Yes, this is because the contribution from the odd $x^3$ term is zero, giving no further conditions on $\alpha_1, \alpha_2, \alpha_3$ (giving the same conditions as for $f=x$). Right?

Thank you for the hint. So, a suitable substitution is
$$y = \frac{x-b}{b-a} + \frac{x-a}{b-a}.$$
This gives
$$\frac{1}{b-a}\int_a^bf(x)dx = \frac{1}{2}\int_{-1}^1f\bigg{(}\frac{b(y-1)}{2}-\frac{a(y+1)}{2}\bigg{)}dy = \frac{1}{2}\int_{-1}^1g(y)dy \approx \alpha_1g(-1)+\alpha_2g(0)+\alpha_3g(1)$$
And so, by your argument, since $f(x)$ is a quadratic polynomial in $x$, then $f\bigg{(}\frac{b(y-1)}{2}-\frac{a(y+1)}{2}\bigg{)}$ and hence $g(y)$ are quadratic polynomials in $y$. And the inequality above is therefore equivalent to the assumption that $a=-1$ and $b=1$ in the original ansatz.

Correct?

5. Dec 16, 2015

### SteamKing

Staff Emeritus
I think Ray is talking here about Simpson's Second Rule.

The problem you have to prove in the OP is also known as Simpson's First Rule, and it uses a quadratic interpolating polynomial to determine the coefficients, or Simpson's Multipliers, of the three ordinates.

In Simpson's Second Rule, a cubic interpolating polynomial is used and four ordinates are required, with different multipliers, of course.

6. Dec 16, 2015

### Samy_A

If the middle term is $\alpha_2f(\frac{b-a}{2})$, you get $\alpha_2g((1-(-1))/2)=\alpha_2g(2/2)=\alpha_2g(1)$.
But @Ray Vickson is correct, the middle term should be $\alpha_2f(\frac{a+b}{2})$, and that will give you $\alpha_2g(0)$.

7. Dec 16, 2015

### Ray Vickson

I cannot figure out what you are saying here? Are you saying that what YOU wrote is correct, or are you agreeing that what I wrote is correct?

8. Dec 16, 2015

### Ray Vickson

No, I don't think so. The ordinary 3-point Simpson rule (designed so that it works on quadratics) also works on cubics. That is why the error analysis for Simpson's rule is proportional to $(b-a)^4$ instead of $(b-a)^3$.

The reason is simple: when you apply the 3-point Simpson rule to $x^3$ (on a symmetric interval $[-a,a]$) the exact integral and the Simpson result agree exactly (both being 0). Non-symmetric intervals $[a,b]$ give the same result, but the arguments are messier and less revealing.

For more on this, see, eg., https://en.wikipedia.org/wiki/Simpson's_rule .

9. Dec 16, 2015

### lampCable

Oh, yes of course, I did not see my mistake. Thank you.

I am sorry, I misunderstood what you said. You are definitely correct.

10. Dec 16, 2015

### SteamKing

Staff Emeritus
Well Simpson's First Rule numerical integration can be applied to integrate a number of different functions for which it was not explicitly derived. The error that you get when you do so may not be as small as with integrating a quadratic function, but people still use it, nevertheless.

Simpson's First Rule is also called the 1-4-1 rule, after the multipliers. Simpson's Second Rule is the 1-3-3-1 rule, also after its multipliers.

I'm a naval architect. Simpson's Rule used to be quite ubiquitous in my profession before computers. It was used to integrate quite a few curves where the shape had no known explicit representation except the ordinates measured from a drawing.

11. Dec 16, 2015

### Ray Vickson

There is no error (except for roundoff) when integrating linear, quadratic or cubic functions using Simpson's 1-4-1 rule. Of course for other functions the use of 1-4-1 Simpson will generally involve an error $E_S$ bounded by
$$|E_S| \leq \frac{h^4}{180} K \, (b-a)^4,$$
where $h = (b-a)/n$ and $K = \max_{a \leq y \leq b} |f''''(y)|$ is the maximum of the fourth derivative. Here, $n$ is the number of sub-intervals of $[a,b]$, so the function $f(x)$ is evaluated at the $(n+1)$ equally-spaced points $a = x_0 < x_1 < \cdots < x_n = b$.