%
%
%


\section{Gaussian Quadrature}   \label{sec_int03}

\begin{frame}
\frametitle{Gaussian Quadrature}
   Newton-Cotes formulas: 
\begin{itemize}   
   \item The choice of nodes
$x_{0}, x_{1}, \ldots, x_{n}$ was made \textit{a priori}.
   
   \item Use values of the function at equally spaced points. 

   \item Once the nodes were fixed, the coefficients were
determined, e.g., by integrating the fundamental Lagrange polynomials
of degree $n$. 

   \item These formulas are exact for polynomials of
degree $\leq n$.
\end{itemize}

\begin{block}{}
This approach is convenient when the formulas are combined to form
the composite rules, but the restriction may decrease the accuracy
of the approximation. 
\end{block}

\end{frame}

\begin{frame}
\begin{block}{Gaussian quadrature}
\begin{enumerate}
    \item Chooses
the points for evaluation in an optimal, rather than pre-fixed or
equally-spaced, way.  

    \item The nodes
$x_{0}, x_{1}, \ldots, x_{n} \in [a,b]$ and
the coefficients $c_{0}, c_{1}, \ldots, c_{n}$ are chosen to
minimize the expected error obtained in the
approximation
\begin{equation}   \label{eq_int03001}
   \int_{a}^{b} f(x) \, dx
   \approx \sum_{i=0}^{n} c_{i} f(x_{i})
\end{equation}

    \item Produce the exact
result for the largest class of polynomials, that is, the choice
which gives the greatest degree of precision.
\end{enumerate}
\end{block} 


The coefficients $c_{0}, c_{1}, \ldots, c_{n}$ are arbitrary, and the nodes
$x_{0}, x_{1}, \ldots, x_{n}$ are restricted only in $[a,b]$.
These give $2n+2$ degrees of freedom. Thus we can expect that
the quadrature formula of (\ref{eq_int03001}) can be
discovered that will be exact for polynomials of degree $\leq 2n+1$.
\end{frame}

\begin{frame}
Suppose we want to determine $c_1, c_2, x_1$ and $x_2$ so that
\begin{eqnarray}
    \int_{-1}^1 f(x) dx \approx c_1 f(x_1) + c_2 f(x_2) \label{eq:Gaussian_1}
\end{eqnarray}
gives the exact result whenever $f(x)$ is a polynomial of degree $2 \times 2 - 1 = 3$ or less, i.e., 
\begin{eqnarray*}
    f(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3.
\end{eqnarray*}
Since
\begin{eqnarray*}
    && \int ( a_0 + a_1 x + a_2 x^2 + a_3 x^3 ) dx \\
    &=& a_0 \int 1 dx + a_1 \int x dx + a_2 \int x^2 dx + a_3 \int x^3 dx,
\end{eqnarray*}
this is equivalent to show that \eqref{eq:Gaussian_1} gives exact results when $f(x)$ is $1, x, x^2$ and $x^3$. Hence
\end{frame}

\begin{frame}
\begin{eqnarray*}
    c_1 + c_2 &=& \int_{-1}^1 1 dx = 2, \\
    c_1 x_1 + c_2 x_2 &=& \int_{-1}^1 x dx = 0, \\
    c_1 x_1^2 + c_2 x_2^2 &=& \int_{-1}^1 x^2 dx = \frac{2}{3}, \\
    c_1 x_1^3 + c_2 x_2^3 &=& \int_{-1}^1 x^3 dx = 0.
\end{eqnarray*} 
It implies that
\begin{eqnarray*}
    c_1 = 1, \ c_2 = 1, \ x_1 = -\frac{\sqrt{3}}{3}, \ x_2 = \frac{\sqrt{3}}{3}
\end{eqnarray*}
which gives
\begin{eqnarray*}
    \int_{-1}^1 f(x) dx \approx f\left( -\frac{\sqrt{3}}{3} \right) + f\left( \frac{\sqrt{3}}{3} \right).
\end{eqnarray*}
\end{frame}

%\subsection{Orthogonal Polynomials and Quadrature Rule}
%
%\begin{frame}
%Recall that a real inner-product space $E$ is a linear vector space
%in which an inner product $<\cdot, \cdot>$ and a norm $\| \cdot \|$
%have been defined with the following properties:
%%
%\begin{enumerate}
%   \item  $\langle f, g \rangle = \langle g, f \rangle$
%   \item  $\langle f, \alpha g + \beta h \rangle
%           = \alpha \langle f, g \rangle + \beta \langle f, h \rangle$
%   \item  $\langle f, f \rangle > 0$ if $f \neq 0$,
%          and $\langle f, f \rangle = 0$ if and only if $f=0$
%   \item  $\| f \| = \sqrt{\langle f, f \rangle}$
%\end{enumerate}
%%
%where $f, g, h \in E$ and $\alpha, \beta \in \mathbb{R}$.

%
%
\begin{frame}
\begin{definition}
\begin{enumerate}
    \item In a inner-product space, we say $f$ is orthogonal to $g$, and write
$f \perp g$ if $\langle f, g \rangle = 0$. 
    \item We write
$f \perp G$ if $f \perp g$ for all $g \in G$.
    \item We say that a finite or infinite sequence of vectors
$f_{1}, f_{2}, \ldots$ in an inner-product space is orthogonal if
$\langle f_{i}, f_{j} \rangle = 0$ for all $i \neq j$, and orthonormal
if $\langle f_{i}, f_{j} \rangle = \delta_{ij}$.
\end{enumerate}
\end{definition}
%
%
%\begin{lemma}
%In an inner-product space, we have
%\begin{enumerate}
%   \item  $\langle \sum_{i=1}^{n} a_{i} f_{i}, g \rangle
%           = \sum_{i=1}^{n} a_{i} \langle f_{i}, g \rangle$
%   \item  $\| f + g \|^{2} = \| f \|^{2} + 2 \langle f, g \rangle
%           + \| g \|^{2}$
%   \item  If $f \perp g$, then $\| f + g \|^{2} = \| f \|^{2}
%           + \| g \|^{2}$
%   \item  $|\langle f, g \rangle| \leq \| f \| \| g \|$
%   \item  $\| f + g \|^{2} + \| f - g \|^{2} = 2 \| f \|^{2} + 2 \| g \|^{2}$
%\end{enumerate}
%\end{lemma}
%
%
%
The space of continuous functions on $[a,b]$ with
inner-product defined as
%
\begin{equation}
   \langle f, g \rangle = \int_{a}^{b} f(x) g(x) \, dx,
\end{equation}
%
is an inner-product space.
\end{frame}

\begin{frame}
%
\begin{definition}
$\{ \phi_{0}, \phi_{1}, \ldots, \phi_{n} \}$, where
$\phi_{i} \in C[a,b] $ for all $ i = 0, 1, \ldots, n$,
is said to be an orthogonal set of functions  if
\[
   \langle \phi_{i}, \phi_{j} \rangle =
   \int_{a}^{b} \phi_{i}(x) \phi_{j}(x)\, dx
   = \begin{cases}
        0,                     & \text{when $i \neq j$},  \\
        \alpha_{i} > 0, \quad & \text{when $i=j$}.
     \end{cases}
\]
If, in addition, $\alpha_{i} = 1$  for all $ i$,
then the set is said to be orthonormal.
\end{definition}



\begin{theorem}
The set of polynomials $\{ p_{0}, p_{1}, \ldots, p_{n} \} $
defined as follows is orthogonal:
%
\[
   p_{n}(x) = (x - a_{n}) p_{n-1}(x) - b_{n} p_{n-2}(x)
   \qquad (n \geq 2)
\]
%
with $p_{0}(x) = 1$, $p_{1}(x) = x - a_{1}$, and
%
\[
   a_{n} = \frac{\langle x p_{n-1}, p_{n-1} \rangle}
                    {\langle p_{n-1}, p_{n-1} \rangle},  \qquad
   b_{n} = \frac{\langle x p_{n-1}, p_{n-2} \rangle}
                    {\langle p_{n-2}, p_{n-2} \rangle}.
\]
\end{theorem}
\end{frame}

\begin{frame}

%
{\em Proof}:
It is clear from the formulation that each $p_{n}$ is a monic
polynomial of degree $n$ and is therefore not zero. Hence, the
denominators in $a_{n}$ and $b_{n}$ are not zero. Now we prove
the theorem by induction on $n$ that
$\langle p_{n}, p_{i} \rangle = 0$ for $i = 0, 1, \ldots, n-1$.

For $n=1$, it can be shown directly from the definition that
\begin{eqnarray*}
   \langle p_{1}, p_{0} \rangle
   &=& \langle (x - a_{1}) p_{0}, p_{0} \rangle \\
   &=& \langle x p_{0}, p_{0} \rangle - a_{1} \langle p_{0}, p_{0} \rangle \\
   &=& \langle x p_{0}, p_{0} \rangle
     - \frac{\langle x p_{0}, p_{0} \rangle}{\langle p_{0}, p_{0} \rangle}
     \langle p_{0}, p_{0} \rangle
   = 0.
\end{eqnarray*}
Now suppose that the assertion is true for an index $n-1$,
where $n \geq 2$. That is
\[
   \langle p_{n-1}, p_{i} \rangle = 0, \qquad i = 0, 1, \ldots, n-2,
   \quad n \geq 2.
\]
\end{frame}

\begin{frame}
Now we can verify that
\begin{eqnarray*}
   \langle p_{n}, p_{n-1} \rangle
   & = &  \langle (x - a_{n}) p_{n-1} - b_{n} p_{n-2}, p_{n-1} \rangle \\
   & = &  \langle x p_{n-1}, p_{n-1} \rangle
           - a_{n} \langle p_{n-1}, p_{n-1} \rangle
           - b_{n} \langle p_{n-2}, p_{n-1} \rangle  \\
   & = & \langle x p_{n-1}, p_{n-1} \rangle
           - \frac{\langle x p_{n-1}, p_{n-1} \rangle}
           {\langle p_{n-1}, p_{n-1} \rangle}
           \langle p_{n-1}, p_{n-1} \rangle   \\
   & = & 0, \\
%
   \langle p_{n}, p_{n-2} \rangle
   & = &  \langle (x - a_{n}) p_{n-1} - b_{n} p_{n-2}, p_{n-2} \rangle \\
   & = &  \langle x p_{n-1}, p_{n-2} \rangle
           - a_{n} \langle p_{n-1}, p_{n-2} \rangle
           - b_{n} \langle p_{n-2}, p_{n-2} \rangle  \\
   & = & \langle x p_{n-1}, p_{n-2} \rangle
           - \frac{\langle x p_{n-1}, p_{n-2} \rangle}
           {\langle p_{n-2}, p_{n-2} \rangle}
           \langle p_{n-2}, p_{n-2} \rangle   \\
   & = & 0,
\end{eqnarray*}
\end{frame}

\begin{frame}
and, for $i = 1, \ldots, n-3$,
\begin{eqnarray*}
   \langle p_{n}, p_{i} \rangle
   & = &  \langle (x - a_{n}) p_{n-1} - b_{n} p_{n-2}, p_{i} \rangle \\
   & = &  \langle x p_{n-1}, p_{i} \rangle
           - a_{n} \langle p_{n-1}, p_{i} \rangle
           - b_{n} \langle p_{n-2}, p_{i} \rangle  \\
   & = &  \langle x p_{n-1}, p_{i} \rangle  \\
   & = &  \langle p_{n-1}, x p_{i} \rangle  \\
   & = &  \langle p_{n-1}, x p_{i} - a_{i+1} p_{i} - b_{i+1} p_{i-1}
          + a_{i+1} p_{i} + b_{i+1} p_{i-1} \rangle \\
   & = &  \langle p_{n-1}, p_{i+1} + a_{i+1} p_{i} + b_{i+1} p_{i-1}
          \rangle  \\
   & = &  \langle p_{n-1}, p_{i+1} \rangle
          + a_{i+1} \langle p_{n-1}, p_{i} \rangle
          + b_{i+1} \langle p_{n-1}, p_{i-1} \rangle  \\
   & = & 0.
\end{eqnarray*}
Finally, when $i = 0$,
\begin{eqnarray*}
   \langle p_{n}, p_{0} \rangle
   &=& \langle (x - a_{n}) p_{n-1} - b_{n} p_{n-2}, p_{0} \rangle \\
   &=& \langle x p_{n-1}, p_{0} \rangle
   = \langle p_{n-1}, x p_{0} \rangle
   = \langle p_{n-1}, p_{1} + a_{1} p_{0} \rangle
   = 0.
\end{eqnarray*}
Hence the theorem is proved.
\qed
\end{frame}

\begin{frame}
%
\begin{corollary}
For any $n > 0$, the set of polynomials
$\{ p_{0}, p_{1}, \ldots, p_{n} \} $ given in the
previous theorem is linearly independent and
\[
   \langle q, p_{n} \rangle =
   \int_{a}^{b} q(x) p_{n}(x) \, dx = 0
\]
for any polynomial $q(x)$ with $\deg(q(x)) < n$.
\end{corollary}
%
{\em Proof}:
Suppose $\alpha_{0}, \alpha_{1}, \ldots, \alpha_{n}$ are real
numbers such that
\[
   P(x) = \alpha_{0} p_{0}(x) + \alpha_{1} p_{1}(x) + \cdots
          + \alpha_{n} p_{n}(x) = 0.
\]
This means that the coefficients of the terms $1, x, x^{2}, \ldots x^{n}$
are all zero. Since $\deg(p_{j}) = j$ and
$\alpha_{n} p_{n}$ is the only term in $P(x)$
which contains the $x^{n}$ term, this implies $\alpha_{n} = 0$.
Hence $P(x)$ can be reduced to
\[
   P(x) = \sum_{j=0}^{n-1} \alpha_{j} p_{j}(x) = 0.
\]
\end{frame}

\begin{frame}
Similarly, we have
$\alpha_{n-1} = 0, \alpha_{n-2} = 0, \ldots, \alpha_{0} = 0$.
Therefore, $\{ p_{0}, p_{1}, \ldots, p_{n} \}$ is linearly independent.

Suppose $\deg(q) = k < n$. Write
\[
   q(x) = a_{0} p_{0}(x) + a_{1} p_{1}(x) + \cdots + a_{k} p_{k}(x)
   = \sum_{j=0}^{k} a_{j} p_{j}(x),
\]
for some real numbers $a_{0}, a_{1}, \ldots, a_{k}$. Then
\begin{eqnarray*}
   \langle q, p_{n} \rangle
   & = &
   \int_{a}^{b} q(x) p_{n}(x) w(x) \, dx  \\
   & = &
    \int_{a}^{b} \left( \sum_{j=0}^{k} a_{j} p_{j}(x) \right)
      p_{n}(x) w(x) \, dx \\
   & = &
   \sum_{j=0}^{k} \int_{a}^{b} p_{j}(x) p_{n}(x) w(x) \, dx
      = 0.
\end{eqnarray*}
\qed
\end{frame}

%
%
\begin{frame}
Let $\Pi_{n}$ denote the set of polynomials of degree at most $n$,
that is,
\[
   \Pi_{n} = \{ p(x) \, | \, \text{$p(x)$ is a polynomial and
   $\deg(p) \leq n$} \}.
\]


\begin{definition}
Let $f(x)$ be any nonzero
continuous function. We say $f$ is orthogonal to $\Pi_{n}$,
and denote $f \perp  \Pi_{n}$, if
\[
   \langle f, p \rangle = \int_{a}^{b} f(x) p(x)  \, dx = 0,
\]
for any $p(x) \in \Pi_{n}$.
\end{definition}
\end{frame}

\begin{frame}
%
\begin{theorem}
Let $q(x)$ be any nonzero polynomial of degree $n+1$, and
$q(x) \perp \Pi_{n}$. If $x_{0}, x_{1}, \ldots, x_{n}$ are
the roots of $q(x)$ in $[a,b]$, and
\[
    c_{i} = \int_{a}^{b} 
    \prod_{\stackrel{j=0}{j \neq i}}^{n}
    \frac{x - x_{j}}{x_{i} - x_{j}} \, dx,
\]
then
\[
   \int_{a}^{b} p(x) \, dx = \sum_{i=0}^{n} c_{i} p(x_{i}), \ \mbox{ for any } \ p \in \Pi_{2n+1}.
\]
That is, the quadrature rule is exact
for any polynomial of degree $\leq 2n+1$.
\end{theorem}
\end{frame}

\begin{frame}

%%
{\em Proof}:
For any polynomial $p \in \Pi_{2n+1}$, we can write
\[
   p(x) = q(x) t(x) + r(x),
\]
where $t(x), r(x) \in \Pi_{n}$. Since $x_{0}, x_{1}, \ldots, x_{n}$
are roots of $q(x)$, we have
\[
   p(x_{i}) = q(x_{i}) t(x_{i}) + r(x_{i}) = r(x_{i}),
   \qquad i = 0, 1, \ldots, n.
\]
By assumption, $q \perp  \Pi_{n}$, we have
\[
   \langle q, t \rangle
   = \int_{a}^{b} q(x) t(x)  \, dx = 0.
\]
Since $r(x) \in \Pi_{n}$, it can be expressed exactly in the
Lagrange form
\[
   r(x) = \sum_{i=0}^{n} r(x_{i})
   \prod_{\stackrel{j=0}{j \neq i}}^{n} \frac{x - x_{j}}{x_{i} - x_{j}}.
\]
\end{frame}

\begin{frame}
Hence
\begin{eqnarray*}
   \int_{a}^{b} p(x) \, dx  
   & = &
   \int_{a}^{b} q(x) t(x)  \, dx + \int_{a}^{b} r(x)  \, dx  \\
   & = &
   \int_{a}^{b} r(x)  \, dx
   = \int_{a}^{b}  \sum_{i=0}^{n} r(x_{i})
   \prod_{\stackrel{j=0}{j \neq i}}^{n} \frac{x - x_{j}}{x_{i} - x_{j}}
   \, dx  \\
   & = &
   \sum_{i=0}^{n} r(x_{i}) \int_{a}^{b}  
   \prod_{\stackrel{j=0}{j \neq i}}^{n} \frac{x - x_{j}}{x_{i} - x_{j}}\, dx \\
   &=& \sum_{i=0}^{n} p(x_{i}) \int_{a}^{b}  
   \prod_{\stackrel{j=0}{j \neq i}}^{n} \frac{x - x_{j}}{x_{i} - x_{j}}\, dx \\
  & = &
  \sum_{i=0}^{n} c_{i} p(x_{i}).
\end{eqnarray*}
\qed
\end{frame}

%
%
%
%Next theorem shows that the roots of $q(x)$ are simple roots
%and lie in the interior of the interval $[a,b]$.
%
%
%\begin{theorem}
%Let $w \in C[a,b]$ be a positive weight function, and $f \in C[a,b]$
%be a nonzero function such that $ f \perp_{w} \Pi_{n}$.
%Then $f$ changes sign at least $n+1$ times on $(a,b)$.
%\end{theorem}
%\proof
%Since $1 \in \Pi_{n}$ and $f \perp_{w} \Pi_{n}$, we have
%\[
%   \int_{a}^{b} f(x) w(x) \, dx = 0,
%\]
%and this shows that $f$ changes sign at least once in $[a,b]$.
%
%Suppose that $f$ only changes sign $m$ times and $m \leq n$.
%Let $t_{0} = a < t_{1} < \cdots < t_{m} < t_{m+1} = b$ such that
%$f$ remains the same sign in each interval
%$(t_{0}, t_{1}), (t_{1}, t_{2}), \ldots, (t_{m}, t_{m+1})$.
%Define an $m$-th degree polynomial as follows
%\[
%   p(x) = (x - t_{1})(x - t_{2}) \cdots (x - t_{m})
%   = \prod_{i=1}^{m} (x - t_{i}).
%\]
%Then $p(x)$ has the same sign property as $f$. This implies that
%\[
%   \int_{a}^{b} f(x) p(x) w(x) \, dx \neq 0.
%\]
%However, $\deg(p) = m \leq n$, hence $p \in \Pi_{n}$. The above
%conclusion contradicts to the assumption that
%\[
%   f \perp_{w} \Pi_{n} \quad \Longrightarrow \quad
%   \int_{a}^{b} f(x) p(x) w(x) \, dx = 0.
%\]
%Therefore $f$ changes sign at least $n+1$ times in $(a,b)$.
%\qed
%
%
%These theorems show that the quadrature rule (\ref{eq_int03002})
%is exact for polynomials of degree $\leq 2n + 1$ if the nodes
%$x_{0}, x_{1}, \ldots, x_{n}$ are chosen to be the distinct roots
%of a polynomial of degree $n+1$ which is $w$-orthogonal to $\Pi_{n}$.
%
%
%
%
%%\subsection{Gaussian Quadrature Rule}
%
%
\begin{frame}

If the interval $[a,b]$
is $[-1,1]$, then we can  obtain a set of orthogonal polynomials called the Lengendre
polynomials. The first few Lengendre polynomials are
\begin{eqnarray*}
   p_{0}(x) & = & 1  \\
   p_{1}(x) & = & x  \\
   p_{2}(x) & = & x^{2} - \frac{1}{3} \\
   p_{3}(x) & = & x^{3} - \frac{3}{5} x \\
   p_{4}(x) & = & x^{4} - \frac{6}{7} x^{2} + \frac{3}{35}  \\
   p_{5}(x) & = & x^{5} - \frac{10}{9} x^{3} + \frac{5}{21} x
\end{eqnarray*}
\end{frame}
%

\begin{frame}

\begin{itemize}
    \item For a given integer $n$, the Lengendre polynomial $p_{n+1}$ is
a monic polynomial of degree $n+1$ and is orthogonal to the set
of first $n$ Lengendre polynomials $\{ p_{0}, p_{1}, \ldots, p_{n} \}$.
    \item By theorem, $\{ p_{0}, p_{1}, \ldots, p_{n} \}$ is linearly independent,
and, hence, is a basis for the vector space $\Pi_{n}$. This implies
that $p_{n+1} \perp \Pi_{n}$. 
\end{itemize}

%Thus, by theorem,
%the quadrature rule
%%
%\[
%   \int_{-1}^{1} f(x) \, dx \approx \sum_{i=0}^{n} c_{i} f(x_{i})
%\]
%will be exact for $f \in \Pi_{2n+1}$ if the nodes
%$x_{0}, x_{1}, \ldots, x_{n}$ are chosen to be
%the roots of $p_{n+1}$. That is, we proved the following theorem.
%
%
\begin{theorem}
Suppose that $x_{0}, x_{1}, \ldots, x_{n}$ are the roots of
the $(n+1)$-st Lengendre polynomial $p_{n+1}$, and that for
each $i = 0, 1, \ldots, n$,
\[
   c_{i} = \int_{-1}^{1} \prod_{\stackrel{j=0}{j \neq i}}^{n}
   \frac{x - x_{j}}{x_{i} - x_{j}} \, dx.
\]
If $f(x)$ is any polynomial of degree $\leq 2n+1$, then
\[
   \int_{-1}^{1} f(x) \, dx = \sum_{i=0}^{n} c_{i} f(x_{i}).
\]
\end{theorem}
\end{frame}
%
%
%The discussion above gives the Gaussian quadrature rule.
%
%\noindent

\begin{frame}

\begin{block}{Gaussian Quadrature Rule}

For a given function $f(x) \in C[-1,1]$ and integer $n$,
\begin{equation}
   \int_{-1}^{1} f(x) \, dx
   \approx \sum_{i=0}^{n} c_{i} f(x_{i}),
\end{equation}
where $x_{0}, x_{1}, \ldots, x_{n}$ are the roots of
the $(n+1)$-st Lengendre polynomial $p_{n+1}$, and
\[
   c_{i} = \int_{-1}^{1} \prod_{\stackrel{j=0}{j \neq i}}^{n}
   \frac{x - x_{j}}{x_{i} - x_{j}} \, dx.
   \qquad  i = 0, 1, \ldots, n.
\]
\end{block}
\end{frame}

\begin{frame}
%
%The following table give some frequently used values for
%$x_{i}$ and $c_{i}$.
%
\begin{small}
\begin{center}
\renewcommand{\arraystretch}{1.25}
\begin{tabular}{|r|l|l|}
   \hline
   $n$  &  $x_{i}$  &  $c_{i}$  \\
   \hline
   0   &  $x_{0} = 0$  &  $c_{0} = 2$   \\
   \hline
   1   &  $x_{0} = -0.5773502692$  &  $c_{0} = c_{1} = 1$  \\
       &  $x_{1} = 0.5773502692$   &  \\
   \hline
   2   &  $x_{0} = -0.7745966692$  &  $c_{0} = \frac{5}{9}$  \\
       &  $x_{1} = 0$              &  $c_{1} = \frac{8}{9}$  \\
       &  $x_{2} = 0.7745966692$   &  $c_{2} = \frac{5}{9}$  \\
   \hline
   3   &  $x_{0} = -0.8611363116$  &  $c_{0} = 0.3478548451$  \\
       &  $x_{1} = -0.3399810436$  &  $c_{1} = 0.6521451549$  \\
       &  $x_{2} = 0.3399810436$   &  $c_{2} = 0.6521451549$  \\
       &  $x_{3} = 0.8611363116$   &  $c_{3} = 0.3478548451$  \\

   \hline
   4   &  $x_{0} = -0.9061798459$  &  $c_{0} = 0.2369268851$  \\
       &  $x_{1} = -0.5384693101$  &  $c_{1} = 0.4786286705$  \\
       &  $x_{2} = 0$        & $c_{2} = \frac{128}{225} = 0.568888889$ \\
       &  $x_{3} = 0.5384693101$   &  $c_{3} = 0.4786286705$  \\
       &  $x_{4} = 0.9061798459$   &  $c_{4} = 0.2369268851$  \\
   \hline
\end{tabular}
\end{center}
\end{small}
\end{frame}
%
%
%A definite integral over an arbitrary interval $[a,b]$ can be
%transformed into an integral over $[-1,1]$ by using a simple
%change of variable technique:
%%
%\begin{equation}
%   t = \frac{2x - a - b}{b - a}
%   \qquad \Longleftrightarrow \qquad
%   x = \frac{1}{2} \left[ (b - a) t + a + b \right].
%\end{equation}
%
%
%
%The idea of Gaussian quadrature rule is not restricted to the use of
%the Lengendre polynomials. For a given weight function $w(x)$ and
%interval $[a,b]$, the nodes $x_{0}, x_{1}, \ldots, x_{n}$ can be
%chosen to be the roots of any monic polynomial $q_{n+1}$ of degree
%$n+1$ which is $w$-orthogonal to $\Pi_{n}$ in the sense that
%%
%\[
%    \int_{a}^{b} q_{n+1}(x) p(x) w(x) \, dx = 0,
%    \qquad \text{for all $p \in \Pi_{n}$}.
%\]
%%
%The computation of the coefficients $c_{i}$ in a Gaussian quadrature
%formula proceeds in the manner already indicated for non-Gaussian
%formulas once the nodes $x_{i}$ have been determined. That is,
%\begin{equation}
%    c_{i} = \int_{a}^{b} w(x)
%    \prod_{\stackrel{j=0}{j \neq i}}^{n}
%    \frac{x - x_{j}}{x_{i} - x_{j}} \, dx,
%\end{equation}
%and
%\begin{equation}
%   \int_{a}^{b} f(x) w(x) \, dx \approx \sum_{i=0}^{n} c_{i} f(x_{i}).
%\end{equation}
%%
%An interesting characteristic of the Gaussian quadrature formulas
%can be verified immediately.
%
%
%\begin{lemma}
%In a Gaussian quadrature formula, the coefficients $c_{i}$ are
%positive and their sum is $\int_{a}^{b} w(x) \, dx$.
%\end{lemma}
%\proof
%For any $0 \leq k \leq n$, let
%\[
%    p(x) = \frac{q_{n+1}(x)}{x - x_{k}}.
%\]
%Since the polynomial $q_{n+1}$ is of degree $n+1$, the polynomial
%$p^{2}(x)$ is of degree at most $2n$. The Gaussian quadrature
%rule will be exact, that is,
%%
%\[
%   0 < \int_{a}^{b} p^{2}(x) w(x) \, dx
%   = \sum_{i=0}^{n} c_{i} p^{2}(x_{i}) = c_{k} p^{2}(x_{k}).
%\]
%%
%This shows that $c_{k} > 0$ for any $0 \leq k \leq n$. Since the
%Gaussian quadrature is of course exact for $f(x) = 1$,
%\[
%    \int_{a}^{b} f(x) w(x) \, dx = \int_{a}^{b} w(x) \, dx
%    = \sum_{i=0}^{n} c_{i} f(x_{i}) = \sum_{i=0}^{n} c_{i}.
%\]
%\qed
%
%
%Note that in the Gaussian quadrature formulas the interval
%$[a,b]$ can be infinite, e.g.,
%$[0, \infty)$ or $(-\infty, \infty)$.
%Some other important cases which lead to Gaussian integration rules
%are listed in the following table.
%
%
%\begin{center}
%\renewcommand{\arraystretch}{1.25}
%\begin{tabular}{lll}
%   \hline
%   $[a,b]$  &  $w(x)$  &  Orthogonal polynomials   \\
%   \hline
%   $[-1,1]$ & $(1 - x^{2})^{-1/2}$ & $T_{n}(x)$, Chebyshev polynomials \\
%   $[0, \infty)$ & $e^{-x}$ & $L_{n}(x)$, Laguerre polynomials  \\
%   $(-\infty, \infty)$ & $e^{-x^{2}}$ & $H_{n}(x)$, Hermite polynomials \\
%   \hline
%\end{tabular}
%\end{center}
%
%
%
%%\subsection{Error Analysis}
%
%\begin{theorem}
%Consider a Gaussian quadrature formula with error term
%%
%\begin{equation}
%   \int_{a}^{b} f(x) w(x) \, dx = \sum_{i=0}^{n} c_{i} f(x_{i}) + E.
%\end{equation}
%%
%For any $f \in C^{2n+2} [a,b]$, we have
%%
%\begin{equation}
%   E = \frac{f^{(2n+2)}(\xi)}{(2n+2)!}
%   \int_{a}^{b} q^{2} (x) w(x) \, dx,
%   \qquad \text{where $\xi \in (a,b)$ and} \;\;
%   q(x) = \prod_{i=0}^{n} (x - x_{i}).
%\end{equation}
%%
%\end{theorem}
%\proof
%By Hermite interpolation, there is a unique polynomial $p(x)$
%of degree at most $2n+1$ such that
%%
%\[
%    p(x_{i}) = f(x_{i}),  \qquad
%    p'(x_{i}) = f'(x_{i}), \qquad
%    i = 0, 1, \ldots, n.
%\]
%%
%The error for this interpolation is
%%
%\[
%   f(x) - p(x)
%   = \frac{1}{(2n+2)!} f^{(2n+2)}(\xi_{x}) \prod_{i=0}^{n} (x - x_{i})^{2}
%   = \frac{1}{(2n+2)!} f^{(2n+2)}(\xi_{x}) q^{2}(x),
%\]
%%
%where $\xi_{x} \in (a,b)$ depends on $x$.
%It follows that
%%
%\[
%   \int_{a}^{b} f(x) w(x) \, dx  - \int_{a}^{b} p(x) w(x) \, dx
%   = \frac{1}{(2n+2)!} \int_{a}^{b} f^{(2n+2)}(\xi_{x}) q^{2}(x) w(x) \, dx.
%\]
%%
%Since $\deg(p) \leq 2n+1$, the Guassian quadrature formula is
%exact for $p(x)$,
%\[
%    \int_{a}^{b} p(x) w(x) \, dx = \sum_{i=0}^{n} c_{i} p(x_{i})
%    = \sum_{i=0}^{n} c_{i} f(x_{i}).
%\]
%Furthermore, $f \in C^{2n+2}[a,b]$, and $w(x)$ is a positive
%weight function, $q^{2}(x) w(x) > 0$ does not change sign
%in $[a,b]$, by the weighted Mean-Value Theorem for integral,
%there exist $\xi \in (a,b)$ such that
%%
%\[
%   \int_{a}^{b} f^{(2n+2)}(\xi_{x}) q^{2}(x) w(x) \, dx
%   = f^{(2n+2)}(\xi) \int_{a}^{b} q^{2}(x) w(x) \, dx.
%\]
%Therefore,
%\[
%   \int_{a}^{b} f(x) w(x) \, dx
%   = \sum_{i=0}^{n} c_{i} f(x_{i}) +
%   \frac{f^{(2n+2)}(\xi)}{(2n+2)!}
%   \int_{a}^{b} q^{2} (x) w(x) \, dx.
%\]
%\qed 