The Golub-Welsch algorithm constructs a Gaussian quadrature rule from the eigenvalues and eigenvectors
of a Jacobi matrix. Let be a finite positive measure
on the real line, with finite moments through order
and a positive definite polynomial inner product through degree
, where
is a positive integer.
Form the leading
Jacobi matrix
from its orthogonal
polynomials. The eigenvalues
of
are the quadrature nodes. For corresponding real unit eigenvectors
, the weights
are
where
is the total mass. The rule
is exact for polynomials of polynomial degree at most (Golub and Welsch 1969).
The Jacobi matrix is a real symmetric matrix and a tridiagonal matrix, so its spectrum can be computed with specialized symmetric tridiagonal eigensolvers. Modifying its terminal entries similarly constructs Radau quadrature and Lobatto quadrature rules with prescribed endpoints (Golub 1973).