Matrix products
A matrix product contains the dot product of each left-hand row with each right-hand column.
On this page 8 sections
01Many inputs through one matrix#
You already know how a matrix acts on one vector. A matrix product applies the left matrix to each column of the right matrix. Collect the resulting output vectors as columns of the product.
For , entry is output for input column . It therefore uses row of and column of .
In the diagram, pairs row with column . The contributions are and , so . The question marks stand for entries still to compute.
02Complete the product#
Keep with rows and with rows . Column 1 of is . Applying gives , so that is column 1 of .
Column 2 of is . Applying gives . Put both output columns together:
A has rows , ; B has rows , . For , compute .
Show answer and explanation
Row 2 dots column 1: .
03Every row must fit every column#
If is and is , each row-column pair has products to add. There are left rows and right columns, giving output entries.
A is ; B is . A learner says AB is . Repair its shape.
Show answer and explanation
Three A rows and one B column give a result.
Matching dimensions make the multiplication possible; they do not justify multiplying corresponding matrix entries. Even for two square matrices, each output entry generally uses an entire row and column.
04Scores for observations#
Let a data matrix have rows . Let have columns and , the weights of two scoring rules. Each entry of scores one observation under one rule.
For example, row 2 under rule 2 is . Changing row 2 of affects row 2 of the output. Changing column 2 of affects column 2 of the output. Reading those roles is a useful check on an implementation.
A has score rows P , Q . B has observation columns U , V . Find score Q for observation V.
Show answer and explanation
Dot Q with V: .
For entry (i,j), dot row i of the left matrix with column j of the right matrix.
- Compute the entries of a compatible matrix product.
Sources & further reading
- [1]Goodfellow, Bengio and Courville: Deep Learning, 2.1–2.2 ↗www.deeplearningbook.org · Article
- [2]MIT 18.06SC: Lecture 3, Multiplication and Inverse Matrices ↗ocw.mit.edu · Article
- [3]Boyd and Vandenberghe, Introduction to Applied Linear Algebra ↗stanford.edu · Article