Matrix Multiplication Calculator
Multiply two matrices with custom dimensions up to 6×6. Features automatic dimension validation and explicit row × column dot products.
How Matrix Multiplication Works
Unlike simple numbers, matrix multiplication is not entry-by-entry multiplication. Instead, it is defined through the dot product between the row vectors of the first matrix and the column vectors of the second matrix.
\((A)_{m \times k} \times (B)_{k \times n} = (C)_{m \times n}, \quad \text{where } C_{ij} = \sum_{r=1}^{k} A_{ir} B_{rj}\)
The inner dimensions must match (\(k = k\)). The outer dimensions determine the result size (\(m \times n\)).Why is Matrix Multiplication Non-Commutative?
In algebra, \(5 \times 3 = 3 \times 5\). In linear algebra, however:
\(A B \ne B A\)
Each matrix represents a linear transformation (such as a rotation, scaling, or shearing). Performing transformation \(B\) first followed by \(A\) usually yields a completely different spatial result than performing \(A\) first followed by \(B\).
Solved Examples with Complete Step-by-Step Dot Products
Given matrices \(A\) and \(B\):
\(A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}, \quad B = \begin{bmatrix} 7 & 8 \\ 9 & 1 \\ 2 & 3 \end{bmatrix}\)
Step 1: Verify Dimensions:
\(A\) is \((2 \times 3)\) and \(B\) is \((3 \times 2)\). Inner dimension \(3 = 3\), so multiplication is valid. Resulting matrix \(C\) will be \((2 \times 2)\).
Step 2: Calculate each entry as a dot product:
- \(C_{11} = \text{Row } 1 \cdot \text{Col } 1 = (1)(7) + (2)(9) + (3)(2) = 7 + 18 + 6 = 31\)
- \(C_{12} = \text{Row } 1 \cdot \text{Col } 2 = (1)(8) + (2)(1) + (3)(3) = 8 + 2 + 9 = 19\)
- \(C_{21} = \text{Row } 2 \cdot \text{Col } 1 = (4)(7) + (5)(9) + (6)(2) = 28 + 45 + 12 = 85\)
- \(C_{22} = \text{Row } 2 \cdot \text{Col } 2 = (4)(8) + (5)(1) + (6)(3) = 32 + 5 + 18 = 55\)
Step 3: Assemble Product Matrix \(C\):
\(C = AB = \begin{bmatrix} 31 & 19 \\ 85 & 55 \end{bmatrix}\)
Compute \(P \times Q\):
\(P = \begin{bmatrix} 2 & -1 \\ 3 & 4 \end{bmatrix}, \quad Q = \begin{bmatrix} \frac{1}{2} & 0 \\ -2 & 3 \end{bmatrix}\)
Dot products:
- \(C_{11} = (2)\left(\frac{1}{2}\right) + (-1)(-2) = 1 + 2 = 3\)
- \(C_{12} = (2)(0) + (-1)(3) = 0 - 3 = -3\)
- \(C_{21} = (3)\left(\frac{1}{2}\right) + (4)(-2) = \frac{3}{2} - 8 = -\frac{13}{2}\)
- \(C_{22} = (3)(0) + (4)(3) = 0 + 12 = 12\)
\(PQ = \begin{bmatrix} 3 & -3 \\ -\frac{13}{2} & 12 \end{bmatrix}\)
Master Matrix Multiplication
Learn row-column rules, geometric composition of linear transformations, and tricks for multiplying matrices quickly.
Read our student tutorial: How to Multiply Matrices Step-by-Step →