# Determinant of a block-matrix with constant diagonal and off-diagonal blocks

Consider $$M$$ an $$nN\times nN$$ block matrix which can be written as $$n\times n$$ blocks, with all the "diagonal" blocks equal $$A\in\mathbb{R}^{N\times N}$$ and all the "off-diagonal" blocks equal $$B\in\mathbb{R}^{N\times N}$$: $$\begin{bmatrix} A & B & \cdots \\ B & A & B &\cdots \\ \vdots & B & A &\cdots \\ & \vdots & B & \ddots & \\ \end{bmatrix}$$

What can be said about the determinant $$\det M$$ in terms of $$\det A$$ and $$\det B$$?

We start by doing for $$1\leqslant k\leqslant N$$ the operation $$C_k\leftarrow \sum_{j=0}^{N-1}C_{k+jN}$$; in this way, we get the same determinant as the initial matrix, where the first block column is $$\pmatrix{A+(n-1)B\\ \vdots\\A+(n-1)B}$$. Using a multiplication by the block diagonal matrix whose diagonal entries are successively $$A+(n-1)B$$, $$I_N$$,$$\dots$$,$$I_N$$, we get that $$\det\begin{bmatrix} A & B & \cdots \\ B & A & B &\cdots \\ \vdots & B & A &\cdots \\ & \vdots & B & \ddots & \\ \end{bmatrix}=\det(A+(n-1)B)\det\begin{bmatrix} I_N & B & \cdots \\ I_N & A & B &\cdots \\ \vdots & B & A &\cdots \\ I_N & \vdots & B & \ddots & \\ \end{bmatrix},$$ and we are reduced to compute the determinant of the same matrix as the starting one, except that all the matrices in the first block column are the identity. Now, observe that $$\det\begin{bmatrix} I_N & B & \cdots \\ I_N & A & B &\cdots \\ \vdots & B & A &\cdots \\ I_N & \vdots & B & \ddots & \\ \end{bmatrix}\det\begin{bmatrix} B & 0 & \cdots \\ 0 &I_N & 0 &\cdots \\ \vdots & 0 & I_N &\cdots \\ \\ 0& \vdots & 0 & & I_N \end{bmatrix}=\det\begin{bmatrix} B & B & \cdots \\ B & A & B &\cdots \\ \vdots & B & A &\cdots \\ B& \vdots & B & \ddots & \\ \end{bmatrix}$$ and the latter determinant is $$\det(B)\det(A-B)^{n-1}$$ (by doing $$C_{kN+i}\leftarrow C_{kN+i}-C_{(k-1)N+i}$$ first for $$k=n$$ then $$k=n-1$$ and so on) hence if $$B$$ is invertible, we get get $$\det\begin{bmatrix} A & B & \cdots \\ B & A & B &\cdots \\ \vdots & B & A &\cdots \\ & \vdots & B & \ddots & \\ \end{bmatrix}=\det(A+(n-1)B)(\det(A-B))^{n-1}.$$ By approximating $$B$$ by an invertible matrix and continuity of determinant, the previous formula is also valid for non-invertible $$B$$.