# Calculate $\lvert A \rvert$ if $a_{ij}=0$ if $i=j$ and $1$ otherwise [duplicate]

Let $n$ be a positive integer and let $A=[a_{ij}] \in M_{n\times n} (R)$ be the matrix defined by

$a_{ij}=0$ if $i=j$
$1$ otherwise

To be honest, I've only calculated determinants of matrices with numbers, nothing like this.

## marked as duplicate by Martin Sleziak, user147263, user1551 linear-algebra StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jul 1 '14 at 20:19

• correction made – cele Jul 1 '14 at 17:44
• And now the title is also fixed. – Hans Engler Jul 1 '14 at 17:48
• Did you try it with $n=1,2,3,4$? – Jonas Meyer Jul 1 '14 at 17:49
• This is a rank 1 perturbation of a diagonal matrix, so look at this post: math.stackexchange.com/questions/730134/… – Hans Engler Jul 1 '14 at 17:50
• @JonasMeyer no, I did not. I wasnt sure what to do at first. – cele Jul 1 '14 at 23:30

$$\left|\begin{array}\\ n-1&1&\cdots&1\\ 0&-1&\cdots&0\\ \vdots&\cdots&-1&0\\ 0&\cdots&&-1 \end{array}\right|=(-1)^{n-1}(n-1)$$
Another way is to use the fact that the determinant is the product of the eigenvalues. Let $B$ be the matrix with ones everywhere. Then $A=B-I$ it is easy to see that the eigenvalues of $B$ are $n$ with multiplicity $1$ and $0$ with multiplicity $n-1$. Now if $(B-I)v=\lambda v$ then $Bv=(\lambda +1)v$ so the eigenvalues of $B$ are $n-1$ with multiplicity $1$ and $-1$ with multiplicity $n-1$. This gives $(-1)^{n-1}(n-1)$ in agreement with the answer of Sami.