Factorization of matrices¶
Exercises · Vectors and matrices · with worked solutions · Lecture notes (PDF) · Chapter 4.4: Factorization of matrices
Exercise 1
Compute the LU factorization of \( \boldsymbol A= \begin{pmatrix} 4 & 3\\ 6 & 3 \end{pmatrix} \) and verify that \(\boldsymbol L\boldsymbol U = \boldsymbol A\).
Solution
The first pivot is \(a_{11} = 4\) and the multiplier is \(\ell_{21} = \frac{6}{4} = \frac{3}{2}\):
Hence
Exercise 2
Compute the LU factorization of
and verify that \(\boldsymbol L\boldsymbol U = \boldsymbol A\).
Solution
The multipliers are \(\ell_{21} = \frac{2}{1} = 2\), \(\ell_{31} = \frac{3}{1} = 3\) and, after the first step, \(\ell_{32} = \frac{2}{1} = 2\):
Hence
Verification:
Exercise 3
Consider
-
Check, using the leading principal minors, that \(\boldsymbol A\) admits an LU factorization without row swaps.
-
Compute the LU factorization and verify that the pivots are \(u_{kk} = \det(\boldsymbol A_{[k]})/\det(\boldsymbol A_{[k-1]})\).
Solution
-
\(\det(\boldsymbol A_{[1]}) = 2\), \(\det(\boldsymbol A_{[2]}) = 2\cdot(-1) - 4\cdot 1 = -6\) and, by Laplace expansion along the first row,
\[ \det(\boldsymbol A_{[3]}) = \det(\boldsymbol A) = 2\cdot(-1-35) - 4\cdot(1+5) + (-2)\cdot(7-1) = -72 - 24 - 12 = -108. \]All the leading principal minors are nonzero, so the LU factorization exists.
-
The multipliers are \(\ell_{21} = \frac{1}{2}\), \(\ell_{31} = \frac{-1}{2} = -\frac{1}{2}\) and, after the first step, \(\ell_{32} = \frac{9}{-3} = -3\):
\[\begin{align*} &\left( \begin{array}{ccc} 2 & 4 & -2 \\ 1 & -1 & 5 \\ -1 & 7 & 1 \\ \end{array} \right) \\[2ex] &\left( \begin{array}{ccc} 2 & 4 & -2 \\ 0 & -3 & 6 \\ -1 & 7 & 1 \\ \end{array} \right) \hspace{1em} \text{(} R_2 \leftarrow R_2 - \tfrac{1}{2}R_1 \text{)} \\[2ex] &\left( \begin{array}{ccc} 2 & 4 & -2 \\ 0 & -3 & 6 \\ 0 & 9 & 0 \\ \end{array} \right) \hspace{1em} \text{(} R_3 \leftarrow R_3 + \tfrac{1}{2}R_1 \text{)} \\[2ex] &\left( \begin{array}{ccc} 2 & 4 & -2 \\ 0 & -3 & 6 \\ 0 & 0 & 18 \\ \end{array} \right) \hspace{1em} \text{(} R_3 \leftarrow R_3 + 3R_2 \text{)} \end{align*}\]Hence
\[ \boldsymbol L= \begin{pmatrix} 1 & 0 & 0\\[0.5ex] \tfrac{1}{2} & 1 & 0\\[0.5ex] -\tfrac{1}{2} & -3 & 1 \end{pmatrix}, \qquad \boldsymbol U= \begin{pmatrix} 2 & 4 & -2\\ 0 & -3 & 6\\ 0 & 0 & 18 \end{pmatrix}. \]Indeed \(u_{11} = 2\), \(u_{22} = \frac{-6}{2} = -3\) and \(u_{33} = \frac{-108}{-6} = 18\). Verification:
\[ \boldsymbol L\boldsymbol U= \begin{pmatrix} 2 & 4 & -2\\ 1 & 2-3 & -1+6\\ -1 & -2+9 & 1-18+18 \end{pmatrix} = \begin{pmatrix} 2 & 4 & -2\\ 1 & -1 & 5\\ -1 & 7 & 1 \end{pmatrix} = \boldsymbol A. \]
Exercise 4
Consider
Show that \(\boldsymbol A\) is nonsingular but does not admit an LU factorization without row swaps. Then compute a PLU factorization \(\boldsymbol P\boldsymbol A = \boldsymbol L\boldsymbol U\) and verify it.
Solution
We have \(\det(\boldsymbol A) = 1\cdot(4-1) - 2\cdot(2-0) + 0 = -1 \neq 0\), but \(\det(\boldsymbol A_{[2]}) = 1\cdot 4 - 2\cdot 2 = 0\): the LU factorization without row swaps does not exist.
Gaussian elimination: \(\ell_{21} = 2\) and \(\ell_{31} = 0\) (the entry \(a_{31}\) is already zero). Then the entry in position \((2,2)\) is zero and we swap rows 2 and 3, swapping also the multipliers (now \(\ell_{21} = 0\), \(\ell_{31} = 2\)):
The entry below the second pivot is already zero, so \(\ell_{32} = 0\). Hence
Verification:
Exercise 5
Compute a PLU factorization of
verify that \(\boldsymbol P\boldsymbol A = \boldsymbol L\boldsymbol U\), and compute \(\det(\boldsymbol A)\) from \(\boldsymbol U\).
Solution
Since \(a_{11} = 0\), we swap rows 1 and 2 (no multiplier has been computed yet). Then \(\ell_{21} = \frac{0}{2} = 0\), \(\ell_{31} = \frac{4}{2} = 2\) and, after the first step, \(\ell_{32} = \frac{3}{1} = 3\):
Hence
Verification:
One row swap was used (\(s=1\)), hence \(\det(\boldsymbol A) = -(2\cdot 1\cdot(-5)) = 10\).
Exercise 6
Compute the LU factorization of
and use it to compute \(\det(\boldsymbol A)\) and \(\det(\boldsymbol A^{-1})\).
Solution
The multipliers are \(\ell_{21} = \frac{6}{3} = 2\) and \(\ell_{31} = \frac{3}{3} = 1\):
The entry in position \((3,2)\) is already zero, so \(\ell_{32} = 0\) and
No row swaps were used, hence
Exercise 7
Consider, for \(k\in\R\), the matrix
-
For which values of \(k\) is \(\boldsymbol A(k)\) nonsingular and admits an LU factorization without row swaps? Compute it.
-
For \(k = 1\), compute a PLU factorization.
Solution
-
The leading principal minors are
\[ \det(\boldsymbol A_{[1]}) = 1, \quad \det(\boldsymbol A_{[2]}) = k - 1, \quad \det(\boldsymbol A_{[3]}) = 1\cdot(k-1) - 1\cdot(1-0) + 0 = k-2. \]They are all nonzero if and only if \(k\neq 1\) and \(k\neq 2\). For these values, \(\ell_{21} = 1\), \(\ell_{31} = 0\) and \(\ell_{32} = \frac{1}{k-1}\):
\[\begin{align*} &\left( \begin{array}{ccc} 1 & 1 & 0 \\ 0 & k-1 & 1 \\ 0 & 1 & 1 \\ \end{array} \right) \hspace{1em} \text{(} R_2 \leftarrow R_2 - R_1 \text{)} \\[2ex] &\left( \begin{array}{ccc} 1 & 1 & 0 \\ 0 & k-1 & 1 \\ 0 & 0 & \tfrac{k-2}{k-1} \\ \end{array} \right) \hspace{1em} \text{(} R_3 \leftarrow R_3 - \tfrac{1}{k-1}R_2 \text{)} \end{align*}\]since \(1 - \frac{1}{k-1} = \frac{k-2}{k-1}\). Hence
\[ \boldsymbol L= \begin{pmatrix} 1 & 0 & 0\\[0.5ex] 1 & 1 & 0\\[0.5ex] 0 & \tfrac{1}{k-1} & 1 \end{pmatrix}, \qquad \boldsymbol U= \begin{pmatrix} 1 & 1 & 0\\[0.5ex] 0 & k-1 & 1\\[0.5ex] 0 & 0 & \tfrac{k-2}{k-1} \end{pmatrix}, \]and indeed \(u_{11}u_{22}u_{33} = k-2 = \det(\boldsymbol A(k))\). For \(k=2\) the matrix is singular.
-
For \(k=1\) we have \(\det(\boldsymbol A(1)) = -1 \neq 0\) but \(\det(\boldsymbol A_{[2]}) = 0\). After \(R_2 \leftarrow R_2 - R_1\) (\(\ell_{21} = 1\), \(\ell_{31} = 0\)) the entry in position \((2,2)\) is zero, so we swap rows 2 and 3 together with their multipliers (now \(\ell_{21} = 0\), \(\ell_{31} = 1\)):
\[\begin{align*} &\left( \begin{array}{ccc} 1 & 1 & 0 \\ 1 & 1 & 1 \\ 0 & 1 & 1 \\ \end{array} \right) \\[2ex] &\left( \begin{array}{ccc} 1 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 1 \\ \end{array} \right) \hspace{1em} \text{(} R_2 \leftarrow R_2 - R_1 \text{)} \\[2ex] &\left( \begin{array}{ccc} 1 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \\ \end{array} \right) \hspace{1em} \text{(} R_2 \leftrightarrow R_3 \text{)} \end{align*}\]Then \(\ell_{32} = 0\) and
\[ \boldsymbol P= \begin{pmatrix} 1 & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0 \end{pmatrix}, \quad \boldsymbol L= \begin{pmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 1 & 0 & 1 \end{pmatrix}, \quad \boldsymbol U= \begin{pmatrix} 1 & 1 & 0\\ 0 & 1 & 1\\ 0 & 0 & 1 \end{pmatrix}, \]and
\[ \boldsymbol P\boldsymbol A(1) = \boldsymbol L\boldsymbol U = \begin{pmatrix} 1 & 1 & 0\\ 0 & 1 & 1\\ 1 & 1 & 1 \end{pmatrix}. \]