Calculate the determinant of the following n x n symmetric matrix:

Hint. Consider the second-order differences of the rows. When $n\ge3$, $$ \pmatrix{1&-2&1\\ &1&-2&1\\ &&\ddots&\ddots&\ddots\\ &&&1&-2&1\\ &&&&1&0\\ &&&&&1}A_n =\pmatrix{0&2\\ \vdots&0&\ddots\\ \vdots&\ddots&\ddots&\ddots\\ 0&\cdots&\cdots&0&2\\ n-2&n-3&\cdots&1&0&1\\ n-1&n-2&\cdots&\cdots&1&0}. $$


You can take this approach:
$$A_n=\begin{bmatrix} 0&1&2& .&.&. &n-1\\ 1&0&1&2& .&.&n-2 \\ 2&1&0&1&.&.&. \\ .&.&.&.&.&.&. \\ .&.&.&.&.&.&2 \\ .&.&.&.&.&.&1 \\ n-1&n-2&.&.&2&1&0 \end{bmatrix} $$ Now, add the last column to the first one, notice it will always be equal to $n-1$. $(C_1 = C_1+C_n)$

$$\begin{bmatrix} n-1&1&2& .&.&. &n-1\\ n-1&0&1&2& .&.&n-2 \\ n-1&1&0&1&.&.&. \\ .&.&.&.&.&.&. \\ .&.&.&.&.&.&2 \\ .&.&.&.&.&.&1 \\ n-1&n-2&.&.&2&1&0 \end{bmatrix} =(n-1)\begin{bmatrix} 1&1&2& .&.&. &n-1\\ 1&0&1&2& .&.&n-2 \\ 1&1&0&1&.&.&. \\ .&.&.&.&.&.&. \\ .&.&.&.&.&.&2 \\ .&.&.&.&.&.&1 \\ 1&n-2&.&.&2&1&0 \end{bmatrix}$$ From here, we can do as follows:
go from the last row towards the first and decrease each row's value with the one above it (for any row but the first one). ($\forall i \neq 1, R_i=R_i-R_{i-1}$, Starting with $i=n$ then $i=n-1 ... i=2$) $$ = (n-1)\begin{bmatrix} 1&1&2& .&.&. &n-1\\ 0&-1&-1&-1& .&.&-1 \\ 0&1&-1&-1&.&.&. \\ .&.&.&.&.&.&. \\ .&.&.&.&.&.&-1 \\ .&.&.&.&.&.&-1 \\ 0&1&.&.&1&1&-1 \end{bmatrix}$$ Expand $C_1$: $$ = (n-1)\begin{bmatrix} -1&-1&-1& .&.&-1 \\ 1&-1&-1&.&.&. \\ .&.&.&.&.&. \\ .&.&.&.&.&-1 \\ .&.&.&.&.&-1 \\ 1&.&.&1&1&-1 \end{bmatrix}$$ Now Add the first row to all of the other rows ($\forall i \neq 1, R_i = R_i + R_1$) $$ = (n-1)\begin{bmatrix} -1&-1&-1& .&.&-1 \\ 0&-2&-2&.&.&. \\ .&.&-2&.&.&. \\ .&.&.&.&.&-2 \\ .&.&.&.&.&-2 \\ 0&.&.&0&0&-2 \end{bmatrix} = (n-1)[-1*(-2)^{n-2}]$$