<s>[INST] 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. 
 [/INST] See in wikipedia the page of determinat in section 3.3 on the Block matrices. 
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
$$
</s>