Una matriz cuadrada se puede escribir como Sea \(A\) una matrizz cuadrada \(n\times n\) tal que se puede escribir \[A=LL^T\] se hace a través de la descomposición de Cholesky
Sea \[A=\begin{pmatrix}4 & 2 & 2 \\ 2&5&1\\ 2&1&6\end{pmatrix}\] \[L=\begin{pmatrix}L_{11} & 0 & 0 \\ L_{21}&L_{22}&0\\ L_{31}&L_{32}&L_{33}\end{pmatrix} \ L^T=\begin{pmatrix}L_{11} & L_{21}& L_{31} \\ 0&L_{22}&L_{32}\\ 0&0&L_{33}\end{pmatrix}\] \[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 compara con las ecuaciones de la matriz \(LL^T\) \[L_{11}^2=4 \ \ \sqrt{L_{11}^2}=\sqrt{4}=2\] \[L_{11}=2\] \[L_{11}L_{21}=2 \ \ 2L_{21}=2 \ \ L_{21}=\frac{2}{2}=1\] \[L_{21}=1\] \[L_{11}L_{31}=2 \ \ 2L_{31}=2 \ \ =\frac{2}{2}=1\] \[L_{31}=1\] \[L_{21}^2+L_{22}^2=5 \ \ (1)^2+L_{22}^2=5 \ \ L_{22}^2=5-1 \ \ L_{22}^2=4 \ \ L_{22}=2\] Implementación en R
Ingresar a la matriz \(A\)
A=matrix(c(4,2,2,2,5,1,2,1,6),nrow=3,byrow=TRUE)
A
## [,1] [,2] [,3]
## [1,] 4 2 2
## [2,] 2 5 1
## [3,] 2 1 6
Hallar \(L\)
L=t(chol(A))
L
## [,1] [,2] [,3]
## [1,] 2 0 0.000000
## [2,] 1 2 0.000000
## [3,] 1 0 2.236068
Hallar \(L^T\)
LT=t(L)
LT
## [,1] [,2] [,3]
## [1,] 2 1 1.000000
## [2,] 0 2 0.000000
## [3,] 0 0 2.236068
Multiplicar matrices \(LL^T\)
B=L%*%LT
B
## [,1] [,2] [,3]
## [1,] 4 2 2
## [2,] 2 5 1
## [3,] 2 1 6
\[\begin{cases} 4x+2y+2z=10\\ 2x+5y+z=13\\ 2x+y+6z=11 \end{cases}\]
A=matrix(c(4,2,2,2,5,1,2,1,6),nrow=3,byrow = TRUE)
b=c(10,13,11)
L=t(chol(A))
Y=forwardsolve(L,b)
X=backsolve(t(L),Y)
print(Y)
## [1] 5.000000 4.000000 2.683282
print(X)
## [1] 0.9 2.0 1.2