Solution (source code)

= Solution
{c}

Exactness on constants and linear <functions> gives
$$
a_1+a_2=\frac13,\qquad a_1x_1+a_2x_2=\frac14.
$$
With the nodes just computed, the solution is
$$
\boxed{a_1=\frac{8-\sqrt{10}}{48},\qquad
a_2=\frac{8+\sqrt{10}}{48}.}
$$
To prove cubic exactness rather than merely moment matching, divide a <polynomial> $u$ of degree at most three by the monic $\phi_2$:
$$
u=q_1\phi_2+r_1,\qquad \deg q_1,\deg r_1\leq1.
$$
The weighted integral of $q_1\phi_2$ vanishes by orthogonality, and its two nodal values vanish because the nodes are roots of $\phi_2$. The remaining $r_1$ is integrated exactly by the two equations above. This proves <Gaussian quadrature> exactness through degree three.