07. Index notation

07. Index notation

Index notation

I can write the entries of an m -by-n matrix A as A=(A11A12A13A1nA21A22A23A2nAm1Am2Am3Amn).

Here Aij denotes the entry sitting in the i th row and the j th column.

One advantage of writing matrices like this is that it gives a compact formula for operations like matrix multiplication: rather than writing out the full matrix AB , we can just write a formula for the ij th entry (AB)ij . Suppose that A is m -by-n and B is n -by-p .

To get (AB)ij , we need to multiply the i th row of A into the j th column of B , in other words: (AB)ij=(Ai1Ai2Ain)(B1jB2jBnj)

=Ai1B1j+Ai2B2j++AinBnj
=nk=1AikBkj.
In this last step, we just introduced a "dummy index" k to keep track of the terms in the sum. We now have a nice compact formula for the ij th entry of AB : it's nk=1AikBkj .

Associativity of matrix multiplication

To demonstrate how useful index notation is, let's prove that matrix multiplication is associative, that is: (AB)C=A(BC).

We can just write out the formula for the ij th entry on each side and check they give the same answer. For the left-hand side: ((AB)C)ij=k(AB)ikCkj
=kAiBkCkj
where we've used the formula for matrix multiplication twice (using all sorts of different letters). Note that the second time I use the formula, I can't use the letter k for my dummy index because k already means something in the expression; that's why I introduced .

For the right-hand side: (A(BC))ij=kAik(BC)kj

=kAikBkCj
We can take the factor Aik inside the sum (just by multiplying out the whole expression), which gives: (A(BC))ij=kAikBkCj.

This looks very similar to the formula for the left-hand side, but the indices k and have been swapped. That doesn't matter: k and are dummy indices, so we can just rename them. We'll relabel k as and as k : (A(BC))ij=kAiBkCkj.

Finally, we can switch the order of the sums without worrying because they're finite sums. This gives exactly the same formula that we had on the left-hand side.

Index notation is very heavily used in subjects like general relativity. For example, the Riemann curvature tensor Rijk is an object with four indices, some up and some down!