# 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

Add all the columns to the first one and then subtract the first row from the others we find

$$\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.

• We posted very near answers at nearly the same time. I deleted mine. – Jonas Meyer Jul 1 '14 at 18:10
• I noticed that. There was no need to delete it, it would have been upvoted. – Rene Schipperus Jul 1 '14 at 18:12
• I agree it is not needed, but I think it is more useful deleted. – Jonas Meyer Jul 1 '14 at 18:13
• I think that often times different verbalizations of the same result, proof, solution, etc., will appeal to, or be clear to, different readers. So I don't mind multiple expressions of the same line of thought. You never know what will "hit" a given reader. Cheers! – Robert Lewis Jul 1 '14 at 18:52
• @RobertLewis, I agree. I have looked at different solutions to the same problem and found myself confused with some approaches but clearer with others. – cele Jul 1 '14 at 23:32