10. Dot product, 2

10. Dot product, 2

Transposition

You may have noticed that the definition of the dot product looks a lot like matrix multiplication. In fact, it is a special case of matrix multiplication: v 1 w 1 + + v n w n = ( v 1 v n ) ( w 1 w n ) . Technically, the matrix product gives a 1-by-1 matrix whose unique entry is the dot product, but let's not be too pedantic.

Here, we took the column vector v = ( v 1 v n ) and turned it on its side to get a row vector which we call the transpose of v , written: v T = ( v 1 v n ) .

More generally, you can transpose a matrix:

Definition:

Given an m -by- n matrix M with entries M i j , we get an n -by- m matrix M T whose i j th entry is M j i , i.e. ( M T ) i j = M j i

( 1 2 3 4 ) T = ( 1 3 2 4 ) .

( 1 2 3 4 5 6 ) T = ( 1 4 2 5 3 6 ) .

So the rows of M become the columns of M T .

With all this in place, we observe that the dot product v w is v T w .

Lemma:

( A B ) T = B T A T .

Writing out the i j th entry of ( A B ) T using index notation, we get: ( A B ) i j T = ( A B ) j i = k A j k B k i Similarly expanding B T A T we get ( B T A T ) i j = k ( B T ) i k ( A T ) k j = k B k i A j k The two expressions differ only by the order of the factors A j k and B k i .

The order of these factors doesn't matter: A j k and B k i are just numbers (entries of A and B ), so they commute. This is one reason index notation is so convenient: it converts expressions involving noncommuting objects like matrices into expressions involving commuting quantities (numbers).