Why does 1 times 5 plus 2 times 7 give the top corner of a matrix product? Matrix multiplication follows one rule: each answer entry is a row of the first matrix paired with a column of the second. Once you see that pattern, sizes, order, and real uses all make sense. This guide walks through the rule, the size check, and the surprises.
| Core rule | Each entry is a row of A times a column of B, summed |
|---|---|
| Size check | Columns of A must equal rows of B |
| Result size | Rows of A by columns of B |
| Order | AB and BA are usually different |
| Example | [1 2; 3 4] x [5 6; 7 8] = [19 22; 43 50] |
Matrix Multiplication Quick Reference
This table collects the facts you need most often. Each row is explained in the sections below, with numbers you can check by hand.
| Question | Answer | Quick example |
|---|---|---|
| How is one entry found? | Row i of A dotted with column j of B | 1 x 5 + 2 x 7 = 19 |
| When is AB defined? | Columns of A equal rows of B | 2×3 times 3×2 works |
| What size is AB? | Rows of A by columns of B | 2×3 times 3×2 gives 2×2 |
| Does AB equal BA? | Usually not | [19 22; 43 50] vs [23 34; 31 46] |
| Is it associative? | Yes, (AB)C = A(BC) | Group in any order, keep the sequence |
| What does I do? | AI = IA = A | Ones on the diagonal, zeros elsewhere |
A few terms appear throughout this guide. Here is what each one means in plain words.
- Entry
- One number inside a matrix, named by its row and column, such as row 2, column 1.
- Dimensions
- The size of a matrix, written rows by columns. A 2×3 matrix has 2 rows and 3 columns.
- Dot product
- Multiply matching numbers from a row and a column, then add the results.
- Identity matrix
- A square matrix with ones on the main diagonal and zeros everywhere else.
- Commutative
- An operation where order does not matter, like 3 x 4 = 4 x 3 for plain numbers.
How Does the Row-by-Column Rule Work?
Each entry of the product comes from one row of the first matrix and one column of the second. You multiply matching numbers in pairs, then add those products together.
Take A with rows [1, 2] and [3, 4], and B with rows [5, 6] and [7, 8]. The top-left entry uses row 1 of A and column 1 of B. That gives 1 x 5 + 2 x 7 = 5 + 14 = 19.
The other three entries follow the same pattern:
- Row 1, column 2: 1 x 6 + 2 x 8 = 6 + 16 = 22.
- Row 2, column 1: 3 x 5 + 4 x 7 = 15 + 28 = 43.
- Row 2, column 2: 3 x 6 + 4 x 8 = 18 + 32 = 50.
So AB = [19, 22; 43, 50]. Notice that you never multiply entry by entry in the same position. Multiplying 1 by 5 and 2 by 6 would build a different operation with a different meaning.
When Can Two Matrices Be Multiplied?
You can multiply A by B only when A has as many columns as B has rows. The product then has the rows of A and the columns of B.
Write the sizes side by side to check. For a 2×3 matrix times a 3×2 matrix, the inner numbers are 3 and 3, so they match. The outer numbers, 2 and 2, give a 2×2 result.
Try A = [1, 0, 2; 3, 1, 0] and B = [1, 2; 0, 1; 4, 0]. The top-left entry is 1 x 1 + 0 x 0 + 2 x 4 = 9. The full product is AB = [9, 2; 3, 7].
Now reverse them. B is 3×2 and A is 2×3, so the inner numbers are 2 and 2. The product BA exists, but it is a 3×3 matrix: [7, 2, 2; 3, 1, 0; 4, 0, 8]. The same two matrices give answers of different sizes.
Some pairs only work one way. A 3×4 matrix times a 4×2 matrix is fine, yet the reverse fails because 2 does not equal 3.
Why Does the Order of Matrices Matter?
Order matters because matrix multiplication is not commutative. For most pairs, AB and BA are different matrices, even when both products exist and have the same size.
Use the same 2×2 pair from before. AB = [19, 22; 43, 50], but BA = [23, 34; 31, 46]. Not one entry matches.
Geometry shows why. Let R turn points 90 degrees counterclockwise, so R = [0, -1; 1, 0]. Let S stretch the x-direction by 2, so S = [2, 0; 0, 1]. Start with the point (1, 0).
- Turn first, then stretch (SR): (1, 0) turns to (0, 1), and the stretch leaves it at (0, 1).
- Stretch first, then turn (RS): (1, 0) stretches to (2, 0), then turns to (0, 2).
Two different endpoints prove that the products differ. Read a product from right to left: in SR, R acts first. Some special pairs do commute, such as two diagonal matrices of the same size. Treat that as the exception, not the rule.
Which Algebra Rules Still Work for Matrices?
Grouping and distributing still work, and the identity matrix acts like the number 1. Only swapping the order is off limits.
The associative rule says (AB)C = A(BC). With C = [1, 1; 0, 1] and our A and B, both groupings give [19, 41; 43, 93]. You may choose which pair to multiply first, but the left-to-right sequence stays fixed.
The distributive rule says C(A + B) = CA + CB and (A + B)C = AC + BC. Keep each factor on the same side when you expand.
The identity matrix leaves any matrix unchanged. For 2×2 matrices, I = [1, 0; 0, 1], and AI = IA = A. A matrix times its inverse gives I, which is how inverses are defined.
Determinants also multiply. Here det(A) = -2 and det(B) = -2, so det(AB) = 4. Check it directly: 19 x 50 – 22 x 43 = 950 – 946 = 4. The determinant calculator confirms each value in seconds.
To multiply square matrices without the arithmetic, the matrix multiplication calculator for 2×2 and 3×3 products fills in every entry and shows the trace.
Where Does Matrix Multiplication Show Up?
Matrix multiplication appears wherever many linear steps combine at once. That includes systems of equations, computer graphics, and machine learning.
A system of equations becomes one product. The pair 2x + y = 5 and x – y = 1 is [2, 1; 1, -1] times [x; y] = [5; 1]. Plug in x = 2 and y = 1, and the product gives [5; 1]. Our guide to solving linear equations step by step covers the solving methods themselves.
Graphics programs chain moves the same way. A turn, a stretch, and a shift combine into one matrix, which then acts on thousands of points. The rotation R above sends the point (3, 1) to (-1, 3).
The work grows quickly with size. Two n by n matrices take n x n x n multiplications with the standard method. That is 8 for 2×2, 27 for 3×3, and 1,000 for 10×10.
The Matrix Multiplication Calculator multiplies two 2×2 or 3×3 matrices, shows each entry of the product, and reports its trace.
Questions People Ask About Matrix Multiplication
How Do You Multiply Two 2×2 Matrices?
Pair each row of the first matrix with each column of the second. Multiply matching numbers and add them. For [1, 2; 3, 4] times [5, 6; 7, 8], the result is [19, 22; 43, 50].
Is Matrix Multiplication Commutative?
No, not in general. AB and BA usually differ. With the matrices above, AB is [19, 22; 43, 50] while BA is [23, 34; 31, 46]. A few special pairs, such as two diagonal matrices, do commute.
Can You Multiply a 2×3 Matrix by a 2×3 Matrix?
No. The first matrix has 3 columns, but the second has only 2 rows. The inner sizes must match. A 2×3 matrix can multiply a 3×2 matrix, which gives a 2×2 result.
What Is the Difference Between Matrix and Element-Wise Multiplication?
Element-wise multiplication multiplies numbers in the same position, so it needs matching sizes. Matrix multiplication combines rows with columns and adds the products. The two methods give different answers for the same pair.
Why Is Matrix Multiplication Defined This Way?
The row-by-column rule makes a product act like doing one transformation after another. It also lets a whole system of linear equations be written as one product, such as AX = B.
Where These Numbers Come From
References Used in This Article
This article is general math education. All worked examples were computed and checked by hand and in code. Reviewed for accuracy by Prof. Dr. Khalil Mudassar, PhD. Last updated September 27, 2026.
Author
Shakeel Muzaffar is the Founder and Editor-in-Chief of MultiCalculators.com, bringing over 15 years of experience in digital publishing, product strategy, and online tool development. He leads the platform's editorial vision, ensuring every calculator meets strict standards for accuracy, usability, and real-world value. Shakeel personally oversees content quality, formula verification workflows, and the platform's commitment to publishing tools that are genuinely useful for students, professionals, and everyday users worldwide.




