TITLE: Inverse of a matrix having zeroes in diagonal and one elsewhere
QUESTION [5 upvotes]: Could any one help me to find inverse of such matrix? I observed that $A=  J-I$, where J is a matrix having all entries 1.
Thanks for helping.

REPLY [5 votes]: Note that the rank of $J$ is 1 because its range is spanned by $(1, \cdots, 1)$. Moreover $(1, \cdots, 1)$ is an eigenvector with eigenvalue $n$. Thus  eigenvalues of $J$ are $n$ and $0$ (with multiplicity $n-1$). So the eigenvalues of $A$ are $n-1$ and $-1$ (with multiplicity $n-1$). The minimal polynomial of $A$ is then 
\begin{align*} (A-(n-1)I)(A+I)&=0\\
 A^2-(n-2)A-(n-1)I&=0\\
 A(A-(n-2)I)&=(n-1)I \\
 A^{-1} &=\frac{1}{n-1}(A-(n-2)I)\end{align*}