Gaussian quadrature

How Gaussian quadrature chooses optimal nodes and weights using orthogonal polynomials: Legendre, Chebyshev, Laguerre and Hermite.

General idea

Newton-Cotes fixes equally spaced nodes. Gauss does the opposite: it allows the nodes to move and computes weights so the rule is exact for polynomials of the highest possible degree.

abw(x)f(x)dxi=1ncif(xi),w(x)>0\int_a^b w(x)f(x)\,dx\approx\sum_{i=1}^{n} c_i f(x_i),\qquad w(x)>0
E=f(2n)(ξ)(2n)!abpn2(x)w(x)dxE=\frac{f^{(2n)}(\xi)}{(2n)!}\int_a^b p_n^2(x)w(x)\,dx

Gauss-Legendre

Gauss-Legendre uses w(x)=1w(x)=1 on [1,1][-1,1]. To apply the rule on [a,b][a,b], the integration interval is transformed and multiplied by the Jacobian.

x=ba2y+b+a2,dx=ba2dyx=\frac{b-a}{2}y+\frac{b+a}{2},\qquad dx=\frac{b-a}{2}\,dy
abf(x)dxba2i=1ncif ⁣(ba2xi+b+a2)\int_a^b f(x)\,dx\approx\frac{b-a}{2}\sum_{i=1}^{n}c_i f\!\left(\frac{b-a}{2}x_i+\frac{b+a}{2}\right)
nNodesWeights
2-0.577350, 0.5773501.000000, 1.000000
30.000000, -0.774597, 0.7745970.888889, 0.555556, 0.555556
4-0.339981, -0.861136, 0.339981, 0.8611360.652145, 0.347855, 0.652145, 0.347855
50.000000, -0.538469, -0.906180, 0.538469, 0.9061800.568889, 0.478629, 0.236927, 0.478629, 0.236927

Other Gaussian families

The family is chosen by looking at the weight and the domain. If the integral already contains a singularity or an exponential, it is better not to fight it: include it in the weight.

FamilyWeight and domainPolynomials
Legendrew(x)=1, [-1,1]p0=1, p1=x, recurrence by Legendre
Chebyshevw(x)=1/sqrt(1-x^2), [-1,1]T0=1, T1=x, Tk=2xT(k-1)-T(k-2)
Laguerrew(x)=e^(-x), [0,+infty)L0=1, L1=1-x, recurrence by Laguerre
Hermitew(x)=e^(-x^2), (-infty,+infty)H0=1, H1=2x, H(k+2)=2xH(k+1)-2(k+1)Hk
11f(x)1x2dxπni=1nf(xi),xi=cos ⁣(π2i12n)\int_{-1}^{1}\frac{f(x)}{\sqrt{1-x^2}}\,dx\approx\frac{\pi}{n}\sum_{i=1}^{n}f(x_i),\qquad x_i=\cos\!\left(\pi\frac{2i-1}{2n}\right)

Derivation of two-point Gauss-Legendre

DerivationDerivation: two-point Gauss-LegendreView as its own page →
  1. Seek a symmetric rule on [1,1][-1,1] with nodes r-r and rr and equal weights cc, because the interval and the weight w(x)=1w(x)=1 are symmetric.

    11f(x)dxcf(r)+cf(r)\int_{-1}^{1}f(x)dx\approx c f(-r)+c f(r)
  2. Impose exactness for f(x)=1f(x)=1:

    2=2cc=12=2c\quad\Longrightarrow\quad c=1
  3. The odd functions xx and x3x^3 are automatically exact by symmetry. Impose exactness for f(x)=x2f(x)=x^2:

    11x2dx=23=r2+r2=2r2\int_{-1}^{1}x^2dx=\frac{2}{3}=r^2+r^2=2r^2
  4. Solving for r gives the two-point rule:

    r=13,11f(x)dxf ⁣(13)+f ⁣(13)r=\frac{1}{\sqrt{3}},\qquad \int_{-1}^{1}f(x)dx\approx f\!\left(-\frac{1}{\sqrt{3}}\right)+f\!\left(\frac{1}{\sqrt{3}}\right)