Algoritmo de Doolittle

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ l_{21} & 1 & 0 & 0 \\ l_{31} & l_{32} & 1 & 0 \\ l_{41} & l_{42} & l_{43} & 1 \end{bmatrix} \begin{bmatrix} u_{11} & u_{12} & u_{13} & u_{14} \\ 0 & u_{22} & u_{23} & u_{24} \\ 0 & 0 & u_{33} & u_{34} \\ 0 & 0 & 0 & u_{44} \end{bmatrix} = \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \end{bmatrix} \end{equation*}

Multiplicando

\begin{equation*} \begin{bmatrix} u_{11} & u_{12} & u_{13} & u_{14} \\ l_{21} u_{11} & l_{21} u_{12} + u_{22} & l_{21} u_{13} + u_{23} & l_{21} u_{14} + u_{24} \\ l_{31} u_{11} & l_{31} u_{12} + l_{32} u_{22} & l_{31} u_{13} + l_{32} u_{23} + u_{33} & l_{31} u_{14} + l_{32} u_{24} + u_{34} \\ l_{41} u_{11} & l_{41} u_{12} + l_{42} u_{22} & l_{41} u_{13} + l_{42} u_{23} + l_{43} u_{33 } & l_{41} u_{14} + l_{42} u_{24} + l_{43} u_{34} + u_{44} \end{bmatrix} = \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \end{bmatrix} \end{equation*}

Despejando y reemplazando

\begin{equation} \begin{bmatrix} 1 & 0 & 0 & 0 \\ \frac{a_{21}}{u_{11}} & 1 & 0 & 0 \\ \frac{a_{31}}{u_{11}} & \frac{a_{32} - l_{31} u_{12}}{u_{22}} & 1 & 0 \\ \frac{a_{41}}{u_{11}} & \frac{a_{42} - l_{41} u_{12}}{u_{22}} & \frac{a_{43} - l_{41} u_{13} - l_{42} u_{23}}{u_{33}} & 1 \end{bmatrix} \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ 0 & a_{22} - l_{21} u_{12} & a_{23} - l_{21} u_{13} & a_{24} - l_{21} u_{14} \\ 0 & 0 & a_{33} - l_{31} u_{13} - l_{32} u_{23} & a_{34} - l_{31} u_{14} - l_{32} u_{24} \\ 0 & 0 & 0 & a_{44} - l_{41} u_{14} - l_{42} u_{24} - l_{43} u_{34} \end{bmatrix} = \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34} \\ a_{41} & a_{42} & a_{43} & a_{44} \end{bmatrix} \end{equation}

Ejemplo

Factorizar la matriz $\mathbf{A}$

\begin{equation*} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 2 & 1 & -1 & 1 \\ 3 & -1 & -1 & 2 \\ -1 & 2 & 3 & -1 \end{bmatrix} \end{equation*}

Las matrices $\mathbf{L}$ y $\mathbf{U}$ iniciales son

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ & 1 & 0 & 0 \\ & & 1 & 0 \\ & & & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 2 & 1 & -1 & 1 \\ 3 & -1 & -1 & 2 \\ -1 & 2 & 3 & -1 \end{bmatrix} \end{equation*}

Primera fila pivote

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ \frac{2}{1} & 1 & 0 & 0 \\ \frac{3}{1} & & 1 & 0 \\ \frac{-1}{1} & & & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 2 - \frac{2}{1} (1) & 1 - \frac{2}{1} (1) & -1 - \frac{2}{1} (2) & 1 - \frac{2}{1} (3) \\ 3 - \frac{3}{1} (1) & -1 - \frac{3}{1} (1) & -1 - \frac{3}{1} (2) & 2 - \frac{3}{1} (3) \\ -1 - \bigl( \frac{-1}{1} \bigr) (1) & 2 - \bigl( \frac{-1}{1} \bigr) (1) & 3 - \bigl( \frac{-1}{1} \bigr) (2) & -1 - \bigl( \frac{-1}{1} \bigr) (3) \end{bmatrix} \end{equation*}

Simplificando

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 3 & & 1 & 0 \\ -1 & & & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 0 & -1 & -5 & -5 \\ 0 & -4 & -7 & -7 \\ 0 & 3 & 5 & 2 \end{bmatrix} \end{equation*}

Segunda fila pivote

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 3 & \frac{-4}{-1} & 1 & 0 \\ -1 & \frac{3}{-1} & & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 0 & -1 & -5 & -5 \\ 0 & -4 - \bigl( \frac{-4}{-1} \bigr) (-1) & -7 - \bigl( \frac{-4}{-1} \bigr) (-5) & -7 - \bigl( \frac{-4}{-1} \bigr) (-5) \\ 0 & 3 - \bigl( \frac{3}{-1} \bigr) (-1) & 5 - \bigl( \frac{3}{-1} \bigr) (-5) & 2 - \bigl( \frac{3}{-1} \bigr) (-5) \end{bmatrix} \end{equation*}

Simplificando

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 3 & 4 & 1 & 0 \\ -1 & -3 & & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 0 & -1 & -5 & -5 \\ 0 & 0 & 13 & 13 \\ 0 & 0 & -10 & -13 \end{bmatrix} \end{equation*}

Tercera fila pivote

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 3 & 4 & 1 & 0 \\ -1 & -3 & \frac{-10}{13} & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 0 & -1 & -5 & -5 \\ 0 & 0 & 13 & 13 \\ 0 & 0 & -10 - \bigl( \frac{-10}{13} \bigr) (13) & -13 - \bigl( \frac{-10}{13} \bigr) (13) \end{bmatrix} \end{equation*}

Simplificando

\begin{equation*} \begin{bmatrix} 1 & 0 & 0 & 0 \\ 2 & 1 & 0 & 0 \\ 3 & 4 & 1 & 0 \\ -1 & -3 & -0.769231 & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 & 2 & 3 \\ 0 & -1 & -5 & -5 \\ 0 & 0 & 13 & 13 \\ 0 & 0 & 0 & -3 \end{bmatrix} \end{equation*}

Lo anterior puede escribirse como

\begin{equation*} \begin{array}{llll:llll} 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = \frac{a_{21}}{a_{11}} & 1 & 0 & 0 & a_{21} = a_{21} - \frac{a_{21}}{a_{11}} a_{11} & a_{22} = a_{22} - \frac{a_{21}}{a_{11}} a_{12} & a_{23} = a_{23} - \frac{a_{21}}{a_{11}} a_{13} & a_{24} = a_{24} - \frac{a_{21}}{a_{11}} a_{14} \\ l_{31} = \frac{a_{31}}{a_{11}} & l_{32} = 0 & 1 & 0 & a_{31} = a_{31} - \frac{a_{31}}{a_{11}} a_{11} & a_{32} = a_{32} - \frac{a_{31}}{a_{11}} a_{12} & a_{33} = a_{33} - \frac{a_{31}}{a_{11}} a_{13} & a_{34} = a_{34} - \frac{a_{31}}{a_{11}} a_{14} \\ l_{41} = \frac{a_{41}}{a_{11}} & l_{42} = 0 & l_{43} = 0 & 1 & a_{41} = a_{41} - \frac{a_{41}}{a_{11}} a_{11} & a_{42} = a_{42} - \frac{a_{41}}{a_{11}} a_{12} & a_{43} = a_{43} - \frac{a_{41}}{a_{11}} a_{13} & a_{44} = a_{44} - \frac{a_{41}}{a_{11}} a_{14} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{32} = \frac{a_{32}}{a_{22}} & 1 & 0 & a_{31} = a_{31} - \frac{a_{32}}{a_{22}} a_{21} & a_{32} = a_{32} - \frac{a_{32}}{a_{22}} a_{22} & a_{33} = a_{33} - \frac{a_{32}}{a_{22}} a_{23} & a_{34} = a_{34} - \frac{a_{32}}{a_{22}} a_{24} \\ l_{41} = l_{41} & l_{42} = \frac{a_{42}}{a_{22}} & l_{43} = 0 & 1 & a_{41} = a_{41} - \frac{a_{42}}{a_{22}} a_{21} & a_{42} = a_{42} - \frac{a_{42}}{a_{22}} a_{22} & a_{43} = a_{43} - \frac{a_{42}}{a_{22}} a_{23} & a_{44} = a_{44} - \frac{a_{42}}{a_{22}} a_{24} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{32} = l_{32} & 1 & 0 & a_{31} = a_{31} & a_{32} = a_{32} & a_{33} = a_{33} & a_{34} = a_{34} \\ l_{41} = l_{41} & l_{42} = l_{42} & l_{43} = \frac{a_{43}}{a_{33}} & 1 & a_{41} = a_{41} - \frac{a_{43}}{a_{33}} a_{31} & a_{42} = a_{42} - \frac{a_{43}}{a_{33}} a_{32} & a_{43} = a_{43} - \frac{a_{43}}{a_{33}} a_{33} & a_{44} = a_{44} - \frac{a_{43}}{a_{33}} a_{34} \end{array} \end{equation*}

Patrón de cálculo

Primer patrón

\begin{equation*} \begin{array}{llll:llll} 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = \frac{a_{21}}{a_{11}} & 1 & 0 & 0 & a_{2\color{blue}{1}} = a_{2\color{blue}{1}} - \frac{a_{21}}{a_{11}} a_{1\color{blue}{1}} & a_{2\color{green}{2}} = a_{2\color{green}{2}} - \frac{a_{21}}{a_{11}} a_{1\color{green}{2}} & a_{2\color{red}{3}} = a_{2\color{red}{3}} - \frac{a_{21}}{a_{11}} a_{1\color{red}{3}} & a_{2\color{fuchsia}{4}} = a_{2\color{fuchsia}{4}} - \frac{a_{21}}{a_{11}} a_{1\color{fuchsia}{4}} \\ l_{31} = \frac{a_{31}}{a_{11}} & l_{32} = 0 & 1 & 0 & a_{3\color{blue}{1}} = a_{3\color{blue}{1}} - \frac{a_{31}}{a_{11}} a_{1\color{blue}{1}} & a_{3\color{green}{2}} = a_{3\color{green}{2}} - \frac{a_{31}}{a_{11}} a_{1\color{green}{2}} & a_{3\color{red}{3}} = a_{3\color{red}{3}} - \frac{a_{31}}{a_{11}} a_{1\color{red}{3}} & a_{3\color{fuchsia}{4}} = a_{3\color{fuchsia}{4}} - \frac{a_{31}}{a_{11}} a_{1\color{fuchsia}{4}} \\ l_{41} = \frac{a_{41}}{a_{11}} & l_{42} = 0 & l_{43} = 0 & 1 & a_{4\color{blue}{1}} = a_{4\color{blue}{1}} - \frac{a_{41}}{a_{11}} a_{1\color{blue}{1}} & a_{4\color{green}{2}} = a_{4\color{green}{2}} - \frac{a_{41}}{a_{11}} a_{1\color{green}{2}} & a_{4\color{red}{3}} = a_{4\color{red}{3}} - \frac{a_{41}}{a_{11}} a_{1\color{red}{3}} & a_{4\color{fuchsia}{4}} = a_{4\color{fuchsia}{4}} - \frac{a_{41}}{a_{11}} a_{1\color{fuchsia}{4}} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{32} = \frac{a_{32}}{a_{22}} & 1 & 0 & a_{3\color{blue}{1}} = a_{3\color{blue}{1}} - \frac{a_{32}}{a_{22}} a_{2\color{blue}{1}} & a_{3\color{green}{2}} = a_{3\color{green}{2}} - \frac{a_{32}}{a_{22}} a_{2\color{green}{2}} & a_{3\color{red}{3}} = a_{3\color{red}{3}} - \frac{a_{32}}{a_{22}} a_{2\color{red}{3}} & a_{3\color{fuchsia}{4}} = a_{3\color{fuchsia}{4}} - \frac{a_{32}}{a_{22}} a_{2\color{fuchsia}{4}} \\ l_{41} = l_{41} & l_{42} = \frac{a_{42}}{a_{22}} & l_{43} = 0 & 1 & a_{4\color{blue}{1}} = a_{4\color{blue}{1}} - \frac{a_{42}}{a_{22}} a_{2\color{blue}{1}} & a_{4\color{green}{2}} = a_{4\color{green}{2}} - \frac{a_{42}}{a_{22}} a_{2\color{green}{2}} & a_{4\color{red}{3}} = a_{4\color{red}{3}} - \frac{a_{42}}{a_{22}} a_{2\color{red}{3}} & a_{4\color{fuchsia}{4}} = a_{4\color{fuchsia}{4}} - \frac{a_{42}}{a_{22}} a_{2\color{fuchsia}{4}} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{32} = l_{32} & 1 & 0 & a_{31} = a_{31} & a_{32} = a_{32} & a_{33} = a_{33} & a_{34} = a_{34} \\ l_{41} = l_{41} & l_{42} = l_{42} & l_{43} = \frac{a_{43}}{a_{33}} & 1 & a_{4\color{blue}{1}} = a_{4\color{blue}{1}} - \frac{a_{43}}{a_{33}} a_{3\color{blue}{1}} & a_{4\color{green}{2}} = a_{4\color{green}{2}} - \frac{a_{43}}{a_{33}} a_{3\color{green}{2}} & a_{4\color{red}{3}} = a_{4\color{red}{3}} - \frac{a_{43}}{a_{33}} a_{3\color{red}{3}} & a_{4\color{fuchsia}{4}} = a_{4\color{fuchsia}{4}} - \frac{a_{43}}{a_{33}} a_{3\color{fuchsia}{4}} \end{array} \end{equation*}

lo anterior puede escribirse como

\begin{equation*} a_{?j} = a_{?j} - \frac{a_{??}}{a_{??}} a_{?j} \end{equation*}

para $j = 1, 2, 3, 4 = 1 , \dots, n$

Segundo patrón

\begin{equation*} \begin{array}{llll:llll} 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{\color{blue}{2}1} = \frac{a_{\color{blue}{2}1}}{a_{11}} & 1 & 0 & 0 & a_{\color{blue}{2}1} = a_{\color{blue}{2}1} - \frac{a_{\color{blue}{2}1}}{a_{11}} a_{11} & a_{\color{blue}{2}2} = a_{\color{blue}{2}2} - \frac{a_{\color{blue}{2}1}}{a_{11}} a_{12} & a_{\color{blue}{2}3} = a_{\color{blue}{2}3} - \frac{a_{\color{blue}{2}1}}{a_{11}} a_{13} & a_{\color{blue}{2}4} = a_{\color{blue}{2}4} - \frac{a_{\color{blue}{2}1}}{a_{11}} a_{14} \\ l_{\color{green}{3}1} = \frac{a_{\color{green}{3}1}}{a_{11}} & l_{32} = 0 & 1 & 0 & a_{\color{green}{3}1} = a_{\color{green}{3}1} - \frac{a_{\color{green}{3}1}}{a_{11}} a_{11} & a_{\color{green}{3}2} = a_{\color{green}{3}2} - \frac{a_{\color{green}{3}1}}{a_{11}} a_{12} & a_{\color{green}{3}3} = a_{\color{green}{3}3} - \frac{a_{\color{green}{3}1}}{a_{11}} a_{13} & a_{\color{green}{3}4} = a_{\color{green}{3}4} - \frac{a_{\color{green}{3}1}}{a_{11}} a_{14} \\ l_{\color{red}{4}1} = \frac{a_{\color{red}{4}1}}{a_{11}} & l_{42} = 0 & l_{43} = 0 & 1 & a_{\color{red}{4}1} = a_{\color{red}{4}1} - \frac{a_{\color{red}{4}1}}{a_{11}} a_{11} & a_{\color{red}{4}2} = a_{\color{red}{4}2} - \frac{a_{\color{red}{4}1}}{a_{11}} a_{12} & a_{\color{red}{4}3} = a_{\color{red}{4}3} - \frac{a_{\color{red}{4}1}}{a_{11}} a_{13} & a_{\color{red}{4}4} = a_{\color{red}{4}4} - \frac{a_{\color{red}{4}1}}{a_{11}} a_{14} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{\color{green}{3}2} = \frac{a_{\color{green}{3}2}}{a_{22}} & 1 & 0 & a_{\color{green}{3}1} = a_{\color{green}{3}1} - \frac{a_{\color{green}{3}2}}{a_{22}} a_{21} & a_{\color{green}{3}2} = a_{\color{green}{3}2} - \frac{a_{\color{green}{3}2}}{a_{22}} a_{22} & a_{\color{green}{3}3} = a_{\color{green}{3}3} - \frac{a_{\color{green}{3}2}}{a_{22}} a_{23} & a_{\color{green}{3}4} = a_{\color{green}{3}4} - \frac{a_{\color{green}{3}2}}{a_{22}} a_{24} \\ l_{41} = l_{41} & l_{\color{red}{4}2} = \frac{a_{\color{red}{4}2}}{a_{22}} & l_{43} = 0 & 1 & a_{\color{red}{4}1} = a_{\color{red}{4}1} - \frac{a_{\color{red}{4}2}}{a_{22}} a_{21} & a_{\color{red}{4}2} = a_{\color{red}{4}2} - \frac{a_{\color{red}{4}2}}{a_{22}} a_{22} & a_{\color{red}{4}3} = a_{\color{red}{4}3} - \frac{a_{\color{red}{4}2}}{a_{22}} a_{23} & a_{\color{red}{4}4} = a_{\color{red}{4}4} - \frac{a_{\color{red}{4}2}}{a_{22}} a_{24} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{32} = l_{32} & 1 & 0 & a_{31} = a_{31} & a_{32} = a_{32} & a_{33} = a_{33} & a_{34} = a_{34} \\ l_{41} = l_{41} & l_{42} = l_{42} & l_{\color{red}{4}3} = \frac{a_{\color{red}{4}3}}{a_{33}} & 1 & a_{\color{red}{4}1} = a_{\color{red}{4}1} - \frac{a_{\color{red}{4}3}}{a_{33}} a_{31} & a_{\color{red}{4}2} = a_{\color{red}{4}2} - \frac{a_{\color{red}{4}3}}{a_{33}} a_{32} & a_{\color{red}{4}3} = a_{\color{red}{4}3} - \frac{a_{\color{red}{4}3}}{a_{33}} a_{33} & a_{\color{red}{4}4} = a_{\color{red}{4}4} - \frac{a_{\color{red}{4}3}}{a_{33}} a_{34} \end{array} \end{equation*}

lo anterior puede escribirse como

\begin{align*} a_{ij} &= a_{ij} - \frac{a_{i?}}{a_{??}} a_{?j} \\ l_{i?} &= \frac{a_{i?}}{a_{??}} \end{align*}

para

\begin{align*} i &= 2, 3, 4 = 2, \dots, m \\ &= 3, 4 = 3, \dots, m \\ &= 4 = 4 , \dots, m \end{align*}

Tercer patrón

\begin{equation*} \begin{array}{llll:llll} 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{2\color{blue}{1}} = \frac{a_{2\color{blue}{1}}}{a_{\color{blue}{11}}} & 1 & 0 & 0 & a_{21} = a_{21} - \frac{a_{2\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}1} & a_{22} = a_{22} - \frac{a_{2\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}2} & a_{23} = a_{23} - \frac{a_{2\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}3} & a_{24} = a_{24} - \frac{a_{2\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}4} \\ l_{3\color{blue}{1}} = \frac{a_{3\color{blue}{1}}}{a_{\color{blue}{11}}} & l_{32} = 0 & 1 & 0 & a_{31} = a_{31} - \frac{a_{3\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}1} & a_{32} = a_{32} - \frac{a_{3\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}2} & a_{33} = a_{33} - \frac{a_{3\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}3} & a_{34} = a_{34} - \frac{a_{3\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}4} \\ l_{4\color{blue}{1}} = \frac{a_{4\color{blue}{1}}}{a_{\color{blue}{11}}} & l_{42} = 0 & l_{43} = 0 & 1 & a_{41} = a_{41} - \frac{a_{4\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}1} & a_{42} = a_{42} - \frac{a_{4\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}2} & a_{43} = a_{43} - \frac{a_{4\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}3} & a_{44} = a_{44} - \frac{a_{4\color{blue}{1}}}{a_{\color{blue}{11}}} a_{\color{blue}{1}4} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{3\color{green}{2}} = \frac{a_{3\color{green}{2}}}{a_{\color{green}{22}}} & 1 & 0 & a_{31} = a_{31} - \frac{a_{3\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}1} & a_{32} = a_{32} - \frac{a_{3\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}2} & a_{33} = a_{33} - \frac{a_{3\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}3} & a_{34} = a_{34} - \frac{a_{3\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}4} \\ l_{41} = l_{41} & l_{4\color{green}{2}} = \frac{a_{4\color{green}{2}}}{a_{\color{green}{22}}} & l_{43} = 0 & 1 & a_{41} = a_{41} - \frac{a_{4\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}1} & a_{42} = a_{42} - \frac{a_{4\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}2} & a_{43} = a_{43} - \frac{a_{4\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}3} & a_{44} = a_{44} - \frac{a_{4\color{green}{2}}}{a_{\color{green}{22}}} a_{\color{green}{2}4} \\ \hline 1 & 0 & 0 & 0 & a_{11} = a_{11} & a_{12} = a_{12} & a_{13} = a_{13} & a_{14} = a_{14} \\ l_{21} = l_{21} & 1 & 0 & 0 & a_{21} = a_{21} & a_{22} = a_{22} & a_{23} = a_{23} & a_{24} = a_{24} \\ l_{31} = l_{31} & l_{32} = l_{32} & 1 & 0 & a_{31} = a_{31} & a_{32} = a_{32} & a_{33} = a_{33} & a_{34} = a_{34} \\ l_{41} = l_{41} & l_{42} = l_{42} & l_{4\color{red}{3}} = \frac{a_{4\color{red}{3}}}{a_{\color{red}{33}}} & 1 & a_{41} = a_{41} - \frac{a_{4\color{red}{3}}}{a_{\color{red}{33}}} a_{\color{red}{3}1} & a_{42} = a_{42} - \frac{a_{4\color{red}{3}}}{a_{\color{red}{33}}} a_{\color{red}{3}2} & a_{43} = a_{43} - \frac{a_{4\color{red}{3}}}{a_{\color{red}{33}}} a_{\color{red}{3}3} & a_{44} = a_{44} - \frac{a_{4\color{red}{3}}}{a_{\color{red}{33}}} a_{\color{red}{3}4} \end{array} \end{equation*}

lo anterior puede escribirse como

\begin{align*} a_{ij} &= a_{ij} - \frac{a_{ik}}{a_{kk}} a_{kj} \\ l_{ik} &= \frac{a_{ik}}{a_{kk}} \end{align*}

para $k = 1, 2, 3 = 1, \dots, m - 1$

Fórmula matemática

\begin{align*} k &= 1, \dots, m - 1 \\ & \quad i = 1 + k, \dots, m \\ & \quad \quad j = 1, \dots, n \\ & \quad \quad \quad a_{ij} = a_{ij} - \frac{a_{ik}}{a_{kk}} a_{kj} \\ & \quad \quad l_{ik} = \frac{a_{ik}}{a_{kk}} \end{align*}

Seudocódigo

function lu_doolittle(a)
    m, n = tamaño(a)
    for k=1 to m-1 do
        for i=1+k to m do
            for j=1 to n do
                a(i,j) = a(i,j) - a(i,k)*a(k,j)/a(k,k)
            end for
            l(i,k) = a(i,k)/a(k,k)
        end for
    end for
end function

otra alternativa para reducir tiempo de cálculo

function lu_doolittle(a)
    m, n = tamaño(a)
    for k=1 to m-1 do
        for i=1+k to m do
            factor = a(i,k)/a(k,k)
            for j=1 to n do
                a(i,j) = a(i,j) - factor*a(k,j)
            end for
            l(i,k) = factor
        end for
    end for
end function

Implementación descomposición de Doolittle


In [1]:
import numpy as np

def lu_doolittle(A):
    a = np.copy(A)
    m, n = a.shape
    l = np.eye(m)
    for k in range(0,m-1):
        for i in range(1+k,m):
            factor = a[i,k]/a[k,k]
            for j in range(0,n):
                a[i,j] = a[i,j] - factor*a[k,j]
            l[i,k] = factor
    return l,a

In [2]:
A = np.array([[1,1,2,3],
              [2,1,-1,1],
              [3,-1,-1,2],
              [-1,2,3,-1]],float)
print(A)


[[ 1.  1.  2.  3.]
 [ 2.  1. -1.  1.]
 [ 3. -1. -1.  2.]
 [-1.  2.  3. -1.]]

In [3]:
l, u = lu_doolittle(A)
print(l)
print(u)


[[ 1.          0.          0.          0.        ]
 [ 2.          1.          0.          0.        ]
 [ 3.          4.          1.          0.        ]
 [-1.         -3.         -0.76923077  1.        ]]
[[  1.   1.   2.   3.]
 [  0.  -1.  -5.  -5.]
 [  0.   0.  13.  13.]
 [  0.   0.   0.  -3.]]

In [4]:
#revisando
np.dot(l,u)


Out[4]:
array([[ 1.,  1.,  2.,  3.],
       [ 2.,  1., -1.,  1.],
       [ 3., -1., -1.,  2.],
       [-1.,  2.,  3., -1.]])