07. Index notation

07. Index notation

Index notation

I can write the entries of an m -by- n matrix A as A = ( A 11 A 12 A 13 A 1 n A 21 A 22 A 23 A 2 n A m 1 A m 2 A m 3 A m n ) . Here A i j 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 A B , we can just write a formula for the i j th entry ( A B ) i j . Suppose that A is m -by- n and B is n -by- p .

To get ( A B ) i j , we need to multiply the i th row of A into the j th column of B , in other words: ( A B ) i j = ( A i 1 A i 2 A i n ) ( B 1 j B 2 j B n j ) = A i 1 B 1 j + A i 2 B 2 j + + A i n B n j = k = 1 n A i k B k j . 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 i j th entry of A B : it's k = 1 n A i k B k j .

Associativity of matrix multiplication

To demonstrate how useful index notation is, let's prove that matrix multiplication is associative, that is: ( A B ) C = A ( B C ) . We can just write out the formula for the i j th entry on each side and check they give the same answer. For the left-hand side: ( ( A B ) C ) i j = k ( A B ) i k C k j = k A i B k C k j 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 ( B C ) ) i j = k A i k ( B C ) k j = k A i k B k C j We can take the factor A i k inside the sum (just by multiplying out the whole expression), which gives: ( A ( B C ) ) i j = k A i k B k C j .

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 ( B C ) ) i j = k A i B k C k j . 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 R j k i is an object with four indices, some up and some down!