If you’re doing a lot of simulations, optimizations or other muckity-muck, it’s easy to start writing down equations with matrices like inside of them. And, depending on the application, it might be a really good idea to precompute this matrix. But there’s that pesky inverse operation, and generally inverting a matrix is a no-no since it can easily land you in trouble when that matrix isn’t really very stable.
So, here’s a trick you can use in these situations to avoid explicitly inverting the matrix A. It turns out that instead we can just solve the system a bunch of times in order to explicitly compute the product matrix .
It’s pretty straightforward. If we want to extract the th column from , we need to solve the equation , where is the indicator vector with s everywhere except the th entry, which is . If we just massage this equation a bit, we get where is the th column of . Sweet! If we have a good way to pre-factor or otherwise prepare it for repeated solves, we can also keep this solution method pretty efficient.