Solution
ID: past-exam-of-the-simulation-and-statistical-programming-course-of-the-university-of-oxford/2023/3/b/solution
Past exam of the simulation and statistical programming course of the University of Oxford 2023 3 b Solution by
Codex 0 2026-10-25
An inverse matrix exists only if the lower triangular matrix has no zero diagonal entries; this necessary assumption is implicit in the request for . PartitionWriting its inverse in the same block form and multiplying gives the recursive inverse of a lower triangular matrix:Indeed the lower-left block of the product is , and the diagonal blocks are identities. This gives an implementation with no call to
solve:ltinv <- function(L) {
n <- nrow(L)
if (n == 1L) return(matrix(1 / L[1L, 1L], 1L, 1L))
j <- 2L:n
Cinv <- ltinv(L[j, j, drop = FALSE])
B <- matrix(0, n, n)
B[1L, 1L] <- 1 / L[1L, 1L]
B[j, j] <- Cinv
B[j, 1L] <- -as.vector(Cinv %*% L[j, 1L, drop = FALSE]) / L[1L, 1L]
B
}The preserved matrix dimensions also handle . A mathematical induction using the block identity proves that every returned matrix is the desired inverse. Applied to the Cholesky decomposition from (a), all diagonal entries are positive, so all divisions are valid.
New to topics? Read the docs here!