5: Álgebra lineal
- Page ID
- 117218
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)Consideremos el sistema de ecuaciones\(n\) lineales e\(n\) incógnitas, dado por
\[\begin{array}{cc} a_{11} x_{1}+a_{12} x_{2}+\cdots+a_{1 n} x_{n}= & b_{1}, \\ a_{21} x_{1}+a_{22} x_{2}+\cdots+a_{2 n} x_{n}= & b_{2}, \\ \vdots & \vdots \\ a_{n 1} x_{1}+a_{n 2} x_{2}+\cdots+a_{n n} x_{n}= & b_{n} . \end{array} \nonumber \]
Podemos escribir este sistema como la ecuación matricial
\[A x=b \text {, } \nonumber \]
con
\[\mathrm{A}=\left(\begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1 n} \\ a_{21} & a_{22} & \cdots & a_{2 n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{n 1} & a_{n 2} & \cdots & a_{n n} \end{array}\right), \quad \mathbf{x}=\left(\begin{array}{c} x_{1} \\ x_{2} \\ \vdots \\ x_{n} \end{array}\right), \quad \mathbf{b}=\left(\begin{array}{c} b_{1} \\ b_{2} \\ \vdots \\ b_{n} \end{array}\right) \nonumber \]
En este capítulo se detalla la solución numérica de (5.1).
Eliminación Gaussiana
El algoritmo numérico estándar para resolver un sistema de ecuaciones lineales se llama Eliminación Gaussiana. Podemos ilustrar este algoritmo con el ejemplo.
Considerar el sistema de ecuaciones
\[\begin{aligned} -3 x_{1}+2 x_{2}-x_{3} &=-1, \\ 6 x_{1}-6 x_{2}+7 x_{3} &=-7, \\ 3 x_{1}-4 x_{2}+4 x_{3} &=-6 . \end{aligned} \nonumber \]
Para realizar la eliminación gaussiana, formamos una Matriz Aumentada combinando la matriz A con el vector de columna\(\vec{b}\):
\[\left(\begin{array}{rrrr} -3 & 2 & -1 & -1 \\ 6 & -6 & 7 & -7 \\ 3 & -4 & 4 & -6 \end{array}\right) \text {. } \nonumber \]
Luego se realiza la reducción de filas en esta matriz. Las operaciones permitidas son (1) multiplicar cualquier fila por una constante, (2) agregar múltiplo de una fila a otra fila, (3) intercambiar el orden de cualquier fila. El objetivo es convertir la matriz original en una matriz triangular superior. Comenzamos con la primera fila de la matriz y trabajamos nuestro camino hacia abajo de la siguiente manera. Primero multiplicamos la primera fila por 2 y la agregamos a la segunda fila, y agregamos la primera fila a la tercera fila:
\[\left(\begin{array}{rrrr} -3 & 2 & -1 & -1 \\ 0 & -2 & 5 & -9 \\ 0 & -2 & 3 & -7 \end{array}\right) \text {. } \nonumber \]
Después vamos a la segunda fila. Multiplicamos esta fila por\(-1\) y la agregamos a la tercera fila:
\[\left(\begin{array}{rrrr} -3 & 2 & -1 & -1 \\ 0 & -2 & 5 & -9 \\ 0 & 0 & -2 & 2 \end{array}\right) \text {. } \nonumber \]
Las ecuaciones resultantes se pueden determinar a partir de la matriz y están dadas por
\[\begin{aligned} -3 x_{1}+2 x_{2}-x_{3} &=-1 \\ -2 x_{2}+5 x_{3} &=-9 \\ -2 x_{3} &=2 . \end{aligned} \nonumber \]
Estas ecuaciones se pueden resolver mediante sustitución hacia atrás, partiendo de la última ecuación y trabajando hacia atrás. Tenemos
\[\begin{aligned} &-2 x_{3}=2 \rightarrow x_{3}=-1 \\ &-2 x_{2}=-9-5 x_{3}=-4 \rightarrow x_{2}=2 \\ &-3 x_{1}=-1-2 x_{2}+x_{3}=-6 \rightarrow x_{1}=2 \end{aligned} \nonumber \]
Por lo tanto,
\[\left(\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \end{array}\right)=\left(\begin{array}{r} 2 \\ 2 \\ -1 \end{array}\right) \nonumber \]
Descomposición de LU
El proceso de Eliminación Gaussiana también da como resultado la factorización de la matriz A para
\[\mathrm{A}=\mathrm{LU} \text {, } \nonumber \]
donde\(\mathrm{L}\) es una matriz triangular inferior y\(\mathrm{U}\) es una matriz triangular superior. Usando la misma matriz A que en la última sección, mostramos cómo se realiza esta factorización. Tenemos
\[\left(\begin{array}{rrr} -3 & 2 & -1 \\ 6 & -6 & 7 \\ 3 & -4 & 4 \end{array}\right) \rightarrow\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & -2 & 3 \end{array}\right)=\mathrm{M}_{1} \mathrm{~A} \nonumber \]
donde
\[\mathrm{M}_{1} \mathrm{~A}=\left(\begin{array}{lll} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 1 & 0 & 1 \end{array}\right)\left(\begin{array}{rrr} -3 & 2 & -1 \\ 6 & -6 & 7 \\ 3 & -4 & 4 \end{array}\right)=\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & -2 & 3 \end{array}\right) . \nonumber \]
Tenga en cuenta que la matriz\(\mathrm{M}_{1}\) realiza la eliminación de filas en la primera columna. Dos veces la primera fila se agrega a la segunda fila y una veces la primera fila se agrega a la tercera fila. Las entradas de la columna de\(\mathrm{M}_{1}\) provienen de\(2=-(6 /-3)\) y\(1=-(3 /-3)\) según se requiera para la eliminación de fila. El número\(-3\) se llama el pivote.
El siguiente paso es
\[\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & -2 & 3 \end{array}\right) \rightarrow\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & -2 \end{array}\right)=\mathrm{M}_{2}\left(\mathrm{M}_{1} \mathrm{~A}\right) \text {, } \nonumber \]
donde
\[\mathrm{M}_{2}\left(\mathrm{M}_{1} \mathrm{~A}\right)=\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & -1 & 1 \end{array}\right)\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & -2 & 3 \end{array}\right)=\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & -2 \end{array}\right) . \nonumber \]
Aquí,\(\mathrm{M}_{2}\) multiplica la segunda fila por\(-1=-(-2 /-2)\) y la agrega a la tercera fila. El pivote es\(-2\).
Ahora tenemos
\[\mathrm{M}_{2} \mathrm{M}_{1} \mathrm{~A}=\mathrm{U} \nonumber \]
o
\[\mathrm{A}=\mathrm{M}_{1}^{-1} \mathrm{M}_{2}^{-1} \mathrm{U} \text {. } \nonumber \]
Las matrices inversas son fáciles de encontrar. La matriz\(\mathrm{M}_{1}\) multiplica la primera fila por 2 y la agrega a la segunda fila, y multiplica la primera fila por 1 y la agrega a la tercera fila. Para invertir estas operaciones, necesitamos multiplicar la primera fila por\(-2\) y agregarla a la segunda fila, y multiplicar la primera fila por\(-1\) y agregarla a la tercera fila. Para verificar, con
\[\mathrm{M}_{1} \mathrm{M}_{1}^{-1}=\mathrm{I}, \nonumber \]
tenemos
\[\left(\begin{array}{lll} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 1 & 0 & 1 \end{array}\right)\left(\begin{array}{rrr} 1 & 0 & 0 \\ -2 & 1 & 0 \\ -1 & 0 & 1 \end{array}\right)=\left(\begin{array}{lll} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right) \text {. } \nonumber \]
Del mismo modo,
\[\mathrm{M}_{2}^{-1}=\left(\begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \end{array}\right) \nonumber \]
Por lo tanto,
\[\mathrm{L}=\mathrm{M}_{1}^{-1} \mathrm{M}_{2}^{-1} \nonumber \]
está dado por
\[\mathrm{L}=\left(\begin{array}{rll} 1 & 0 & 0 \\ -2 & 1 & 0 \\ -1 & 0 & 1 \end{array}\right)\left(\begin{array}{lll} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 1 \end{array}\right)=\left(\begin{array}{rrr} 1 & 0 & 0 \\ -2 & 1 & 0 \\ -1 & 1 & 1 \end{array}\right) \nonumber \]
que es triangular inferior. Los elementos fuera de la diagonal de\(\mathrm{M}_{1}^{-1}\) y simplemente\(\mathrm{M}_{2}^{-1}\) se combinan para formar L. Nuestra descomposición de LU es por lo tanto
\[\left(\begin{array}{rrr} -3 & 2 & -1 \\ 6 & -6 & 7 \\ 3 & -4 & 4 \end{array}\right)=\left(\begin{array}{rrr} 1 & 0 & 0 \\ -2 & 1 & 0 \\ -1 & 1 & 1 \end{array}\right)\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & -2 \end{array}\right) \text {. } \nonumber \]
CAPÍTULO 5. ALGEBRA LINEAL Otra característica agradable de la descomposición de LU es que se puede hacer sobrescribiendo A, por lo tanto, ahorrando memoria si la matriz\(\mathrm{A}\) es muy grande.
La descomposición de LU es útil cuando uno necesita resolver\(\mathrm{A} \mathbf{x}=\mathbf{b}\) para\(\mathbf{x}\) cuando\(\mathrm{A}\) es fijo y hay muchos diferentes\(\mathbf{b}\), primero determina\(\mathrm{L}\) y\(\mathrm{U}\) usa la eliminación gaussiana. Entonces uno escribe
\[(\mathrm{LU}) \mathbf{x}=\mathrm{L}(\mathrm{Ux})=\mathbf{b} \text {. } \nonumber \]
Dejamos
\[\mathbf{y}=\mathrm{Ux}, \nonumber \]
y primero resolver
\[\text { Ly }=b \nonumber \]
para\(\mathbf{y}\) por sustitución directa. Luego resolvemos
\[\mathrm{Ux}=\mathrm{y} \nonumber \]
para\(\mathbf{x}\) por sustitución hacia atrás. Si contamos operaciones, podemos demostrar que resolver (LU)\(\mathbf{x}=\mathbf{b}\) es sustancialmente más rápido una vez\(\mathrm{L}\) y\(\mathrm{U}\) están en la mano que resolviendo\(\mathrm{Ax}=\mathbf{b}\) directamente por eliminación gaussiana.
Ahora ilustramos la solución de\(L U x=b\) usar nuestro ejemplo anterior, donde
\[\mathrm{L}=\left(\begin{array}{rrr} 1 & 0 & 0 \\ -2 & 1 & 0 \\ -1 & 1 & 1 \end{array}\right), \quad \mathrm{U}=\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & -2 \end{array}\right), \quad \mathbf{b}=\left(\begin{array}{l} -1 \\ -7 \\ -6 \end{array}\right) \nonumber \]
Con\(\mathbf{y}=\mathrm{Ux}\), primero resolvemos\(\mathbf{L y}=\mathbf{b}\), es decir
\[\left(\begin{array}{rrr} 1 & 0 & 0 \\ -2 & 1 & 0 \\ -1 & 1 & 1 \end{array}\right)\left(\begin{array}{l} y_{1} \\ y_{2} \\ y_{3} \end{array}\right)=\left(\begin{array}{l} -1 \\ -7 \\ -6 \end{array}\right) \text {. } \nonumber \]
Uso de sustitución directa
\[\begin{aligned} &y_{1}=-1, \\ &y_{2}=-7+2 y_{1}=-9, \\ &y_{3}=-6+y_{1}-y_{2}=2 . \end{aligned} \nonumber \]
Ahora resolvemos\(U x=\mathbf{y}\), es decir
\[\left(\begin{array}{rrr} -3 & 2 & -1 \\ 0 & -2 & 5 \\ 0 & 0 & -2 \end{array}\right)\left(\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \end{array}\right)=\left(\begin{array}{r} -1 \\ -9 \\ 2 \end{array}\right) \text {. } \nonumber \]
Usando la sustitución hacia atrás,
\[\begin{aligned} -2 x_{3} &=2 \rightarrow x_{3}=-1, \\ -2 x_{2} &=-9-5 x_{3}=-4 \rightarrow x_{2}=2, \\ -3 x_{1} &=-1-2 x_{2}+x_{3}=-6 \rightarrow x_{1}=2, \end{aligned} \nonumber \]
y una vez más hemos determinado
\[\left(\begin{array}{l} x_{1} \\ x_{2} \\ x_{3} \end{array}\right)=\left(\begin{array}{r} 2 \\ 2 \\ -1 \end{array}\right) \text {. } \nonumber \]
Pivote parcial
Al realizar la eliminación gaussiana, el elemento diagonal que se utiliza durante el procedimiento de eliminación se denomina pivote. Para obtener el múltiplo correcto, se utiliza el pivote como divisor a los elementos debajo del pivote. La eliminación gaussiana en esta forma fallará si el pivote es cero. En esta situación, se debe realizar un intercambio de filas.
Incluso si el pivote no es idéntico a cero, un valor pequeño puede resultar en grandes errores de redondeo. Para matrices muy grandes, uno puede perder fácilmente toda la precisión en la solución. Para evitar estos errores de redondeo derivados de pequeños pivotes, se realizan intercambios de filas, y esta técnica se denomina pivotamiento parcial (el pivotamiento parcial contrasta con el pivotamiento completo, donde se intercambian tanto filas como columnas). Ilustraremos con el ejemplo la descomposición de LU mediante pivotamiento parcial.
Considerar
\[\mathrm{A}=\left(\begin{array}{rrr} -2 & 2 & -1 \\ 6 & -6 & 7 \\ 3 & -8 & 4 \end{array}\right) \text {. } \nonumber \]
Intercambiamos filas para colocar el elemento más grande (en valor absoluto) en el pivote, o\(a_{11}\), posición. Es decir,
\[\mathrm{A} \rightarrow\left(\begin{array}{rrr} 6 & -6 & 7 \\ -2 & 2 & -1 \\ 3 & -8 & 4 \end{array}\right)=\mathrm{P}_{12} \mathrm{~A} \nonumber \]
donde
\[\mathrm{P}_{12}=\left(\begin{array}{ccc} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{array}\right) \nonumber \]
es una matriz de permutación que cuando se multiplica a la izquierda intercambia la primera y segunda filas de una matriz. Tenga en cuenta que\(P_{12}^{-1}=P_{12}\). El paso de eliminación es entonces
\[\mathrm{P}_{12} \mathrm{~A} \rightarrow\left(\begin{array}{rrc} 6 & -6 & 7 \\ 0 & 0 & 4 / 3 \\ 0 & -5 & 1 / 2 \end{array}\right)=\mathrm{M}_{1} \mathrm{P}_{12} \mathrm{~A} \nonumber \]
donde
\[\mathrm{M}_{1}=\left(\begin{array}{ccc} 1 & 0 & 0 \\ 1 / 3 & 1 & 0 \\ -1 / 2 & 0 & 1 \end{array}\right) . \nonumber \]
El paso final requiere un intercambio de filas más:
\[\mathrm{M}_{1} \mathrm{P}_{12} \mathrm{~A} \rightarrow\left(\begin{array}{rrc} 6 & -6 & 7 \\ 0 & -5 & 1 / 2 \\ 0 & 0 & 4 / 3 \end{array}\right)=\mathrm{P}_{23} \mathrm{M}_{1} \mathrm{P}_{12} \mathrm{~A}=\mathrm{U} . \nonumber \]
Dado que las matrices de permutación dadas por\(\mathrm{P}\) son sus propias inversas, podemos escribir nuestro resultado como
\[\left(\mathrm{P}_{23} \mathrm{M}_{1} \mathrm{P}_{23}\right) \mathrm{P}_{23} \mathrm{P}_{12} \mathrm{~A}=\mathrm{U} \text {. } \nonumber \]
Multiplicación\(\mathrm{M}\) de a la izquierda por\(\mathrm{P}\) intercambios de filas mientras que la multiplicación a la derecha por columnas de\(P\) intercambios. Es decir,
\[P_{23}\left(\begin{array}{ccc} 1 & 0 & 0 \\ 1 / 3 & 1 & 0 \\ -1 / 2 & 0 & 1 \end{array}\right) P_{23}=\left(\begin{array}{ccc} 1 & 0 & 0 \\ -1 / 2 & 0 & 1 \\ 1 / 3 & 1 & 0 \end{array}\right) P_{23}=\left(\begin{array}{ccc} 1 & 0 & 0 \\ -1 / 2 & 1 & 0 \\ 1 / 3 & 0 & 1 \end{array}\right) \text {. } \nonumber \]
El resultado neto en\(\mathrm{M}_{1}\) es un intercambio de los elementos no diagonales\(1 / 3\) y\(-1 / 2\).
Entonces podemos multiplicar por la inversa de\(\left(\mathrm{P}_{23} \mathrm{M}_{1} \mathrm{P}_{23}\right)\) para obtener
\[\mathrm{P}_{23} \mathrm{P}_{12} \mathrm{~A}=\left(\mathrm{P}_{23} \mathrm{M}_{1} \mathrm{P}_{23}\right)^{-1} \mathrm{U}, \nonumber \]
que escribimos como
\[\text { PA }=\text { LU. } \nonumber \]
En lugar de L, MATLAB escribirá esto como
\[\mathrm{A}=\left(\mathrm{P}^{-1} \mathrm{~L}\right) \mathrm{U} . \nonumber \]
Por conveniencia, solo denotaremos\(\left(\mathrm{P}^{-1} \mathrm{~L}\right)\) por\(\mathrm{L}\), pero por\(\mathrm{L}\) aquí nos referimos a una matriz triangular inferior permutada.
Programación MATLAB
En MATLAB, para resolver\(A \mathbf{x}=\mathbf{b}\) para\(\mathbf{x}\) usar la eliminación gaussiana, un tipo
donde\(\backslash\) resuelve el\(x\) uso del algoritmo más eficiente disponible, dependiendo de la forma de A. Si A es una\(n \times n\) matriz general, entonces primero se encuentra la descomposición de LU de A usando pivotamiento parcial, y luego\(x\) se determina a partir de sustitución permutada hacia adelante y hacia atrás. Si\(\mathrm{A}\) es triangular superior o inferior, entonces se usa directamente la sustitución hacia adelante o hacia atrás (o su versión permutada).
Si hay muchos lados diferentes de la mano derecha, uno primero encontraría directamente la descomposición LU de A usando una llamada a una función, y luego resolvería usando\(\backslash\). Es decir, uno iteraría para diferentes\(\mathbf{b}\) las siguientes expresiones:
donde la segunda y tercera líneas se pueden acortar a
donde se requiere el paréntesis. En conferencia, voy a demostrar estas soluciones en MATLAB usando la matriz\(A=[-3,2,-1 ; 6,-6,7 ; 3,-4,4]\) y el lado derecho\(b=[-1 ;-7 ;-6]\), que es el ejemplo que hicimos a mano. Aunque no detallamos el algoritmo aquí, MATLAB también puede resolver el problema del valor propio del álgebra lineal. Aquí, el problema matemático a resolver viene dado por
\[\mathrm{A} \mathbf{x}=\lambda \mathbf{x}, \nonumber \]
donde\(\mathrm{A}\) es una matriz cuadrada,\(\lambda\) son los valores propios, y los\(\mathrm{x}^{\prime}\) s asociados son los vectores propios. La subrutina MATLAB que resuelve este problema es eig.m. Para encontrar solo los valores propios de\(A\), un tipo
Para encontrar tanto los valores propios como los vectores propios, un tipo
Puede encontrar más información en las páginas de ayuda de MATLAB. Una de las buenas características de la programación en MATLAB es que no se comete un gran pecado si uno usa una función incorporada sin gastar el tiempo requerido para comprender completamente el algoritmo subyacente.