How do you prove that $x^TAx=x^TBx$ if and only if $A+A^T=B+B^T$
It seems like a trivial problem, but I am not sure how to prove "if and only if". I've been trying by using symmetric matrices, but am not sure how to finish the proof.
If any one could show me to the correct direction or a book where there are examples of how to proofs of "if and only if".
Edit: So far my unfinished proof is as follows: $$x^TAx=x^TBx$$ $$tr(x^TAx)=tr(x^TBx)$$ $$tr(x^TAx)-tr(x^TBx)=0$$ $$tr(x^T(A-B)x)=0=tr(x^T(A-B)^Tx)$$ which means that the solution with either be $ A=B $ or $(A-B)$ is skew symmetric $(trace=0)$
But I am not sure how to finish the proof to show that if and only if $A+A^T=B+B^T$
Since $x^TAx$ is a $1\times1$ matrix, $x^TAx=\left(x^TAx\right)^T=x^TA^Tx$. Therefore, $$ x^TAx=x^TA^Tx\tag1 $$ Thus, $$ x^T\!\left(A+A^T\right)\!x+\overbrace{x^T\!\left(A-A^T\right)\!x}^0=2x^TAx\tag2 $$ Therefore, as requested $$ x^TAx=x^TBx\iff x^T\!\left(A+A^T\right)\!x=x^T\!\left(B+B^T\right)\!x\tag3 $$ $$ %\begin{align} &2(x+y)^TA(x+y)-2(x-y)^TA(x-y)\tag{4a}\\ &(x+y)^T\left(A+A^T\right)(x+y)-(x-y)^T\left(A+A^T\right)(x-y)\tag{4b}\\ &=2x^T\left(A+A^T\right)y+2y^T\left(A+A^T\right)x\tag{4c}\\ &=4x^T\left(A+A^T\right)y\tag{4d} \end{align} $$