How to multiply two matrices
Choose compatible dimensions
Set the rows and columns of Matrix A, then set the rows and columns of Matrix B. A × B exists only when the number of columns in A equals the number of rows in B. The outer dimensions become the result size: an m × n matrix multiplied by an n × p matrix produces an m × p matrix. The helper line states this rule near the selectors, and Calculate gives a clear dimension error if the inner values do not match.
Every visible cell must contain a finite number. Use 0 for an intentional zero, a leading minus sign for a negative number, and a period for decimals. Changing a dimension preserves entries that still occupy the same positions and adds blank cells for new positions. It also invalidates the old result immediately, because a result from a previous shape does not describe the resized matrices.
Follow the row-by-column rule
For each result cell, take one complete row from A and one complete column from B. Multiply the first pair, the second pair, and so on, then add those products. In symbols, cᵢⱼ = Σ aᵢₖbₖⱼ. The shared inner index k is exactly why A must have as many columns as B has rows. This is a dot product repeated for every row-and-column pairing.
Matrix multiplication is not entry-by-entry multiplication and it is generally not commutative. Even when both A × B and B × A exist, they can have different values; for rectangular inputs, one order may exist while the other does not. The page always computes A × B in the order shown. It does not silently swap matrices or calculate a Hadamard product.
Read and check the product
The result grid has one row for every row of A and one column for every column of B. To verify a particular result entry, highlight its row in A and its column in B, multiply matching positions, and add. Checking the first result cell is often enough to catch a wrong dimension choice or accidental entry. Multiplying by an identity matrix of the matching size should return the other matrix unchanged.
Products appear with at most two decimal places, while the internal arithmetic retains numeric precision until formatting. Copy result produces bracketed rows suitable for notes or worksheets. Matrix products are used to apply transformations, combine transition steps, and compose coefficient tables. Those interpretations depend on the order, so label A and B before entering real project data.
Worked examples
Multiply 2 × 3 by 3 × 2
For A = [[1, 2, 3], [4, 5, 6]] and B = [[7, 8], [9, 10], [11, 12]], the top-left entry is 1×7 + 2×9 + 3×11 = 58. The top-right is 64, the bottom-left is 139, and the bottom-right is 154, so A × B = [[58, 64], [139, 154]].
Check with the identity matrix
Let A = [[2, -1], [3, 4]] and B = [[1, 0], [0, 1]]. Each row of A paired with the two identity columns reproduces its original entries. The product is [[2, -1], [3, 4]], which is a useful input check.
Limits and troubleshooting
Supported input and precision
Each dimension is limited to one, two, or three. The page accepts ordinary decimal numbers, including negative values and zero, but not fraction strings, variables, complex entries, pasted matrix syntax, or symbolic expressions. It computes only the product A × B.
Displayed values use at most two decimal places and remove trailing zeros. Repeated calculations are based on the values you entered, not on a rounded displayed result. Very large products are rejected instead of showing Infinity or an unreliable value.
Dimension and entry errors
If the dimensions error appears, change either the column count of A or the row count of B until they match. The result dimensions are allowed to differ from both inputs. A blank-cell error means every visible position, including zeros, must be completed.
This page does not provide elementwise multiplication, powers, inverses, determinants, row reduction, or symbolic steps. It shows a concise row-by-column explanation and numeric product only; use the other dedicated pages for transpose or determinant.
Frequently asked questions
Why must columns of A equal rows of B?
Each result cell pairs an entire row of A with an entire column of B. Those two lists need the same number of elements so every multiplication has a partner.
What size will the result be?
If A is m × n and B is n × p, the product has m rows and p columns. These are the outside dimensions of the two input shapes.
Is A × B always equal to B × A?
No. Matrix multiplication is generally order-sensitive. B × A may differ in value, differ in shape, or be undefined even when A × B is valid.
Can I multiply entries in matching positions?
That is an elementwise or Hadamard product, which is not this page’s operation. This calculator uses the standard row-by-column matrix product.
Why is Copy unavailable after I change a value?
The previously displayed product is stale as soon as an input or dimension changes. Recalculate first, then copy the product that matches the current matrices.