Tema: Descomposición de Cholesky y solución de sistemas lineales.
Estudiante: Dilan Sneider Aguirre Diaz
Asignatura: Algebra lineal
Docente: Luisa Maria Montoya Conde
Sea:
\[ A=\begin{pmatrix} 16&8&4\\ 8&13&6\\ 4&6&11 \end{pmatrix} \]
Primero planteamos la matriz triangular inferior:
\[ L=\begin{pmatrix} L_{11}&0&0\\ L_{21}&L_{22}&0\\ L_{31}&L_{32}&L_{33} \end{pmatrix} \]
Su transpuesta es:
\[ L^T=\begin{pmatrix} L_{11}&L_{21}&L_{31}\\ 0&L_{22}&L_{32}\\ 0&0&L_{33} \end{pmatrix} \]
Multiplicamos las dos matrices:
\[ LL^T= \begin{pmatrix} L_{11}^2&L_{11}L_{21}&L_{11}L_{31}\\ L_{21}L_{11}&L_{21}^2+L_{22}^2&L_{21}L_{31}+L_{22}L_{32}\\ L_{31}L_{11}&L_{31}L_{21}+L_{32}L_{22}&L_{31}^2+L_{32}^2+L_{33}^2 \end{pmatrix} \]
Ahora se iguala la matriz A y se comparan sus elementos con las ecuaciones de la matriz \(LL^T\).
Primer elemento:
\[ L_{11}^2=16 \]
\[ L_{11}=\sqrt{16}=4 \]
Segundo elemento:
\[ L_{11}L_{21}=8 \]
\[ 4L_{21}=8 \]
\[ L_{21}=\frac{8}{4}=2 \]
Tercer elemento:
\[ L_{11}L_{31}=4 \]
\[ 4L_{31}=4 \]
\[ L_{31}=\frac{4}{4}=1 \]
Cuarto elemento:
\[ L_{21}^2+L_{22}^2=13 \]
\[ (2)^2+L_{22}^2=13 \]
\[ L_{22}^2=13-4 \]
\[ L_{22}=\sqrt{9}=3 \]
Quinto elemento:
\[ L_{21}L_{31}+L_{22}L_{32}=6 \]
\[ (2)(1)+(3)L_{32}=6 \]
\[ 3L_{32}=6-2 \]
\[ L_{32}=\frac{4}{3} \]
Sexto elemento:
\[ L_{31}^2+L_{32}^2+L_{33}^2=11 \]
\[ (1)^2+\left(\frac{4}{3}\right)^2+L_{33}^2=11 \]
\[ 1+\frac{16}{9}+L_{33}^2=11 \]
\[ L_{33}^2=11-1-\frac{16}{9} \]
\[ L_{33}^2=\frac{74}{9} \]
\[ L_{33}=\frac{\sqrt{74}}{3} \]
Por lo tanto, la matriz triangular inferior queda:
\[ \boxed{ L=\begin{pmatrix} 4&0&0\\ 2&3&0\\ 1&\frac{4}{3}&\frac{\sqrt{74}}{3} \end{pmatrix} } \]
Ingresar la matriz A
A=matrix(c(16,8,4,8,13,6,4,6,11),nrow=3,byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 16 8 4
## [2,] 8 13 6
## [3,] 4 6 11
Hallar L
L=t(chol(A))
L
## [,1] [,2] [,3]
## [1,] 4 0.000000 0.000000
## [2,] 2 3.000000 0.000000
## [3,] 1 1.333333 2.867442
Hallar L transpuesta
LT=t(L)
LT
## [,1] [,2] [,3]
## [1,] 4 2 1.000000
## [2,] 0 3 1.333333
## [3,] 0 0 2.867442
Multiplicar matrices LLᵀ
B=L%*%LT
B
## [,1] [,2] [,3]
## [1,] 16 8 4
## [2,] 8 13 6
## [3,] 4 6 11
Sea:
\[ B=\begin{pmatrix} 9&6&3\\ 6&20&10\\ 3&10&14 \end{pmatrix} \]
Primero planteamos la matriz triangular inferior:
\[ L=\begin{pmatrix} L_{11}&0&0\\ L_{21}&L_{22}&0\\ L_{31}&L_{32}&L_{33} \end{pmatrix} \]
Su transpuesta es:
\[ L^T=\begin{pmatrix} L_{11}&L_{21}&L_{31}\\ 0&L_{22}&L_{32}\\ 0&0&L_{33} \end{pmatrix} \]
Multiplicamos las matrices:
\[ LL^T= \begin{pmatrix} L_{11}^2&L_{11}L_{21}&L_{11}L_{31}\\ L_{21}L_{11}&L_{21}^2+L_{22}^2&L_{21}L_{31}+L_{22}L_{32}\\ L_{31}L_{11}&L_{31}L_{21}+L_{32}L_{22}&L_{31}^2+L_{32}^2+L_{33}^2 \end{pmatrix} \]
Ahora igualamos los elementos de la matriz B.
Primer elemento:
\[ L_{11}^2=9 \]
\[ L_{11}=\sqrt{9}=3 \]
Segundo elemento:
\[ L_{11}L_{21}=6 \]
\[ 3L_{21}=6 \]
\[ L_{21}=\frac{6}{3}=2 \]
Tercer elemento:
\[ L_{11}L_{31}=3 \]
\[ 3L_{31}=3 \]
\[ L_{31}=\frac{3}{3}=1 \]
Cuarto elemento:
\[ L_{21}^2+L_{22}^2=20 \]
\[ (2)^2+L_{22}^2=20 \]
\[ L_{22}^2=20-4 \]
\[ L_{22}=\sqrt{16}=4 \]
Quinto elemento:
\[ L_{21}L_{31}+L_{22}L_{32}=10 \]
\[ (2)(1)+(4)L_{32}=10 \]
\[ 4L_{32}=10-2 \]
\[ L_{32}=\frac{8}{4}=2 \]
Sexto elemento:
\[ L_{31}^2+L_{32}^2+L_{33}^2=14 \]
\[ (1)^2+(2)^2+L_{33}^2=14 \]
\[ 1+4+L_{33}^2=14 \]
\[ L_{33}^2=14-5 \]
\[ L_{33}=\sqrt{9}=3 \]
Por lo tanto, la matriz triangular inferior queda:
\[ \boxed{ L=\begin{pmatrix} 3&0&0\\ 2&4&0\\ 1&2&3 \end{pmatrix} } \]
Ingresar la matriz B
A=matrix(c(9,6,3,6,20,10,3,10,14),nrow=3,byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 9 6 3
## [2,] 6 20 10
## [3,] 3 10 14
Hallar L
L=t(chol(A))
L
## [,1] [,2] [,3]
## [1,] 3 0 0
## [2,] 2 4 0
## [3,] 1 2 3
Hallar L transpuesta
LT=t(L)
LT
## [,1] [,2] [,3]
## [1,] 3 2 1
## [2,] 0 4 2
## [3,] 0 0 3
Multiplicar matrices LLᵀ
C=L%*%LT
C
## [,1] [,2] [,3]
## [1,] 9 6 3
## [2,] 6 20 10
## [3,] 3 10 14
Sea el siguiente sistema de ecuaciones:
\[ \begin{cases} 4x+2y=8\\ 2x+5y+2z=14\\ 2y+5z=17 \end{cases} \]
Primero despejamos la variable \(y\) de la primera ecuación:
\[ 4x+2y=8 \]
\[ 2y=8-4x \]
\[ y=4-2x \]
Ahora reemplazamos este resultado en la segunda ecuación:
\[ 2x+5(4-2x)+2z=14 \]
\[ 2x+20-10x+2z=14 \]
\[ -8x+2z=-6 \]
Despejamos \(z\):
\[ 2z=8x-6 \]
\[ z=4x-3 \]
Ahora reemplazamos \(y\) y \(z\) en la tercera ecuación:
\[ 2(4-2x)+5(4x-3)=17 \]
\[ 8-4x+20x-15=17 \]
\[ 16x-7=17 \]
\[ 16x=24 \]
\[ x=\frac{24}{16}=\frac{3}{2} \]
Calculamos \(y\):
\[ y=4-2\left(\frac{3}{2}\right) \]
\[ y=4-3=1 \]
Calculamos \(z\):
\[ z=4\left(\frac{3}{2}\right)-3 \]
\[ z=6-3=3 \]
Por lo tanto, la solución del sistema es:
\[ \boxed{x=\frac{3}{2},\quad y=1,\quad z=3} \]
Ingresar la matriz A y el vector b
A=matrix(c(4,2,0,2,5,2,0,2,5),nrow=3,byrow=TRUE)
b=c(8,14,17)
A
## [,1] [,2] [,3]
## [1,] 4 2 0
## [2,] 2 5 2
## [3,] 0 2 5
b
## [1] 8 14 17
Hallar L
L=t(chol(A))
L
## [,1] [,2] [,3]
## [1,] 2 0 0
## [2,] 1 2 0
## [3,] 0 1 2
Resolver el sistema mediante Cholesky
Y=forwardsolve(L,b)
X=backsolve(t(L),Y)
print(Y)
## [1] 4 5 6
print(X)
## [1] 1.5 1.0 3.0
Sea el siguiente sistema de ecuaciones:
\[ \begin{cases} 3x+2y+z=8\\ 3x+10y+5z=28\\ 3x+10y+14z=45 \end{cases} \]
Primero restamos la primera ecuación de la segunda:
\[ (3x+10y+5z)-(3x+2y+z)=28-8 \]
\[ 8y+4z=20 \]
Dividimos entre 4:
\[ 2y+z=5 \]
Ahora restamos la segunda ecuación de la tercera:
\[ (3x+10y+14z)-(3x+10y+5z)=45-28 \]
\[ 9z=17 \]
Despejamos \(z\):
\[ z=\frac{17}{9} \]
Reemplazamos este valor en la ecuación anterior:
\[ 2y+\frac{17}{9}=5 \]
\[ 2y=5-\frac{17}{9} \]
\[ 2y=\frac{45}{9}-\frac{17}{9} \]
\[ 2y=\frac{28}{9} \]
\[ y=\frac{14}{9} \]
Finalmente, reemplazamos los valores de \(y\) y \(z\) en la primera ecuación:
\[ 3x+2\left(\frac{14}{9}\right)+\frac{17}{9}=8 \]
\[ 3x+\frac{28}{9}+\frac{17}{9}=8 \]
\[ 3x+\frac{45}{9}=8 \]
\[ 3x+5=8 \]
\[ 3x=3 \]
\[ x=1 \]
Por lo tanto, la solución del sistema es:
\[ \boxed{x=1,\quad y=\frac{14}{9},\quad z=\frac{17}{9}} \]
Ingresar la matriz A y el vector b
A=matrix(c(3,2,1,3,10,5,3,10,14),nrow=3,byrow=TRUE)
b=c(8,28,45)
A
## [,1] [,2] [,3]
## [1,] 3 2 1
## [2,] 3 10 5
## [3,] 3 10 14
b
## [1] 8 28 45
Resolver el sistema
X=solve(A,b)
print(X)
## [1] 1.000000 1.555556 1.888889