11.4. LU Decomposition Homework¶
How can LU decomposition improve the computational efficiency of finding solutions to \(\mathbf{A}\,\bm{x} = \bm{b}\) for a set of several \(\bm{b}\) vectors?
Start with the matrix
\[\begin{split}\mathbf{A} = \begin{bmatrix} 6 & 9 & -2 \\ -3 & 0 & 1 \\ 6 & 4 & 6 \end{bmatrix}.\end{split}\]Using LU decomposition, find the matrix factors of \(\bf{A}\) (\(\bf{L}\), \(\bf{U}\), and \(\bf{P}\)). What are the determinants of each? Find the determinant of \(\bf{A}\) by means LU decomposition,
det(P)*prod(diag(U)). Verify thatdet(A)gives the same answer.Using LU decomposition with Python, find the solution to the following system of equations (\(\mathbf{A}\,\bm{x} = \bm{b}\)). Use \(\bf{L}\), \(\bf{U}\), and \(\bf{P}\) in your solution.
A = np.array([[-8, 2, 8, -1], [2, -6, 6, 4], [-3, 9, 14, 11], [-9, 8, -4, 13]]).astype(float) b = np.array([[11, 5, 1, 4]]).astype(float).T