top | item 27751398

(no title)

mferraro89 | 4 years ago

Thanks for calling this out, I thought it might cause confusion. Matrices are super weird objects because they don't fit nicely into the {scalar, vector, function, operator} classes that maybe we're used to. A matrix is a function in that it can take in a vector and map it to a new vector. It is also an operator in that it can take in some other matrix (a function!) and give you a transformed matrix (a new function). It is also a function in the sense that it can map vectors to scalars, where the input vectors (x, y) are the coordinates and the scalar stored there is the output. All of this gets further complicated by the fact that the elements of a matrix can be scalars, complex numbers, or even matrices! They are really strange objects and maybe I'll write up a whole post just about that strangeness.

discuss

order

yccs27|4 years ago

Just writing down the connections here for myself and maybe others:

A matrix represents a linear function taking a vector and returning a vector, written as

w = M v

Matrix multiplication corresponds to function composition.

Vectors can be indexed, and we can view them as a function i -> v[i] defined on the indexing set. We can also define basis vectors b_i, such that b_i[j] is 1 at index j=i and 0 otherwise. Any vector can be written as a weighted sum of basis vectors, with the vector components as coefficients:

v = Σ_i v[i] b_i

where Σ_i represents summation over the index i.

Matrices can be indexed with two indices, and this is closely related to vector indexing: For a matrix M, we have

M[i, j] = (M b_j)[i]

Each column of the matrix represents its output for a certain basis vector as input. By writing a vector as a sum of basis vectors and using linearity, we get the well-known matrix-vector multiplication formula:

(M v)[i] = Σ_j M[i, j] v[j]