Matrix Multiplication Calculator

Product C — row 1[30, 24, 18]
Product C — row 2[84, 69, 54]
Product C — row 3[138, 114, 90]
How this was calculated
  1. C11 = 1×9 + 2×6 + 3×3 = 30.
  2. C12 = 1×8 + 2×5 + 3×2 = 24.
  3. C13 = 1×7 + 2×4 + 3×1 = 18.
  4. C21 = 4×9 + 5×6 + 6×3 = 84.
  5. C22 = 4×8 + 5×5 + 6×2 = 69.
  6. C23 = 4×7 + 5×4 + 6×1 = 54.
  7. C31 = 7×9 + 8×6 + 9×3 = 138.
  8. C32 = 7×8 + 8×5 + 9×2 = 114.
  9. C33 = 7×7 + 8×4 + 9×1 = 90.
  10. Each entry of the product is the dot product of a row of A with a column of B — which is why A × B is generally not the same as B × A.

This matrix multiplication calculator takes two matrices you enter and computes their product using the standard row-by-column rule. To multiply A by B, each entry of the product is the dot product of a row of A with a column of B: Cij = A i1 × B 1j + A i2 × B 2j + A i3 × B 3j. The calculator returns the full result matrix along with a breakdown showing every entry's sum. For example, it verifies that [[1,2,3],[4,5,6],[7,8,9]] times [[9,8,7],[6,5,4],[3,2,1]] gives [[30,24,18],[84,69,54],[138,114,90]], where the first entry is 1×9 + 2×6 + 3×3 = 30. It also confirms that [[2,0],[1,3]] times [[4,1],[2,5]] gives [[8,2],[10,16]].

This row-by-column method is the accepted standard because it produces the unique product matrix consistent with linear composition, and it applies uniformly across any compatible dimensions. A 3x3 product needs 27 multiplications and 18 additions, which is why showing every entry's sum matters when checking work by hand. The method also reveals key properties: multiplying any matrix by the identity matrix returns the matrix unchanged, a quick way to check entries are in the right places, and matrix multiplication is not commutative, meaning A × B is generally different from B × A. This page shows the formula, step-by-step workings, worked examples, and sources so you can verify each result with confidence.

Worked examples

The classic textbook pair

Primary result: [30, 24, 18] — the first row of the product; the full matrix is [30, 24, 18], [84, 69, 54], [138, 114, 90]. (3 x 3 · 1 · 2 · 3 · 4 · 5 · 6 · 7 · 8 · 9 · 9 · 8 · 7 · 6 · 5 · 4 · 3 · 2 · 1)

Product C — row 1[30, 24, 18]
Product C — row 2[84, 69, 54]
Product C — row 3[138, 114, 90]

A 2x2 product

Primary result: [8, 2] — with the second row [10, 16]; note how the zero in A zeroes out one term of each sum. (2 x 2 · 2 · 0 · 0 · 1 · 3 · 0 · 0 · 0 · 0 · 4 · 1 · 0 · 2 · 5 · 0 · 0 · 0 · 0)

Product C — row 1[8, 2]
Product C — row 2[10, 16]

Multiplying by the identity

Primary result: [0.5, 1.5, 2] — the identity matrix returns A unchanged, a useful check that the entries are in the right places. (3 x 3 · 0.5 · 1.5 · 2 · 0 · 1 · 0 · 3 · 0 · 1 · 1 · 0 · 0 · 0 · 1 · 0 · 0 · 0 · 1)

Product C — row 1[0.5, 1.5, 2]
Product C — row 2[0, 1, 0]
Product C — row 3[3, 0, 1]

The row-times-column rule

The row-times-column rule is the core idea behind every matrix multiplication calculator. To multiply A by B, each entry of the product is the dot product of a row of A with a column of B. Written out, Cij = A i1 × B 1j + A i2 × B 2j + A i3 × B 3j. In plain terms, you take a row from A, line it up with a column from B, multiply the matching entries pairwise, and add those products together to get a single number. That number becomes one entry of the result matrix.

A verified example makes the rule concrete. Multiply [[1,2,3],[4,5,6],[7,8,9]] times [[9,8,7],[6,5,4],[3,2,1]]. The product is [[30,24,18],[84,69,54],[138,114,90]]. Look at the first entry, C11. You take the first row of A, which is 1, 2, 3, and the first column of B, which is 9, 6, 3. Pair them up and multiply: 1×9 + 2×6 + 3×3 = 30. The same process fills in every other entry. The second entry uses the first row of A with the second column of B, the third entry uses the first row of A with the third column of B, and so on until the matrix is complete.

The row-from-A, column-from-B picture helps you keep track of which pieces combine. A 3x3 product needs 27 multiplications and 18 additions, which is why showing every entry's sum matters when checking work by hand. Each of the 9 entries in the result requires 3 multiplications and 2 additions. A smaller example confirms the same pattern: [[2,0],[1,3]] times [[4,1],[2,5]] gives [[8,2],[10,16]]. For the first entry, take row 1 of A, which is 2, 0, and column 1 of B, which is 4, 2. The calculation is 2×4 + 0×2 = 8. Every entry follows the same dot-product structure regardless of matrix size.

Two properties of matrix multiplication are worth noting as you verify results. First, multiplying any matrix by the identity matrix returns the matrix unchanged, which gives you a quick way to check that entries are in the right places. Second, matrix multiplication is not commutative: A × B is generally different from B × A. The row-times-column rule applies in one direction, so reversing the order changes which rows pair with which columns and typically produces a different result.

A full 3x3 worked example

To see exactly how a matrix multiplication calculator works, walk through the classic pair where A = [[1,2,3],[4,5,6],[7,8,9]] and B = [[9,8,7],[6,5,4],[3,2,1]]. The verified result is [[30,24,18],[84,69,54],[138,114,90]]. To multiply A by B, each entry of the product is the dot product of a row of A with a column of B: Cij = Ai1 × B1j + Ai2 × B2j + Ai3 × B3j. A 3x3 product needs 27 multiplications and 18 additions, which is why showing every entry's sum matters when checking work by hand.

Start with the first row of A paired with each column of B. The first entry is 1×9 + 2×6 + 3×3 = 30. Moving across, the next entry in the top row uses the same row of A but the second column of B: 1×8 + 2×5 + 3×2 = 24. The third entry follows with the third column of B: 1×7 + 2×4 + 3×1 = 18. So the first row of the product is [30, 24, 18].

The second row of the product uses the second row of A, which is [4,5,6]. Pair it with the first column of B for entry C21: 4×9 + 5×6 + 6×3 = 84. For C22, use the second column of B: 4×8 + 5×5 + 6×2 = 69. For C23, use the third column of B: 4×7 + 5×4 + 6×1 = 54. That gives the second row [84, 69, 54].

The third row of the product uses the third row of A, which is [7,8,9]. For C31, pair it with the first column of B: 7×9 + 8×6 + 9×3 = 138. For C32, use the second column of B: 7×8 + 8×5 + 9×2 = 114. For C33, use the third column of B: 7×7 + 8×4 + 9×1 = 90. The final row is [138, 114, 90], completing the full product [[30,24,18],[84,69,54],[138,114,90]].

EntryRow of AColumn of BCalculationResult
C11[1,2,3][9,6,3]1×9 + 2×6 + 3×330
C12[1,2,3][8,5,2]1×8 + 2×5 + 3×224
C13[1,2,3][7,4,1]1×7 + 2×4 + 3×118
C21[4,5,6][9,6,3]4×9 + 5×6 + 6×384
C22[4,5,6][8,5,2]4×8 + 5×5 + 6×269
C23[4,5,6][7,4,1]4×7 + 5×4 + 6×154
C31[7,8,9][9,6,3]7×9 + 8×6 + 9×3138
C32[7,8,9][8,5,2]7×8 + 8×5 + 9×2114
C33[7,8,9][7,4,1]7×7 + 8×4 + 9×190
Matrix multiplication is not commutative: A × B is generally different from B × A. Multiplying any matrix by the identity matrix returns the matrix unchanged — a quick way to check entries are in the right places.

Why order matters

Matrix multiplication is not commutative: A × B is generally different from B × A. This sets it apart from ordinary number arithmetic, where 3 × 5 always equals 5 × 3. The reason becomes clear once you look at the mechanics. To multiply A by B, each entry of the product is the dot product of a row of A with a column of B: Cij = A i1 × B 1j + A i2 × B 2j + A i3 × B 3j. Because rows come from the first matrix and columns come from the second, swapping the two matrices changes which rows pair with which columns, and the results usually diverge.

Geometric intuition makes this concrete. Think of each matrix as an instruction that transforms a shape — a rotation, a scaling, a reflection, or some combination. When you apply one transformation and then another, the order of application matters. Rotating a rectangle and then scaling it produces a different final shape than scaling first and then rotating. Matrix multiplication stacks these transformations, and the product matrix represents the combined effect. Since applying transformation A after B differs from applying B after A, the products A × B and B × A generally represent different overall transformations.

A quick numerical example shows the mismatch. Verified: [[2,0],[1,3]] times [[4,1],[2,5]] gives [[8,2],[10,16]]. Reversing the order, [[4,1],[2,5]] times [[2,0],[1,3]] gives [[11,3],[19,15]] — clearly not the same. A reliable matrix multiplication calculator will let you check both directions so you can confirm which ordering your problem requires.

One ordering rule stays constant: multiplying any matrix by the identity matrix returns the matrix unchanged — a quick way to check entries are in the right places. The identity matrix acts like the number 1 in ordinary multiplication, so it commutes with every matrix. This property is useful when verifying that you have transcribed entries correctly before tackling a harder product.

The size of the calculations explains why order is easy to get wrong by hand. A 3x3 product needs 27 multiplications and 18 additions, which is why showing every entry's sum matters when checking work by hand. Each of those 27 multiplications depends on which matrix is on the left and which is on the right, so a single swap can ripple through every entry of the result.

Identity and zero matrices

Two special matrices play roles in matrix multiplication that mirror the numbers 1 and 0 in ordinary arithmetic. The identity matrix is the matrix equivalent of multiplying by 1, and the zero matrix absorbs everything. Understanding how they behave gives you a fast way to confirm that your matrix multiplication calculator results are trustworthy and that your entries are sitting in the correct positions.

The identity matrix is a square matrix with 1s along the main diagonal and 0s everywhere else. When you multiply any matrix by the identity matrix, the result is the original matrix, completely unchanged. This property has been verified: multiplying any matrix by the identity matrix returns the matrix unchanged, which gives you a quick way to check that entries are in the right places. For example, if you multiply a 3x3 matrix by the 3x3 identity, the dot product of each row with the corresponding column of the identity simply pulls out the original entries. Recall that each entry of the product is the dot product of a row of the first matrix with a column of the second: Cij = A i1 × B 1j + A i2 × B 2j + A i3 × B 3j. When the second matrix is the identity, that sum collapses to a single value, leaving every entry exactly where it started.

The zero matrix, by contrast, contains only zeros. Multiplying any matrix by a zero matrix of compatible dimensions produces another zero matrix. No matter how large or complex the first matrix is, every dot product in the multiplication sums to zero, so the entire result vanishes. This mirrors what happens when you multiply a number by zero in basic arithmetic.

These two special cases also highlight why order matters in matrix multiplication. Matrix multiplication is not commutative, meaning A × B is generally different from B × A. The identity matrix is a notable exception to that rule, since multiplying by it in either order returns the original matrix. The zero matrix behaves the same way, absorbing everything regardless of which side it sits on. For all other matrices, though, swapping the order can change the result entirely. A 3x3 product needs 27 multiplications and 18 additions, which is why showing every entry's sum matters when checking work by hand. Testing your calculations against the identity matrix first confirms that your setup is correct before you move on to more involved problems.

FAQs

How do you multiply two matrices?

To multiply two matrices, multiply each row of the first matrix by each column of the second matrix and add the products. That sum becomes the entry where the row and column meet. Repeat this process for every row-column combination until all entries are filled.

When is matrix multiplication not defined?

Matrix multiplication is not defined when the number of columns in the first matrix does not equal the number of rows in the second. On this page both matrices are the same square size, so it is always defined.

Is A × B the same as B × A?

Generally no. Matrix multiplication is not commutative, meaning the order matters. Switching the order can produce a different result, and in some cases one product may be defined while the other is not.

What is the identity matrix?

The identity matrix is a square matrix with 1s on the diagonal and 0s elsewhere. Multiplying any matrix by the identity matrix leaves that matrix unchanged, just as multiplying a number by 1 leaves the number unchanged.

How many multiplications does a 3x3 product take?

A 3x3 matrix product takes 27 multiplications. Each of the nine entries in the result requires three multiplications, so the total is 27. This comes from multiplying three pairs of numbers per entry and summing them.

Can I multiply a 2x2 matrix by a 3x3 matrix?

No. The inner dimensions (2 and 3) do not match. For matrix multiplication to be defined, the number of columns in the first matrix must equal the number of rows in the second. Since 2 does not equal 3, the product is undefined.

Sources

Related calculators

Matrix Determinant Calculator
The determinant of a 2×2 or 3×3 matrix with the cofactor expansion shown step by step, the trace, and whether the matrix can be inverted at all.
Matrix Inverse Calculator (2×2)
The inverse of a 2×2 matrix from its determinant — with the singular case (determinant zero) called out honestly instead of a bogus answer.
Eigenvalue Calculator (2x2 Matrix)
Both eigenvalues of a 2x2 matrix from its trace and determinant — real or a complex conjugate pair — with the characteristic equation shown step by step.
System of Equations Calculator
Solve two linear equations in x and y with Cramer's rule — including an honest answer when the lines are parallel or identical.