Determine a quadrature formula
$$Q[f] = w_0f(0) + w_1f(\pi/2) + w_2f(\pi)$$
in order to calculate
$$I[f] = \int_0^\pi f(x) dx.$$
The formula shall integrate every function of the space $G = \operatorname{span} \{1, \sin x, \cos(x/2)\}$ exact.
I know that a quadrature formula with $m$ knots $x_i, i = 1, \ ..., \ m$, is exact up to degree $2m-1$. Since we have $m = 3$ knots, which are $x_1 = 0, x_2 = \pi/2$ and $x_3 = \pi$ in this case, we have at most an accuracy of $5$.
But what to do next? I definitely have to calculate the weights $w_0, w_1$ and $w_2$, but how would I do that?
Plus, does it even matter which kind of base I have to work with? I am not sure what it means that the formula shall be able to integrate every function of $G$ exact.