Derive Newton QUADRATE (high precision) of the form $\int_a^b f(x)dx ≈ w0 f(a)+w1 f(b)+w2 f′(a)+w3 f′(b)$ Derive a formula of the form
$$\int_a^b f(x)dx ≈ w0 f(a)+w1 f(b)+w2 f′(a)+w3 f′(b)$$ 
that is exact for polynomials of the highest degree possible.
For a simpler version like $$\int_0^1 f(x) dx ≈ w1f(0) + w2f(x1)$$ i know how to solve: i would need to solve a system of equations 
$$f(x) = x0 \int_0^1 1 dx = w1 · 1 + w2 · 1$$
$$f(x) = x1 \int_0^1 x dx = w1 · 0 + w2 · x1$$
$$f(x) = x2 \int_0^1 x^2 dx=w1 · 0 + w2 · x1^2$$
would anyone please explain briefly (or hint at) what i wouold do for this problem. thanks.
 A: Assume for the moment $a=-c$, $\>b=c>0$, and consider the polynomial
$$f(x):=a_0+a_1x+a_2x^2+a_3 x^3\ .$$
Then
$$w:=\int_{-c}^c f(x)\>dx=2c a_0 +{2c^3\over3}a_2\ .\tag{1}$$On the other hand we want a representation of $w$ of the form
$$z:=p\bigl(f(c)+f(-c)\bigr)+q\bigl(f'(c)-f'(-c)\bigr)=2p a_0+(2c^2p+4cq)a_2\tag{2}$$
for suitable $p$ and $q$, that should not depend on the $a_i$. Comparing $(2)$ and $(1)$ we obtain the conditions
$$2p=2c,\quad 2c^2 p+4cq={2c^3\over3}\ ,$$
that are uniquely solved by $p=c$, $\>q=-{c^2\over3}$. It follows that for our third degree polynomial $f$ we have
$$\int_{-c}^c f(x)\>dx=c\bigl(f(c)+f(-c)\bigr)-{c^2\over3}\bigl(f'(c)-f'(-c)\bigr)\ .$$
As $c={b-a\over2}$ this immediately translates into
$$\int_a^b f(x)\>dx={b-a\over2}\bigl(f(c)+f(-c)\bigr)-{(b-a)^2\over12}\bigl(f'(c)-f'(-c)\bigr)\ .$$
This formula is exact for arbitrary polynomials of degree $\leq3$ and arbitrary $a<b$.
A: You know that the formula can't be exact for $4^{\text{th}}$ degree polynomials because
$$\int_a^b(x-a)^2(x-b)^2dx\ne0$$
Because the integrand is positive in $(a,b)$, but your quadrature formula predicts it is $0$. Thus all you need is a basis for $\mathcal{P}_3$, the vector space of polynomials of degree at most $3$. Apply your quadrature formula to each basis polynomial and you get $4$ equations in $4$ unknowns. There are $2$ schools of thought here, first is to use a simple basis:
$$\begin{align}\int_a^b1\,dx&=w_0+w_1=2\left(\frac{b-a}2\right)\label{a}\tag{1}\\
\int_a^b\left(x-\frac{b+a}2\right)\,dx&=-\left(\frac{b-a}2\right)w_0+\left(\frac{b-a}2\right)w_1+w_2+w_3=0\label{b}\tag{2}\\
\int_a^b\left(x-\frac{b+a}2\right)^2\,dx&=\left(\frac{b-a}2\right)^2w_0+\left(\frac{b-a}2\right)^2w_1-2\left(\frac{b-a}2\right)w_2+2\left(\frac{b-a}2\right)w_3=\frac23\left(\frac{b-a}2\right)^3\label{c}\tag{3}\\
\int_a^b\left(x-\frac{b+a}2\right)^3\,dx&=-\left(\frac{b-a}2\right)^3w_0+\left(\frac{b-a}2\right)^3w_1+3\left(\frac{b-a}2\right)^2w_2+3\left(\frac{b-a}2\right)^2w_3=0\label{d}\tag{4}\end{align}$$
If we multiply eq$(\ref{b})$ by $\left(\frac{b-a}2\right)^2$ and subtract from eq$(\ref{d})$ we see that
$$2\left(\frac{b-a}2\right)^2w_2+2\left(\frac{b-a}2\right)^2w_3=0$$
So $w_2=-w_3$. Using this result in eq$(\ref{b})$ we have
$$-\left(\frac{b-a}2\right)w_0+\left(\frac{b-a}2\right)w_1=0$$
So $w_0=w_1$. Multiply eq$(\ref{a})$ by $\left(\frac{b-a}2\right)^2$ and subtract from eq$(\ref{c})$ to show that
$$-2\left(\frac{b-a}2\right)w_2+2\left(\frac{b-a}2\right)w_3=-\frac43\left(\frac{b-a}2\right)^3$$
And we can conclude that $w_2=-w_3=\frac{(b-a)^2}{12}$. And from eq$(\ref{a})$, $w_0=w_1=\left(\frac{b-a}2\right)$.  
The other school of thought is to construct a fancy basis that avoids systems of equations.
$$\begin{align}w_0&=\int_a^b\frac{2x^3-3(a+b)x^2+6abx+b^2(b-3a)}{(b-a)^3}dx\\
&=\frac1{(b-a)^3}\left(\frac12(b^4-a^4)-(a+b)(b^3-a^3)+3ab(b^2-a^2)+b^2(b-3a)(b-a)\right)\\
&=\frac{b-a}2\end{align}$$
$$\begin{align}w_1&=\int_a^b\frac{2x^3-3(a+b)x^2+6abx+a^2(a-3b)}{(a-b)^3}\\
&=\frac1{(a-b)^3}\left(\frac12(b^4-a^4)-(a+b)(b^3-a^3)+3ab(b^2-a^2)+a^2(a-3b)(b-a)\right)\\
&=\frac{b-a}2\end{align}$$
$$\begin{align}w_2&=\int_a^b\frac{(x-a)(x-b)^2}{(b-a)^2}dx\\
&=\frac1{(b-a)^2}\left(\frac14(b^4-a^4)-\frac13(2b+a)(b^3-a^3)+\frac12(b^2+2ab)(b^2-a^2)-ab^2(b-a)\right)\\
&=\frac{(b-a)^2}{12}\end{align}$$
$$\begin{align}w_3&=\int_a^b\frac{(x-a)^2(x-b)}{(b-a)^2}dx\\
&=\frac1{(b-a)^2}\left(\frac14(b^4-a^4)-\frac13(2a+b)(b^3-a^3)+\frac12(a^2+2ab)(b^2-a^2)-a^2b(b-a)\right)\\
&=-\frac{(b-a)^2}{12}\end{align}$$
So either way seems to work out OK.
