# Fast matrix inversion

1. Aug 28, 2011

### blindconsole

Hello,

I'm trying to find a fast way to solve the matrix equation $(A+pI)x=b$, where A is a large matrix, I is the identity matrix, and p is a parameter whose value needs to be swept. Obviously I could just use mldivide or matrix inversion for every value of p, but this seems inefficient. Does anyone know of a better way? Thanks!

2. Aug 28, 2011

### Dickfore

Diagonalize the matrix $A$:
$$A \, U = U \, \Lambda$$
where $\Lambda$ is a diagonal matrix whose diagonal entries are the eigenvalues $\lambda_{i}$ of $A$ and $U$ is a vector whose columns are the eigenvectors of $A$. Then, we have:
$$f(A) = U \, f(\Lambda) \, U^{-1}$$
where by $f(\Lambda)$ we mean a diagonal matrix whose diagonal entries are $f(\lambda_{i})$.

Now, notice that if you have $A$, diagonlaized, then:
$$(A + p I) \, U = A \, U + p I \, U = U \, \Lambda + p U \, I = U \, (\Lambda + p I)$$
where we have used the fact that $I U = U I = U$. Here, $\Lambda + p I$ is again a diagonal matrix whose eigenvalues are $\lambda_{i} + p$. Then, we will have:
$$(A + p I)^{-1} = U \, \frac{1}{\Lambda + p I} \, U^{-1}$$

3. Aug 28, 2011