\documentclass[twoside]{article}

\usepackage{camnum}

\textheight=22.5cm
\textwidth=15cm
\topmargin=-1cm
\oddsidemargin=0.5cm
\evensidemargin=0.5cm
\parindent=0pt
\parskip=6pt

\begin{document}
\begin{center}
  {\large \textbf{Mathematical Tripos Part IB: Easter 1999}}

  {\Large \textbf{Numerical Analysis -- Detailed Example
      4\footnote{Corrections and suggestions to these notes should
        be emailed to \texttt{A.Iserles@damtp.cam.ac.uk}. All handouts
        are available on the WWW at the URL 
        \texttt{http://www.damtp.cam.ac.uk/user/na/PartIB/Handouts.html}.}}}

  \vspace{8pt}
  \textbf{\textit{\LARGE QR factorization: Gram--Schmidt}}
\end{center}

Let
\begin{displaymath}
  \MM{a}_1=\left[
    \begin{array}{r}
      1\\-2\\4\\-2
    \end{array}\right],\qquad \MM{a}_2=\left[
    \begin{array}{r}
      1\\0\\2\\1
    \end{array}\right],\qquad \MM{a}_3=\left[
    \begin{array}{r}
      3\\1\\-3\\1
    \end{array}\right].
\end{displaymath}
Therefore
\begin{Eqnarray*}
  &&\MM{q}_1=\frac{1}{\|\MM{a}_1\|}\MM{a}_1 =\frac15 \left[
    \begin{array}{r}
      1\\-2\\4\\-2
    \end{array}\right],\\
  &&\MM{b}=\MM{a}_2-(\MM{q}_1^{\CC{T}}\MM{a}_2)\MM{q}_1=\frac{1}{25}\left[
    \begin{array}{r}
      18\\14\\22\\39
    \end{array}\right],\qquad \MM{q}_2=\frac{1}{\|\MM{b}\|} \MM{b}
  =\frac{\sqrt{101}}{505} \left[
    \begin{array}{r}
      18\\14\\22\\39
    \end{array}\right],\\
  &&\MM{b}=\MM{a}_3-(\MM{q}_1^{\CC{T}}\MM{a}_3)\MM{q}_1-
  (\MM{q}_2^{\CC{T}}\MM{a}_3)\MM{q}_2 =\frac{1}{101}\left[
    \begin{array}{r}
      326\\-27\\-129\\-68
    \end{array}\right],\qquad \MM{q}_3= \frac{1}{\|\MM{b}\|} \MM{b} =
  \frac{\sqrt{128270}}{128270} \left[
    \begin{array}{r}
      326\\-27\\-129\\-68
    \end{array}\right].
\end{Eqnarray*}
Therefore (to four significant digits)
\begin{displaymath}
  \MM{q}_1=\left[
    \begin{array}{r}
      0.2000\\-0.4000\\0.8000\\-0.4000
    \end{array}\right], \qquad \MM{q}_2=\left[
    \begin{array}{r}
      0.3582\\0.2786\\0.4378\\0.7761
    \end{array}\right],\qquad \MM{q}_3=\left[
    \begin{array}{r}
      0.9102\\-0.0754\\-0.3602\\-0.1899
    \end{array}\right].
\end{displaymath}
To obtain a basis of $\BB{R}^4$ we set $\MM{b}=\MM{e}_1-\sum_{k=1}^s
(\MM{q}_k^{\CC{T}}\MM{e}_1)\MM{q}_k$ (any other unit vector will do)
and let $\MM{q}_4=\MM{b}/\|\MM{b}\|$, whence 
\begin{Eqnarray*}
  Q&=&[\MM{q}_1,\MM{q}_2,\MM{q}_3,\MM{q}_4]=\left[
    \begin{array}{rrrr}
      0.2000 & 0.3582 & 0.9102 & 0.0561\\
      -0.4000 & 0.2786 & -0.0754 & -0.8699\\
      0.8000 & 0.4378 & -0.3602 & -0.1964\\
      -0.4000 & 0.7761 & -0.1899 & 0.4490
    \end{array}\right],\\
  R&=&Q^{\CC{T}}A=\left[
    \begin{array}{rrr}
      5.0000 &  1.4000 &  -2.6000\\
      0 &  2.0100  & 0.8159\\
      0 & 0 & 3.5460\\
      0 & 0 & 0
    \end{array}\right].
\end{Eqnarray*}


\end{document}
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
