How this calculation works
An entry of A × B is the dot product of one row of A with one column of B. A must have as many columns as B has rows. The result keeps A’s row count and B’s column count.
Cᵢⱼ = Σₖ Aᵢₖ BₖⱼA worked example
For A = [1 2; 3 4] and B = [5 6; 7 8], A × B = [19 22; 43 50]. The first entry is 1 × 5 + 2 × 7 = 19.
Good to know
For small matrices of exact rational numbers, up to 6 rows and 6 columns. Entries are limited to ±1,000,000; integer fraction denominators to 1,000,000. Decimal input allows up to 6 places. No expressions, scientific notation, complex numbers or uncertain measurements. Large intermediate fractions are bounded to keep the tool responsive.
Reference: Harvey Mudd College: matrix algebra (opens in a new tab) ↗
A small shopping example makes the dimensions useful
Suppose one row contains quantities [2 3] and a column contains the corresponding prices [10; 20]. Their product is a single total, 2 × 10 + 3 × 20 = 80. The two matching positions connect a quantity to its price.
Several rows of quantities can represent several orders. Several columns of prices can represent alternative price scenarios. The product then gives one total for each order and scenario, so the outer dimensions tell you what each result represents.
Multiplication order is part of the question
With A = [1 2; 3 4] and B = [5 6; 7 8], A × B starts with 19, while B × A starts with 23. The inputs have matching square dimensions, yet reversing them changes the answer. This makes order a substantive choice.
A × B may also exist when B × A does not. A 2 × 3 matrix multiplied by a 3 × 1 matrix gives a 2 × 1 result. The reversed order would need the inner dimensions 1 and 2 to match, which they do not.
Inspect one cell before trusting the whole table
The worked steps expand the top-left entry into individual products. Check this cell against your intended row and column labels before copying a large result. If that pairing is wrong, the remaining arithmetic can be correct while answering the wrong question.
For a two-row product, confirm that the second output row uses the second input row rather than the first. Copying one row of a worked example into every output position is a common transcription error that the dimensions alone will not reveal.
A few questions, answered
Is this entry-by-entry multiplication?
No. It calculates the usual matrix product using row-by-column dot products. Hadamard multiplication is a separate operation.
Can the result be a single number?
Yes. A 1 × n row multiplied by an n × 1 column produces a 1 × 1 matrix.
Does multiplying by an identity matrix change A?
No, when its size is compatible. You can enter a matching identity to check input ordering and the product table.