This is a late response to your question however, it never hurts know more math!
In order to calculate $\int_0^1 x^{4}f(x)\,dx$ you use the Method of Undetermined Coefficients. That is:
Let $f_{i}(x)=x^{i}$. Then, calculate $c=\int_0^1 x^{4}f_{i}(x)\,dx$ and $A_{0} f_{i}(x_{0})+A_{1}f_{i}(x_{1})$. From this, you will get an equation of the form $c=A_{0} x_{0}^{i}+A_{1}x_{1}^{i}$. In this problem, we have 4 unknowns hence to solve for $A_{0}, x_{0}, A_{1}, x_{1}$ you must create 4 equations using this method. From there you can solve for your variables.
The Method of Undetermined Coefficients can work with any weight function, using the integral $\int_a^b w(x)f(x)\,dx$ for each $f_{i}(x)=x^{i}$ as defined in the method above.
Let's look first at $\int_{-1}^{1} f(t) \ dt$.
We want the formula to evaluate $\int_{-1}^{1} dt, \int_{-1}^{1} t \ dt, \int_{-1}^{1} t^{2} \ dt, \int_{-1}^{1} t^{3} \ dt, \int_{-1}^{1} t^{4} \ dt, \int_{-1}^{1} t^{5} \ dt, \int_{-1}^{1} t^{6} \ dt $ and $\int_{-1}^{1} t^{7} \ dt$ exactly.
That leads to the following system of equations:
$$ 2 = \omega_{0} + \omega_{1}$$
$$ 0 = \omega_{0} x_{0} + \omega_{1} x_{1}+ \omega_{2}+\omega_{3}$$
$$ \frac{2}{3} = \omega_{0} x_{0}^{2} + \omega_{1} x_{1}^{2} + 2 \omega_{2} x_{2} + 2 \omega_{3} x_{3}$$
$$ 0 = \omega_{0} x_{0}^{3} + \omega_{1} x_{1}^{3}+ 3 \omega_{2} x_{2}^{2} + 3 \omega_{3} x_{3}^{2} $$
$$ \frac{2}{5} = \omega_{0} x_{0}^{4} + \omega_{1} x_{1}^{4}+ 4 \omega_{2} x_{2}^{3} + 4 \omega_{3} x_{3}^{3} $$
$$0 = \omega_{0} x_{0}^{5} + \omega_{1} x_{1}^{5} + 5 \omega_{2} x_{2}^{4} + 5 \omega_{3} x_{3}^{4} $$
$$\frac{2}{7} = \omega_{0} x_{0}^{6} + \omega_{1} x_{1}^{6} + 6 \omega_{2} x_{2}^{5} + 6\omega_{3} x_{3}^{5} $$
$$ 0 = \omega_{0} x_{0}^{7} + \omega_{1} x_{1}^{7} + 7 \omega_{2} x_{2}^{6} + 7\omega_{3} x_{3}^{6}$$
Solve the system using a numerical solver.
Then use the the fact that $$\int_{a}^{b} f(x) \ dx = \frac{b-a}{2} \int_{-1}^{1} f \Big(a+(1+t)\frac{b-a}{2} \Big) \ dt$$
Best Answer
The Gauss-Legendre-quadrature is exact for polynomials upto degree 2n-1, if n is the number of points. So, with two points, the formula is exact upto degree 3. The reason is, that
$$\int_{-1}^1 x^n dx = 0$$
for odd n. So you only need the constant term and the quadratic term, so two points are enough.
Concrete, you have four equations :
$$c_1+c_2 = 2$$ $$c_1x_1+c_2x_2 = 0$$ $$c_1x_1^2+c_2x_2^2 = \frac{2}{3}$$ $$c_1x_1^3+c_2x_2^3 = 0$$
We multiply the second equation with $x_1^2$ and subtract the fourth to get
$$c_2x_2(x_1^2-x_2^2) = 0$$
This means $x_1=-x_2$ because the abscisses must be different ($x_2=0$ would lead to equal abscisses).
Inserting this in the second equation we get
$$-c_1x_2+c_2x_2 = 0$$
So it follows
$$c_1=c_2=1$$
with the first equation.
Finally, inserting this in the third equation, gives $x_1^3=\frac{1}{3}$. So $x_1=-x_2=\sqrt{\frac{1}{3}}$
Note that this solution only holds for the weighting function w(x) = 1. For other weighting functions, we need gauss-quadrature. There are formulas for the weights and the abscisses in the general case.