# If $v^TAv = v^TBv$ for all constant vectors $v$ and $A,B$ are matrices, is it true that $A=B$?

If $v^TAv = v^TBv$ for all constant vectors $v$ and $A,B$ are matrices of size $n$ by $n$, is it true that $A=B$?

I have thought about using basis vectors but cannot get system of equations uniquely. Is there a trick here?

## 3 Answers

It is not true. Take $A$ to be the zero matrix, and $B$ to be any nonzero skew-symmetric matrix. You can prove that both sides are always zero, but $A$ and $B$ are not equal.

If you assume that both $A$ and $B$ are symmetric real matrices, then they are equal. You can see that $v^TAv = v^TBv$ is equivalent to $v^T(A-B)v=0$. We know that $A-B$ is also a symmetric matrix. When the last equality holds for all vectors $v$, $A-B$ must be a zero matrix. This is due to the spectral theorem, as the existence of eigenvectors of $A-B$ is justified by the spectral theorem. See the details in another post. Now get any eigenvector $v$ of $A-B$ to see that $v^T(A-B)v=\lambda\left\lVert v \right\rVert^2$, where $\lambda$ is the eigenvalue of $A-B$ corresponding to the eigenvector $v$. Since eigenvectors are by definition nonzero, it must be the eigenvalue that is zero. So all eigenvalues of $A-B$ are zero. $A-B$ is similar to the zero matrix, so that $A-B$ itself is also the zero matrix.

The question is the same as:

Is it true $A=0$, if $v^TAv=0$, for all vectors $v$?

If $A$ is anti-symmetric, it is not.

• In case it's not clear, I'll just add that they're the same because we may subtract $v^TBv$ from both sides of the OP's equation to get $v^T (A-B) v = 0$. Then $A$ and $B$ are the same if and only if $A-B = 0$. Additionally, every matrix $M$ may be expressed as $A-B$ (i.e. set $A = M$ and $B = 0$), and so the OP's question reduces to the one in this answer. – Myridium Oct 17 '16 at 7:24

If you assume that the matrices are symmetric then it is true. Otherwise not. In fact, $M=A-B$ may be any anti-symmetric matrix, i.e. $M^T=-M$.

If $M$ is symmetric on the other hand it is diagonaliable with real eigenvalues and in an orthonormal basis. Picking an eigenvector $v$ for eigenvalue $\lambda$ you see that $0=v^T M v = \lambda v^T v$ so $\lambda=0$. Thus, all eigenvalues are zero and for a diagonalizable matrix this implies that the matrix is the zero matrix.

• I assume you don't need both $A$ and $B$ to be symmetric. Surely only $A-B$ needs to be symmetric? Like if $B=-A^T$? – snulty Oct 17 '16 at 8:04
• No you are right. On the other hand if you want to specify a category of matrices for which the statement is true, then the most natural is the category of symmetric matrices. – H. H. Rugh Oct 17 '16 at 8:28