# 格拉姆-施密特正交化

（重定向自Gram-Schmidt正交化

${\displaystyle \mathbf {A} ={\begin{bmatrix}1&2\\3&4\end{bmatrix}}}$

## 记法

• ${\displaystyle {\boldsymbol {V}}^{n}}$ 维数n 的内积空间
• ${\displaystyle {\boldsymbol {v}}\in {\boldsymbol {V}}^{n}}$ ${\displaystyle {\boldsymbol {V}}^{n}}$ 中的元素，可以是向量、函数，等等
• ${\displaystyle \langle {\boldsymbol {v}}_{1},{\boldsymbol {v}}_{2}\rangle }$ ${\displaystyle {\boldsymbol {v}}_{1}}$ ${\displaystyle {\boldsymbol {v}}_{2}}$ 内积
• ${\displaystyle \mathrm {span} \{{\boldsymbol {v}}_{1},{\boldsymbol {v}}_{2},\ldots ,{\boldsymbol {v}}_{n}\}}$ ${\displaystyle {\boldsymbol {v}}_{1}}$ ${\displaystyle {\boldsymbol {v}}_{2}}$ ……${\displaystyle {\boldsymbol {v}}_{n}}$ 张成的子空间
• ${\displaystyle \mathrm {proj} _{\boldsymbol {v}}\,{\boldsymbol {u}}={\langle {\boldsymbol {u}},{\boldsymbol {v}}\rangle \over \langle {\boldsymbol {v}},{\boldsymbol {v}}\rangle }{\boldsymbol {v}}}$ ${\displaystyle {\boldsymbol {u}}}$ ${\displaystyle {\boldsymbol {v}}}$ 上的投影

## 基本思想

Gram-Schmidt正交化的基本想法，是利用投影原理在已有正交基的基础上构造一个新的正交基。

${\displaystyle {\boldsymbol {v}}\in {\boldsymbol {V^{n}}}}$ ${\displaystyle {\boldsymbol {V}}^{k}}$ ${\displaystyle {\boldsymbol {V}}^{n}}$ 上的${\displaystyle k}$ 维子空间，其标准正交基为${\displaystyle \{{\boldsymbol {\eta }}_{1},\ldots ,{\boldsymbol {\eta }}_{k}\}}$ ，且${\displaystyle {\boldsymbol {v}}}$ 不在${\displaystyle {\boldsymbol {V}}^{k}}$ 上。由投影原理知，${\displaystyle {\boldsymbol {v}}}$ 与其在${\displaystyle {\boldsymbol {V}}^{k}}$ 上的投影${\displaystyle \mathrm {proj} _{\boldsymbol {V^{k}}}{\boldsymbol {v}}}$ 之差

${\displaystyle {\boldsymbol {\beta }}={\boldsymbol {v}}-\sum _{i=1}^{k}\mathrm {proj} _{{\boldsymbol {\eta }}_{i}}\,{\boldsymbol {v}}={\boldsymbol {v}}-\sum _{i=1}^{k}\langle {\boldsymbol {v}},{\boldsymbol {\eta }}_{i}\rangle {\boldsymbol {\eta }}_{i}}$

${\displaystyle {\boldsymbol {\eta }}_{k+1}={\frac {\boldsymbol {\beta }}{\|{\boldsymbol {\beta }}\|}}={\frac {\boldsymbol {\beta }}{\sqrt {\langle {\boldsymbol {\beta }},{\boldsymbol {\beta }}\rangle }}}}$

## 算法

 ${\displaystyle {\boldsymbol {\beta }}_{1}={\boldsymbol {v}}_{1},}$ ${\displaystyle {\boldsymbol {\eta }}_{1}={{\boldsymbol {\beta }}_{1} \over \|{\boldsymbol {\beta }}_{1}\|}}$ ${\displaystyle {\boldsymbol {\beta }}_{2}={\boldsymbol {v}}_{2}-\langle {\boldsymbol {v}}_{2},{\boldsymbol {\eta }}_{1}\rangle {\boldsymbol {\eta }}_{1},}$ ${\displaystyle {\boldsymbol {\eta }}_{2}={{\boldsymbol {\beta }}_{2} \over \|{\boldsymbol {\beta }}_{2}\|}}$ ${\displaystyle {\boldsymbol {\beta }}_{3}={\boldsymbol {v}}_{3}-\langle {\boldsymbol {v}}_{3},{\boldsymbol {\eta }}_{1}\rangle {\boldsymbol {\eta }}_{1}-\langle {\boldsymbol {v}}_{3},{\boldsymbol {\eta }}_{2}\rangle {\boldsymbol {\eta }}_{2},}$ ${\displaystyle {\boldsymbol {\eta }}_{3}={{\boldsymbol {\beta }}_{3} \over \|{\boldsymbol {\beta }}_{3}\|}}$ ${\displaystyle \vdots }$ ${\displaystyle \vdots }$ ${\displaystyle {\boldsymbol {\beta }}_{n}={\boldsymbol {v}}_{n}-\sum _{i=1}^{n-1}\langle {\boldsymbol {v}}_{n},{\boldsymbol {\eta }}_{i}\rangle {\boldsymbol {\eta }}_{i},}$ ${\displaystyle {\boldsymbol {\eta }}_{n}={{\boldsymbol {\beta }}_{n} \over \|{\boldsymbol {\beta }}_{n}\|}}$

${\displaystyle S=\lbrace {\boldsymbol {v}}_{1}={\begin{pmatrix}3\\1\end{pmatrix}},{\boldsymbol {v}}_{2}={\begin{pmatrix}2\\2\end{pmatrix}}\rbrace .}$

${\displaystyle {\boldsymbol {\beta }}_{1}={\boldsymbol {v}}_{1}={\begin{pmatrix}3\\1\end{pmatrix}}}$
${\displaystyle {\boldsymbol {\beta }}_{2}={\boldsymbol {v}}_{2}-\mathrm {proj} _{{\boldsymbol {\beta }}_{1}}\,{\boldsymbol {v}}_{2}={\begin{pmatrix}2\\2\end{pmatrix}}-\mathrm {proj} _{\begin{pmatrix}3\\1\end{pmatrix}}\,{\begin{pmatrix}2\\2\end{pmatrix}}={\begin{pmatrix}-2/5\\6/5\end{pmatrix}}}$

${\displaystyle \langle {\boldsymbol {\beta }}_{1},{\boldsymbol {\beta }}_{2}\rangle =\left\langle {\begin{pmatrix}3\\1\end{pmatrix}},{\begin{pmatrix}-2/5\\6/5\end{pmatrix}}\right\rangle =-{\frac {6}{5}}+{\frac {6}{5}}=0.}$

${\displaystyle {\boldsymbol {\eta }}_{1}={1 \over {\sqrt {10}}}{\begin{pmatrix}3\\1\end{pmatrix}}}$
${\displaystyle {\boldsymbol {\eta }}_{2}={1 \over {\sqrt {8 \over 5}}}{\begin{pmatrix}-2/5\\6/5\end{pmatrix}}}$

## 不同的形式

${\displaystyle \langle {\boldsymbol {a}},{\boldsymbol {b}}\rangle ={\boldsymbol {b}}^{T}{\boldsymbol {a}}}$

${\displaystyle \langle {\boldsymbol {a}},{\boldsymbol {b}}\rangle ={\boldsymbol {b}}^{H}{\boldsymbol {a}}}$

${\displaystyle \langle f(x),g(x)\rangle =\int _{-\infty }^{\infty }f(x)g(x)dx}$