Matrix with zeros on diagonal and ones in other places is invertible
Solution 1:
If you have studied eigenvalues and eigenvectors there is a very easy proof.
Let $A$ be your $n\times n$ matrix, with $n\ge2$. Then $A+I$ is the matrix consisting entirely of $1$s, which clearly has $n-1$ zero rows after row-reduction. Therefore $A$ has eigenvalue $-1$, repeated (at least) $n-1$ times, and since ${\rm trace}(A)=0$, the other eigenvalue is $n-1$.
Since every eigenvalue of $A$ is non-zero, the determinant of $A$ is non-zero, so $A$ is invertible.
Solution 2:
This is easy to calculate by row reduction:
Add all rows to first: $$\det(A) =\det \begin{bmatrix} 0 & 1 & 1 &...&1 \\ 1 & 0 & 1 &...&1 \\ 1 & 1 & 0 &...&1 \\ ... & ... & ... &...&... \\ 1 & 1 & 1 &...&0 \\ \end{bmatrix}=\det \begin{bmatrix} n-1 & n-1 & n-1 &...&n-1 \\ 1 & 0 & 1 &...&1 \\ 1 & 1 & 0 &...&1 \\ ... & ... & ... &...&... \\ 1 & 1 & 1 &...&0 \\ \end{bmatrix} \\ =(n-1)\det \begin{bmatrix} 1 & 1 & 1 &...&1 \\ 1 & 0 & 1 &...&1 \\ 1 & 1 & 0 &...&1 \\ ... & ... & ... &...&... \\ 1 & 1 & 1 &...&0 \\ \end{bmatrix}=(n-1)\det \begin{bmatrix} 1 & 1 & 1 &...&1 \\ 0 & -1 & 0 &...&0 \\ 0 & 0 & -1 &...&0 \\ ... & ... & ... &...&... \\ 0 & 0 & 0 &...&-1 \\ \end{bmatrix}$$
where in the last row operation I subtracted the first row from each other row.
This shows $$\det(A)=(n-1)(-1)^{n-1}$$