<s>[INST] $n^{th}$ determinant Find determinant $D_n$ of matrix $$
        \begin{bmatrix}
        1 & 1 & \cdots & 1 & -n \\
        1 & 1 & \cdots & -n & 1 \\
        \vdots & \vdots & \ddots & \vdots & \vdots \\
        1 & -n & \cdots & 1 & 1 \\
        -n & 1 & \cdots & 1 & 1
        \end{bmatrix}
$$
After multiplying first row by $-1$ and adding to $n-1$ rows:
$$
        \begin{vmatrix}
        1 & 1 & \cdots & 1 & -n \\
        0 & 0 & \cdots & -n-1 & n+1 \\
        \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & -n-1 & \cdots & 0 & n+1 \\
        -n & 1 & \cdots & 1 & 1
        \end{vmatrix}
$$
Second and $n-1$ row are changing place:
$$
        \begin{vmatrix}
        1 & 1 & \cdots & 1 & -n \\
        0 & -n-1 & \cdots & 0 & n+1 \\
        \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & 0 & \cdots & -n-1 & n+1 \\
        -n & 1 & \cdots & 1 & 1
        \end{vmatrix}
$$
Multiplying first row by $n$ and adding it to $n$-th row:
$$
        \begin{vmatrix}
        1 & 1 & \cdots & 1 & -n \\
        0 & -n-1 & \cdots & 0 & n+1 \\
        \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & 0 & \cdots & -n-1 & n+1 \\
        0 & n+1 & \cdots & n+1 & 1-n^2
        \end{vmatrix}
$$
Adding second to $n$-th row:
$$
        \begin{vmatrix}
        1 & 1 & \cdots & 1 & -n \\
        0 & -n-1 & \cdots & 0 & n+1 \\
        \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & 0 & \cdots & -n-1 & n+1 \\
        0 & 0 & \cdots & n+1 & (1+n)(2-n)
        \end{vmatrix}
$$
Adding $n-1$ to $n$-th row:
$$
        \begin{vmatrix}
        1 & 1 & \cdots & 1 & -n \\
        0 & -n-1 & \cdots & 0 & n+1 \\
        \vdots & \vdots & \ddots & \vdots & \vdots \\
        0 & 0 & \cdots & -n-1 & n+1 \\
        0 & 0 & \cdots & 0 & (1+n)(3-n)
        \end{vmatrix}
$$
Product on main diagonal gives $$D_n=(n+1)(3-n)(-n-1)^{n-2}$$
This is not correct. What is wrong with this upper triangular transformation?
 [/INST] An easier way to do that: 


*

*Step $1$: Add the $2$nd, $3$rd, $\ldots$, $n$th row to the first row to get
$$\begin{bmatrix}
-1 & -1 & \cdots & -1 & -1\\
1 & 1 & \cdots & -n & 1 \\
\vdots & \vdots & \ddots & \vdots & \vdots \\
1 & -n & \cdots & 1 & 1 \\
-n & 1 & \cdots & 1 & 1 \\
\end{bmatrix}$$

*Step $2$: Add the first row to the $2$nd, $\ldots$, $n$th row respectively to get:
$$\begin{bmatrix}
-1 & -1 & \cdots & -1 & -1\\
0 & 0 & \cdots & -n - 1 & 0 \\
\vdots & \vdots & \ddots & \vdots & \vdots \\
0 & -n - 1 & \cdots & 0 & 0 \\
-n - 1 & 0 & \cdots & 0 & 0 \\
\end{bmatrix}$$

*Step $3$: Expand the determinant along the $n$th column to get
$$\det(D_n) = (-1)^{1 + n}(-1)\det(B) = (-1)^{n + 2}\det(B),$$
where $B$ is the anti-diagonal matrix
$$\begin{bmatrix}
0 & 0 & \cdots & -n - 1 \\
\vdots & \vdots & \ddots & \vdots \\
0 & -n - 1 & \cdots & 0 \\
-n - 1 & 0 & \cdots & 0 \\
\end{bmatrix}$$
For any $m \times m$ anti-diagnoal matrix $D$
$$D = \begin{bmatrix}
0 &  \cdots & d \\
\vdots  & \ddots & \vdots \\
d &  \cdots & 0 \\
\end{bmatrix},$$
we have $$\det(D) = \begin{cases} 
(-1)^{m/2}d^m & d \text{ is even},\\
(-1)^{(m - 1)/2}d^m & d \text{ is odd}.
\end{cases}$$
Therefore,
\begin{align}
\det(D_n) = & (-1)^{n + 2}\begin{cases}
(-1)^{(n - 1)/2}(-n - 1)^{n - 1} & n - 1 \text{ is even}, \\
(-1)^{(n - 1 - 1)/2}(-n - 1)^{n - 1} & n - 1 \text{ is odd}.
\end{cases} \\
= & \begin{cases}
(-1)^{\frac{5n + 1}{2}}(n + 1)^{n - 1} & n \text{ is odd}, \\
(-1)^{\frac{5n}{2}}(n + 1)^{n - 1} & n \text{ is even}.
\end{cases} \\
\end{align}
</s>