If the expectation $\langle v,Mv \rangle$ of an operator is $0$ for all $v$ is the operator $0$?

I ran into this a while back and convinced my self that it was true for all finite dimensional vector spaces with complex coefficients. My question is to what extent could I trust this result in the infinite dimensional case. If there is a circumstance where it is not true then I would like the corresponding counter example.

The statement is $$\langle v| \textbf{M} v \rangle = 0 \quad \forall \mid v\rangle \in \mathbb{V} \Rightarrow \textbf{M}=0$$

• $\textbf{M}$ is a linear operator on $\mathbb{V}$.
• $\mathbb{V}$ is a vector space over the field $\mathbb{C}$.

In the case of finite dimensions we can see that this is true by going to the eigenbasis of $\textbf{M}$. In that case if $\textbf{M} \mid \lambda_i \rangle = \lambda_i \mid \lambda_i \rangle$ then $\lambda_i \langle \lambda_i \mid \lambda_i \rangle= \langle \lambda_i \mid \textbf{M} \lambda_i \rangle = 0 \quad \forall i$. This means the diagonal form of $\textbf{M}$ is the zero matrix. This is assuming that the eigen vectors of $\textbf{M}$ can form a basis for the space which I believe is always true in finite dimensional vector spaces with complex coefficients because of the spectral theorem.

This is true in general for all vector spaces over $\mathbb C$. Indeed, one can consider $v = x-y$ and $v=x-iy$ to come up with the identity $\langle x, My \rangle=0$ for all $x, y$.