Skip to content
math

Matrix Multiplication Calculator

Multiply two matrices A (m×n) and B (n×p) to get an m×p product using the row-by-column rule.

Matrix A (2×2)
Matrix B (2×2)
A · B
[0, 0] [0, 0]
The product is a 2×2 matrix. Each entry (i, j) is the dot product of row i from A and column j from B.

Row-by-column rule

For A (m×n) · B (n×p) to be defined, A’s column count must equal B’s row count — both equal n. The result is an m×p matrix. Entry C[i][j] = Σ A[i][k] × B[k][j] for k = 1 … n. Multiplication is not commutative in general: A·B ≠ B·A.

How it works

  1. 1Set m, n, and p with the selectors. A becomes m×n; B becomes n×p (sharing the inner dimension n).
  2. 2Fill in the cell values for both matrices. Each entry in the result C[i][j] = Σ A[i][k] × B[k][j] for k = 1…n.
  3. 3The calculator displays the m×p product matrix as soon as the inner dimensions agree.

Use cases

  • Composing linear transformations in computer graphics — rotation followed by scaling, for example.
  • Solving systems of equations by representing coefficient and variable matrices separately.
  • Verifying hand-calculated products step-by-step in a linear algebra course.

Frequently asked questions

Why can’t I multiply any two matrices together?

Matrix multiplication requires A’s column count to equal B’s row count (the shared n). A 3×2 matrix can multiply a 2×4 matrix, but not another 3×2 matrix. Use the n selector to keep both matrices compatible.

Is matrix multiplication commutative?

No. In general A·B ≠ B·A — swapping the order usually changes the result, and the product may not even be defined in both orders if the matrices aren’t square.

What size matrices does this calculator support?

Each dimension (m, n, p) can range from 1 to 4, so you can compute products up to 4×4. This covers most textbook problems and common 3-D transformation matrices.

See all →