Rearrangement property of diagonal matrices

191 Views Asked by At

Is it true that for a diagonal matrix $B\in\mathbb{R}^{n\times n}$, a matrix $A\in\mathbb{R}^{n\times p}$, the following property holds: $$ A^\top B A = A^\top A B, $$ where in essence I am asking this: Can diagonal matrices be rearranged in matrix multiplications (we know this is not true in general from the basic laws of linear algebra)? The motivation for knowing this is that it helps to simplify the analysis of machine learning algorithms that uses singular/eigen value decomposition. Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

This is not true. If we let $$A = \begin{pmatrix} \frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} \\ \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \end{pmatrix} \quad \text{ and }\quad B = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix},$$ then $$A^\top AB = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix} \quad \text{while} \quad A^\top B A = \begin{pmatrix} \frac{3}{2} & \frac{1}{2} \\ \frac{1}{2} & \frac{3}{2} \end{pmatrix}.$$