A (
4
×
3
)
(
)
B (
3
×
1
)
(
)
=
AB ( 4 × 1 )
(
)
The product AB is only defined if the number of columns of A is the same as the number of rows of B.

B ( 3 × 1 )
(
)
A ( 4 × 3 )
(
)
=
BA ( × )
(
)
The product BA is only defined if the number of columns of B is the same as the number of rows of A.

Matrix multiplication: AB and BA

Created by Wangrui Zhao

Computation
AB
← Hover over a result entry
BA
← Hover over a result entry

How to use

Hover over a result entry to see which products are summed.
Edit any value to update live.
Use the ▲▼ steppers above A and B to change their dimensions.


AB vs BA

The two products live in the two rows. Each is only defined when the inner dimensions match.


Legend

active row of the left factor
active column of the right factor
resulting entry of the product