# 引言

• $Q^TQ=I$，不要求$Q$为方阵

• 如果$Q$为方阵，则$Q^T = Q^{-1}$

• $Qx$是保持长度的变换

$||Qx||^2 =(Qx)^T(Qx) = x^TQ^TQx = x^Tx = ||x||^2$

• $Q$不改变向量点积。

$Qx\times Qy = (Qx)^TQy=x^TQ^TQy = x^Ty$

## 反射矩阵

$u$是一列向量，$u^Tu = 1$

$Q = I_n - 2uu^T, u\in R^n$$Q$为一个反射矩阵(refection matrix)。

$Q^T = I - 2uu^T = Q, \space Q^TQ = I - 4uu^T + 4uu^T = I$

$Qu = u - 2uu^Tu = -u$

# 投影与正交

• 投影矩阵$P = Q(Q^TQ)^{-1}Q^T = QQ^T$
• 投影向量$p = Pb=QQ^Tb$

$p = QQ^Tb = \begin{bmatrix}q_1 &... &q_n \end{bmatrix} \begin{bmatrix}q_1^T \\\\...\\\\ q_n^T \end{bmatrix}b = \begin{bmatrix}q_1 &... &q_n \end{bmatrix}\begin{bmatrix}q_1^Tb \\\\...\\\\ q_n^Tb \end{bmatrix} = \sum \limits _{i=1}^{n}(q_iq^T_i)b$

# Gram Schmidt正交化

$\alpha _1,\alpha_2,...,\alpha_k$相互正交，$v\in L\{\alpha _1,\alpha_2,...,\alpha_k \}$,则：

$v =\frac{\alpha_1^Tv}{\alpha_1^T\alpha_1}\alpha_1+...+\frac{\alpha_k^Tv}{\alpha_k^T\alpha_k}\alpha_k$

$v =(\alpha_1^Tv)\alpha_1+...+(\alpha_k^Tv)\alpha_k$

$e_i$为误差向量，$v_i$为原始向量，$q_i$即为所求

$e_1 = v_1 = w_1,q_1 = \frac{v_1}{||v_1||}$

$e_2 = v_2 - (q_1^Tv_2)q_1 = w_2,q_2 = \frac{w_2}{||w_2||}$

$e_k = v_k - (q_1^Tv_k)q_1 - ... - (q^T_{k_1}v_k)q_{k-1}= w_k,q_k = \frac{v_k}{||v_k||}$

# QR分解

$a_1=(q_1^T a_1)q_1$

$a_2=(q_1^T a_2)q_1 + (q_2^Ta_2)q_2$

$a_3=(q_1^T a_3)q_1 + (q_2^Ta_3)q_2+(q_2^Ta_3)q_3$

$a_n=(q_1^T a_n)q_1 + (q_2^Ta_n)q_2+...+(q^T_na_n)q_n$

$A = \begin{bmatrix}a1 &a_2 & ... & a_n\end{bmatrix} = \begin{bmatrix}q_1 &q_2 & ... & q_n\end{bmatrix}\begin{bmatrix} q_1 ^T a_1& q_1^Ta_2 &... &q_1^Ta_n \\\\ 0 &q_2^Ta_2 & ... & q_2^Ta_n\\\\ ... & ... &... & ...\\\\ 0 &0 & ... & q_n^Ta_n\end{bmatrix}$

$Q =\begin{bmatrix}q_1 &q_2 & ... & q_n\end{bmatrix},\space \space R = \begin{bmatrix}q_1^T a_1& q_1^Ta_2 &... &q_1^Ta_n \\\\ 0 &q_2^Ta_2 & ... & q_2^Ta_n\\\ ... & ... &... & ...\\\\ 0 &0 & ... & q_n^Ta_n\end{bmatrix}$

## 应用

• $A,B$都是正交矩阵，则$AB$也是正交矩阵

$A^TA = E \space \space B^TB=E$

$(AB)^TAB = B^TA^TAB = B^TEB =E$

• $A$是可逆方阵，则$QR$分解是唯一的。

• $A_{m\times n}$列满秩，有QR分解$A = QR$$b \notin C(A)$，设$b$$C(A)$上的投影为$p,e= b-p$，则$(A,b)$也是列满秩，其QR分解为：

$(A,b) = (Q,\frac {e}{||e||})\begin{pmatrix} R& \alpha \\\\ 0 & ||e||\end{pmatrix}, \alpha = Q^Tb$