Matrix of a quadratic form Let $J=\left(\begin{array}{cc}1 & 1 \\ 1 & -1\end{array}\right)$ and $E=\left\{\left(\begin{array}{ll}a & b \\ c & d\end{array}\right) \in M_{2}(\mathbb{R}) : a - d=0\right\}$
We define the application $\varphi: E \times E \rightarrow \mathbb{R}$ such that for all M,N$\in E, \varphi(M,N)=Tr(M J N)$.
I was asked to prove that $B=\left\{\left(\begin{array}{ll}1 & 0 \\ 0 & 1\end{array}\right),\left(\begin{array}{ll}0 & 1 \\ 0 & 0\end{array}\right),\left(\begin{array}{ll}0 & 0 \\ 1 & 0\end{array}\right)\right\}$ is a basis of $E$.
But now i want to figure out the matrix of the associated quadratic form q (I was asked to prove that $\varphi$ is symmetric bilinear too).
One way to do this is to compute $\varphi(e_{i};e_{j})$ where $e_{i}, e_{j}$ are vectors of the basis B of E:
$\varphi\left(I_{2}, I_{2}\right)=Tr\left(I_{2} J I_{2}\right)=\operatorname{Tr}(J)=0$ ;
$\varphi\left(E_{2,2} , E_{2,2}\right)=0$ ;
$\varphi\left(E_{3,3}, E_{3,3}\right)=0$ ; $\varphi\left(I_{2} ; E_{2,2}\right)=\operatorname{Tr}\left(\left(\begin{array}{ll}0 & 1 \\ 0 & 1\end{array}\right)\right)=1$ ; $\varphi\left(I_{3} ; E_{3,3}\right)=\operatorname{Tr}\left(\left(\begin{array}{cc}1& 0 \\ -1 & 0\end{array}\right)\right)=1$ ; $\varphi\left(E_{2,2} ; E_{3,3}\right)=Tr\left(E_{2,2} J E_{3,3}\right)=Tr\left(\left(\begin{array}{ll}-1 & 0 \\ 0 & 0\end{array}\right)\right)=-1 .$
$Thus A=Mat_{B}(\varphi)=\left(\begin{array}{ccc}0 & 1 & 1 \\ 1 & 0 & -1 \\ 1& -1 & 0\end{array}\right)$. On the other hand i wanted to find the matrix of q starting from the matrix expression of q(M). $q(M)=Tr(MJM)=Tr\left[\left(\begin{array}{cc}a & b \\ c & a\end{array}\right)\left(\begin{array}{cc}1 & 1 \\ 1 & -1\end{array}\right)\left(\begin{array}{ll}a & b \\ c & a\end{array}\right)\right]=Tr\left(\begin{array}{ll}a^{2}+a c+a b-b c & a b+a^{2}+b^{2}-a b \\ a c+c^{2}+a^{2}-a c & b c+a c+a b-a^{2}\end{array}\right)$
$\begin{aligned} q(M)=& 2 a b+2 a c \\ \varphi(M ; N) &=a b^{\prime}+a^{\prime} b+a c^{\prime}+a^{\prime} c \\ &=a\left(b^{\prime}+c^{\prime}\right)+b\left(a^{\prime}\right)+c\left(a^{\prime}\right) \\ \varphi(M ; N) &=(a \quad b \quad c) \quad\left(\begin{array}{lll}0 & 1 & 1 \\ 1 & 0 & 0 \\ 1 & 0 & 0\end{array}\right)\left(\begin{array}{l}a^{\prime} \\ b^{\prime} \\ c^{\prime}\end{array}\right) \end{aligned}$.
Here is the problem! The matrix A of q is not the same as previous. And i really really  don't see where is the problem. Thanks for helping!
 A: As it stands, $\varphi$ is not symmetric. In fact, using the cyclic property of trace, we have
\begin{aligned}
\varphi\left(\pmatrix{0&1\\ 0&0},\pmatrix{0&0\\ 1&0}\right)
&=\operatorname{tr}\left(\pmatrix{0&1\\ 0&0}\pmatrix{1&1\\ 1&-1}\pmatrix{0&0\\ 1&0}\right)\\
&=\operatorname{tr}\left(\pmatrix{1&1\\ 1&-1}\pmatrix{0&0\\ 1&0}\pmatrix{0&1\\ 0&0}\right)\\
&=\operatorname{tr}\left(\pmatrix{1&1\\ 1&-1}\pmatrix{0&0\\ 0&1}\right)
=-1
\end{aligned}
while
\begin{aligned}
\varphi\left(\pmatrix{0&0\\ 1&0},\pmatrix{0&1\\ 0&0}\right)
&=\operatorname{tr}\left(\pmatrix{0&0\\ 1&0}\pmatrix{1&1\\ 1&-1}\pmatrix{0&1\\ 0&0}\right)\\
&=\operatorname{tr}\left(\pmatrix{1&1\\ 1&-1}\pmatrix{0&1\\ 0&0}\pmatrix{0&0\\ 1&0}\right)\\
&=\operatorname{tr}\left(\pmatrix{1&1\\ 1&-1}\pmatrix{1&0\\ 0&0}\right)
=1.
\end{aligned}
With respect to the basis mentioned in your question, the correct matrix representation of $\varphi$ is
$$
M=\pmatrix{0&1&1\\ 1&0&-1\\ 1&1&0}
$$
which gives rise to the same quadratic form represented by
$$
\frac12(M+M^T)=\pmatrix{0&1&1\\ 1&0&0\\ 1&0&0}.
$$
There is probably a typo in the question. I think the author wanted to define $\varphi(M,N)$ as $\operatorname{tr}(MJN^T)$ (or $\operatorname{tr}(M^TJN)$) instead, so that
$$
\varphi(M,N)
=\operatorname{tr}(MJN^T)
=\operatorname{tr}\left((MJN^T)^T\right)
=\operatorname{tr}(NJM^T)
=\varphi(N,M).
$$
