matrix multiplication calculator

Interactive Matrix Multiplication Tool

Set matrix dimensions, enter values, and compute A × B instantly. Rule reminder: the number of columns in Matrix A must equal the number of rows in Matrix B.

Matrix size limit: 8 × 8 for readability.

Matrix A

Matrix B

How matrix multiplication works

Matrix multiplication combines two matrices to produce a new matrix. It is not performed element-by-element. Instead, each entry in the result matrix comes from a dot product: multiply a row from the first matrix by a column from the second matrix, then add the products.

If A is an m × n matrix and B is an n × p matrix, then A × B is defined and the result is an m × p matrix.

Dimension rule (the most important check)

Before multiplying, always check compatibility:

  • Columns of Matrix A must equal rows of Matrix B.
  • If this condition fails, multiplication is undefined.
  • The output matrix shape is rows of A by columns of B.

Example: A is 2 × 3 and B is 3 × 4. This is valid, and the result will be 2 × 4.

Step-by-step example

Given matrices

Let:

  • A = [[1, 2], [3, 4]]
  • B = [[5, 6], [7, 8]]

Compute each cell:

  • C(1,1) = 1×5 + 2×7 = 19
  • C(1,2) = 1×6 + 2×8 = 22
  • C(2,1) = 3×5 + 4×7 = 43
  • C(2,2) = 3×6 + 4×8 = 50

So the result is C = [[19, 22], [43, 50]].

Common mistakes to avoid

  • Mixing up dimensions: Check compatibility first.
  • Element-wise confusion: Matrix multiplication is not simple pair matching unless specifically requested (Hadamard product).
  • Order matters: In general, A × B ≠ B × A.
  • Arithmetic slips: Dot products can be error-prone by hand; use a calculator to verify.

Why this matters in real applications

Matrix multiplication is foundational in many fields:

  • Computer graphics (rotations, scaling, and transformations)
  • Machine learning and neural networks
  • Data science and statistics
  • Physics simulations and engineering systems
  • Economics and optimization models

Quick tips for using this calculator

  • Start with small matrices to understand the process.
  • Use decimal values if needed; the calculator supports them.
  • Use “Fill Example” to instantly test a known case.
  • For classroom work, compute one row/column manually and compare.

🔗 Related Calculators

🔗 Related Calculators