# Generalised Woodbury matrix identity

I have a question regarding the Woodbury matrix identity. In general, the Woodbury matrix identity is as follows

$$(\mathbf{A} + \mathbf{u} \mathbf{u}^T)^{-1} = \mathbf{A}^{-1} - \frac{\mathbf{A}^{-1}\mathbf{u} \mathbf{u}^T\mathbf{A}^{-1}}{1 + \mathbf{u}^T \mathbf{A}^{-1}\mathbf{u} }$$ where $$\mathbf{u}$$ is a $$n \times 1$$ vector and $$\mathbf{A}$$ is a $$n \times n$$ matrix.

Is there any formula to calculate the sum of this expression? i.e., $$(\mathbf{I} + \sum_{k = 1}^{K}a_k \mathbf{u}_k \mathbf{u}_k^T)^{-1}$$ where $$\mathbf{I}$$ is an identity matrix of size $$n \times n$$?

Thank you very much in advance

The more general Woodbury matrix identity states that $$\left(A + UCV \right)^{-1} = A^{-1} - A^{-1}U \left(C^{-1} + VA^{-1}U \right)^{-1} VA^{-1}$$ where $$A$$ is an $$n \times n$$ matrix, $$C$$ is a $$k \times k$$ matrix, $$U$$ is an $$n \times k$$ matrix, and $$V$$ is a $$k \times n$$ matrix.
If we set $$A = I$$, $$C = \text{diag}(a_1,\ldots,a_k)$$, $$U = \begin{bmatrix}u_1 & \cdots & u_k\end{bmatrix}$$, and $$V = U^T$$, we obtain the formula:
$$\left(I + UCU^T \right)^{-1} = I - U \left(C^{-1} + U^TU \right)^{-1} U^T,$$ where the left side is equal to the expression you are interested in, and the right side only requires inverting a $$k \times k$$ matrix instead of an $$n \times n$$ matrix.