Matrices with at most one negative eigenvalue Suppose a vector $y$ and a symmetric matrix $M$ are given.
\begin{equation}
\forall x; \quad x^Ty=0 \implies x^TMx \ge 0
\end{equation}
Prove that $M$ has at most one negative eigenvalue.
 A: Hint. As $M$ is real symmetric, it has a orthonormal eigenbasis. Suppose $(\lambda_1,v_1),(\lambda_2,v_2)$ are two eigenpairs of $M$ with $\lambda_1,\lambda_2<0$ and $v_1\perp v_2$. Use a dimension argument to show that $\mathrm{span}\{y\}^\perp\cap\mathrm{span}\{v_1,v_2\}\neq0$. That is, there exists a nonzero vector $w\in\mathrm{span}\{v_1,v_2\}$ such that $w\perp y$. Why is this a contradiction?
A: First $y\neq 0$, otherwise this is trivially true.
WOLOG, suppose $y=(0,\dots,0,1)$, then $x^T y=0$ means $x_n=0$, say $x=(x_1,\dots, x_n)$. Let $x'=(x_1,\dots,x_{n-1})$ and $M'$ be the matrix deleting $n$ row and $n$ column of $M$. Note that 
$$
x^TMx=x'^{T}M'x' \ge 0
$$
the eigenvalue of $M'$ is non-negative.
Is $M$ symmetric? If not, then this is not true. Let $M'=1$ and $M=\pmatrix{1& -2\\2&-3}$, you have an counterexample.
So $M$ should be symmetric. Then you may assume $M'=diag(a_1,\dots,a_{n-1})$ where $a_i \ge 0$. Considering the quadratic form given by $M$, you can obtain the result easily. The rest is yours.
