1. Descomposicion de Cholesky

Sea \(A\) una matriz real,Cholesky permite escribirla como

\[ A = LL^T \]

a. Desarrollo

Para una matriz de tamaño \(3 \times 3\), escribimos \(L\)

\[ L = \begin{pmatrix} L_{11} & 0 & 0 \\ L_{21} & L_{22} & 0 \\ L_{31} & L_{32} & L_{33} \end{pmatrix} \qquad 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} \]

Primera matriz

\[ A = \begin{pmatrix} 16 & 8 & 4 \\ 8 & 13 & 6 \\ 4 & 6 & 11 \end{pmatrix}. \]

Hallar \(L_{11}\)

\[ \begin{aligned} L_{11}^2 &= 16 \\ L_{11} &= \sqrt{16} \\ L_{11} &= 4. \end{aligned} \]

Hallar \(L_{21}\)

\[ \begin{aligned} L_{11}L_{21} &= 8 \\ 4L_{21} &= 8 \\ L_{21} &= \frac{8}{4} \\ L_{21} &= 2. \end{aligned} \]

Hallar \(L_{31}\)

\[ \begin{aligned} L_{11}L_{31} &= 4 \\ 4L_{31} &= 4 \\ L_{31} &= \frac{4}{4} \\ L_{31} &= 1. \end{aligned} \]

Hallar \(L_{22}\)

\[ \begin{aligned} L_{21}^2 + L_{22}^2 &= 13 \\ 2^2 + L_{22}^2 &= 13 \\ 4 + L_{22}^2 &= 13 \\ L_{22}^2 &= 13 - 4 \\ L_{22}^2 &= 9 \\ L_{22} &= \sqrt{9} \\ L_{22} &= 3. \end{aligned} \]

Hallarmos \(L_{32}\)

\[ \begin{aligned} L_{21}L_{31} + L_{22}L_{32} &= 6 \\ (2)(1) + 3L_{32} &= 6 \\ 2 + 3L_{32} &= 6 \\ 3L_{32} &= 6 - 2 \\ 3L_{32} &= 4 \\ L_{32} &= \frac{4}{3}. \end{aligned} \]

Hallar \(L_{33}\)

conservamos \(L_{32}=\frac{4}{3}\) como fracción para calcular su cuadrado

\[ \begin{aligned} 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 &= 10 - \frac{16}{9} \\ L_{33}^2 &= \frac{90}{9} - \frac{16}{9} \\ L_{33}^2 &= \frac{74}{9} \\ L_{33} &= \sqrt{\frac{74}{9}} \\ L_{33} &= \frac{\sqrt{74}}{3}. \end{aligned} \]

Resultado matriz A

Ubicamos los seis valores en la matriz triangular inferior

\[ L_A = \begin{pmatrix} 4 & 0 & 0 \\ 2 & 3 & 0 \\ 1 & \frac{4}{3} & \frac{\sqrt{74}}{3} \end{pmatrix} \qquad L_A^T = \begin{pmatrix} 4 & 2 & 1 \\ 0 & 3 & \frac{4}{3} \\ 0 & 0 & \frac{\sqrt{74}}{3} \end{pmatrix}. \]

Comprobamos

\[ L_A L_A^T = \begin{pmatrix} 4(4) & 4(2) & 4(1) \\ 2(4) & 2^2+3^2 & 2(1)+3\left(\frac{4}{3}\right) \\ 1(4) & 1(2)+\frac{4}{3}(3) & 1+\frac{16}{9}+\frac{74}{9} \end{pmatrix} = \begin{pmatrix} 16 & 8 & 4 \\ 8 & 13 & 6 \\ 4 & 6 & 11 \end{pmatrix} =A. \]

Segunda matriz

\[ B = \begin{pmatrix} 9 & 6 & 3 \\ 6 & 20 & 10 \\ 3 & 10 & 24 \end{pmatrix}. \]

Igualamos \(LL^T=B\). Calculamos nuevamente los seis valores de \(L\) usando las entradas de \(B\)

Hallar \(L_{11}\)

\[ \begin{aligned} L_{11}^2 &= 9 \\ L_{11} &= \sqrt{9} \\ L_{11} &= 3. \end{aligned} \]

Hallar \(L_{21}\)

\[ \begin{aligned} L_{11}L_{21} &= 6 \\ 3L_{21} &= 6 \\ L_{21} &= \frac{6}{3} \\ L_{21} &= 2. \end{aligned} \]

Hallar \(L_{31}\)

\[ \begin{aligned} L_{11}L_{31} &= 3 \\ 3L_{31} &= 3 \\ L_{31} &= \frac{3}{3} \\ L_{31} &= 1. \end{aligned} \]

Hallar \(L_{22}\)

\[ \begin{aligned} L_{21}^2 + L_{22}^2 &= 20 \\ 2^2 + L_{22}^2 &= 20 \\ 4 + L_{22}^2 &= 20 \\ L_{22}^2 &= 20 - 4 \\ L_{22}^2 &= 16 \\ L_{22} &= \sqrt{16} \\ L_{22} &= 4. \end{aligned} \]

Hallar \(L_{32}\)

\[ \begin{aligned} L_{21}L_{31} + L_{22}L_{32} &= 10 \\ (2)(1) + 4L_{32} &= 10 \\ 2 + 4L_{32} &= 10 \\ 4L_{32} &= 10 - 2 \\ 4L_{32} &= 8 \\ L_{32} &= \frac{8}{4} \\ L_{32} &= 2. \end{aligned} \]

Hallar \(L_{33}\)

\[ \begin{aligned} L_{31}^2 + L_{32}^2 + L_{33}^2 &= 24 \\ 1^2 + 2^2 + L_{33}^2 &= 24 \\ 1 + 4 + L_{33}^2 &= 24 \\ 5 + L_{33}^2 &= 24 \\ L_{33}^2 &= 24 - 5 \\ L_{33}^2 &= 19 \\ L_{33} &= \sqrt{19}. \end{aligned} \]

Resutado matriz B

\[ L_B = \begin{pmatrix} 3 & 0 & 0 \\ 2 & 4 & 0 \\ 1 & 2 & \sqrt{19} \end{pmatrix} \qquad L_B^T = \begin{pmatrix} 3 & 2 & 1 \\ 0 & 4 & 2 \\ 0 & 0 & \sqrt{19} \end{pmatrix}. \]

Comprobamos

\[ L_B L_B^T = \begin{pmatrix} 3(3) & 3(2) & 3(1) \\ 2(3) & 2^2+4^2 & 2(1)+4(2) \\ 1(3) & 1(2)+2(4) & 1^2+2^2+(\sqrt{19})^2 \end{pmatrix} = \begin{pmatrix} 9 & 6 & 3 \\ 6 & 20 & 10 \\ 3 & 10 & 24 \end{pmatrix} =B. \]

b. Implementación en R

La función chol() devuelve el factor triangular superior.

Comprobación de la matriz A

Ingresar la matriz \(A\). byrow = TRUE.

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_A\).

L_A = t(chol(A))
L_A
##      [,1]     [,2]     [,3]
## [1,]    4 0.000000 0.000000
## [2,]    2 3.000000 0.000000
## [3,]    1 1.333333 2.867442

.

Hallar \(L_A^T\).

LT_A = t(L_A)
LT_A
##      [,1] [,2]     [,3]
## [1,]    4    2 1.000000
## [2,]    0    3 1.333333
## [3,]    0    0 2.867442

Multiplicar \(L_A L_A^T\).

A_comprobada = L_A %*% LT_A
A_comprobada
##      [,1] [,2] [,3]
## [1,]   16    8    4
## [2,]    8   13    6
## [3,]    4    6   11

Comparar el producto con la matriz primera

all.equal(A, A_comprobada)
## [1] TRUE

Comprobación de la matriz B

Ingresar la matriz \(B\).

B = matrix(c(9,  6,  3,
             6, 20, 10,
             3, 10, 24),
           nrow = 3, byrow = TRUE)
B
##      [,1] [,2] [,3]
## [1,]    9    6    3
## [2,]    6   20   10
## [3,]    3   10   24

Hallar \(L_B\).

L_B = t(chol(B))
L_B
##      [,1] [,2]     [,3]
## [1,]    3    0 0.000000
## [2,]    2    4 0.000000
## [3,]    1    2 4.358899

Hallar \(L_B^T\).

LT_B = t(L_B)
LT_B
##      [,1] [,2]     [,3]
## [1,]    3    2 1.000000
## [2,]    0    4 2.000000
## [3,]    0    0 4.358899

Multiplicar \(L_B L_B^T\).

B_comprobada = L_B %*% LT_B
B_comprobada
##      [,1] [,2] [,3]
## [1,]    9    6    3
## [2,]    6   20   10
## [3,]    3   10   24

Comparar el producto con la matriz

all.equal(B, B_comprobada)
## [1] TRUE

nos damos cuenta que ambas comparaciones dan TRUE. Por lo tanto, los factores calculados permiten reconstruir las matrices originales mediante \(A=L_A L_A^T\) y \(B=L_B L_B^T\).