Determinant of a matrix whose $(i,j)$th element is $|i-j|$?

Solution 1:

As I said in the comments, the solution is here. I am copying it on this page just in case the referencing page gets deleted.

For $i = 1, 2, 3, ... , n-2$ subtract twice row $i+1$ from row $i$ and add row $i+2$ to row $i$. For $i < n-1$, row $i$ becomes all $0$s except for a $2$ in column $i+1$.

Now expand successively by the first, second, third ... rows to get $(-2)n-2$ times the $2 \times 2$ determinant with first row $n-2, 1$ and second row $n-1, 0$. This $2 \times 2$ determinant has value $-(n-1)$, so $|A| = (-1)^{n-1} (n-1) 2^{n-2}$.