<s>[INST] Calculating the determinant of a matrix $n\times n$ I was trying to calculate $detD_{1,1}$ when 
$$ D=\begin{pmatrix}0 & -1 & -1 & \ldots & \ldots & -1 & -1 & -1\\
0 & 2 & -1 & \ldots & \ldots & 0 & 0 & 0\\
0 & 0 & 2 & \ldots & \ldots & -1 & 0 & 0\\
\vdots & \vdots & \vdots & \ddots & \ldots & \vdots & \vdots & \vdots\\
\vdots & \vdots & \vdots & \ldots & \ddots & \vdots & \vdots & \vdots\\
0 & 0 & 0 & \ldots & \ldots & 2 & -1 & 0\\
0 & 0 & 0 & \ldots & \ldots & 0 & 2 & -1\\
0 & -1 & 0 & \ldots & \ldots & 0 & 0 & 2
\end{pmatrix}$$
I got to the following determinant of a matrix:
$$ \begin{vmatrix}0 & -1 & 0 & \ldots & \ldots & 0 & 0 & 4\\
0 & 0 & -1 & \ldots & \ldots & 0 & 0 & 8\\
0 & 0 & 0 & \ldots & \ldots & -1 & 0 & 16\\
\vdots & \vdots & \vdots & \ddots & \ldots & \vdots & \vdots & \vdots\\
\vdots & \vdots & \vdots & \ldots & \ddots & \vdots & \vdots & \vdots\\
0 & 0 & 0 & \ldots & \ldots & 0 & -1 & 2^{n-1}\\
0 & 0 & 0 & \ldots & \ldots & 0 & 2 & -1\\
-1 & 0 & 0 & \ldots & \ldots & 0 & 0 & 2
\end{vmatrix}$$
But now I'm stuck. How can I continue from here? If there was no $-1$ at the bottom I could just multiplate the diagonal.
 [/INST] Move the bottom row of the matrix to the top (permuting the rows cyclically) to find
$$ 
\begin{vmatrix}0 & -1 & 0 & \ldots & \ldots & 0 & 0 & 4\\
0 & 0 & -1 & \ldots & \ldots & 0 & 0 & 8\\
0 & 0 & 0 & \ldots & \ldots & -1 & 0 & 16\\
\vdots & \vdots & \vdots & \ddots & \ldots & \vdots & \vdots & \vdots\\
\vdots & \vdots & \vdots & \ldots & \ddots & \vdots & \vdots & \vdots\\
0 & 0 & 0 & \ldots & \ldots & 0 & -1 & 2^{n-1}\\
0 & 0 & 0 & \ldots & \ldots & 0 & 2 & -1\\
-1 & 0 & 0 & \ldots & \ldots & 0 & 0 & 2
\end{vmatrix} = \\
(-1)^{n-1}
\begin{vmatrix}
-1 & 0 & 0 & \ldots & \ldots & 0 & 0 & 2\\
0 & -1 & 0 & \ldots & \ldots & 0 & 0 & 4\\
0 & 0 & -1 & \ldots & \ldots & 0 & 0 & 8\\
0 & 0 & 0 & \ldots & \ldots & -1 & 0 & 16\\
\vdots & \vdots & \vdots & \ddots & \ldots & \vdots & \vdots & \vdots\\
\vdots & \vdots & \vdots & \ldots & \ddots & \vdots & \vdots & \vdots\\
0 & 0 & 0 & \ldots & \ldots & 0 & -1 & 2^{n-1}\\
0 & 0 & 0 & \ldots & \ldots & 0 & 2 & -1
\end{vmatrix}
$$
Because this matrix is block upper-triangular, we can compute
$$
\begin{vmatrix}
-1 & 0 & 0 & \ldots & \ldots & 0 & 0 & 2\\
0 & -1 & 0 & \ldots & \ldots & 0 & 0 & 4\\
0 & 0 & -1 & \ldots & \ldots & 0 & 0 & 8\\
0 & 0 & 0 & \ldots & \ldots & -1 & 0 & 16\\
\vdots & \vdots & \vdots & \ddots & \ldots & \vdots & \vdots & \vdots\\
\vdots & \vdots & \vdots & \ldots & \ddots & \vdots & \vdots & \vdots\\
0 & 0 & 0 & \ldots & \ldots & 0 & -1 & 2^{n-1}\\
0 & 0 & 0 & \ldots & \ldots & 0 & 2 & -1
\end{vmatrix} = (-1)^{n-2} \det \begin{vmatrix}-1&2^{n-1}\\2&-1\end{vmatrix}
$$
</s>