# How do i find the determinant of this nxn matrix?

I have the following matrix with dimensions nxn: $$\begin{bmatrix} -2 & x & x & \cdots & x \\ x & -2 & x & \cdots & x \\ x & x & -2 & \cdots & x \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ x & x & x & \cdots & -2 \\ \end{bmatrix}$$

I need to find the determinant of it. I'm in the cofactors & cramer rule section, so i think i need to make use of them.

• Similar to math.stackexchange.com/questions/1449447/…. – lhf Sep 29 '15 at 23:34
• What have you tried? – Robert Shore Aug 13 at 0:01
• I added the first column to the others and put (nm + x) in evidence. got $(nm + x).x ^{n-1}$, but the feedback doesnt say this – the cat Aug 13 at 0:39

## 4 Answers

Here's a solution with row operations and cofactors, as requested.

Subtract the bottom row from all other rows, then expand the determinant using the first column. There are two terms, one involving the determinant of an upper triangular matrix, which is the product of the diagonal elements, and another involving the determinant of a similar matrix with decremented dimension, for which you can use induction. (The formula derived in my other answer can help you work out the induction.)

• Thank you very much, this was exactly what i was looking for – agos46 Sep 30 '15 at 0:11

Denote the dimension of the matrix by $n$. Adding $x+2$ on the diagonal yields a matrix with an $(n-1)$-fold eigenvalue of $0$, so $-(x+2)$ is an $(n-1)$-fold eigenvalue. Also, subtracting $(n-1)x-2$ yields a degenerate matrix (since its columns sum to $0$), so this is the $n$-th eigenvalue. The determinant is the product of the eigenvalues, $((n-1)x-2)(-(x+2))^{n-1}$.

• Thanks for your answer!, but i'm really starting linear algebra so i think i must solve this problem with row operations, cofactors or factorization – agos46 Sep 29 '15 at 23:43
• @agos46: OK; I posted another answer that uses only row operations and cofactors (and induction). – joriki Sep 29 '15 at 23:52

The simplest is in two steps:

• substract the last row to the $n-1$ first row; the yields the determinant: $$\begin{vmatrix} -(x+2)&0&0&\dots&0& x+2 \\ 0&-(x+2)&0&\dots&0& x+2 \\ 0&0&-(x+2)&\dots&0& x+2 \\ \vdots&&&&&\vdots\\ 0&0&0&\dots&-(x+2)& x+2\\ x&x&x&\dots&x&-2 \end{vmatrix}$$
• add each of the $n-1$ first columns to the last one: $$\begin{vmatrix} -(x+2)&0&0&\dots&0& 0 \\ 0&-(x+2)&0&\dots&0& 0 \\ 0&0&-(x+2)&\dots&0& 0 \\ \vdots&&&&&\vdots\\ 0&0&0&\dots&-(x+2)& 0\\ x&x&x&\dots&x&(n-1)x-2 \end{vmatrix}$$ Finally, you obtain a lower triangular determinant. Such determinany=ts are equal to the product of the elemnts on the diagonal. If you're not supposed to kniw that, just develop the determinant along the last column. You get $$(-1)^{n-1}(x+2)^{n-1}\bigl((n-1)x-2\bigr).$$

More generally:

Given two numbers $$m$$ and $$x$$. Compute the determinant of the $$n\times n$$-matrix whose entries on the main diagonal all equal $$m+x$$ and whose remaining $$n\left(n-1\right)$$ entries all equal $$m$$.

Hint:

The determinant is

$$\begin{vmatrix} m+x&m&m&\dots &m &m\\ m&m+x&m&\dots&m&m\\ m&m&m+x&\dots &m&m\\ \vdots & \vdots &\vdots &&\vdots &\vdots \\ m&m &m&\dots &m+x& m \\ m&m&m&\dots &m&m+x \end{vmatrix}$$ Subtracting the 2nd row from the 1st, then the 3rd from the 2bd, &c., you obtain $$\begin{vmatrix} x&-x&0&\dots &0 &0\\ 0&x&-x&\dots&0&0\\ 0&0&x&\dots &0&0\\ \vdots & \vdots &\vdots &&\vdots &\vdots \\ 0&0 &0&\dots &x& -x\\ m&m&m&\dots &m&m+x \end{vmatrix} =x^{n-1}\begin{vmatrix} 1&-1&0&\dots &0 &0\\ 0&1&-1&\dots&0&0\\ 0&0&1&\dots &0&0\\ \vdots & \vdots &\vdots &&\vdots &\vdots \\ 0&0 &0&\dots &1& -1\\ m&m&m&\dots &m&m+x \end{vmatrix}$$ Can you prove inductively the latter determinant is equal to $$x+mn$$? You just have to play with the column vectors.

Added: As @JeanMarie kindly reminded me, I (long ago) posted an answer to a similar problem which was simpler:

First subtract the last row from each row above, to obtain $$\begin{vmatrix} x&0 &0&\dots &0 &-x\\ 0&x&0&\dots&0&-x\\ 0&0&x&\dots &0&-x\\ \vdots & \vdots &\vdots &&\vdots &\vdots \\ 0&0 &0&\dots &x& -x\\ m&m&m&\dots &m&m+x \end{vmatrix}$$ then add all previous columns to the last column: you get the triangular matrix $$\begin{vmatrix} x&0 &0&\dots &0 &0\\ 0&x&0&\dots&0&0\\ 0&0&x&\dots &0&0\\ \vdots & \vdots &\vdots &&\vdots &\vdots \\ 0&0 &0&\dots &x& 0\\ m&m&m&\dots &m&mn+x \end{vmatrix}$$

• The solution you give here is less simple that the solution you gave there some years ago for a similar issue ;) – Jean Marie Aug 14 at 4:38
• I had found your latter answer so simple by comparison with those we had given to this very recent question (too!) math.stackexchange.com/q/3322260 – Jean Marie Aug 14 at 4:43
• @JeanMarie: Indeed it was simpler. I had completely forgotten it. I think I'll edit my answer to add it. Thank you for reminding me! – Bernard Aug 14 at 8:46