Determinant and inverse matrix calculation of a special matrix Is there any smart way of calculating the determinant of this kind matrix?
\begin{pmatrix}
1 & 2 & 3 & \cdots &  n \\
2 & 1 & 2 & \cdots & n-1 \\ 
3 & 2 & 1 & \cdots & n-2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
n & n-1 & n-2 & \cdots & 1 \end{pmatrix}
I encountered this in a problem for the case $n=4$. I need to find the inverse matrix.
I doubt the idea of this problem is to calculate all the cofactors and then the inverse matrix in the usual way.
I see the pattern here and some recursive relations... but I am not sure if this helps for calculating the determinant of the existing matrix.
 A: $$\begin{vmatrix}
1 & 2 & 3 & \cdots &  n \\
2 & 1 & 2 & \cdots & n-1 \\ 
3 & 2 & 1 & \cdots & n-2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
n & n-1 & n-2 & \cdots & 1 \end{vmatrix}$$
Notice the sum of an element from the first column and an element from the last column (with the same row) will always be equal to $n+1$,thus we can do $(C_1 = C_1+C_n)$
$$ = \begin{vmatrix}
n+1 & 2 & 3 & \cdots &  n \\
n+1 & 1 & 2 & \cdots & n-1 \\ 
n+1 & 2 & 1 & \cdots & n-2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
n+1 & n-1 & n-2 & \cdots & 1 \end{vmatrix} = (n+1)
\begin{vmatrix}
1 & 2 & 3 & \cdots &  n \\
1 & 1 & 2 & \cdots & n-1 \\ 
1 & 2 & 1 & \cdots & n-2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
1 & n-1 & n-2 & \cdots & 1 \end{vmatrix}$$
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{vmatrix}
1 & 2 & 3 & \cdots &  n \\
0 & -1 & -1 & \cdots & -1 \\ 
0 & 1 & -1 & \cdots & -1 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 1 & 1 & \cdots & -1 \end{vmatrix}$$
Expand $C_1$:
$$ = (n+1)\begin{vmatrix}
-1 & -1 & -1 & \cdots &  -1 \\
1 & -1 & -1 & \cdots & -1 \\ 
1 & 1 & -1 & \cdots & -1 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
1 & 1 & 1 & \cdots & -1 \end{vmatrix}$$
Now Add the first row to all of the other rows ($\forall i \neq 1, R_i = R_i + R_1$).
$$ = (n+1)\begin{vmatrix}
-1 & -1 & -1 & \cdots &  -1 \\
0 & -2 & -2 & \cdots & -2 \\ 
0 & 0 & -2 & \cdots & -2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & \cdots & -2 \end{vmatrix} = (n+1)[-(-2)^{n-2}]$$
A: Call your matrix $A$. Let $\{e_1,e_2,\ldots,e_{n-1}\}$ be the standard basis of $\mathbb R^{n-1}$. Let also $e=\sum_ie_i=(1,1,\ldots,1)^T$ and
$$
L=\pmatrix{1\\ -1&1\\ &\ddots&\ddots\\ &&-1&1}.
$$
Then $B:=LAL^T=\pmatrix{1&e^T\\ e&-2I_{n-1}}$. Using Schur complement, we obtain
$$
\det(A)=\det(B)=\det(-2I_{n-1})\left(1-e^T(-2I_{n-1})^{-1}e\right)=(-2)^{n-1}\frac{n+1}{2}.
$$
To find $A^{-1}$, partition $L$ as $\pmatrix{1&0\\ -e_1&L'}$. Then
\begin{aligned}
A^{-1}
&=L^TB^{-1}L\\
&=\pmatrix{1&-e_1^T\\ 0&L'^T}
\pmatrix{\frac{2}{n+1}&\frac{1}{n+1}e^T\\ \frac{1}{n+1}e&\frac{1}{2(n+1)}ee^T-\frac12I_{n-1}}
\pmatrix{1&0\\ -e_1&L'}\\
&=\pmatrix{\frac{1}{n+1}&\frac{1}{2(n+1)}e^T+\frac12e_1^T\\ \ast&\frac{1}{2(n+1)}e_ne^T-\frac12L'^T}
\pmatrix{1&0\\ -e_1&L'}\\
&=\pmatrix{\frac{-n}{2(n+1)}&\frac{1}{2(n+1)}e_n^T+\frac12e_1^T\\ \ast&\frac{1}{2(n+1)}e_ne_n^T-\frac12L'^TL'}.
\end{aligned}
By direct calculation, $L'^TL'$ is the symmetric tridiagonal matrix whose main diagonal is $(2,\ldots,2,1)$ and whose superdiagonal is a vector of $-1$s. Since $A^{-1}$ is symmetric, we finally get
$$
A^{-1}=\pmatrix{
\frac{-n}{2(n+1)}&\frac12&&&\frac{1}{2(n+1)}\\
\frac12&-1&\frac12\\
&\frac12&-1&\ddots\\
&&\ddots&\ddots&\frac12\\
\frac{1}{2(n+1)}&&&\frac12&\frac{-n}{2(n+1)}
}.
$$
A: If it’s the determinant you are looking for, then what if you subtract column $j+1$ from column $j$ to get the matrix
$$\begin{pmatrix}
-1 & -1 & -1& \cdots &  n \\
1& -1 & -1& \cdots & n-1 \\ 
1& 1& -1 & \cdots & n-2 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
1& 1& 1& \cdots & 1 \end{pmatrix}_{n\times n}$$
Then you could add the bottom row to the top row to get $[0,0,...,n+1]$ then the determinant will be
$$(-1)^{n+1}(n+1)\begin{vmatrix}
1& -1 & -1& \cdots & -1\\ 
1& 1& -1 & \cdots & -1\\
\vdots & \vdots & \vdots & \ddots & \vdots \\
1& 1& 1& \cdots & 1 \end{vmatrix}_{(n-1)\times(n-1)}$$
From which you can always add the bottom row to the top to get $[2,0,...,0]$, so you end up getting
$(-1)^{n+1}(n+1)2^{n-2}$?
It looks like for the $n \times n$ matrix $A$ given, the inverse has the general form
$$B=
\begin{pmatrix}
\frac{-n}{2(n+1)}& \frac{1}{2} & 0 & 0 &\cdots & 0 & \frac{1}{2(n+1)} \\
\frac{1}{2} & -1 & \frac{1}{2} & 0 & \cdots & 0& 0 \\ 
0 & \frac{1}{2} & -1 & \frac{1}{2} & \cdots & 0&0 \\
0 & 0 & \frac{1}{2} & -1 & \cdots & 0&0\\
\vdots & \vdots & \vdots & \vdots & \ddots & \vdots &\vdots\\
0 & 0 & 0 & 0 & \cdots &-1&\frac{1}{2}\\
\frac{1}{2(n+1)} & 0 & 0 & 0& \cdots &\frac{1}{2}& \frac{-n}{2(n+1)} \end{pmatrix}
$$
I don't really have proof of how I got this except plugging in the matrix to an inverse matrix calculator for various values of $n$ and noticing a pattern. But one can certainly check that it is indeed the inverse, multiplying on the left and getting $B\cdot A=I$ ensures it is the inverse.
To check this, when multiplying this matrix on the left, it’s not hard to check for the rows of the form $[0,...,\frac{1}{2},-1,\frac{1}{2},...,0]$ because either we have three consecutive integers $n,n+1,n+2$ or $n,n-1,n-2$ $$\frac{n}{2}-(n+1)+\frac{n+2}{2}=0$$ $$\frac{n}{2}-(n-1)+\frac{n-2}{2}=0$$ or $$2\cdot\frac{1}{2}+(-1)\cdot 1+ 2\cdot \frac{1}{2}=1$$ which always is a diagonal entry. Then considering the top row:
$$\frac{-n}{2(n+1)} + 2\cdot \frac{1}{2} + \frac{n}{2(n+1)}=1$$
$$(i+1)\cdot\frac{-n}{2(n+1)}+ i\cdot \frac{1}{2} + (n-i)\cdot  \frac{1}{2(n+1)}=0$$ for $i=1,2,...,n-1$.
The bottom row acts similarly. Thus we indeed get $I$. This probably yields to a nice method to find the inverse through $[A|I] \rightsquigarrow [I|B]$.
Hope this helps!
A: On a related note, the inverse of the closely related matrix $(a_{ij}) = (\frac{n}{4}- \frac{1}{2} |i-j|)$ is still Toeplitz and symmetric with first row $(2,-1, 0, \ldots, 0, 1)$, determinant $4$, and eigenvalues coming in pairs ( and a $4$, when $n$ odd). Moreover, one can explicitely find the eigenvectors of this inverse, using trigonometric functions. Now, there is a formula for the inverse of a peturbation of a matrix by a matrix of rank $1$. So finding the inverse is feasible.
As an example, check out this inverse ( case $n=5$): WA link .
