<s>[INST] How to calculate the determinant of this n by n matrix? Find the determinant of this n by n matrix.
$$
\begin{pmatrix}
0 & x_1 & x_2 & \cdots& x_k \\
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_k & 0 & 0 & \cdots& 1 \\
\end{pmatrix}
$$
where, $$ k=n-1 $$.
I am new to matrices and determinants, but this is what I did:
I developed the determinant using the second column:
$$
(-1)^2*x_1 
\begin{pmatrix}
x_1  & 0 & \cdots & 0 \\
x_2  & 1& \cdots & 0 \\
\vdots& \vdots& \ddots& \vdots \\
x_k  & 0 & \cdots& 1 \\
\end{pmatrix} + (-1)^3 *1
\begin{pmatrix}
0 & x_2 & \cdots & x_k \\
x_2  & 1& \cdots & 0 \\
\vdots& \vdots& \ddots& \vdots \\
x_k  & 0 & \cdots& 1 \\\end{pmatrix}
$$
the first determinant is triangular, so its equal to $ x_1 $ but this is where I got stuck. I don't know what to do with the second determinant. Any help is appriciated. Thanks
 [/INST] If you denote:
$$D_k=\begin{vmatrix}
0 & x_1 & x_2 & \cdots& x_k \\
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_k & 0 & 0 & \cdots& 1 \\
\end{vmatrix}$$
and expand it by the last column (or row), you get
\begin{align}D_k=\begin{vmatrix}
0 & x_1 & x_2 & \cdots& x_k \\
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_k & 0 & 0 & \cdots& 1 \\
\end{vmatrix}&=(-1)^kx_k\begin{vmatrix}
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_{k-1}&0 &0&\cdots&1\\
x_k & 0 & 0 & \cdots&0\\
\end{vmatrix}
+\begin{vmatrix}
0 & x_1 & x_2 & \cdots& x_{k-1} \\
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_{k-1} & 0 & 0 & \cdots& 1 \\
\end{vmatrix}\\[2ex]
&=(-1)^kx_k\begin{vmatrix}
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_{k-1}&0 &0&\cdots&1\\
x_k & 0 & 0 & \cdots&0\\
\end{vmatrix}
+ D_{k-1}
\end{align}
Now expand this determinant by  the last row:
$$\begin{vmatrix}
x_1 & 1 & 0 & \cdots & 0 \\
x_2 & 0 & 1& \cdots & 0 \\
\vdots& \vdots& \vdots& \ddots  & \vdots\\
x_{k-1}&0 &0&\cdots&1\\
x_k & 0 & 0 & \cdots&0\\
\end{vmatrix}=(-1)^{k-1}x_k\begin{vmatrix}
 1&0&\cdots & 0 \\
0&1&\cdots & 0 \\
 \vdots&\vdots& \ddots  & \vdots\\
0&0&\cdots&1
\end{vmatrix}=(-1)^{k-1}x_k.
$$
Finally we obtain the recursion relation:
$$D_k=(-1)^{2k-1}x_k^2+
+ D_{k-1}=-x_k^2+
+ D_{k-1},$$
from which  a trivial recurrence shows that 
$$D_k=-\sum_{i=1}^k x_i^2.$$
</s>