# Numerical Analysis/Gaussian Quadrature

For the first example, I just want an example to show that the solution is exact for polynomials of degree , using the th degree Legendre polynomial. I'm going to approximate .

This problem accurately illustrates the method for solving problems using the Gaussian Quadrature algorithm. Note that the zeros of the Legendre polynomials of degree are and .

We can see from the previous example that this method works quite well if we are integrating from to , but in application, we rarely want to integrate over such a simple region. So in our next example, we will show that this technique is also effective if we change the limits of integration, as seen on the Wikipedia page, then we will solve the example

We will next show how to solve a problem that isn't a simple polynomial. We will approximate using a two point Gaussian approximation, and discuss the error analysis.

We will next analyze this error, looking at the actual error followed by finding the error bound. We denote the approximation by and the exact solution by .

The theoretical error bound when using the Legendre polynomial method is

In our example, the actual error was well within the error bound. We also see that with only two calculations, this is a very good algorithm for approximating integrals quickly with relatively good accuracy.

## Exercises[edit | edit source]

1. Show that Gaussian Quadrature can solve exactly general cubic polynomials.

a) Set up the integral:

Solution:

b) Evaluate the integral:

Solution:

c) Evaluate the approximation:

Solution:

d) Do parts b and c correspond?

Solution:

Yes

2. Approximate using Gaussian Quadrature

a) Evaluate the problem symbolically:

Solution:

b) Evaluate the approximation:

Solution:

c) Find the actual error

Solution:

d) Find the error bound

Solution:

d) Is the actual error less than the error bound?

Solution:

Yes

3. If are the roots of the th Legendre Polynomial and that for each , the numbers are defined by

Prove that if is any polynomial of degree less than , then

Proof:

The set that is relevant to this proof is the set of Legendre Polynomials, a collection orthogonal polynomials with properties:

- For each is a monic polynomial of degree .
- whenever is a polynomial of degree less that .

First we use polynomial division, to get with a remainder term , so that and the two polynomials and are of degree less than and is of degree . Then using this fact we can rewrite the original integral into the form

- .

Since the degree of is less than twice the degree of the w: Legendre polynomial, then the degree of is less than the degree of . So (by Legendre property 2 started above), . Thus we see that . We do not know what is, but we know it has degree less than so it equals the polynomial that interpolates it at the values . We will use the w: Lagrange polynomial form. Since is a roots of for each , we have

Since is a polynomial of degree less than , then Lagrange polynomial for is

- .

We next integrate this polynomial by

- .

Since is a constant, we will pull that outside the integral, giving us

- .

We then note that

- ,

so we will substitute into our integration, giving us

This completes the proof.

#### Gaussian Quadrature Example[edit | edit source]

I realized that there was insufficient information after the derived and solved sample on Gaussian Quadrature thus i took the pain to edit this wikiversity page by adding a solved example to the information already on there and below is what i factored in.

Find the constants C_0, C_1, and x_1 so that the quadrature formula

has the highest possible degree of precision.

**Solution**

Since there are three unknowns, C_0, C_1 and x_1, we will expect the formula to be exact for

**Thus**

Equation 2 and 3 will yield.

**Hence**

**Now,**

**And**

**Thus the degree of the precision is 2**

## Example Quiz[edit | edit source]