The reason why we can represent a function \( f(x) \) with a polynomial of degree \( 2N-1 \) is due to the fact that we have \( 2N \) equations, \( N \) for the mesh points and \( N \) for the weights.
The mesh points are the zeros of the chosen orthogonal polynomial of order \( N \), and the weights are determined from the inverse of a matrix. An orthogonal polynomials of degree \( N \) defined in an interval \( [a,b] \) has precisely \( N \) distinct zeros on the open interval \( (a,b) \).
Before we detail how to obtain mesh points and weights with orthogonal polynomials, let us revisit some features of orthogonal polynomials by specializing to Legendre polynomials. In the text below, we reserve hereafter the labelling \( L_N \) for a Legendre polynomial of order \( N \), while \( P_N \) is an arbitrary polynomial of order \( N \). These polynomials form then the basis for the Gauss-Legendre method.