Free online matrix tool

Matrix Multiplication Calculator

Multiply two matrices online, calculate the product A × B, and inspect each row-by-column calculation. Choose compatible matrix dimensions and enter your own numbers for an immediate result.

Multiply matrices A and B

Choose the dimensions first. The calculator keeps the inner dimensions compatible so the product can be computed.

Columns of A = rows of B

AMatrix A

2 × 2

BMatrix B

2 × 2

Enter real numbers, including decimals and negative values. For reliable calculations, use values between -1 trillion and 1 trillion.

How matrix multiplication works

Matrix multiplication combines rows from the first matrix with columns from the second matrix. It is different from multiplying entries in matching positions.

1Check the dimensions

If A has m rows and n columns, and B has n rows and p columns, multiplication is possible. The shared dimension n must match.

(m × n) · (n × p) = (m × p)

2Multiply row by column

To calculate one result entry, multiply each number in a row of A by the corresponding number in a column of B, then add those products together.

cᵢⱼ = Σ aᵢₖ bₖⱼ

3Worked example

Consider these two matrices:

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

The top-left entry is calculated from the first row of A and the first column of B: (1 × 5) + (2 × 7) = 19. The top-right entry is (1 × 6) + (2 × 8) = 22. The bottom-left entry is (3 × 5) + (4 × 7) = 43, and the bottom-right entry is (3 × 6) + (4 × 8) = 50.

AB = [[19, 22], [43, 50]]

You can load this example into the calculator above to check the result.

Important matrix multiplication rules

  • The dimensions must match: the number of columns in A must equal the number of rows in B.
  • The result size: multiplying an m × n matrix by an n × p matrix gives an m × p matrix.
  • Order matters: AB is not generally equal to BA. One product may be defined while the other is not.
  • Associative property: when the dimensions allow it, (AB)C = A(BC).
  • Distributive property: when the dimensions allow it, A(B + C) = AB + AC.

Frequently asked questions

How do you multiply two matrices?

Multiply a row of the first matrix by a column of the second matrix. Multiply corresponding entries and add the products. Repeat for every row-column combination to fill the result matrix.

When is matrix multiplication possible?

The number of columns in the first matrix must equal the number of rows in the second matrix. If A is m × n and B is n × p, the product AB has dimensions m × p.

Can rectangular matrices be multiplied?

Yes. Matrices do not have to be square. For example, a 2 × 3 matrix can be multiplied by a 3 × 4 matrix, producing a 2 × 4 matrix.

Is matrix multiplication commutative?

No, not in general. AB and BA can have different values, different dimensions, or one product may be undefined. The order of the matrices matters.

What does this calculator accept?

This calculator supports matrices from 1 × 1 up to 8 × 8 when their dimensions are compatible. Enter real numbers, including negative and decimal values.

Continue working with matrices using these related tools.