Finding the inverse of a symmetric $28\times28$ matrix

inverselinear algebramatrices

Let $A$ be a $28 \times 28$ matrix whose $(i,j)$-th entry is $$ a_{ij} = \begin{cases} 28 &\text{if } i = j\\ -1 &\text{if } i \neq j \end{cases} $$ What is the inverse of this matrix?


I tried doing it by the adjoint method, but my resolution is wrong. First I tried finding the determinant of $A$, which I believe to be $\det(A) =28^{28}+27-14\cdot28^2-14$. Then, I tried finding the cofactor of $a_{ij}$ where $i=j$, which I believe is $\operatorname{cof}(28) =28^{27}-27-28^3$ and also the cofactor of $a_{ij} $ where $i\neq j$ which I calculated to be $\operatorname{cof}(-1)=28^{26}+27-1+27\cdot28$. Since the matrix is symmetric, I thought that the cofactor matrix is equal to the adjoint matrix, so the elements of the inverse matrix would be:
$$a_{ii}^{-1}=\frac{\operatorname{cof}(28)}{\det(A)}$$ and
$$a_{ij}^{-1}=\frac{\operatorname{cof}(-1)}{\det(A)}$$
where $i\neq j$. But this doesn't give the correct value. I think it might be a simple mistake, but I really can't find it so any help would be appreciated.

Best Answer

Here is an another way:

Note that $A=29I - e e^T$, where $e$ is a vector of ones. It is straightforward to check that the eigenvalues are $1,29$ hence it is invertible.

To compute $A^{-1}$, solve $Ax=b$.

This is $29x-(e^Tx)e = b$, hence $29 e^T x -(e^Tx)e^T e = e^T b $, or $e^T x = e^T b$. The first equation can be written as $29 x = (e^T b)e+b=(I+e e^T)b $, and so $x = {1 \over 29} (I+e e^T)b $, from which we get $A^{-1} = {1 \over 29} (I+e e^T)$.