Q:

How to derive the following formula for the inverse of a matrix?

I came across the following theorem:
Let $A$ be a nonsingular square $p \times p$ matrix and $z$ be a p-dimensional column vector. The matrix $(A - z z^T)^{-1}$ is given by
$$(A- zz^T)^{-1} = A^{-1} + \frac{A^{-1}zz^TA^{-1}}{1-z^T A^{-1}z}$$
Now I tried using $A-zz^T$ multiply the matrix on the right side of the above formula and I cannot obtain an identity matrix. I tried:
$$(A^{-1} + \frac{A^{-1}zz^TA^{-1}}{1-z^T A^{-1}z})(A-zz^T) = I - A^{-1}zz^T - \frac{1}{1-z^TA^{-1}z}(A^{-1}zz^T+A^{-1}zz^TA^{-1}zz^T)$$
This is where I got stuck. Can someone help me on this please?

A:

You've almost got it! There's a small typo in your formula: the last term should be
$$
{}+ \frac{1}{1-z^TA^{-1}z}(A^{-1}zz^T-A^{-1}zz^TA^{-1}zz^T).
$$
And notice this equals
$$
\frac{1}{1-z^TA^{-1}z} \big( A^{-1}z ( 1 - z^TA^{-1}z) z^T \big),
$$
which should get you where you want to go.

A:

It is a particular case of Sherman-Morrison theorem 
(https://en.wikipedia.org/wiki/Sherman%E2%80%93Morrison_formula)
with $u=z$ and $v=-z$.

A:

Remember that matrix multiplication is associative meaning $(AB)C = A(BC)$ so that 
$$(A^{-1}zz^T)(A^{-1}zz^T) =  A^{-1}z(z^TA^{-1}z)z^T = (z^TA^{-1}z).A^{-1}zz^T$$  
Notice that the last equality is due to the fact that $z^TA^{-1}z$ is a scalar.
Going back to your equality we now have:
$$
\begin{alignat}{}
(A^{-1} + \frac{A^{-1}zz^TA^{-1}}{1-z^T A^{-1}z})(A-zz^T) &&= I - A^{-1}zz^T + \frac{1}{1-z^TA^{-1}z}(A^{-1}zz^T - A^{-1}zz^TA^{-1}zz^T) \\\\&&= I - A^{-1}zz^T +  \frac{1}{1-z^TA^{-1}z}(A^{-1}zz^T - (z^TA^{-1}z).A^{-1}zz^T) \\\\&&= I - A^{-1}zz^T +  \frac{A^{-1}zz^T}{1-z^TA^{-1}z}(1 - (z^TA^{-1}z)) \\\\&&= I
\end{alignat}
$$

