...

/

Challenge: Lower-upper Decomposition Algorithm

Challenge: Lower-upper Decomposition Algorithm

Code a Python algorithm that generates the lower-upper decomposition of a matrix.

LU Decomposition

Lower-upper (LU) decomposition is the process of factoring an invertible matrix, AA, to a product of a lower triangular matrix, LL, and an upper triangular matrix UU.

A=LUA = LU

An input matrix that’s square and invertible will always have a unique LU decomposition where the LL matrix has 1s1s at its diagonal.

[a11a12a13a21a22a23a31a32a33]=[100l2110l31l321]×[u11u12u130u22u2300u33]\begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ l_{21} & 1 & 0 \\ l_{31} & l_{32} & 1 \end{bmatrix} \times \begin{bmatrix} u_{11} & u_{12} & u_{13} \\ 0 & u_{22} & u_{23} \\ 0 & 0 & u_{33} \end{bmatrix} ...