Two point Gaussian Quadrature rule I want to use the two point Gaussian Quadrature rule to approximate (evaluate) $\int_0^1 \! 6x^2-2x+1 \, \mathrm{d}x $
Since, with the two point Gaussian Quadrature rule, n=2 and the integral of polynomial of order up to 2n-1 is exact using this rule, we should, again, be able to exactly evaluate the integral.
Furthermore, I have given the weight function $w(x)=1$, so that $I_2(f)=a_1f(x_1)+a_2f(x_2)$.
Another requirement is that $a_2=-1$ and $x_2=0.9$.
Due to the fact that $w(x)=1$, we are in essence dealing with the Gauss Legendre Quadrature. But since the points and weights for the two point Gauss Legendre Quadrature are unique and not equal to the given values, I am failing to evaluate the Integral and wondering where I have made an error in my thinking.
Thanks a lot in advance.

This is a kind of restricted Gauss-Legendre quadrature, where one of the nodes (and its weight) are prescribed to you. This node and its weight are not what you would choose yourself, of course. But you have to deal with that by choosing $a_1$ and $x_1$ to do the best you can. 
For the quadrature rule to be exact on constants, we need $a_1+a_2=1$. Hence $a_1=2$. For it to be exact on $f(x)=x$, we need $a_1x_1+a_2x_2 = 0.5$. Hence, $2x_1-0.9=0.5$, which yields $x_1=0.7$. That's it, no more free parameters left. In particular, there is no guarantee that this (weird) quadrature rule will be exact on quadratic polynomials. This is what you'll see when applying it to your function. 
