The easiest way to intuit matrix matrix multiplication is as a composition of linear transformations. But before doing that, letโs go through the formal definition.
Consider a matrix :
Consider another matrix :
The resultant matrix can be expressed as follows:
Notice that, each column of matrix is getting transformed by the matrix .
Functional Transformation Perspective
Letโs think about matrix multiplication from a functional transformation perspective. Consider two functions and where both functions abide by the Linearity property.
where,
How to interpret this? Think of any vector . That vector is getting fed to a linear function and produces a vector in . This is equivalent to multiplying the vector with . The resultant vector in gets fed to another linear function which transforms the vector into a vector in . This is equivalent to multiplying the vector by matrix . A visualization is given below:
Composing Transformations
A better way to interpret matrix matrix multiplication is as composing transformations. In Matrix Multiplication as Transformation some โelementaryโ transformation was mentioned. We can compose those transformations to create more complex transformations. Sometimes it is better to think about it the other way meaning decomposing a complex transformation into smaller โelementaryโ transformations.
Consider the following matrix matrix transformation;
Here, two separate types of transformation is getting composed which are rotation followed by a uniform stretching.
Formula for finding each element of a Matrix Matrix multiplication
, and .
Expanding this out will give the following expression:
Each element in the result matrix is just an inner product. This makes writing out the general form really easy. If we want to access the element from the row and column, we can apply the following formula:
Note that, we are summing over number of elements because both and has a length of .
References
- Margalit, Dan, and Joseph Rabinoff. โMatrix Multiplication.โ Interactive Linear Algebra, textbooks.math.gatech.edu/ila/matrix-multiplication.html.