Find the inverse of the $n \times n$ matrix with ones on the main diagonal and $a$ off the main diagonal

inverselinear algebramatrices

I want to find the inverse of this $n\times n$ matrix, assuming it is invertible. The condition of invertible is discussed at Rank of the $n \times n$ matrix with ones on the main diagonal and $a$ off the main diagonal.

Now assume it is invertible. I need to find the inverse.

\begin{pmatrix}
1 & a & a & \cdots & \cdots & a \\
a & 1 & a & \cdots & \cdots & a \\
a & a & 1 & a & \cdots & a \\
\vdots & \vdots & a& \ddots & & \vdots\\
\vdots & \vdots & \vdots & & \ddots & \vdots \\
a & a & a & \cdots &\cdots & 1
\end{pmatrix}

Best Answer

$$ {\bf M}_n (a) := \begin{bmatrix} 1 & a & a & \dots & a & a\\ a & 1 & a & \dots & a & a\\ a & a & 1 & \dots & a & a\\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ a & a & a & \dots & 1 & a\\ a & a & a & \dots & a & 1\end{bmatrix} = (1-a) {\bf I}_n + a {\bf 1}_n {\bf 1}_n^{\top} $$

Using Sherman-Morrison,

$$ {\bf M}_n^{-1} (a) = \cdots = \color{blue}{\frac{1}{1 - a} \left( {\bf I}_n - \frac{a}{1 + (n-1) a} {\bf 1}_n {\bf 1}_n^{\top} \right)} $$

which is the matrix that Greg obtained via other means.