Matrix Multiplication (2×3 · 3×2)
Multiply rectangular matrices by matching the left column count with the right row count.
Match the inner dimension 3
Each left row and right column has three entries. The 2×3 and 3×2 factors therefore produce four dot products in a 2×2 result.
[[1, 2, 3], [4, 0, −1]] · [[1, 0], [2, −1], [0, 3]]Reverse the outer dimensions
A 3×2 matrix times a 2×3 matrix has the same inner dimension but a 3×3 result. The outer dimensions determine the output shape.
[[1, 0], [2, −1], [0, 3]] · [[1, 2, 3], [4, 0, −1]]See a one-by-one result
A 1×3 row times a 3×1 column produces one dot product in a 1×1 matrix, not three separate entries.
[[2, −1, 3]] · [[4], [2], [−1]]Practice
Practice: problems like this one, made and checked in your browser.
Recap
- The left column count must equal the right row count.
- Output rows come from the left matrix; output columns come from the right.
- Reversing rectangular factors can change the result dimensions.