TITLE: Eigenvalues of a Complete graph
QUESTION [6 upvotes]: Using the following command in MATLAB, I am finding out that the eigenvalues of a complete graph are $-1$ with the multiplicity $n-1$ and $n-1$ with multiplicity of $1$. However I believe that the eigenvalues of $K_n$ should be zero with multiplicity $1$ and $n$ with multiplicity $n-1$. To make matters worse I have just noted that the determinant of the adjacency matrix of a complete graph with n vectors is $(-1)^{n-1}(n-1)$ which also mean my belief is also not correct. 
n = 6;
i = 1;
while (i <= n)
    i = i + 1;
    M = ones(i) - eye(i);
    [v, d] = eig(M)
end

How can I determine the spectrum of a complete graph analytically?

REPLY [4 votes]: It's worth adding that the eigenvalues of the Laplacian matrix of a complete graph are $0$ with multiplicity $1$ and $n$ with multiplicity $n-1$.
Recall that the Laplacian matrix for graph $G$ is
$L_G = D - A$
where $D$ is the diagonal degree matrix of the graph. For $K_n$, this has $n-1$ on the diagonal, and $-1$ everywhere else. The constant vector $\mathbf{1}$ is then an eigenvector with eigenvalue $0$. The vectors $v^i$ with $v^i_0 = -1$ and $v^i_i = 1$ for $i \in [2,n]$ give the remaining eigenvectors with eigenvalue $n$.