Matrix multiplication composes linear transformations, chains Markov transitions, rotates and scales graphics, and is the core operation of neural networks.
How to use the Matrix Multiplication Calculator
- First matrix size (rows × columns)
- A: a₁
- A: b₁
- A: c₁
- A: a₂
- A: b₂
- A: c₂
- A: a₃
- A: b₃
- A: c₃
- Second matrix size (rows × columns)
- B: x₁
- B: y₁
- B: z₁
- B: x₂
- B: y₂
- B: z₂
- B: x₃
- B: y₃
- B: z₃
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
Each entry of the product is the dot product of a row of A with a column of B. The number of columns of A must equal the number of rows of B.
Formula
cᵢⱼ = Σₖ aᵢₖ · bₖⱼ (A is m × n, B is n × p, C is m × p)
Worked example
Inputs: First matrix size (rows × columns): 2 × 3; A: a₁: 4; A: b₁: 1; A: c₁: 2; A: a₂: 1; A: b₂: 3; A: c₂: 0; Second matrix size (rows × columns): 3 × 2; B: x₁: 1; B: y₁: 2; B: x₂: 0; B: y₂: 1; B: x₃: 2; B: y₃: 1.
Results: A × B = ⎡ 8 11 ⎤
⎣ 1 5 ⎦; Size of the product = 2×2; How each entry is computed = c₁₁ = 4·1 + 1·0 + 2·2 = 8
c₁₂ = 4·2 + 1·1 + 2·1 = 11
c₂₁ = 1·1 + 3·0 + 0·2 = 1
c₂₂ = 1·2 + 3·1 + 0·1 = 5.
Key terms
- Matrix product
- The composition of linear maps.
Frequently asked questions
When can two matrices be multiplied?
When A has as many columns as B has rows.
Is AB = BA?
Generally not, because matrix multiplication is not commutative.
What is the size of the product?
(rows of A) × (columns of B).
What is the identity matrix?
The square matrix with 1s on the diagonal; AI = IA = A.