# Proving an implication from a matrix equation

I am supposed to prove that, if $\eta$ is lorentz metric, $M$ is a 4 by 4 matrix and $x^tM^t \eta Mx=x^t\eta x$ for any column vector $x$, then $M^t\eta M=\eta$. What I did seems awfully clumsy. I used simple vectors to derive that the components $M_{ij}=0$, when $i=j$, $M_{23}=0$ and $M_{32}=0$ and otherwise $M_{ij}=-M_{ji}$. I plugged $M$ in the equation and was able to show that the remaining components must be $0$ except $M_{12}=-M_{21}=M_{34}=-M_{43}=i$. Then the claim was easy to verify. I did side step at certain points to avoid what I eventually had to rely on. I am unhappy. Could you give me tips how to solve the problem neatly?

-

It is easier if you abstract a bit, and prove more. We aim to show that if $A$ and $B$ are symmetric and real and $x^TAx=x^TBx$ for all $x$, then $A=B$. Since $x^TAx-x^TBx=x^T(A-B)x$, it will be enough to show that if $x^TCx=0$ for all $x$ (and $C$ is real symmetric), then $C=0$.
The trick is to note that if $x^TCx=0$ for all $x$ then for any $x$ and $y$ $$0 = (x+y)^TC(x+y) = x^TCx + y^TCy + x^TCy+y^TCx = 0 + 0 +2x^TCy.$$ Hence $x^TCy=0$ for all $x$ and $y$. [This idea is useful in a number of places, and is worth knowing.]
Now if we let $x$ and $y$ run over the standard basis vectors, we get that $C_{i,j}=0$ for all $i$ and $j$.