Matrix Multiplication
Matrix multiplication combines two matrices A and B to produce C = AB. Each element C[i][j] is the dot product of row i of A and column j of B. The inner dimensions must match: A (m×n) × B (n×p) yields C (m×p).
Did our AI summary help? Let us know.
Neural layers apply Wx + b — matrix-vector multiplication. Strassen algorithm: O(n^2.81) vs naive O(n³). Identity matrix I satisfies AI = IA = A.
Ready to run the numbers?
Why: Matrix multiplication underpins neural networks, graphics transforms, and Markov chains. Understanding row-by-column dot products is essential for linear algebra.
How: Compute each C[i][j] by taking row i of A, column j of B, multiplying element-wise and summing. Use dimension compatibility to validate before computing.
Run the calculator when you are ready.
Quick Examples — Click to Load
Matrix A
Matrix B
Matrix A (2×2)
Matrix B (2×2)
For educational and informational purposes only. Verify with a qualified professional.
🧮 Fascinating Math Facts
AB is associative: (AB)C = A(BC)
Row × column = scalar; column × row = outer product
Key Takeaways
- • Matrix multiplication is non-commutative: AB ≠ BA in general.
- • Dimension compatibility: A (m×n) × B (n×p) → C (m×p). A's columns must equal B's rows.
- • Matrix multiplication is associative: (AB)C = A(BC).
- • Each element C[i][j] is the dot product of row i of A and column j of B.
- • The identity matrix I satisfies AI = IA = A for compatible square matrices.
Did You Know?
How Matrix Multiplication Works
Matrix multiplication uses row-by-column dot products. For C = A × B:
Formula
C[i][j] = Σ A[i][k] · B[k][j]
Take row i of A and column j of B. Multiply corresponding elements and sum.
Example: C[1,1]
For a 2×2 case: C[1,1] = A[1,1]·B[1,1] + A[1,2]·B[2,1]. The "inner" dimension (columns of A, rows of B) must match.
Expert Tips
Check Dimensions First
Before multiplying, verify cols(A) = rows(B). Otherwise the operation is undefined.
Order Matters
AB ≠ BA in general. Think of matrices as linear maps: applying B then A is different from A then B.
Row × Column = Dot Product
Each result element is a dot product. A 1×n row times an n×1 column gives a scalar.
Use Identity for Checks
Multiply by I to verify: AI = A and IA = A. Great for debugging.
This Calculator vs MATLAB vs Manual
| Feature | This Calculator | MATLAB | Manual |
|---|---|---|---|
| Step-by-step dot products | ✅ | ❌ | ⚠️ |
| Dimension validation | ✅ | ✅ | ⚠️ |
| Bar chart visualization | ✅ | ❌ | ❌ |
| Educational content | ✅ | ❌ | ❌ |
| No installation | ✅ | ❌ | ✅ |
Frequently Asked Questions
Why isn't matrix multiplication commutative?
Matrix multiplication represents composition of linear transformations. Applying transformation B then A generally gives a different result than A then B. So AB ≠ BA in general.
When can two matrices be multiplied?
A (m×n) and B (p×q) can be multiplied as AB only if n = p. The result is m×q.
What is the dot product in matrix multiplication?
Each element C[i][j] is the dot product of row i of A and column j of B: C[i][j] = Σ A[i][k]·B[k][j].
What is the identity matrix?
The n×n identity I has 1s on the diagonal and 0s elsewhere. For any compatible A, AI = IA = A.
What is the computational complexity?
Naive multiplication of m×n by n×p is O(mnp). For square n×n matrices, that's O(n³).
Can I multiply a row vector by a column vector?
Yes! A 1×n row times an n×1 column gives a 1×1 matrix (a scalar) — that's the dot product.
What about column times row?
An n×1 column times a 1×m row gives an n×m matrix — the outer product.
Is (AB)C = A(BC)?
Yes. Matrix multiplication is associative, so you can compute AB first then multiply by C, or BC first then multiply by A.
Matrix Multiplication at a Glance
Sources
- • Gilbert Strang, Linear Algebra and Its Applications
- • Khan Academy — Matrix Multiplication: khanacademy.org
- • MIT OpenCourseWare 18.06: ocw.mit.edu
- • Wolfram MathWorld — Matrix Multiplication: mathworld.wolfram.com
- • 3Blue1Brown — Essence of Linear Algebra: 3blue1brown.com
Disclaimer: This calculator is for educational purposes. Results use JavaScript floating-point arithmetic. For production or research, use specialized libraries (NumPy, MATLAB) for numerical stability. Always verify critical calculations independently.
Related Calculators
Matrix Power Calculator
Matrix Power Calculator - Calculate and learn about linear-algebra concepts
MathematicsLinear Algebra Matrix Calculator
Linear Algebra Matrix Calculator - Calculate and learn about linear-algebra concepts
MathematicsLinear Algebra Matrix Determinant Calculator
Linear Algebra Matrix Determinant Calculator - Calculate and learn about linear-algebra concepts
MathematicsLinear Algebra Matrix Norm Calculator
Linear Algebra Matrix Norm Calculator - Calculate and learn about linear-algebra concepts
MathematicsAdjoint Matrix Calculator
Adjoint Matrix Calculator - Calculate and learn about linear-algebra concepts
MathematicsCharacteristic Polynomial Calculator
Characteristic Polynomial Calculator - Calculate and learn about linear-algebra concepts
Mathematics