To understand how the weights and the mesh points are generated, we define first a polynomial of degree 2N−1 (since we have 2N variables at hand, the mesh points and weights for N points). This polynomial can be represented through polynomial division by P2N−1(x)=LN(x)PN−1(x)+QN−1(x),
Recall that we wanted to approximate an arbitrary function f(x) with a polynomial P2N−1 in order to evaluate ∫1−1f(x)dx≈∫1−1P2N−1(x)dx.