Finding the inverse of a symmetric $28\times28$ matrix 
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.
 A: 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)$.
A: More generally, let
$$ {\bf A} := (n+1) \, {\bf I}_n - {\bf 1}_n {\bf 1}_n^\top $$
Note that $\bf A$ is a rank-$1$ update of a multiple of the identity matrix.  Using Sherman-Morrison,
$$ {\bf A}^{-1} = \cdots = \frac{1}{n+1} \left( {\bf I}_n + {\bf 1}_n {\bf 1}_n^\top \right) $$
A: let $W$   be the 28 by 28  matrix where every entry is $1.$  The simple fact is $$   W^2  = 28 W$$
Your matrix is
$$  A = 29 I - W $$
If there is an inverse matrix $B,$   it i of the same shape, some coefficients  $\beta, \gamma$  with
$$ B = \beta I + \gamma W$$
With these definitions, what values of $\beta, \gamma$   make $AB = I?$
