Specifically, I am interested in the case where one eigenvalue is exactly $0$. Given an $n \times n$ symmetric matrix, I would like to find the closest $n\times n$ symmetric matrix that has one eigenvalue that is equal to $0$.
Although the $n\times n$ matrices form a Hilbert space, the set of symmetric matrices with a zero eigenvalue is probably not convex, because the eigenvalues of a sum of two matrices has a complex relationship with the original matrices. Thus, the classic projection theorem does not guarantee a unique solution. However, I only need a solution. Since the eigenvalues of a matrix are continuous in the entries, the set of $n\times n$ matrices with a zero eigenvalue should be closed, and so the set of solutions shouldn't be totally insane.
In any case, how can I find the closest $n\times n$ symmetric matrix(es) with a zero eigenvalue to an arbitrary given $n\times n$ symmetric matrix?