kill(all);

p(xi):= a0+a1*xi+a2*xi^2+a3*xi^3;

exact: fullratsimp(
    integrate(p(xi), xi, -1, 1)
);

quad: w1*p(xi1)+w2*p(xi2);

res:quad-exact;

ev(res,a0=0,a1=0,a2=0,a3=0);

eqn:[
    diff(res, a0)=0,
    diff(res, a1)=0,
    diff(res, a2)=0,
    diff(res, a3)=0
];

sols:solve(%, [xi1,xi2,w1,w2]);