1 — Configuration
2 — Enter matrix values (fractions like 1/3 are supported)

How to Multiply Matrices — Step-by-Step

Matrix multiplication (also called the matrix product) combines two matrices to produce a third. Unlike ordinary multiplication, there is an important rule: the number of columns in the first matrix must equal the number of rows in the second matrix.

The Golden Rule: cols(A) = rows(B)

If matrix A is m × n and matrix B is n × p, then A × B produces an m × p matrix. The inner dimensions (both n) must match.

Step-by-step process

  1. Verify that the number of columns in A equals the number of rows in B.
  2. The result matrix C will have the same number of rows as A and the same number of columns as B.
  3. Each element C[i, j] is the dot product of row i from A and column j from B.
  4. Multiply matching elements, then sum them all up.

Worked example: 2×2 matrix multiplication

Multiply A (2×2) by B (2×2):

Matrix A

[ 1 2 ]
[ 3 4 ]

Matrix B

[ 5 6 ]
[ 7 8 ]
C[1,1] =(1×5) + (2×7) = 5 + 14 = 19
C[1,2] =(1×6) + (2×8) = 6 + 16 = 22
C[2,1] =(3×5) + (4×7) = 15 + 28 = 43
C[2,2] =(3×6) + (4×8) = 18 + 32 = 50

Result: C = [[19, 22], [43, 50]]

Worked example: 3×3 matrix multiplication

For a 3×3 example, each element requires the sum of three products — one for each inner dimension. For example, to find C[1,1], take row 1 of A = [a, b, c] and column 1 of B = [d, e, f], then compute a·d + b·e + c·f. Click "Show step-by-step solution" above to see every calculation after using the calculator.

Which Matrix Sizes Can Be Multiplied?

The table below shows common matrix size combinations, whether they are compatible, and what size result they produce:

Matrix AMatrix BCompatible?Result size
2×22×2Yes2×2
2×33×2Yes2×2
3×33×3Yes3×3
3×22×4Yes3×4
4×44×4Yes4×4
1×33×1Yes1×1 (scalar)
2×32×3No
3×23×2No
4×32×4No

Our calculator checks this automatically and shows a warning if dimensions are incompatible. To multiply a matrix by a vector, set one matrix to a single column (e.g., 3×1).

Key Properties of Matrix Multiplication

Not commutative

Unlike regular multiplication, A × B ≠ B × A in general. Often B × A is not even defined when A × B is. This is the most important distinction when working with matrices.

Associative

(A × B) × C = A × (B × C). When multiplying three matrices, the grouping does not affect the final result. This calculator handles 3-matrix chains in a single step.

Distributive

A × (B + C) = A×B + A×C. Matrix multiplication distributes over addition, just like scalar multiplication.

Identity matrix

Multiplying any matrix A by the identity matrix I returns A unchanged: A × I = I × A = A.

Real-world applications

Matrix multiplication is used in computer graphics (3D coordinate transforms), machine learning (neural network forward passes), economics (Leontief input-output models), network theory (shortest path algorithms), and cryptography (Hill cipher).

Frequently Asked Questions

Related Matrix Calculators

Need more matrix operations? These tools handle the most common tasks: