Dot product in matrix notation

The transpose of a matrix

Before describing the dot product in matrix notation, we briefly digress to make sure you know what the transpose of a matrix is.

We can transpose a matrix by switching its rows with its columns. We denote the transpose of matrix A by AT . For example, if

A = 123 4 5 6

then the transpose of A is

AT = 14 2 5 36 .

Since an n-dimensional vector x is represented by an n × 1 column matrix,

x = x1 x2 x3 x n ,

the transpose xT is a 1 × n row matrix

xT = x1x2x3xn .

The dot product as matrix multiplication

Given the rules of matrix multiplication, the product of a 1 × n matrix with an n × 1 matrix is a 1 × 1 matrix, i.e., a scalar. So if we multiply xT (a 1 × n matrix) with any n-dimensional vector y (viewed as an n × 1 matrix), we end up with a matrix multiplication equivalent to the familiar dot product of x y:

xT y = x1x2x3xn y1 y2 y3 y n = x1y1 + x2y2 + x3y3 + + xnyn = x y.

Although we won’t typically write a dot product as xT y, you may see it elsewhere. Moreover, this dot product forms the building block for the general matrix multiplication.