## Non-commutative product

For an arbitrary asymmetric square matrix $$\mathbf A$$ construct a matrix $$\mathbf B$$ s.t. their products do not commute, i.e. $$\mathbf A\mathbf B\ne\mathbf B\mathbf A$$.

Do products commute when both matrices are symmetric?

• #### Hint

Use facts from the previous exercise.

• #### Resolution

There are several solutions to this problem.

If $$a_{i,j}\ne a_{j,i}$$, we can choose $$\mathbf B$$ s.t. $$b_{i,j}=b_{j,i}=1$$, and $$b_{k,l}=0$$ otherwise. Then we get $$(\mathbf A\mathbf B)_{i,i}=a_{i,j}\ne a_{j,i}=(\mathbf B\mathbf A)_{i,i}$$.

Another option is to choose $$\mathbf B$$ s.t. the only nonzero element is $$b_{i,i}=1$$. Then the two products cannot agree on elements with indices $$i$$ and $$j$$. We get $$(\mathbf A\mathbf B)_{i,j}=0=(\mathbf B\mathbf A)_{i,j}=a_{i,j}$$, while $$(\mathbf B\mathbf A)_{j,i}=0=(\mathbf A\mathbf B)_{j,i}=a_{j,i}$$, but at least one of $$a_{i,j}$$ and $$a_{j,i}$$ is distinct from zero.

Even on symmetric matrices the product does not commute (even the result need not to be symmetric), e.g.

$$\begin{pmatrix} 0 & 1 \\ 1 & 0 \\ \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 0 \\ \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 1 & 0 \\ \end{pmatrix} \ne \begin{pmatrix} 0 & 1 \\ 0 & 0 \\ \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 0 \\ \end{pmatrix} \begin{pmatrix} 0 & 1 \\ 1 & 0 \\ \end{pmatrix}$$