求下列矩阵的QR分解.
求矩阵 $A$ 的QR分解.
\[
A=\begin{pmatrix}
1 & 2 & 2\\
2 & 1 & 2\\
1 & 2 & 1
\end{pmatrix}
\]
求矩阵 $A$ 的QR分解.
\[
A=\begin{pmatrix}
1 & 2 & 2\\
2 & 1 & 2\\
1 & 2 & 1
\end{pmatrix}
\]
1
令 $A=(\beta_1,\beta_2,\beta_3)$. 即
\[
\beta_1=\begin{pmatrix}
1\\
2\\
1
\end{pmatrix},\quad
\beta_2=\begin{pmatrix}
2\\
1\\
2
\end{pmatrix},\quad
\beta_3=\begin{pmatrix}
2\\
2\\
1
\end{pmatrix}.
\]
将 $\beta_1,\beta_2,\beta_3$ 施行 Gram-Schmidt 正交化. 于是
$\xi_1=\beta_1=(1,2,1)^T$, $\|\xi_1\|=\sqrt{1^2+2^2+1^2}=\sqrt{6}$, $(\xi_1,\xi_1)=6$.
\[
\xi_2=\beta_2-\frac{(\beta_2,\xi_1)}{(\xi_1,\xi_1)}\xi_1=(2,1,2)^T-\frac{2\cdot 1+1\cdot 2+2\cdot 1}{6}(1,2,1)^T=(1,-1,1)^T
\]
从而 $\|\xi_2\|=\sqrt{1^2+(-1)^2+1^2}=\sqrt{3}$, $(\xi_3,\xi_3)=3$.
\[
\begin{split}
\xi_3&=\beta_3-\frac{(\beta_3,\xi_2)}{(\xi_2,\xi_2)}\xi_2-\frac{(\beta_3,\xi_1)}{(\xi_1,\xi_1)}\xi_1\\
&=(2,2,1)^T-\frac{2\cdot 1+2\cdot(-1)+1\cdot 1}{3}(1,-1,1)^T-\frac{2\cdot 1+2\cdot 2+1\cdot 1}{6}(1,2,1)^T\\
&=(\frac{1}{2},0,-\frac{1}{2})^T.
\end{split}
\]
故 $\|\xi_3\|=\sqrt{(\frac{1}{2})^2+0^2+(-\frac{1}{2})^2}=\frac{1}{\sqrt{2}}$, $(\xi_3,\xi_3)=\frac{1}{2}$.
因此,
\[
\eta_1=\frac{\xi_1}{\|\xi_1\|}=\frac{1}{\sqrt{6}}\begin{pmatrix}1\\ 2\\ 1\end{pmatrix}
=\begin{pmatrix}\frac{1}{\sqrt{6}}&\frac{2}{\sqrt{6}}&\frac{1}{\sqrt{6}}\end{pmatrix}\ ,
\]
\[
\eta_2=\frac{\xi_2}{\|\xi_2\|}=\frac{1}{\sqrt{3}}\begin{pmatrix}1\\ -1\\ 1\end{pmatrix}
=\begin{pmatrix}\frac{1}{\sqrt{3}}&-\frac{1}{\sqrt{3}}&\frac{1}{\sqrt{3}}\end{pmatrix}\ ,
\]
\[
\eta_3=\frac{\xi_3}{\|\xi_3\|}=\frac{1}{\frac{1}{\sqrt{2}}}\begin{pmatrix}\frac{1}{2}\\ 0\\ -\frac{1}{2}\end{pmatrix}
=\begin{pmatrix}\frac{1}{\sqrt{2}}&0&-\frac{1}{\sqrt{2}}\end{pmatrix}\ .
\]
因此, 正交矩阵 $O$ 为
\[
O=(\eta_1,\eta_2,\eta_3)=\begin{pmatrix}
\frac{1}{\sqrt{6}} & \frac{1}{\sqrt{3}} & \frac{1}{\sqrt{2}}\\
\frac{2}{\sqrt{6}} & -\frac{1}{\sqrt{3}} & 0\\
\frac{1}{\sqrt{6}} & \frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{2}}
\end{pmatrix}\ .
\]
\[
(\beta_2,\eta_1)=(2,1,2)^T\cdot\frac{1}{\sqrt{6}}(1,2,1)^T=\frac{1}{\sqrt{6}}(2\cdot 1+1\cdot 2+2\cdot 1)=\sqrt{6}.
\]
\[
(\beta_3,\eta_1)=(2,2,1)^T\cdot\frac{1}{\sqrt{6}}(1,2,1)^T=\frac{1}{\sqrt{6}}(2\cdot 1+2\cdot 2+1\cdot 1)=\frac{7}{\sqrt{6}}.
\]
\[
(\beta_3,\eta_2)=(2,2,1)^T\cdot\frac{1}{\sqrt{3}}(1,-1,1)^T=\frac{1}{\sqrt{3}}(2\cdot 1+2\cdot(-1)+1\cdot 1)=\frac{1}{\sqrt{3}}.
\]
于是, 上三角矩阵 $R$ 为
\[
R=\begin{pmatrix}
\|\xi_1\| & (\beta_2,\eta_1) & (\beta_3,\eta_1)\\
0 & \|\xi_2\| & (\beta_3,\eta_2)\\
0 & 0 & \|\xi_3\|
\end{pmatrix}=
\begin{pmatrix}
\sqrt{6} & \sqrt{6} & \frac{7}{\sqrt{6}}\\
0 & \sqrt{3} & \frac{1}{\sqrt{3}}\\
0 & 0 & \frac{1}{\sqrt{2}}
\end{pmatrix}\ .
\]
2
利用 Sowya 中的 QR() 函数计算.
>> A=[1 2 2;2 1 2;1 2 1]
input> [1,2,2;2,1,2;1,2,1]
--------------------
1 2 2
2 1 2
1 2 1
--------------------
>> QR(A)
---O--------------
0.40824829 0.57735027 0.70710678
0.81649658 -0.57735027 0.00000001
0.40824829 0.57735027 -0.70710678
-----------------
---R--------------
2.44948974 2.44948974 2.85773803
0 1.73205081 0.57735027
0 0 0.70710678
-----------------