# Integrating a Lagrange polynomial through four points- the easy way?

I'm trying to take the Lagrange polynomial $P_3(x)$ that passes through four points- $(x_1,y_1), (x_2,y_2), (x_3,y_3)$, and $(x_4,y_4)$, and integrate it (maybe deriving Simpson's rule in the process!). All the x-values are a distance h apart from each other. Once I did some simplifications using h, here's what I ended up with: $$P_3(x) = {(x-x_2)(x-x_3)(x-x_4)y_1\over -6h^3} + {(x-x_1)(x-x_3)(x-x_4)y_2\over 2h^3} + {(x-x_1)(x-x_2)(x-x_4)y_3\over -2h^3} + {(x-x_1)(x-x_2)(x-x_3)y_4\over 6h^3}$$ I'm trying to find a substitution to make these integrals easier. When I choose a u-substitution, should I try to make the integrands go from -1 to 1? And how would I scale the u-substitution to make that happen? Throw out the next step that you think I should take! Thanks!

• You know the final result is a linear combination of $y_1, \ldots, y_4$. Since they are separated by same distance $h$ apart, by symmetry of $x_1 \leftrightarrow x_4, x_2 \leftrightarrow x_3$, the result depends only on $y_1 + y_4$ and $y_2 + y_3$. Furthermore, you know when $y_1 = y_2 = y_3 = y_4 = y$, the result has to be $3h y$. As a result, the final result has the form $$\frac{3h}{4}(y_1 + y_2 + y_3 + y_4) + A(y_1-y_2-y_3+y_4)$$ for some contant $A$. You just need to find a $f(x)$ you know how to integral and figure out the constant $A$. – achille hui Feb 18 '16 at 13:55

You can always change the interval of integration from, say, $[a,b]$ to $[-1,1]$ by a linear transformation, specifically $$x = \phi(t) = a \frac{1-x}{2} + b \frac{1+x}{2},$$ where I have chosen the peculiar representation to stress the fact that $$\phi(-1) = a, \quad \phi(1) = b$$ We also see that $$\phi'(t) = \frac{b-a}{2}.$$ It follows that for any continuous function $f : [a,b] \rightarrow \mathbb{R}$ we can write $$\int_a^b f(x)dx = \int_{-1}^1 f(\phi(t)) \phi'(t) dt$$
In your case we could write $$x_1 = a, \quad x_2 = a + h, \quad x_3 = a + 2h, \quad x_4 = a + 3h = b$$ so that $$\phi(t) = a \frac{1-x}{2} + (a+3h) \frac{1+x}{2} = a + 3h \frac{1+x}{2}$$ and $$\phi(-1) = x_1, \quad \phi\left(-\frac{1}{3}\right) = x_2, \quad \phi\left(\frac{1}{3}\right) = x_2, \quad \phi\left(1\right) = x_3$$ The substitution will allow you to move your integral to the interval $[-1,1]$. At this point, I would recommend reducing the polynomials to standard form by carrying all the multiplications.
You mention Simpson's rule. It is difficult to apply it in this context, because the number of natural sub-intervals is an odd number (specifically 3), rather than an even number. The simplest way that I know to rediscover Simpson's rule is to seek numbers $a$, $b$, and $c$ such the quadrature rule $$\int_{-h}^h f(x) dx = a f(-h) + b f(0) + c f(h)$$ is exact for all polynomials of degree less than or equal to $2$. By using $$f(x) = 1, \quad f(x) = x, \quad \text{and}\quad f(x) = 2$$ you will assemble a linear system of dimension $3$ for the unknowns $a$, $b$ and $c$. Once you have solved it you will be able to verify that your new quadrature rule also integrates $f(x) = x^3$ correctly.