The rule looks arbitrary until you see what it encodes, and then it is hard to forget. This page covers the mechanics, the size check, the traps with signs and order, a fast way to catch arithmetic slips, and what the rule is really doing.
How Do You Multiply Matrices? The Row-by-Column Rule
Pick one row from the left matrix and one column from the right matrix. Multiply matching entries, add the results, and write the sum in the product at that row and that column. The picture to hold is “across, then down”: move across row of while moving down column of .
Example 1. Multiply by .
Entry by entry: , , , . The top-left entry came from row 1 and column 1, the top-right from row 1 and column 2, and so on. Position in the answer is always (row of , column of ).
The most common trap is multiplying entry by entry, which would give . That is a real operation, but it is not matrix multiplication. It feels natural because adding and subtracting matrices does work entry by entry, and that is exactly why the habit leaks across.
When Is Matrix Multiplication Defined? The Size Check

A dot product needs two lists of equal length. Each row of has as many entries as has columns, and each column of has as many entries as has rows. So exists exactly when those two counts agree. If is and is , the product is .
Write the sizes side by side as . If the inner pair matches, the outer pair is the size of the answer.
Order changes the verdict, not just the answer. A matrix times a matrix gives a matrix, but reversing them gives a matrix. A row times a column ( times ) collapses to a single number, while a column times a row ( times ) blows up into a full matrix.
| undefined | undefined | ||
| undefined | |||
Do this size check before any arithmetic. It takes five seconds and catches the problems that have no answer.
Quick check
Answer: is ; is not defined
Matrix Multiplication With Negatives and Fractions
Signs are where accurate setups go wrong. Each entry is a sum of products, so work out every product with its sign first, then add. The usual priorities from order of operations practice problems apply inside every entry: products before sums, and a negative times a negative is positive.
Example 2. Multiply by . The sizes are and , so the answer is .
So .
For fractions, factor the common denominator out as a scalar, because a scalar slides through a matrix product.
Example 3. Multiply by . Write the first matrix as and multiply the whole numbers first:
Multiplying by gives . Working directly with fractions gives the same thing: the bottom-right entry is .
Why Does Matrix Multiplication Work This Way?
A matrix is a machine that turns an input vector into an output vector. Multiplying matrices means chaining two machines: is defined to equal , so acts first and acts second. The row-by-column rule is not a convention someone picked; it is the only rule that makes this true.
Here is the derivation for matrices. Let have entries and . Feed that into and look at the first output entry:
The coefficients on and are the first row of : row 1 of against column 1 of , then row 1 of against column 2 of . Nothing else could make one machine equal the chain of two.
With matrices this is just composing and to get , the lines through the origin from slope-intercept form with intercept . Matrices extend that idea to many inputs at once. It also explains the size rule: the output of must have the same length as the input of .
Why Is Matrix Multiplication Not Commutative?
Chaining machines depends on order, just as putting on socks then shoes differs from shoes then socks. In Example 1, , but reversing the order gives
The two answers share nothing. Some pairs do commute, such as any two diagonal matrices of the same size, or any matrix with the identity, but you can never assume it.
Try this: Let and . Compute and . One swaps the columns of and the other swaps the rows. Which is which, and why does the side matter?
The damage shows up in algebra you would otherwise do on autopilot:
- , which equals only when .
- does not force or .
- does not let you cancel to get .
The second point surprises people. Take and . Every row of meets every column of in zeros, so is the zero matrix even though neither factor is.
Quick check
Answer: ,
How Can You Check a Matrix Product Quickly?

Recomputing the same entries tends to repeat the same slip. A different route catches it. The column-sum check is the fastest one: adding the rows of together and then multiplying by must give the column sums of .
- Confirm the sizes: inner numbers match, outer numbers give the answer’s shape.
- Add up each column of to get one row of column sums.
- Multiply that row by . The result must equal the column sums of your answer.
Test it on Example 1. The column sums of are . Then . The columns of add to and . They match.
It works because multiplication distributes over addition, so summing the rows of is the same as summing the rows of first. On Example 2 the column sums of are , and multiplying by gives . The columns of add to and . Correct again.
The check catches any single wrong entry, though two errors that cancel within one column can slip through. For matrices a second independent check is available: compare with , covered below.
Identity, Zero and Inverse Matrices in Products
The identity matrix plays the role of the number : whenever the sizes fit. The zero matrix absorbs everything it touches, . Between them sits the inverse: is the matrix with , and it exists only for square matrices with a nonzero determinant.
means , so must be . A matrix has no square, because the inner sizes and clash.
Multiplication is how you verify an inverse. For the determinant is , so the inverse swaps the diagonal and negates the other two entries: . This is the recipe from the inverse of a 2×2 matrix. Now multiply:
Product of inverses reverses order: . Undoing “socks then shoes” means taking off the shoes first.
Determinants and Transposes of a Matrix Product
For square matrices of the same size, . Check it on Example 1. The determinant of a 2×2 matrix gives and . For the product, , which is .
This holds for any size, so with a 3×3 determinant you can find without multiplying the matrices at all. You can test your skill with these 3×3 determinant practice problems. It also explains why a product is invertible only when both factors are: if either determinant is , so is the product’s.
The transpose reverses the order: . With Example 1, , and
The reversal is forced by sizes. If is and is , then would be , which usually does not even exist.
Quick check
Answer: Both equal
Where Is Matrix Multiplication Used in Real Life?
Computer graphics is the cleanest case. Rotating a point counterclockwise by angle is multiplication by . For a right angle, , and doing it twice gives
which is a half turn of . Multiply in general and the top-left entry is . That equals , so the angle-addition formulas are a matrix product in disguise. Different kinds of angles simply give different matrices.
Games and animation stack many such matrices (rotate, scale, shift) into one product, so each point is transformed in a single step. Population models and Markov chains use repeated powers to predict where a system settles. Neural networks are layers of matrix products, and search engines rank pages by multiplying huge link matrices again and again.
Cost matters at that scale. Multiplying two matrices the standard way takes multiplications, so doubling the size makes the work eight times larger. Faster algorithms exist, but the row-by-column rule is still the one that every other method must agree with.
Practice problems
0 of 5 solved
- Compute .
Answer:
Row 1 with column 1: . Row 1 with column 2: . Row 2 with column 1: . Row 2 with column 2: . - Compute .
Answer:
The sizes are and , so the product is . Row 1: . Row 2: . - Compute .
Answer:
Row 1: and . Row 2: and . - Compute .
Answer:
The sizes are and , so the product is . Row 1 gives . Row 2 gives . Row 3 gives , , . - For , compute .
Answer: The zero matrix
and . Then . Subtracting leaves the zero matrix.
Common questions
How do you multiply two matrices step by step?
Check that the first matrix has as many columns as the second has rows. Then, for each entry of the answer, multiply matching numbers from one row of the first matrix and one column of the second, and add them. Write the sum at that row and column of the product.
Can you multiply matrices of different sizes?
Yes, as long as the inner sizes match. A matrix times a matrix works and gives a matrix. A matrix times another matrix does not work.
Is matrix multiplication commutative?
No. and are usually different, and one of them may not even exist. Matrix multiplication is associative and distributive, so and .
How many multiplications does a 3×3 times 3×3 product need?
The answer has entries, and each one is a sum of products, so the product needs multiplications and additions. For matrices the count is multiplications.
Can two nonzero matrices multiply to give the zero matrix?
Yes. For example, is the zero matrix. Unlike ordinary numbers, a zero product does not force either factor to be zero.
What is the difference between matrix multiplication and entry-by-entry multiplication?
Matrix multiplication combines whole rows with whole columns, so every entry of the answer uses several entries from each factor. Entry-by-entry multiplication (the Hadamard product) multiplies only matching positions and needs matrices of the same size. It is a different operation.