Matrix Multiplication- Understanding the Process

What Matrix Multiplication Actually Is

Matrix multiplication is a way to combine two grids of numbers into a single grid. It's not the same as multiplying every element by the same number. That's called scalar multiplication. This is different.

You take rows from the first matrix and columns from the second matrix. Pair them up, multiply, add the results. That's the dot product method. Sounds simple. It is simple. The catch is the dimensions have to line up correctly.

The Dimension Rule You Can't Ignore

Before you touch a single number, check your dimensions. This trips up almost everyone at first.

If matrix A has dimensions m ร— n (m rows, n columns) and matrix B has dimensions n ร— p (n rows, p columns), then you can multiply them. The result will be an m ร— p matrix.

The inner dimensions must match. That's the only requirement. The outer dimensions tell you the size of your answer.

How to Actually Do the Multiplication

Here's the step-by-step process. No shortcuts, just the method that works every time.

Step 1: Find the Dot Product

For each element in the result matrix, you compute a dot product. Take one row from the left matrix and one column from the right matrix. Multiply corresponding elements, then add everything up.

Row [a, b] ร— Column [c, d] = (a ร— c) + (b ร— d)

Step 2: Work Through the Grid

Element (i, j) in the result comes from row i of the left matrix and column j of the right matrix. Fill in the grid systematically. Row 1, Column 1. Row 1, Column 2. Keep going until the grid is full.

Step 3: Don't Rearrange the Order

Matrix multiplication is not commutative. A ร— B does not equal B ร— A in most cases. Sometimes B ร— A doesn't even work when A ร— B does, because of the dimension rule.

A Worked Example

Let's multiply:

Matrix A (2 ร— 3):
[1, 2, 3]
[4, 5, 6]

Matrix B (3 ร— 2):
[7, 8]
[9, 10]
[11, 12]

Result will be (2 ร— 2). Let's find the four elements.

Element (1,1): Row [1,2,3] ยท Column [7,9,11]
= (1ร—7) + (2ร—9) + (3ร—11) = 7 + 18 + 33 = 58

Element (1,2): Row [1,2,3] ยท Column [8,10,12]
= (1ร—8) + (2ร—10) + (3ร—12) = 8 + 20 + 36 = 64

Element (2,1): Row [4,5,6] ยท Column [7,9,11]
= (4ร—7) + (5ร—9) + (6ร—11) = 28 + 45 + 66 = 139

Element (2,2): Row [4,5,6] ยท Column [8,10,12]
= (4ร—8) + (5ร—10) + (6ร—12) = 32 + 50 + 72 = 154

Result:
[58, 64]
[139, 154]

Common Mistakes That Waste Time

Where This Actually Shows Up

Matrix multiplication isn't just a textbook exercise. It's used everywhere in applied math and computer science.

Tool Comparison for Matrix Operations

Tool Best For Learning Value Speed
Pen and paper Small matrices, understanding the process High Slow
NumPy (Python) Large matrices, real applications Medium Fast
MATLAB Engineering and scientific work Medium Fast
Online calculators Quick checks, verifying answers Low Instant
Octave Free MATLAB alternative Medium Fast

Getting Started: Your First Practice Problems

Don't touch a calculator yet. Do these by hand.

Problem 1

Multiply [1, 2] ร— [[3, 4], [5, 6]]

Answer: [(1ร—3 + 2ร—5), (1ร—4 + 2ร—6)] = [13, 16]

Problem 2

Multiply [[2, 0], [1, 3]] ร— [[1, 1], [2, 1]]

Answer:
[(2ร—1 + 0ร—2), (2ร—1 + 0ร—1)] = [2, 2]
[(1ร—1 + 3ร—2), (1ร—1 + 3ร—1)] = [7, 4]

Result: [[2, 2], [7, 4]]

Problem 3

Identify why [[1, 2], [3, 4]] ร— [[1, 2]] fails.

Left matrix is 2ร—2. Right matrix is 2ร—1. The inner dimensions are 2 and 2 โ€” they match, so this should work. Wait, check again. Yes, it works. Result is 2ร—1.

Try [[1, 2, 3]] ร— [[1, 2], [3, 4]]. Left is 1ร—3, right is 2ร—2. 3 โ‰  2. Can't multiply. That's the one that fails.

The Bottom Line

Matrix multiplication comes down to one thing: dot products. Check your dimensions first, compute each dot product carefully, and fill in the grid. That's it. The rest is practice.

Once you can do 2ร—2 and 3ร—3 matrices reliably by hand, move to code. NumPy handles the mechanics so you can focus on when and why to use matrix operations, not just how to add up a row of numbers.