Skip to content
MasterMath

Matrix Multiplication Calculator

Multiply two matrices and see whether the order matters — it almost always does. The columns of A must equal the rows of B.

Product A × B

—

Product A × B—
Dimensions of the result—
Are they compatible?—
Does A × B = B × A?—

The product matrix

RowValues

How this was worked out

    The formula

    (A × B)ᵢⱼ = Σ Aᵢₖ × Bₖⱼ

    What it means

    Each element of the product is a row of A paired with a column of B: multiply term by term and add. That is why the number of columns in A has to equal the number of rows in B — otherwise the pairing runs out.

    How to do it by hand

    1. Check the columns of A match the rows of B
    2. The result is as tall as A and as wide as B
    3. For each position, take that row of A and that column of B
    4. Multiply term by term and add the products

    What is worth knowing

    Matrix multiplication is not commutative, and that is not a quirk — it is the whole point. A matrix represents a transformation, and rotating then stretching is genuinely different from stretching then rotating. Sometimes B × A is not even defined: a 2×3 times a 3×4 works, and the reverse does not. The definition looks arbitrary until you see that it is exactly what makes the product represent 'apply B, then apply A', which is what makes matrices useful for graphics, physics and everything downstream.

    Frequently asked questions

    When can two matrices be multiplied?

    When the columns of the first equal the rows of the second. A 2×3 times a 3×4 gives a 2×4.

    Why is A × B not the same as B × A?

    Because matrices represent transformations, and the order you apply them in changes the result. Sometimes B × A is not even defined.

    Why is the definition so complicated?

    Because it is built so the product represents doing one transformation after another. That property is what makes it useful.

    What is the identity matrix?

    A square matrix with ones on the diagonal and zeros elsewhere. Multiplying by it leaves any matrix unchanged.