# Inverting a matrix with the same diagonal entries in a particular form

Hi I'm struggling with this inversion and any help would be greatly appreciated.

I want to invert the following $$\mathbb R^{m\times m}$$ matrix $$\begin{bmatrix} 1 + m & m & \dots & \dots & m \\ m & 1+m & m & \dots & m\\ \dots & \dots &\dots & \dots & \dots\\ m & m & m & \dots & 1 +m \end{bmatrix}$$ such that it is of the following form: $$I - \gamma \textbf{u}\textbf{u}^T$$ for a constant $$\gamma$$ that I need to find, and $$\textbf{u} = \begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix} \in \mathbb R^m.$$

So the matrix to invert is square and has $$1+m$$ in all its diagonal entries and $$m$$ everywhere else, not sure if there is a special way to invert such a matrix. Thanks.

## 1 Answer

The solution is $$\gamma=\frac{m}{m^2+1}$$.

When writing out the product of the matrix that needs to be inverted with the proposed form of the inverse: $$\begin{equation} \begin{bmatrix} 1 + m & m & \dots & m \\ m & 1+m & \ddots & \vdots\\ \vdots & \ddots &\ddots & m\\ m & \dots & m & 1 +m \end{bmatrix} \begin{bmatrix} 1-\gamma & -\gamma & \dots & -\gamma \\ -\gamma & 1-\gamma & \ddots & \vdots\\ \vdots & \ddots &\ddots & -\gamma\\ -\gamma & \dots & -\gamma & 1-\gamma \end{bmatrix} = \begin{bmatrix} 1 & 0 & \dots & 0 \\ 0 & 1 & \ddots & \vdots\\ \vdots & \ddots &\ddots & 0\\ 0 & \dots & 0 & 1 \end{bmatrix} \end{equation}$$ you'll notice that for each diagonal element of the resulting identity matrix, you have $$\begin{equation} (1+m)(1-\gamma) + (m-1) m (-\gamma) = 1 \end{equation}$$ while on the off-diagonal, you have $$\begin{equation} m (1-\gamma) + (1+m)(-\gamma) + (m-2)m(-\gamma) = 0 \end{equation}$$ Both equations have the same solution for $$\gamma$$, namely $$\gamma=\frac{m}{m^2+1}$$.

• Thank you! That makes a lot of sense i don't know why i never thought to do that myself, thanks again for your help. – user649959 Mar 2 at 19:16