1
$\begingroup$

I started giving names and indexes. $$X = (X)_{ij}$$ $$Y = (Y)_{jk}$$ $$Z = (Z)_{km}$$ so that we have $$(XYZ)_{im} = x_{ij}y_{jk}z_{km}$$ Now I know that for a matrix $A$ the trace would be $Tr(A) = a_{hh}$

So I think $Tr(XYZ) = (XYZ)_{ii}=(XYZ)_{mm}$ and I also ave $Tr(ZXY)_{pq} =(ZXY)_{pp}=(ZXY)_{qq}$.

But how do I prove it? I couldn't go further

EDIT

Everyone in the comments talks about commutativity, so I'll write here the counterexample I gave in one of the comments. Everyone says we can apply it because they are real numbers. True, they are, however consider the following $$\mathbf{y} = \mathbf{A}\mathbf{x} \Longleftrightarrow y_i = a_{ij}x_j$$ Now clearly the entries of the matrix, $a_{ij}$ and of the vector $x_j$ are real numbers. However it is false to say that $a_{ij}x_j = x_ja_{ij}$. Indeed if we take $\mathbf{A}$ to be a $3\times 3$ matrix and $\mathbf{x}$ to be a $3\times 1$ vector, then the multiplication $\mathbf{x}\mathbf{A} = x_ja_{ij}$ makes no sense

  • 3
    The more typical approach is to show $Tr(AB) = Tr(BA)$, then deduce that $$ Tr([XY]Z) = Tr(Z[XY]) $$ do you still want to prove it your way?2017-02-02
  • 0
    @Omnomnomnom oh okay that makes sense.. can you post how to solve $Tr(AB) = Tr(BA)$ a bit formally with the index notation? I understand how it works by intuition, but I am not good at rigurous index notation proofs yet2017-02-02

4 Answers 4

2

Lets prove $tr(AB) = tr(BA)$.

$ (AB)_{i,j} = \sum_{k}A_{ik}B_{kj}$

$(BA)_{ij} = \sum_{k}B_{ik}A_{kj}$

Now

$tr(AB) = \sum_{i}(AB)_{ii} = \sum_{i}\sum_{k}A_{ik}B_{ki}$

Now since all sums are finite, we can interchange the sums over $i$ and $k$ and since $A_{ik}$ and $B_{ki}$ are just numbers and hence commute, we can interchange them too. Hence the above expression is equal to

$\sum_{k}\sum_{i}B_{ki}A_{ik}$

which is equal to

$\sum_{k}(BA)_{kk}$

which is just $tr(BA)$.

Let me know is something is unclear.

Remark: It is crucial that we have finite sums here. Infinite sums cannot in general be interchanged like this. Also crucial is that $A_{ik}B_{ki}$ commute; note that even though $A$ and $B$ are matrices, $A_{ik}$ and $B_{ki}$ are numbers (or elements of a commutative ring, as the case maybe) and hence they commute even though matrices $A$ and $B$ may not.

  • 1
    shouldn't it be $$\sum_jB_{ij}A_{jk}$$?2017-02-02
  • 1
    No it should be $B_{ik}A_{kj}$.2017-02-02
  • 0
    @Euler_Salter yes you are right. I'll change it right away. Apparently, I cant type ten lines without a typo :p2017-02-02
  • 0
    @mvw Well, you are also right. Its just a matter of notation. I am summing over $k$ so you are right.2017-02-02
1

You have \begin{align} \text{Tr}\,(XYZ)&=\sum_m(XYZ)_{mm}=\sum_m \sum_{j,k}x_{mj}y_{jk}z_{km}\\ &=\sum_k\sum_{m,j}z_{km}x_{mj}y_{jk}=\sum_k(ZXY)_{kk}\\ &=\text{Tr}\,(ZXY). \end{align}

  • 0
    thank you for your answer. Could you please write it down more explicitely, because I am not sure of why you can swap the terms written in index notation. How do we know commutativity works?2017-02-02
  • 0
    You have $x_{mj}y_{kj}z_{km}=z_{km}x_{mj}y_{jk}$ because the product of numbers is commutative. As for knowing "why" commutativity works, it depends on how you define what the real numbers are; most of the time it is either taken as an axiom, or it follows from their construction. But I don't think you ever questioned that $2.5\times3.7=3.7\times2.5$.2017-02-02
  • 0
    It wasn't a question on why commutativity in general works, but why it can be used here. I understand your argument about being real numbers, however for example consider $\mathbf{y} = \mathbf{A}\mathbf{x} \implies y_i = a_{ij}x_j$. Here $a_{ij}$ and $x_j$ are real numbers (components of matrix and of a vector), however I cant say $a_{ij}x_j = x_ja_{ij}$ because it doesn't even make sense, say $A$ was a $3\times 3$ matrix and that $x$ was a $3\times 1$ vector. Then the product $xA$ makes no sense!2017-02-02
  • 1
    Ok, I see what you mean, In your example, $x_ja_{ij}$ does not define a product of matrices (at least not in the way we usually define them and how we write $\mathbf{xA}$). In the argument in the answer, on the other hand, all that is happening is that the commuting of the coefficients suggests a switch in the roles of the indices, which is achieved by commuting the sums (out sum was initially on $m$, but is on $k$ by the end of the argument). That's basically all that's happening, and it is the same reason why $\text{Tr}(AB)=\text{Tr}(BA)$.2017-02-02
1

Using Einstein summation convention and assuming matrix elements from a field: $$ \DeclareMathOperator{tr}{tr} \tr(XYZ) = X_{ij} Y_{jk} Z_{ki} = Z_{ki} X_{ij} Y_{jk} = \tr(ZXY) $$

  • 0
    same question to you: how do we know we can do the second step, i.e. using commutativivty? matrix multiplication is not commutative. Those are elements, but still they come from matrices2017-02-02
  • 0
    While matrix multiplication in general is not commutative, this is about the trace of a matrix product and this just needs commutative element wise multiplication, which is true for elements from a field.2017-02-02
1

Proof that $Tr(AB) = Tr(BA)$: note that $AB = a_{ij}b_{jk}$. We then have $$ Tr(AB) = [a_{ij}b_{jk}]_{i,i} = a_{ij}b_{ji} = b_{ij}a_{ji} = [b_{ij}a_{jk}]_{i,i} = Tr(BA) $$

  • 0
    I have a couple of questions around your solutions. Firstly, what is the meaning of $[ \cdot ]_{i,i}$ ?2017-02-02
  • 0
    @Euler_Salter it's not the usual notation, but I think it's helpful as an explanatory step. $[m_{ik}]_{i,i}$ is my way of writing the trace of the matrix whose entries are $m_{ik}$.2017-02-02
  • 0
    Secondly, you have used commutativity in the third step. But how do you know $a_{ij}b_{ji} = b_{ij}a_{ij}$ ? Because for example if we have $a_{ij}b_{jk}\neq b_{jk}a_{ij}$ because matrix multiplication is non abelian2017-02-02
  • 0
    For your second comment: the elements being added are identical. We're adding the products $a_{ij}b_{kl}$ for which $j=k$ and $i=l$. In Martin's notation, it is a reordering of the sum.2017-02-02
  • 0
    oh okay so you've swapped also the indexes, I didn't notice. I've never seen this property though. Does it work because each of the expressions give $$a_{11}b_{11}+a_{12}b_{21}+a_{13}b_{31}+a_{21}b_{12}+a_{22}b_{22}+a_{23}b_{32}+a_{31}b_{13}+a_{32}b_{23}+a_{33}b_{33}$$ ?2017-02-02
  • 0
    @Euler_Salter that's exactly right; I suppose there was no real reason to swap the indices. The two notations do suggest different arrangements of this sum, however.2017-02-02
  • 0
    I understand that since they are dummy indexes, we have $$a_{ij}b_{ji} = a_{ji}b_{ij}$$ because the labelling doesn't matter. But I'm not so sure about the commutativity of the terms. Indeed with the second expression I wouldn't obtain the expression above, I think2017-02-02
  • 0
    @Euler_Salter I disagree. Try it though. For example, take $A$ to be $2 \times 3$ and $B$ to be $3 \times 2$, and see how each sum works out.2017-02-02
  • 0
    oh right they have to have same number of row and columns pairwise for $BA$ to be defined!2017-02-02