Matrix-Vector Products

Tags
👉
Here, we explore the simplest operations: matrix vector and matrix matrix products, but we try to understand them inside and out

Vector-vector products

If we had a vector x,yx, y, then xTyx^Ty i the inner product. On the other hand, xyTxy^T is the outer product, defined as follows

This can make your life easier if your matrix has a certain pattern to it.

Matrix-Vector Product

Matrix-vector product: row inner product interpretation

Matrix-vector product: mixture of column interpretation

Intuitively, here is where we see the matrix as a definition of a new basis, where each column is a basis vector.

Linear function interpretation

You can think of the matrix as a compact representation of a series of linear functions. If a matrix is m×mm \times m, it can be "solved" with vector xx such that Ax=bAx = b. If it's m×nm \times n where m>nm > n, then you have more "equations" then "variables" (more formally, you're mapping from lowdim to highdim). Therefore, you might not have a solution for Ax=bAx = b. Alternatively, if m<nm < n, then you have more "variables" than "equations", so you will have infinite solutions.

Therefore, you can think of matrices as representations of functions, as well as functions itself!

Matrix-Matrix Product

The inner product interpretation

Every element at i,ji, j is just the dot product of the ith row with the jth column

The Outer product interpretation

You can also think of the whole matrix product as a summation of outer products.

Column and Row Interpretations

You can think of the second matrix as a bunch of vectors (which it is), and it yields the following result

You can also think of the first matrix as a bunch of rows, which allows you to writ it like this

👉
The general theme: there are many ways of looking at something. Use them when needed!

The geometric tie-in

A matrix is a function that maps from one set of basis vector to another set. To be more precise, Au1=∑Aj,1wjAu_1 = \sum A_{j, 1}w_j. therefore, a matrix-vector product is a transformation of a vector. This is expressed as a linear combination of transformations of basis vectors, due to the linearity property of linear maps.

A matrix-matrix product is just a transformation of a set of basis vectors, which has already been transformed once by one matrix. It's akin to function composition.

The path interpretations

You can imagine an input xx and an output yy, and we compose the two functions A,BA, B. There are multiple paths from each element input to each element output, and the matrix multiplication is just summing up all the paths (one path above is highlighted)