Punto 1: Descomposición de Cholesky

Definición: Una matriz cuadrada de tamaño \(n \times n\) se puede expresar como la multiplicación de una matriz triangular inferior \(L\) por su transpuesta \(L^T\):

\[M = L \cdot L^T\]


Matriz A

Sea la matriz \(A\):

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

a. Desarrollo manual

Planteamos la matriz triangular inferior \(L\) y su transpuesta \(L^T\):

\[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}\]

Al multiplicar \(L \cdot L^T\) e igualar cada componente con la matriz \(A\), obtenemos:

\[L \cdot L^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} = \begin{pmatrix} 16 & 8 & 4 \\ 8 & 13 & 6 \\ 4 & 6 & 11 \end{pmatrix}\]

Despejamos cada componente:

  • Hallar \(L_{11}\): \[L_{11}^2 = 16 \implies L_{11} = \sqrt{16} = 4\]

  • Hallar \(L_{21}\): \[L_{11} \cdot L_{21} = 8 \implies 4 \cdot L_{21} = 8 \implies L_{21} = \frac{8}{4} = 2\]

  • Hallar \(L_{31}\): \[L_{11} \cdot L_{31} = 4 \implies 4 \cdot L_{31} = 4 \implies L_{31} = \frac{4}{4} = 1\]

  • Hallar \(L_{22}\): \[L_{21}^2 + L_{22}^2 = 13 \implies 2^2 + L_{22}^2 = 13 \implies 4 + L_{22}^2 = 13 \implies L_{22}^2 = 9 \implies L_{22} = \sqrt{9} = 3\]

  • Hallar \(L_{32}\): \[L_{31} \cdot L_{21} + L_{32} \cdot L_{22} = 6 \implies (1)(2) + L_{32}(3) = 6 \implies 2 + 3L_{32} = 6 \implies 3L_{32} = 4 \implies L_{32} = \frac{4}{3}\]

  • Hallar \(L_{33}\): \[L_{31}^2 + L_{32}^2 + L_{33}^2 = 11 \implies 1^2 + \left(\frac{4}{3}\right)^2 + L_{33}^2 = 11 \implies 1 + \frac{16}{9} + L_{33}^2 = 11\] \[\frac{25}{9} + L_{33}^2 = 11 \implies L_{33}^2 = 11 - \frac{25}{9} = \frac{99 - 25}{9} = \frac{74}{9} \implies L_{33} = \sqrt{\frac{74}{9}} = \frac{\sqrt{74}}{3}\]

Por lo tanto, las matrices resultantes para \(A\) son:

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

b. Comprobación en R

# 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
LA <- t(chol(A))
LA
##      [,1]     [,2]     [,3]
## [1,]    4 0.000000 0.000000
## [2,]    2 3.000000 0.000000
## [3,]    1 1.333333 2.867442
# Hallar L transpuesta
LTA <- t(LA)
LTA
##      [,1] [,2]     [,3]
## [1,]    4    2 1.000000
## [2,]    0    3 1.333333
## [3,]    0    0 2.867442
# Comprobar multiplicando L por LT
CompA <- LA %*% LTA
CompA
##      [,1] [,2] [,3]
## [1,]   16    8    4
## [2,]    8   13    6
## [3,]    4    6   11

Matriz B

Sea la matriz \(B\):

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

a. Desarrollo manual

Igualamos \(L \cdot L^T\) con la matriz \(B\):

\[\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} = \begin{pmatrix} 9 & 6 & 3 \\ 6 & 20 & 10 \\ 3 & 10 & 14 \end{pmatrix}\]

Despejamos cada componente:

  • Hallar \(L_{11}\): \[L_{11}^2 = 9 \implies L_{11} = \sqrt{9} = 3\]

  • Hallar \(L_{21}\): \[L_{11} \cdot L_{21} = 6 \implies 3 \cdot L_{21} = 6 \implies L_{21} = \frac{6}{3} = 2\]

  • Hallar \(L_{31}\): \[L_{11} \cdot L_{31} = 3 \implies 3 \cdot L_{31} = 3 \implies L_{31} = \frac{3}{3} = 1\]

  • Hallar \(L_{22}\): \[L_{21}^2 + L_{22}^2 = 20 \implies 2^2 + L_{22}^2 = 20 \implies 4 + L_{22}^2 = 20 \implies L_{22}^2 = 16 \implies L_{22} = \sqrt{16} = 4\]

  • Hallar \(L_{32}\): \[L_{31} \cdot L_{21} + L_{32} \cdot L_{22} = 10 \implies (1)(2) + L_{32}(4) = 10 \implies 2 + 4L_{32} = 10 \implies 4L_{32} = 8 \implies L_{32} = \frac{8}{4} = 2\]

  • Hallar \(L_{33}\): \[L_{31}^2 + L_{32}^2 + L_{33}^2 = 14 \implies 1^2 + 2^2 + L_{33}^2 = 14 \implies 1 + 4 + L_{33}^2 = 14 \implies 5 + L_{33}^2 = 14 \implies L_{33}^2 = 9 \implies L_{33} = \sqrt{9} = 3\]

Por lo tanto, las matrices resultantes para \(B\) son:

\[L = \begin{pmatrix} 3 & 0 & 0 \\ 2 & 4 & 0 \\ 1 & 2 & 3 \end{pmatrix}, \qquad L^T = \begin{pmatrix} 3 & 2 & 1 \\ 0 & 4 & 2 \\ 0 & 0 & 3 \end{pmatrix}\]

b. Comprobación en R

# Ingresar la matriz B
B <- matrix(c(9, 6, 3,
              6, 20, 10,
              3, 10, 14), nrow = 3, byrow = TRUE)
B
##      [,1] [,2] [,3]
## [1,]    9    6    3
## [2,]    6   20   10
## [3,]    3   10   14
# Hallar L
LB <- t(chol(B))
LB
##      [,1] [,2] [,3]
## [1,]    3    0    0
## [2,]    2    4    0
## [3,]    1    2    3
# Hallar L transpuesta
LTB <- t(LB)
LTB
##      [,1] [,2] [,3]
## [1,]    3    2    1
## [2,]    0    4    2
## [3,]    0    0    3
# Comprobar multiplicando L por LT
CompB <- LB %*% LTB
CompB
##      [,1] [,2] [,3]
## [1,]    9    6    3
## [2,]    6   20   10
## [3,]    3   10   14

Punto 2: Sistemas de ecuaciones lineales con Cholesky

Para resolver un sistema de la forma \(M \cdot X = b\) mediante la descomposición de Cholesky (\(M = L \cdot L^T\)), se divide el proceso en dos pasos:

  1. Resolver \(L \cdot Y = b\) para hallar el vector \(Y\).
  2. Resolver \(L^T \cdot X = Y\) para hallar el vector solución \(X = (x, y, z)^T\).

Sistema a

Sea el sistema de ecuaciones:

\[\begin{cases} 4x + 2y = 8 \\ 2x + 5y + 2z = 14 \\ 2y + 5z = 17 \end{cases}\]

Que en forma matricial \(A \cdot X = b\) corresponde a:

\[A = \begin{pmatrix} 4 & 2 & 0 \\ 2 & 5 & 2 \\ 0 & 2 & 5 \end{pmatrix}, \qquad X = \begin{pmatrix} x \\ y \\ z \end{pmatrix}, \qquad b = \begin{pmatrix} 8 \\ 14 \\ 17 \end{pmatrix}\]

a. Desarrollo manual

1. Hallar \(L\) y \(L^T\) a partir de \(A = L \cdot L^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} = \begin{pmatrix} 4 & 2 & 0 \\ 2 & 5 & 2 \\ 0 & 2 & 5 \end{pmatrix}\]

  • \(L_{11}^2 = 4 \implies L_{11} = 2\)
  • \(2 \cdot L_{21} = 2 \implies L_{21} = \frac{2}{2} = 1\)
  • \(2 \cdot L_{31} = 0 \implies L_{31} = \frac{0}{2} = 0\)
  • \(1^2 + L_{22}^2 = 5 \implies 1 + L_{22}^2 = 5 \implies L_{22}^2 = 4 \implies L_{22} = 2\)
  • \((0)(1) + L_{32}(2) = 2 \implies 2L_{32} = 2 \implies L_{32} = 1\)
  • \(0^2 + 1^2 + L_{33}^2 = 5 \implies 1 + L_{33}^2 = 5 \implies L_{33}^2 = 4 \implies L_{33} = 2\)

Por lo tanto:

\[L = \begin{pmatrix} 2 & 0 & 0 \\ 1 & 2 & 0 \\ 0 & 1 & 2 \end{pmatrix}, \qquad L^T = \begin{pmatrix} 2 & 1 & 0 \\ 0 & 2 & 1 \\ 0 & 0 & 2 \end{pmatrix}\]

2. Resolver \(L \cdot Y = b\):

\[\begin{pmatrix} 2 & 0 & 0 \\ 1 & 2 & 0 \\ 0 & 1 & 2 \end{pmatrix} \begin{pmatrix} Y_1 \\ Y_2 \\ Y_3 \end{pmatrix} = \begin{pmatrix} 8 \\ 14 \\ 17 \end{pmatrix}\]

  • \(2Y_1 = 8 \implies Y_1 = \frac{8}{2} = 4\)
  • \(Y_1 + 2Y_2 = 14 \implies 4 + 2Y_2 = 14 \implies 2Y_2 = 10 \implies Y_2 = 5\)
  • \(Y_2 + 2Y_3 = 17 \implies 5 + 2Y_3 = 17 \implies 2Y_3 = 12 \implies Y_3 = 6\)

Entonces:

\[Y = \begin{pmatrix} 4 \\ 5 \\ 6 \end{pmatrix}\]

3. Resolver \(L^T \cdot X = Y\):

\[\begin{pmatrix} 2 & 1 & 0 \\ 0 & 2 & 1 \\ 0 & 0 & 2 \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} 4 \\ 5 \\ 6 \end{pmatrix}\]

  • \(2z = 6 \implies z = \frac{6}{2} = 3\)
  • \(2y + z = 5 \implies 2y + 3 = 5 \implies 2y = 2 \implies y = 1\)
  • \(2x + y = 4 \implies 2x + 1 = 4 \implies 2x = 3 \implies x = \frac{3}{2} = 1.5\)

Resultado manual del sistema a: \(x = 1.5\), \(y = 1\), \(z = 3\).

b. Comprobación en R

# Matriz de coeficientes y vector independiente (Sistema a)
Aa <- matrix(c(4, 2, 0,
               2, 5, 2,
               0, 2, 5), nrow = 3, byrow = TRUE)
ba <- c(8, 14, 17)

# Descomposición L
La <- t(chol(Aa))

# Resolver L * Y = ba y luego t(La) * X = Y
Ya <- forwardsolve(La, ba)
Xa <- backsolve(t(La), Ya)

print(Ya)
## [1] 4 5 6
print(Xa)
## [1] 1.5 1.0 3.0

Sistema b

Sea el sistema de ecuaciones:

\[\begin{cases} 3x + 2y + z = 8 \\ 3x + 10y + 5z = 28 \\ 3x + 10y + 14z = 45 \end{cases}\]

Que en forma matricial \(M \cdot X = b\) corresponde a:

\[M = \begin{pmatrix} 3 & 2 & 1 \\ 3 & 10 & 5 \\ 3 & 10 & 14 \end{pmatrix}, \qquad X = \begin{pmatrix} x \\ y \\ z \end{pmatrix}, \qquad b = \begin{pmatrix} 8 \\ 28 \\ 45 \end{pmatrix}\]

a. Desarrollo manual

1. Hallar \(L\) y \(L^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} = \begin{pmatrix} 3 & 2 & 1 \\ 3 & 10 & 5 \\ 3 & 10 & 14 \end{pmatrix}\]

  • \(L_{11}^2 = 3 \implies L_{11} = \sqrt{3}\)
  • \(\sqrt{3} \cdot L_{21} = 3 \implies L_{21} = \frac{3}{\sqrt{3}} = \sqrt{3}\)
  • \(\sqrt{3} \cdot L_{31} = 3 \implies L_{31} = \frac{3}{\sqrt{3}} = \sqrt{3}\)
  • \((\sqrt{3})^2 + L_{22}^2 = 10 \implies 3 + L_{22}^2 = 10 \implies L_{22}^2 = 7 \implies L_{22} = \sqrt{7}\)
  • \((\sqrt{3})(\sqrt{3}) + L_{32}\sqrt{7} = 10 \implies 3 + \sqrt{7}L_{32} = 10 \implies \sqrt{7}L_{32} = 7 \implies L_{32} = \frac{7}{\sqrt{7}} = \sqrt{7}\)
  • \((\sqrt{3})^2 + (\sqrt{7})^2 + L_{33}^2 = 14 \implies 3 + 7 + L_{33}^2 = 14 \implies 10 + L_{33}^2 = 14 \implies L_{33}^2 = 4 \implies L_{33} = 2\)

Por lo tanto:

\[L = \begin{pmatrix} \sqrt{3} & 0 & 0 \\ \sqrt{3} & \sqrt{7} & 0 \\ \sqrt{3} & \sqrt{7} & 2 \end{pmatrix}, \qquad L^T = \begin{pmatrix} \sqrt{3} & \sqrt{3} & \sqrt{3} \\ 0 & \sqrt{7} & \sqrt{7} \\ 0 & 0 & 2 \end{pmatrix}\]

2. Resolver \(L \cdot Y = b\):

\[\begin{pmatrix} \sqrt{3} & 0 & 0 \\ \sqrt{3} & \sqrt{7} & 0 \\ \sqrt{3} & \sqrt{7} & 2 \end{pmatrix} \begin{pmatrix} Y_1 \\ Y_2 \\ Y_3 \end{pmatrix} = \begin{pmatrix} 8 \\ 28 \\ 45 \end{pmatrix}\]

  • \(\sqrt{3}Y_1 = 8 \implies Y_1 = \frac{8}{\sqrt{3}}\)
  • \(\sqrt{3}\left(\frac{8}{\sqrt{3}}\right) + \sqrt{7}Y_2 = 28 \implies 8 + \sqrt{7}Y_2 = 28 \implies \sqrt{7}Y_2 = 20 \implies Y_2 = \frac{20}{\sqrt{7}}\)
  • \(\sqrt{3}\left(\frac{8}{\sqrt{3}}\right) + \sqrt{7}\left(\frac{20}{\sqrt{7}}\right) + 2Y_3 = 45 \implies 8 + 20 + 2Y_3 = 45 \implies 2Y_3 = 17 \implies Y_3 = \frac{17}{2}\)

Entonces:

\[Y = \begin{pmatrix} \frac{8}{\sqrt{3}} \\ \frac{20}{\sqrt{7}} \\ \frac{17}{2} \end{pmatrix}\]

3. Resolver \(L^T \cdot X = Y\):

\[\begin{pmatrix} \sqrt{3} & \sqrt{3} & \sqrt{3} \\ 0 & \sqrt{7} & \sqrt{7} \\ 0 & 0 & 2 \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} \frac{8}{\sqrt{3}} \\ \frac{20}{\sqrt{7}} \\ \frac{17}{2} \end{pmatrix}\]

  • \(2z = \frac{17}{2} \implies z = \frac{17}{4} = 4.25\)
  • \(\sqrt{7}y + \sqrt{7}\left(\frac{17}{4}\right) = \frac{20}{\sqrt{7}} \implies y + \frac{17}{4} = \frac{20}{7} \implies y = \frac{20}{7} - \frac{17}{4} = \frac{80 - 119}{28} = -\frac{39}{28}\)
  • \(\sqrt{3}x + \sqrt{3}\left(-\frac{39}{28}\right) + \sqrt{3}\left(\frac{17}{4}\right) = \frac{8}{\sqrt{3}} \implies x - \frac{39}{28} + \frac{17}{4} = \frac{8}{3} \implies x + \frac{20}{7} = \frac{8}{3} \implies x = \frac{8}{3} - \frac{20}{7} = -\frac{4}{21}\)

b. Comprobación en R

# Matriz de coeficientes y vector independiente (Sistema b)
Mb <- matrix(c(3, 2, 1,
               3, 10, 5,
               3, 10, 14), nrow = 3, byrow = TRUE)
bb <- c(8, 28, 45)

# Descomposición L
Lb <- t(chol(Mb))

# Resolver L * Y = bb y luego t(Lb) * X = Y
Yb <- forwardsolve(Lb, bb)
Xb <- backsolve(t(Lb), Yb)

print(Yb)
## [1] 4.618802 7.699484 9.141401
print(Xb)
## [1] 0.9230769 1.2675585 2.6956522