Let us break up this problem like we've had previously. π
We begin with the first row of the left-matrix, and
Multiply it with the first column of the right-matrix, with
The output element thus occupying the space (1, 1)
Output element (1, 1)
Output element (1, 2)
Output element (1, 3)
Output element (2, 1)
Output element (2, 2)
Output element (2, 3)
Useful Tricks
Size of output
With the previous example laid out, you might question "What would happen if there are not enough elements in my right-matrix to interact with my left?".
With that being a valid question, math simply answers back with a "you can't" π₯. Hence, the size of both matrices and the non-commutative property (discussed at next page) are important to ensure valid operations.
To recap, we would require
The same amount of columns in the left-matrix, to
the rows of the right-matrix
For example, a left-matrix of size m x n, has to interact with a right-matrix of size n x o, with m and o being any integers greater than or equals to 1.
Finally, the following might be a trivial, but yet a useful trick to find the size of the output vector.
Size of output
As it is a requirement for "n" (value 2) to be the same,
With the values of "m" (value 2), and
"o" (value 1),
The size of output variable of m x o (2 x 1) can be seen
The output matrix size is the rows of the left-matrix, by the columns of the right-matrix (m x o).
Standard Method (rows times columns)
To recap from the previous page, an element has the notation of a(i,j),
where i is the row number,
and j is the column number
Notation of Element
Supposed the fact that the above matrix is the output matrix X in the operation (a . b = x),
What then were the factors of A and B used for the computation of a particular element in X?
You may then recall that we previously used the count of row numbers of the left-matrix, and the count of column numbers of the right-matrix to determine the output matrix size.
Similarly, for each output element x(i, j), its factors are the resultant interaction between the
"i-th" row of the left matrix, and
the "j-th" column of the right-matrix.
This would otherwise be also the standard way to think about matrix multiplication, with:
xi,jβ=k=1βkβai,nβbn,jβ
The following question helps illustrates the discussion.
Let's say we arbitrarily wanted to check the value and the method we obtained x(2, 3).
Element of Output Matrix x(2, 3)
How do we go about doing so? Easy!
We can do so simply via the 2nd row of the left-matrix, and the 3rd column of the right-matrix.
Factors involved in computing x(2, 3)
Columns Method
The output matrix X can be alternatively thought of as
A combination of 3 separate columns, from
Its corresponding column in right-matrix B,
Multiplied by matrix A
(A*Cols of B) represents Cols of X
Row Method
Alternatively, the output matrix X can be alternatively thought of as