6.6. Matrix decomposition exercises#
Exercise 6.1
Solve the following system of linear equations using LU decomposition.
Solution
The coefficient matrix is
Compute the LU decomposition of \(A\)
therefore
Solving \(L \mathbf{y} = \mathbf{b}\) using forward substitution
Solving \(U \mathbf{x} = \mathbf{y}\) using back substitution
Exercise 6.2
Solve the following system of linear equations using LU decomposition with partial pivoting.
Solution
The coefficient matrix is
Performing partial pivoting on \(A\)
So the permutation matrix is
Computing the LU decomposition of \(PA\)
therefore
Solving \(L \mathbf{y} = P\mathbf{b}\) using forward substitution
Solving \(U \mathbf{x} = \mathbf{y}\) using back substitution
Exercise 6.3
Use LU decomposition to solve the systems of linear equations \(A \mathbf{x}_1 = \mathbf{b}_1\) and \(A \mathbf{x}_2 = \mathbf{b}_2\) where
Solution
Compute the LU decomposition of \(A\)
therefore
Solving \(A \mathbf{x}_1 = \mathbf{b}_1\)
therefore \(\mathbf{x}_1 = (1, 2, 3)^\mathsf{T}\).
Solving \(A \mathbf{x}_2 = \mathbf{b}_2\)
therefore \(\mathbf{x}_2 = (3, -1, 5)^\mathsf{T}\).
Exercise 6.4
Solve the following systems of linear equations using Cholesky decomposition.
Solution
The coefficient matrix is
Checking whether \(A\) is a positive definite matrix
therefore \(A\) is positive definite. Computing the Cholesky decomposition of \(A\)
therefore
Solving \(L \mathbf{y} = \mathbf{b}\) using forward substitution
Solving \(L^\mathsf{T} \mathbf{x} = \mathbf{y}\) using back substitution
Exercise 6.5
Calculate the QR decomposition using the Gram-Schmidt process of the following matrices:
(a) \(\begin{pmatrix} 6 & 6 & 1 \\ 3 & 6 & 1 \\ 2 & 1 & 1 \end{pmatrix}\);
Solution
therefore
(c) \(\begin{pmatrix} 1 & 2 & 1 \\ 1 & 4 & 3 \\ 1 & -4 & 6 \\ 1 & 2 & 1 \end{pmatrix}\).
Solution
therefore
Exercise 6.6
Calculate the QR decomposition of the matrices from Exercise 6.5 using the Householder reflections.
Solution
(a) \(A = \begin{pmatrix} 6 & 6 & 1 \\ 3 & 6 & 1 \\ 2 & 1 & 1 \end{pmatrix}\)
Checking the QR decomposition is correct
(b) \(A = \begin{pmatrix} 1 & 2 & 1 \\ 1 & 4 & 3 \\ 1 & -4 & 6 \\ 1 & 2 & 1 \end{pmatrix}\)
Set \(Q = I_4\) and \(R = A\)
Checking that the QR decomposition is correct