26.3: Gram-Schmidt Orthogonalization Process
- Page ID
- 69418
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)
Implement the Gram-Schmidt orthoganalization process from the Hefron textbook (page 282). This function takes a \(m \times n\) Matrix \(A\) with linearly independent columns as input and return a \(m \times n\) Matrix \(G\) with orthogonal column vectors. The basic algorithm works as follows:
AT = transpose(A)
(this process works with the columns of the matrix so it is easier to work with the transpose. Think about a list of list, it is easy to get a row (a list)).- Make a new empty list of the same size as
AT
and call itGT
(G transpose) - Loop index
i
over all of the rows in AT (i.e. columns of A)GT[i] = AT[i]
- Loop index
j
from 0 toi
GT[i] -= proj(GT[i], GT[j])
G = transpose(GT)
Use the following function definition as a template:
Here, we are going to test your function using the vectors:
What is the Big-O complexity of the Gram-Schmidt process?