Calculate the determinant of the following $n \times n$ symmetric matrix: Let $n$ be a positive integer and $A = (a_{ij})_{n\times n}$, where $a_{ij} = |i-j|$, for $i = 1, 2, \dots, n$ and $j = 1, 2, \dots, n$. Calculate $\det A$.
I noticed that $a_{ii} = 0$ and $a_{ij} = a_{ji}$, so A is a symmetric matrix. Also, I saw that, if we make the notation $A_n$ for the A with n elements, $A_n$ is constructed from $A_{n-1}$ with $n-1, n-2, \dots, 0$ as elements for the last line and last column. I tried to use Laplace expansion but with no result.
This is how $A_n$ looks like: $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}$
I calculated for a few small numers: $\det A_1 = 0$, $\det A_2 = -1$, $\det A_3 = 4$, $\det A_4 = -12$, $\det A_5 = 32$, but I didn't figure out a rule such that I could find the determinant through induction. Can you help me on this one?
 A: 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}.
$$
A: 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}]$$
