Determinant of a $k \times k$ block matrix Consider the $k \times k$ block matrix:
$$C = \left(\begin{array}{ccccc} A & B & B & \cdots & B \\ B & A & B &\cdots & B \\ \vdots & \vdots & \vdots & \ddots & 
\vdots \\ B & B & B & \cdots & A
\end{array}\right) = I_k \otimes (A - B) + \mathbb{1}_k \otimes B$$
where $A$ and $B$ are size $n \times n$ and $\mathbb{1}$ is the matrix of all ones.
It would seem that the formula for the determinant of $C$ is simply:
$$\det(C) = \det(A-B)^{k-1} \det(A+(k-1) B)$$
Can anyone explain why this seems to be true or offer a proof or direct me to a proof?
 A: Let us assume that $A-B$ is invertible. Write
$$\begin{array}{rl} C &= \begin{bmatrix} A & B & \ldots & B\\ B & A & \ldots & B\\ \vdots & \vdots & \ddots & \vdots\\B & B & \ldots & A\end{bmatrix}\\\\ &= \begin{bmatrix} A-B & O_n & \ldots & O_n\\ O_n & A-B & \ldots & O_n\\ \vdots & \vdots & \ddots & \vdots\\ O_n & O_n & \ldots & A-B \end{bmatrix} + \begin{bmatrix} B \\ B\\ \vdots \\ B\end{bmatrix} \begin{bmatrix} I_n \\ I_n\\ \vdots \\ I_n\end{bmatrix}^T\\\\ &= (I_k \otimes (A-B)) + (1_k \otimes B) (1_k \otimes I_n)^T\\\\ &= (I_k \otimes (A-B)) \left(I_{nk} + (I_k \otimes (A-B)^{-1}) (1_k \otimes B) (1_k \otimes I_n)^T\right)\end{array}$$
Using Sylvester's determinant identity,
$$\begin{array}{rl} \det (C) &= \det\left((I_k \otimes (A-B)) \left(I_{nk} + (I_k \otimes (A-B)^{-1}) (1_k \otimes B) (1_k \otimes I_n)^T\right)\right)\\\\ &= \det(I_k \otimes (A-B)) \cdot \det \left( I_{nk} + (I_k \otimes (A-B)^{-1}) (1_k \otimes B) (1_k \otimes I_n)^T \right)\\\\ &= \det(I_k \otimes (A-B)) \cdot \det \left( I_{n} + (1_k \otimes I_n)^T (I_k \otimes (A-B)^{-1}) (1_k \otimes B) \right)\\\\ &= \left(\det(A - B)\right)^k \cdot \det \left( I_{n} + k (A-B)^{-1} B \right)\\\\ &= \det((A-B)^k) \cdot \det \left( I_{n} + k (A-B)^{-1} B \right)\\\\ &= \det((A-B)^{k-1}) \cdot \det \left( A-B + k B \right)\\\\ &= (\det(A-B))^{k-1} \cdot \det \left( A + (k-1) B \right)\end{array}$$
A: We can just manipulate $C$ in the usual way by row operations: Subtract the last "row" from all the other "rows" (this is really several traditional row operations done at once). This produces
$$
\begin{pmatrix} A- B &0& 0 & \ldots & 0 &B-A \\
0 & A-B &0 &\ldots & 0 & B-A\\
&& \ldots &&&\\
B & B & B & \ldots & B & A \end{pmatrix} .
$$
Assume for the moment that $A-B$ is invertible. Subtract $B(A-B)^{-1}$ times all the other rows from the last row; we multiply from the left so that we indeed obtain linear combinations of the rows. This gives an upper triangular matrix with diagonal entries $A-B$ ($k-1$ times) and $A+(k-1)B$. We now read off the asserted formula.
The invertible matrices are dense, so I obtain the general case by approximation.
A: Subtracting the last row of blocks from the first $k-1$ rows of blocks, we obtain
$$\begin{bmatrix}A-B & O & O & \dots & O & B-A\\ O & A-B & O & \dots & O & B-A\\ O & O & A-B & \dots & O & B-A\\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ O & O & O & \dots & A-B & B-A\\ B & B & B & \dots & B & A\end{bmatrix}$$
which is the first step in Remling's answer. Adding the first $k-1$ columns of blocks to the last column of blocks, we obtain a block lower triangular matrix
$$\begin{bmatrix}A-B & O & O & \dots & O & O\\ O & A-B & O & \dots & O & O\\ O & O & A-B & \dots & O & O\\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ O & O & O & \dots & A-B & O\\ B & B & B & \dots & B & M_k (A,B)\end{bmatrix}$$
where $M_k (A,B) = A+(k-1)B$. The determinant of this block lower triangular matrix is
$$(\det(A-B))^{k-1} \det(M_k (A,B)) = (\det(A-B))^{k-1} \det (A + (k-1) B)$$
Thus,
$$\det(C) = (\det(A-B))^{k-1} \det (A + (k-1) B)$$
