Diagonal elements and eigenvalues of a real symmetric matrix