[Math] How to compute solution of a non-square matrix by QR Decomposition and Cholesky Factorization

linear algebralinear-transformationsmatrices

$$
A = \begin{matrix}
10000 & 10001 & \\
10001 & 10002 & \\
10002 & 10003 & \\
10003 & 10004 & \\
10004 & 10005 & \\
\end{matrix}
$$

$$
b = \begin{matrix}
20001 & \\
20003 & \\
20005 & \\
20007 & \\
20009 & \\
\end{matrix}
$$
I want to find QR Decomposition of Ax = b by using Householder Transformation and also compute the solution using the Cholesky factorization. Could you help me ?

Best Answer

For the Householder approach, we will refer to these notes and for Cholesky, these notes.

$$A = \left( \begin{array}{cc} 10000. & 10001. \\ 10001. & 10002. \\ 10002. & 10003. \\ 10003. & 10004. \\ 10004. & 10005. \\ \end{array} \right), ~~b = \begin {pmatrix} 20001 \\20003\\20005\\20007\\20009\end{pmatrix}$$

$A_1 =A$

$x_1=\left( \begin{array}{c} 10000. \\ 10001. \\ 10002. \\ 10003. \\ 10004. \\ \end{array} \right)$

$n_1 = ||x_1||_2 = 22365.2$

$e_1=\left( \begin{array}{c} 1 \\ 0 \\ 0 \\ 0 \\ 0 \\ \end{array} \right)$

$v_1 = x_1 + n_1 e_1 = \left( \begin{array}{c} 32365.2 \\ 10001. \\ 10002. \\ 10003. \\ 10004. \\ \end{array} \right)$

$c_1 = \dfrac{2}{v_1^T.v_1} = 1.381498731530902 \times 10^{-9}$

$h_1 = I - c_1 v_1 . v_1^T = \left( \begin{array}{ccccc} -0.447124 & -0.447169 & -0.447214 & -0.447258 & -0.447303 \\ -0.447169 & 0.861822 & -0.138191 & -0.138205 & -0.138219 \\ -0.447214 & -0.138191 & 0.861795 & -0.138219 & -0.138233 \\ -0.447258 & -0.138205 & -0.138219 & 0.861767 & -0.138247 \\ -0.447303 & -0.138219 & -0.138233 & -0.138247 & 0.86174 \\ \end{array} \right)$

$A_2 = h_1.A_1 = \left( \begin{array}{cc} -22365.2 & -22367.4 \\ 0 & 0.0000382051 \\ 0 & -0.000061781 \\ 0 & -0.000161767 \\ 0 & -0.000261753 \\ \end{array} \right)$

$x_2 = \left( \begin{array}{c} 0.0000382051 \\ -0.000061781 \\ -0.000161767 \\ -0.000261753 \\ \end{array} \right)$

$n_2 = ||x_2||_2 = 0.000316165$

$e_2=\left( \begin{array}{c} 1 \\ 0 \\ 0 \\ 0 \\ \end{array} \right)$

$v_2 = x_2 - n_2 e_2 = \left( \begin{array}{c} -0.000277959 \\ -0.000061781 \\ -0.000161767 \\ -0.000261753 \\ \end{array} \right)$

$c_2 = \dfrac{2}{v_2^T.v_2} = 1.1379 \times 10^7$

$h_2 = I - c_2 v_2 . v_2^T = \left( \begin{array}{cccc} 0.120839 & -0.195408 & -0.511655 & -0.827902 \\ -0.195408 & 0.956567 & -0.113724 & -0.184015 \\ -0.511655 & -0.113724 & 0.702226 & -0.481824 \\ -0.827902 & -0.184015 & -0.481824 & 0.220367 \\ \end{array} \right)$

$A_3 = h_2.\left( \begin{array}{c} 0.0000382051 \\ -0.000061781 \\ -0.000161767 \\ -0.000261753 \\ \end{array} \right) = \left( \begin{array}{c} 0.000316165 \\ 0 \\ 0 \\ 0 \\ \end{array} \right)$

Following the notes, we have $A = QR = h_1.h_2.A_3$, which is

$\left( \begin{array}{ccccc} -0.447124 & 0.632519 & -0.207235 & 0.1811 & 0.569435 \\ -0.447169 & 0.316291 & -0.259445 & -0.455694 & -0.651944 \\ -0.447214 & 0.0000632303 & 0.892524 & -0.0577574 & -0.00803894 \\ -0.447258 & -0.316165 & -0.177773 & 0.758198 & -0.30583 \\ -0.447303 & -0.632392 & -0.248071 & -0.425846 & 0.396378 \\ \end{array} \right).\left( \begin{array}{cc} -22365.2 & -22367.4 \\ 0 & 0.000316165 \\ 0 & 0 \\ 0 & 0 \\ 0 & 0 \\ \end{array} \right)$

Using back substitution, $Rx = Q^T b$ gives

$$x = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$$

For Cholesky, we have

$$A_C = A^T.A = \left( \begin{array}{cc} 500200030 & 500250040 \\ 500250040 & 500300055 \\ \end{array} \right)$$

$L_{11} = a_{11}^{1/2} = 22365.2, L_{21} = \dfrac{a_{21}}{\sqrt{a_{11}}} = 22367.4 , L_{22} = \sqrt{a_{22}-L_{21}^2}=0.000422864$

Now, we are ready to solve

$$Ax = b \implies LL^T x = b \implies Lc = b, L^Tx = c$$

of course, we arrive at the same result.