Matrix Operations
10+ solvers available
Basic Operations
Multiplication
Properties
Advanced
Matrix Multiplication Calculator
Multiply two matrices A (m×k) and B (k×n) using the row-column rule. The result C = A×B has dimensions m×n, where each entry Cᵢⱼ is the dot product of row i of A and column j of B. Matrix multiplication is not commutative (AB ≠ BA generally), but it is associative and distributive
Learn About Matrix Multiplication
Understanding the concepts behind the calculations.
📑 Quick Navigation
What is Matrix Multiplication?
Matrix multiplication is NOT element-wise multiplication. It is a row-column operation where each entry in the product is the dot product of a row from the first matrix and a column from the second matrix.
Definition: If A is an m×n matrix and B is an n×p matrix, then C = A·B is an m×p matrix where:
Each entry cᵢⱼ = (row i of A) · (column j of B)
⚠️ IMPORTANT: Matrix multiplication is NOT commutative! A·B ≠ B·A in general.
Visual Representation
The entry at (1,1) comes from row 1 of A and column 1 of B.
The Dimension Rule: Inner Dimensions Must Match
Dimension Compatibility: For A·B to be defined:
The number of columns of A must equal the number of rows of B.
✅ Valid Multiplications:
- 2×3 · 3×4 = 2×4 ✓
- 3×3 · 3×3 = 3×3 ✓
- 1×5 · 5×1 = 1×1 ✓ (dot product)
- 4×2 · 2×3 = 4×3 ✓
❌ Invalid Multiplications:
- 2×3 · 2×3 ✗ (inner: 3 ≠ 2)
- 3×2 · 3×3 ✗ (inner: 2 ≠ 3)
- 4×1 · 4×1 ✗ (inner: 1 ≠ 4)
💡 Memory Trick: Write dimensions side by side: (m × n)(n × p) → (m × p). The inner numbers (n) must match, and they "cancel" to give outer dimensions.
How to Multiply: Row × Column
The Process
- Take row i from the first matrix A
- Take column j from the second matrix B
- Multiply corresponding elements and sum them up (dot product)
- Place result in position (i, j) of the product matrix C
- Repeat for all i and j
Example: 2×2 Multiplication
- Entry (1,1): (row1 of A) · (col1 of B) = a·e + b·g
- Entry (1,2): (row1 of A) · (col2 of B) = a·f + b·h
- Entry (2,1): (row2 of A) · (col1 of B) = c·e + d·g
- Entry (2,2): (row2 of A) · (col2 of B) = c·f + d·h
Properties of Matrix Multiplication
✓ Associative
Order of multiplication doesn't matter for grouping.
✓ Distributive
Multiplication distributes over addition.
✗ NOT Commutative
Order MATTERS! Always specify which is first.
✓ Identity Matrix
The identity matrix I acts like 1 for multiplication.
Additional Properties
- Transpose:
(AB)ᵀ = BᵀAᵀ(notice order reversal!) - Scalar multiplication:
c(AB) = (cA)B = A(cB) - Zero matrix:
A·0 = 0and0·A = 0
📌 Important: Unlike regular numbers, matrix multiplication is not commutative. AB and BA may not even have the same dimensions!
Step-by-Step Examples
Example 1: 2×2 × 2×2
Problem: Multiply A·B
Step 1: Check dimensions → 2×2 · 2×2 = 2×2 ✓
Step 2: Compute entry C₁₁ (row1·col1):
Step 3: Compute entry C₁₂ (row1·col2):
Step 4: Compute entry C₂₁ (row2·col1):
Step 5: Compute entry C₂₂ (row2·col2):
Result:
Example 2: 2×3 × 3×2
Problem: Multiply A·B (notice inner dimension 3 matches!)
Result will be 2×2
C₁₁: Row1·Col1 = 1·7 + 2·9 + 3·11 = 7 + 18 + 33 = 58
C₁₂: Row1·Col2 = 1·8 + 2·10 + 3·12 = 8 + 20 + 36 = 64
C₂₁: Row2·Col1 = 4·7 + 5·9 + 6·11 = 28 + 45 + 66 = 139
C₂₂: Row2·Col2 = 4·8 + 5·10 + 6·12 = 32 + 50 + 72 = 154
Example 3: Demonstrating Non-Commutativity
Show that AB ≠ BA
AB:
BA:
Conclusion: AB ≠ BA, proving matrix multiplication is not commutative!
Special Cases
| Case | Description | Example |
|---|---|---|
| Square × Square | Most common case | 3×3 · 3×3 = 3×3 |
| Row Vector × Column Vector | Dot product (scalar result) | 1×n · n×1 = 1×1 |
| Column Vector × Row Vector | Outer product (matrix result) | n×1 · 1×m = n×m |
| Identity Matrix I | AI = A and IA = A | I acts like 1 |
| Zero Matrix 0 | A·0 = 0 and 0·A = 0 | Zero matrix times anything = zero |
| Symmetric × Symmetric | Product may not be symmetric! | AB not necessarily symmetric |
Real-World Applications
🤖 Machine Learning
- Neural Networks: Layer transformations = weight matrix × input vector
- Linear Regression: Predictions = X·β
- Principal Component Analysis (PCA): Projections = X·V
- Word Embeddings: Word2Vec, GloVe use matrix multiplications
🎮 Computer Graphics
- 3D Transformations: Rotation, scaling, translation matrices
- Camera Projections: 3D → 2D via matrix multiplication
- Animation: Skeletal transformations
🔬 Engineering
- Control Systems: State-space models (x' = Ax + Bu)
- Structural Analysis: Stiffness matrices
- Signal Processing: Filtering and convolution
📊 Economics
- Input-Output Models: x = Ax + d → (I-A)x = d
- Portfolio Optimization: Risk calculations
- Markov Chains: πₙ = π₀·Pⁿ
Common Mistakes to Avoid
- Multiplying incompatible dimensions → Always check that columns of A = rows of B
- Assuming commutativity → AB ≠ BA in most cases! Always respect order
- Element-wise multiplication confusion → Matrix multiplication uses dot products, not multiplying corresponding entries
- Forgetting that (AB)ᵀ = BᵀAᵀ → Notice the order reversal!
- Misplacing the summation → Make sure you sum ALL products from k=1 to n
- Incorrect dimension of result → Result dimensions are (rows of A) × (columns of B)
Frequently Asked Questions
Q: Why isn't matrix multiplication commutative?
A: Because the row-column operation is directional. Row i of A pairs with column j of B. Swapping changes which rows pair with which columns, usually giving different results.
Q: Can I multiply a 3×2 matrix by a 3×2 matrix?
A: No. For 3×2 · 3×2, inner dimensions are 2 (from first) and 3 (from second). 2 ≠ 3, so undefined.
Q: Is matrix multiplication associative?
A: Yes! (AB)C = A(BC) whenever the dimensions allow the products. This is very useful for computing efficiency.
Q: What is the identity matrix and why is it special?
A: Identity I has 1s on diagonal, 0s elsewhere. For any compatible A: A·I = A and I·A = A. It's the multiplicative identity element.
Q: How does matrix multiplication relate to linear transformations?
A: Each matrix represents a linear transformation. Matrix multiplication corresponds to composition of transformations (apply one, then the other).
Q: What's the cost of multiplying matrices?
A: For m×n and n×p matrices, naive multiplication requires m·n·p multiplications. For 2×2: 8 multiplications. For 100×100: 1 million!
Practice Problems
Beginner
-
Multiply:
$$ \begin{bmatrix} 1 & 0 \\\\ 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} 4 & 5 \\\\ 6 & 7 \end{bmatrix} $$ -
Compute the dot product (1×2 · 2×1):
$$ \begin{bmatrix} 2 & 3 \end{bmatrix} \cdot \begin{bmatrix} 4 \\\\ 5 \end{bmatrix} $$
Intermediate
-
Multiply:
$$ \begin{bmatrix} 2 & -1 \\\\ 0 & 3 \end{bmatrix} \cdot \begin{bmatrix} 1 & 4 \\\\ -2 & 1 \end{bmatrix} $$ -
If A is 3×4 and B is 4×2, what are the dimensions of AB?
Advanced
-
Find two 2×2 matrices where AB = 0 but neither A nor B is zero.
-
Show that (AB)ᵀ = BᵀAᵀ using A = [[1,2],[3,4]] and B = [[5,6],[7,8]]
Click to reveal solutions
1. Same as B: [[4, 5], [6, 7]] (identity matrix)
2. 2·4 + 3·5 = 8 + 15 = 23 (scalar, not matrix)
3. [[4, 7], [-6, 3]]
4. 3×2
5. Example: A = [[1,0],[0,0]], B = [[0,0],[0,1]]
6. Compute both sides to verify equality
Summary
🎯 Key Takeaways
- Matrix multiplication is NOT element-wise — it's row × column dot products
- Dimension rule: (m×n)(n×p) = (m×p) — inner dimensions must match
- NOT commutative: AB ≠ BA in general — order matters!
- IS associative: (AB)C = A(BC) — grouping doesn't matter
- Identity I: AI = IA = A — acts like 1 for multiplication
- Applications: Neural networks, graphics, control systems, economics
💡 Quick Memory Aid: "Rows of A, columns of B, dot product in the middle!"
Try It Yourself!
Use the calculator above to multiply matrices:
- Enter Matrix A (first matrix)
- Enter Matrix B (second matrix — must have compatible dimensions)
- Click "Calculate" to see:
- The dimension check (inner dimensions must match)
- Each entry's dot product calculation
- The resulting product matrix C = A·B
- Step-by-step verification
📐 Test these examples:
- 2×2 multiplication:
[[1,2],[3,4]] × [[5,6],[7,8]] - Rectangular matrices:
[[1,2,3],[4,5,6]] × [[7,8],[9,10],[11,12]] - Identity test: Any matrix × Identity = Same matrix
- Non-commutativity: Try switching the order to see different results!
📐 Pro Tip: Always check dimensions first — our calculator will warn you if they're incompatible!