Application to the case \( N=2 \)

The exact answer is \( 2/3 \). Using \( N=2 \) with the above two weights and mesh points we get $$ \begin{equation*} I=\int_{-1}^1x^2dx =\sum_{i=0}^{1}\omega_ix_i^2=\frac{1}{3}+\frac{1}{3}=\frac{2}{3}, \end{equation*} $$ the exact answer!

If we were to emply the trapezoidal rule we would get $$ \begin{equation*} I=\int_{-1}^1x^2dx =\frac{b-a}{2}\left((a)^2+(b)^2\right)/2= \frac{1-(-1)}{2}\left((-1)^2+(1)^2\right)/2=1! \end{equation*} $$ With just two points we can calculate exactly the integral for a second-order polynomial since our methods approximates the exact function with higher order polynomial. How many points do you need with the trapezoidal rule in order to achieve a similar accuracy?