I have the following problem:
Let $M$ be a symmetric positive semidefinite real matrix of order $n$ and $x,x',y,y' \in \mathbb{R}^n$ such that $(x-x')^TM(x-x') = 0 = (y - y')^TM(y-y')$. Then, $x^TMy = (x')^TM(y')$.
I tried this to solving the problem. We can write \begin{align} x^TMy - (x')^TM(y') &= x^TMy - (x')^TMy + (x')^TMy - (x')^TM(y') \\ &= (x-x')^TMy + (x')^TM(y-y'), \end{align} so the problem reduces to prove that the last equality is zero. When $M$ is strictly positive definite, then the expresions of the form $u^TMv$ are dot products, and using the Cauchy-Schwarz inequality is easy to see that $(x-x')^TMy = 0 = (x')^TM(y-y')$. But when $M$ is singular I'm not sure if the inequality holds. In fact, the usual proof starts using that $u = 0 \iff \|u\| = 0$, which is not true for the seminorms induced by PSD matrices, so can I do it for the singular case?
I think you're going in the right direction, the missing part is to show that a positive semidefinite bilinear form has the Cauchy-Schwarz property. This can be done separating the cases $y^TMy = 0$ and $y^TMy \neq 0$, while letting $x \in \mathbb{R}^n$. http://kaba.hilvi.org/homepage/blog/semi_norms.htm.
The case $y^TMy \neq 0:$ Let $x_{\parallel}=\frac{x^TMy}{y^TMy}y$ and $x_{\perp}=x-x_{\parallel}$. We have
\begin{align} (x^TMy)^2 &= (x^TMy)^2\frac{(y^TMy)^2}{(y^TMy)^2} = \frac{x^TMy}{y^TMy}y^TMy\frac{x^TMy}{y^TMy}y^TMy = (x_{\parallel}^TMx_{\parallel})(y^TMy), \end{align}
so if we can show that $x_{\parallel}^TMx_{\parallel} \leq x^TMx$ then $(x^TMy)^2 \leq (x^TMx)(y^TMy)$ i.e. the Cauchy-Schwarz property follows and thus
\begin{align} x^TMy - (x')^TM(y') &= x^TMy - (x')^TMy + (x')^TMy - (x')^TM(y') \\ &= (x-x')^TMy + (x')^TM(y-y') \\ &\leq (((x-x')^TM(x-x'))(y^TMy))^\frac{1}{2} + (((x')^TMx')((y-y')^TM(y-y')))^\frac{1}{2} \\ &=0, \end{align}
and we are done. It remains to show $x_{\parallel}^TMx_{\parallel} \leq x^TMx$, using that $x_{\parallel} \cdot x_{\perp} = 0$ and that $M$ is positive semidefinite so $x_{\perp}^TMx_{\perp} \geq 0:$
\begin{align} x_{\parallel}^TMx_{\parallel} \leq x_{\parallel}^TMx_{\parallel} + x_{\perp}^TMx_{\perp} = x_{\parallel}^TMx_{\parallel} + 2x_{\parallel}^TMx_{\perp} + x_{\perp}^TMx_{\perp} =(x_{\parallel}+x_{\perp})^TM(x_{\parallel}+x_{\perp})=x^TMx \end{align}