# Fast way to calculate determinant for a block matrix

I have a block matrix

$$Q_{(n+m-1)\times(n+m-1)} = \begin{pmatrix} A & -J\\-J^t & B \end{pmatrix}$$

where

$$A_{(m-1)\times(m-1)} = n*I_{(m-1)\times(m-1)} \text{ and } B_{n\times n} = m*I_{n\times n}$$

where $I$ is identity matrix. $J$ is then $(m-1)\times n$ matrix with all entries $1$.

For example, when $m = 4, n = 2$ we have

$$Q_{5\times 5} = \begin{pmatrix} 2 & 0 & 0 & -1 & -1\\ 0 & 2 & 0 & -1 & -1\\0&0&2&-1&-1\\-1&-1&-1&4&0\\-1&-1&-1&0&4\end{pmatrix}$$

Answer is $n^{m-1}\cdot m^{n-1}$ but I don't know how to show that. Please help. Thank you.

-
See here the formulae for the determinant of block matrices under assumptions which are satisfied in your case, as $A$ is invertible, for instance. –  1015 Apr 9 '13 at 13:09

When $A$ is Invertible matrix, we have $$\det\begin{pmatrix}A& B\\ C& D\end{pmatrix} = \det(A) \det(D - C A^{-1} B).$$
When $D$ is invertible, a similar identity with $\det(D)$ factored out can be derived analogously,
$$\det\begin{pmatrix}A& B\\ C& D\end{pmatrix} = \det(D) \det(A - B D^{-1} C).$$ In this case \begin{align} \det\begin{pmatrix}A & -J \\ -J^T & B \end{pmatrix}= & \det A \cdot \det\big( B-JA^{-1}J^T \big) \\ = & n^{m-1}\det \left[ \begin{array}{c} m & m-1 & \ldots & m-1 & m-1\\ m-1 & m & \ldots & m-1 & m-1\\ \vdots & \vdots & \ddots &\vdots & \vdots\\ m-1 & m-1 & \ldots & m & m-1\\ m-1 & m-1 & \ldots & m-1 & m\\ \end{array} \right]_{n\times n} \end{align} Now, note that $$\left[ \begin{array}{c} m & \ldots & m-1 & \ldots & m-1\\ m-1 &\ldots & m-1 & \ldots & m-1\\ \vdots & & \vdots & & \vdots\\ m-1 & & m & & m-1\\ \vdots & & \vdots & & \vdots\\ m-1 &\ldots & m-1 & \ldots & m-1\\ m-1 &\ldots & m-1 & \ldots & m\\ \end{array} \right]_{n\times n} \left[ \begin{array}{c} 1\\ 1\\ \vdots\\ 0\\ \vdots\\ 1\\ 1\\ \end{array} \right] = (m-1) \left[ \begin{array}{c} 1\\ 1\\ \vdots\\ 0\\ \vdots\\ 1\\ 1\\ \end{array} \right]$$ implies $$\det \left[ \begin{array}{c} m & \ldots & m-1 & \ldots & m-1\\ m-1 &\ldots & m-1 & \ldots & m-1\\ \vdots & & \vdots & & \vdots\\ m-1 & & m & & m-1\\ \vdots & & \vdots & & \vdots\\ m-1 &\ldots & m-1 & \ldots & m-1\\ m-1 &\ldots & m-1 & \ldots & m\\ \end{array} \right]_{n\times n} = (m-1)^n$$ and then $$\det\begin{pmatrix}A & -J \\ -J^T & B \end{pmatrix}=n^{m-1}\cdot (m-1)^n$$
I arrived there as well, I was thinking what can we say about $(m-1)*J+I$. I think using $eig((m-1)*J)$ and $eig((m-1)*J+I)$, and that $det = \prod_{i} \lambda_i$, we can arrive at correct result. –  mez Apr 9 '13 at 16:00
There are some mistakes in your answer though. $\det A = n^{m-1}$ and that $B-JAJ^{T} = B-\frac{1}{n}JJ^{T}$, but idea in general is correct. –  mez Apr 14 '13 at 10:36