# Determinant of a specially structured matrix

I have the following $n\times n$ matrix:

$$A=\begin{bmatrix}a&b&\cdots&b\\b&a&\cdots&b\\\vdots& &\ddots&\vdots\\b&\cdots&b&a\end{bmatrix}$$

where $0 < b < a$.

I am interested in the expression for the determinant $\det[A]$ in terms of $a$, $b$ and $n$. This seems like a trivial problem, as the matrix $A$ has such a nice structure, but my linear algebra skills are pretty rusty and I can't figure it out. Any help would be appreciated.

-
Please do not use math displays in titles. – Mariano Suárez-Alvarez Nov 29 '11 at 6:23
This isn't a duplicate of math.stackexchange.com/questions/84206/… but the answer to this question appears in the answers to that question. – Gerry Myerson Nov 29 '11 at 6:23
There's a geometric, rather than algebraic, way of viewing it that makes it easy to understand. I've posted it below. – Michael Hardy Nov 29 '11 at 15:56
I've been away for a while -- I apologize for the late acceptance of an answer (I've looked at this before I left, but haven't had time to pick the best answer.) Also, @MarianoSuárez-Alvarez, I apologize for putting the matrix into the title... Thanks for correcting me on that. – M.B.M. Dec 13 '11 at 6:40

Add row 2 to row 1, add row 3 to row 1,..., add row $n$ to row 1, we get $$\det(A)=\begin{vmatrix} a+(n-1)b & a+(n-1)b & a+(n-1)b & \cdots & a+(n-1)b \\ b & a & b &\cdots & b \\ b & b & a &\cdots & b \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ b & b & b & \ldots & a \\ \end{vmatrix}$$ $$=(a+(n-1)b)\begin{vmatrix} 1 & 1 & 1 & \cdots & 1 \\ b & a & b &\cdots & b \\ b & b & a &\cdots & b \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ b & b & b & \ldots & a \\ \end{vmatrix}.$$ Now add $(-b)$ of row 1 to row 2, add $(-b)$ of row 1 to row 3,..., add $(-b)$ of row 1 to row $n$, we get $$\det(A)=(a+(n-1)b)\begin{vmatrix} 1 & 1 & 1 & \cdots & 1 \\ 0 & a-b & 0 &\cdots & 0 \\ 0 & 0 & a-b &\cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \ldots & a-b \\ \end{vmatrix}=(a+(n-1)b)(a-b)^{n-1}.$$

-
I like this solution due to its simplicity and elegance. Other solutions are great too. – M.B.M. Dec 13 '11 at 6:42
nice solution. easy to understand. – prasad Apr 22 '13 at 6:33

SFAICT this route hasn't been mentioned yet, so:

Consider the decomposition

$$\small\begin{pmatrix}a&b&\cdots&b\\b&a&\cdots&b\\\vdots&&\ddots&\vdots\\b&\cdots&b&a\end{pmatrix}=\begin{pmatrix}a-b&&&\\&a-b&&\\&&\ddots&\\&&&a-b\end{pmatrix}+\begin{pmatrix}\sqrt b\\\sqrt b\\\vdots\\\sqrt b\end{pmatrix}\cdot\begin{pmatrix}\sqrt b&\sqrt b&\cdots&\sqrt b\end{pmatrix}$$

Having this decomposition allows us to use the Sherman-Morrison-Woodbury formula for determinants:

$$\det(\mathbf A+\mathbf u\mathbf v^\top)=(1+\mathbf v^\top\mathbf A^{-1}\mathbf u)\det\mathbf A$$

where $\mathbf u$ and $\mathbf v$ are column vectors. The corresponding components are simple, and thus the formula is easily applied (letting $\mathbf e$ denote the column vector whose components are all $1$'s):

\begin{align*} \begin{vmatrix}a&b&\cdots&b\\b&a&\cdots&b\\\vdots&&\ddots&\vdots\\b&\cdots&b&a\end{vmatrix}&=\left(1+(\sqrt{b}\mathbf e)^\top\left(\frac{\sqrt{b}}{a-b}\mathbf e\right)\right)(a-b)^n\\ &=\left(1+\frac{nb}{a-b}\right)(a-b)^n=(a+(n-1)b)(a-b)^{n-1} \end{align*}

where we used the fact that $\mathbf e^\top\mathbf e=n$.

-
This is very pretty! – M.B.M. Jul 28 '12 at 5:35
Can't you put $\mathbf u:=\mathbf e$ and $\mathbf v:=b\mathbf e$ (or vice versa) to avoid the radicals? – yo' Oct 2 '15 at 20:09
@yo, yes, that can be done. – J. M. Oct 6 '15 at 12:49

Subtract the bottom row from each of the other rows, then expand along some convenient row or column.

-

This is indeed an easy problem. Let $J$ be the square matrix with every entry equal to $1$. Your problem is equivalent to finding the determinant of $\lambda I + \mu J$ for arbitrary $\lambda, \mu$. Let $v=\left(\frac1{\sqrt{n}}, \frac1{\sqrt{n}},\ldots,\frac1{\sqrt{n}}\right)^\top$ and $e=(1,0,\ldots,0)^\top$. Then $J=nvv^\top$. Take any orthogonal matrix with its first column equal to $v$. Then $V^\top(\lambda I + \mu J)V = \lambda I+\mu nee^\top = \textrm{diag}\left(\lambda+\mu n,\lambda,\ldots,\lambda\right)$. Hence $\det(\lambda I + \mu J) = (\lambda+\mu n)\lambda^{n-1}$. Put $\lambda=a-b$ and $\mu=b$, we get the answer to your question as $[a+(n-1)b](a-b)^{n-1}$.

-

Hint: We can assume that the ground ring is a field, and that $b\neq0$. Consider the subspace formed by the vectors with equal coordinates, and the subspace formed by the vectors whose coordinates add up to $0$; note that these two subspaces are eigenspaces; compute the corresponding eigenvalues; and conclude.

EDIT. To find the eigenspaces of $A$ you can add $b-a$ to it, to make all the entries equal to $b$. (Adding a scalar to $A$ doesn't affect the eigenspaces.)

-

The matrix can be diagonalized. All it takes is a bit of geometry. We have

$$A=\begin{bmatrix}a&b&\cdots&b\\b&a&\cdots&b\\\vdots& &\ddots&\vdots\\b&\cdots&b&a\end{bmatrix}.$$

This is a linear combination of the matrices $P$ and $Q=I-P$ where $P$ is the matrix of the orthogonal projection onto the $1$-dimensional space of column vectors in which all scalar components are equal, i.e. the space $$\left\{\begin{bmatrix} x \\ x \\ x \\ \vdots \\ x \end{bmatrix} : x \text{ is a scalar} \right\}.$$ We have $$P = \begin{bmatrix} 1/n & 1/n & \ldots & 1/n \\ 1/n & 1/n & \ldots & 1/n \\ \vdots & \vdots & & \vdots \\ 1/n & 1/n & \ldots & 1/n \end{bmatrix}$$ (all entries are $1/n$), so that $$P \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix} = \begin{bmatrix} \bar{x} \\ \bar{x} \\ \bar{x} \\ \vdots \\ \bar{x} \end{bmatrix}$$ where $\bar{x} = (x_1+\cdots+x_n)/n$ is the average of the components, and $$Q \begin{bmatrix} x_1 \\ \vdots \\ x_n \end{bmatrix} = \begin{bmatrix} x_1-\bar{x} \\ x_2-\bar{x} \\ x_3-\bar{x} \\ \vdots \\ x_n-\bar{x} \end{bmatrix}.$$ We want $$A = \alpha P + \beta Q.$$ Looking at the diagonal elements we have $$\alpha\cdot\frac 1n + \beta \left(1-\frac 1n\right) = a,$$ and from the off-diagonal elements we get $$\alpha\cdot\frac 1n - \beta \cdot\frac 1n =b.$$ Hence $$\alpha = a + (n-1)b \qquad\text{and}\qquad\beta= a-b.$$

Since $P$ projects orthogonally onto a $1$-dimensional subspace and $Q$ is the complementary orthogonal projection onto an $(n-1)$-dimensional subspace, the matrix $\alpha P+\beta Q$ can be diagonalized as $$\begin{pmatrix} \alpha \\ & \beta \\ & & \beta \\ & & & \beta \\ & & & & \ddots \\ & & & & & \beta \end{pmatrix}.$$ The determinant is therefore $$\alpha\beta^{n-1}.$$

-

Consider the $n\times n$ matrix $B$ with entries $-b$ everywhere, except on the main diagonal where it has entries $0$. Now $\det A=\det(aI-B)$ is just the value of the characteristic polynomial $\chi_B\in K[X]$ at $X=a$. For $X=b$ the matrix $bI-B$ clearly has rank at most$~1$ (all columns are equal), so by rank-nullity the eigenspace of $B$ for the eigenvalue $b$ has dimension at least $n-1$, and $\chi_B$ is divisible by $(X-b)^{n-1}$. The final eigenvalue must make their sum $\operatorname{tr}(B)=0$ so it is $-(n-1)b$, and the final factor of $\chi_B$ is $X+(n-1)b$. So$$\det A=\chi_B[X:=a] = (a-b)^{n-1}(a+(n-1)b).$$

-