Matrix Multiplication Calculator

Multiply two matrices where columns of A equal rows of B.

Rows separated by semicolons, columns by commas. Cols of A must equal rows of B.

How Matrix Multiplication Works

Each element (i,j) in the product matrix C = A×B is computed as the dot product of row i of A with column j of B:

C[i][j] = A[i][0]×B[0][j] + A[i][1]×B[1][j] + ... + A[i][n-1]×B[n-1][j]

For this to work, the number of columns in A must equal the number of rows in B. If A is m×n and B is n×p, then C = A×B is m×p.

Worked Example

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

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

C[0][0] = 1×5 + 2×7 = 19
C[0][1] = 1×6 + 2×8 = 22
C[1][0] = 3×5 + 4×7 = 43
C[1][1] = 3×6 + 4×8 = 50

A×B = [19, 22] [43, 50]

Key Properties

Dimension Rule

Only compatible dimensions can be multiplied:

Real-World Applications

Frequently Asked Questions

When can two matrices be multiplied?

Matrix A (m×n) can multiply B (n×p) only when cols(A) = rows(B). The result is m×p.

Is matrix multiplication commutative?

No. A×B ≠ B×A in general. It is associative and distributive, but not commutative.

What is the identity matrix for multiplication?

The identity matrix I has 1s on the diagonal and 0s elsewhere. A×I = I×A = A.

How do I compute a single element of the product?

Element C[i][j] = dot product of row i of A with column j of B = sum of A[i][k]×B[k][j] for all k.