Let us look the the matrix

$\left(\begin{array}{ccccc} a & b & b & b & b\\ b & a & b & b & b\\ b & b & a & b & b\\ b & b & b & a & b\\ b & b & b & b & a \end{array}\right)$

It has one value, $a$, on the main diagonal, and another value, $b$ everywhere else. Let us assume that we are over a ring and that $a$ is invertible.

I wish to find the determinant of every $n\times n$ matrix of this form ($a$ on the diagonal, $b$ everywhere else). Using row and column operations I have managed to transform the matrix to upper-triangular form and found formula for specific cases. Generalizing it I got to the following formula:

$\det(A) = a\left(a-b\right)^{n-2}\left(a+\left(n-2\right)b-\frac{\left(n-1\right)b^{2}}{a}\right)$

I think I can prove it with row-operations in the general case with a little patience.

However, I'm wondering if there is a "smart" way of getting to this formula that I'm missing and if there is a nicer representation of it. Also, what can be said when $a$ is not invertible? (esp. the case where we are over a field and $a=0$).


marked as duplicate by Dietrich Burde, Lord Shark the Unknown, Martin Argerami linear-algebra Jan 31 at 4:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Add all the columns to the first column it becomes a column where all its entries equal to $a+(n-1)b$. Now substract the first row from the other rows we obtain the determinant:

$$\left|\begin{array}{ccccc} a+(n-1)b & b &\cdots& b & b & b\\ 0 & a-b &\cdots& 0 & 0 & 0\\ 0 & 0 &\cdots& a-b & 0 & 0\\ 0& 0 &\cdots&\cdot 0 & a-b & 0\\ 0 & 0&\cdots & 0 & 0 & a-b \end{array}\right|=(a+(n-1)b)(a-b)^{n-1}$$


Yes, your matrix is $b J + (a-b)I,$ where $J$ is the matrix of ones. It has rank one, and eigenvalues $n, 0, \dotsc, 0.$ Sine it commutes with the identity (like everything else), the eigenvalues of the sum are $b n + (a-b) = (n-1) b + a,$ and the rest $a-b$s.


Not the answer you're looking for? Browse other questions tagged or ask your own question.