I need to derive a formula for the characteristic polynomial of a complete graph. Here are some example of the adjacency matrices:
$$ K_2 = \begin{pmatrix}{} 0 & 1 \\ 1 & 0 \end{pmatrix} , \qquad \chi(K_2)=(-1 + x) (1 + x) $$
$$ K_3 = \begin{pmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{pmatrix} , \qquad \chi(K_3)=-(-2 + x) (1 + x)^2 $$
$$ K_4 = \begin{pmatrix} 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 \end{pmatrix}, \qquad \chi(K_4)=(-3 + x) (1 + x)^3 $$
$$ K_5 = \begin{pmatrix} 0 & 1 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 1 & 0 \end{pmatrix}, \qquad \chi(K_5)=-(-4 + x) (1 + x)^4 $$
I see the pattern
$$ \chi(K_n)=(-1)^{n}(-(n-1) + x) (1 + x)^{(n-1)} $$
but I have no idea how to prove it. Any ideas?
Application: from the closed formula one can derive the number of closed walks in the graph.