# A formula for determinant of symetric matrix whose off-diagonal entries are $-1$ [duplicate]

I've tried the determinant of matrices with the form $$\left( \begin{matrix} x&-1&\cdots&-1\\ -1&x&\cdots&-1\\ \vdots&\vdots&\ddots&-1\\ -1&-1&\cdots&x \end{matrix} \right)_{n\times n}$$ i.e. with $x$ in the diagonal and $-1$ everywhere else. I've always get $$(x+1)^n-n(x+1)^{n-1}=(x+1)^{n-1}(x-n+1)$$ for various $n$ and I think it is a correct formula.

I think by induction will be a way but I don't know how. Any variant or counterexample are welcome.

## marked as duplicate by amd, Xander Henderson, user99914, Shailesh, Chris GodsilJun 1 '18 at 12:04

Hint:

Denote $D_n$ this determinant for an $n\times n$ matrix. Subtracting the second column from the first end expanding by the first column, we obtain that $$D_n=\begin{vmatrix}x+1&-1&-1&\dots&-1\\ -(x+1)&\phantom{-}x&-1&\dots&-1\\ 0&-1&\phantom{-}x&\dots&-1\\[-1ex] \vdots&\phantom{-}\vdots&\phantom{-}\vdots&\dots&\phantom{-}\vdots\\0&-1&-1&\dots&\phantom{-}x\end{vmatrix} =(x+1)D_{n-1}+(x+1)\begin{vmatrix}-1&-1&\dots&-1\\ -1&\phantom{-}x&\dots&-1\\[-1ex] \phantom{-}\vdots&\phantom{-}\vdots&\dots&\phantom{-}\vdots\\-1&-1&\dots&\phantom{-}x\end{vmatrix}.$$ Now in the last determinant, the first row is the sum ot two rows $$\begin{pmatrix}x &-1&\dots&-1\end{pmatrix}+\begin{pmatrix}-x-1&0&\dots&0\end{pmatrix},$$ so that, by multilinearity \begin{align} &\begin{vmatrix}-1&-1&\dots&-1\\ -1&\phantom{-}x&\dots&-1\\[-1ex] \phantom{-}\vdots&\phantom{-}\vdots&\dots&\phantom{-}\vdots\\-1&-1&\dots&\phantom{-}x\end{vmatrix}=\begin{vmatrix}x&-1&\dots&-1\\ -1&\phantom{-}x&\dots&-1\\[-1ex] \phantom{-}\vdots&\phantom{-}\vdots&\dots&\phantom{-}\vdots\\-1&-1&\dots&\phantom{-}x\end{vmatrix}-\begin{vmatrix}x+1&0&\dots&0\\ -1&\phantom{-}x&\dots&-1\\[-1ex] \phantom{-}\vdots&\phantom{-}\vdots&\dots&\phantom{-}\vdots\\-1&-1&\dots&\phantom{-}x\end{vmatrix}\\[1ex] &= D_{n-1}-(x+1)\begin{vmatrix} \phantom{-}x&\dots&-1\\[-1ex] \phantom{-}\vdots&\dots&\phantom{-}\vdots\\-1&\dots&\phantom{-}x\end{vmatrix} =D_{n-1}-(x+1)D_{n-2}, \end{align} whence the recurrence relation: $$D_n=2(x+1)D_{n-1}-(x+1)^2D_{n-2}.$$