Use this calculator to multiply two matrices quickly. Choose dimensions for matrix A (m × n) and matrix B (n × p), enter values, and click calculate.
Current setup: A (2 × 2) and B (2 × 2)
Matrix A
Matrix B
What Is Matrix Multiplication?
Matrix multiplication is a way to combine two matrices into a new matrix. It is one of the most important operations in linear algebra and is used in data science, engineering, computer graphics, economics, and machine learning.
If matrix A has size m × n and matrix B has size n × p, then the product matrix C = A × B has size m × p. The middle dimension n must match, or multiplication is not defined.
How the Calculator Works
1) Choose matrix dimensions
Set rows and columns using the three inputs at the top. The calculator enforces valid multiplication format automatically by using one shared inner dimension.
2) Enter values for both matrices
After generating the matrix grids, type your numbers directly into each cell. Decimals and negative values are supported.
3) Multiply and view result
Click Multiply Matrices. The result appears as a new matrix with correct output dimensions and computed values.
Matrix Multiplication Rule (Core Idea)
Each value in the result matrix comes from a row-by-column dot product:
- Take one row from matrix A.
- Take one column from matrix B.
- Multiply corresponding entries.
- Add those products together.
Repeat for every row and column pair to build the full output matrix.
Example
Suppose:
- A = [[1, 2], [3, 4]]
- B = [[5, 6], [7, 8]]
Then:
- C₁₁ = 1×5 + 2×7 = 19
- C₁₂ = 1×6 + 2×8 = 22
- C₂₁ = 3×5 + 4×7 = 43
- C₂₂ = 3×6 + 4×8 = 50
So C = [[19, 22], [43, 50]].
Common Mistakes to Avoid
- Dimension mismatch: the number of columns in A must equal the number of rows in B.
- Entry order errors: matrix multiplication is generally not commutative, so A × B is usually different from B × A.
- Arithmetic mistakes: carefully multiply then sum each row-column pair.
Where Matrix Multiplication Is Used
- Machine learning: neural network layers and feature transformations.
- Computer graphics: 2D/3D rotations, scaling, and camera transforms.
- Economics and finance: input-output models and portfolio transformations.
- Physics and engineering: state-space systems and signal processing.
Quick Tips for Better Accuracy
- Use small dimensions first to verify your setup.
- Enter values row by row to stay organized.
- Use the example-fill button to test the calculator logic quickly.