Taking q(x)=1, q(x)=x
and q(x)=x2 in equation (1) and working out
the integral (easy!) will give you three
equations which you can solve to find
l1, l2 and l3.
The key to showing that the same formula works
for other polynomials is to show that if it works
for 1, x and x2 it works for any linear
combination of them and so for any quadratic
polynomial.
Finally you can go on to check out the formula
for x3, x4 and x5.