Theory
Rupa's two counters
Rupa runs two snack counters, one at the campus gate and one at the railway station. Each sells samosas and teas. Her January and February sales (in hundreds):
Jan = ⎡ 10 6 ⎤ Feb = ⎡ 12 9 ⎤
⎣ 8 12 ⎦ ⎣ 10 14 ⎦
Rows are counters (Campus, Station), columns are items (samosa, tea).
Her accountant asks: total sales for the quarter? Growth per item? Revenue per counter? Three questions, three matrix operations.
Theory
Addition: stack the sheets
Print January on one transparent sheet and February on another, then stack them. Each cell lines up with its twin: Campus-samosa over Campus-samosa. Adding matrices is just adding the twins. That is why the two sheets must be the same size: every cell needs exactly one partner.
Theory
Addition and subtraction, formally
If A and B have the same order, then (A + B)ᵢⱼ = aᵢⱼ + bᵢⱼ. Same for subtraction. Different orders? Not defined. No exceptions.
Jan + Feb = ⎡ 22 15 ⎤ (total sales)
⎣ 18 26 ⎦
Feb - Jan = ⎡ 2 3 ⎤ (growth)
⎣ 2 2 ⎦
Every cell of the growth matrix is positive: both counters sold more of both items.
Quiz
A has order 2×3 and B has order 3×2. What is A + B?
- Not defined, the orders differ
- A 2×2 matrix
- A 3×3 matrix
- Defined if you transpose B first
Show the answer
Not defined, the orders differ
Addition pairs each cell with its twin at the same position, so the orders must be identical, and 2×3 ≠ 3×2. Transposing B creates a different matrix whose sum with A is a different question, not a repair of this one.
Theory
Multiplication is a different animal
Here is February's Campus row: 12 samosas, 9 teas (in hundreds). Prices: samosa ₹9, tea ₹7. The counter's revenue:
12·9 + 9·7 = 108 + 63 = 171
Multiply pair-wise, then add. You have computed bills this way your whole life. That "row times column, then sum" motion is the atom of matrix multiplication. It is not cell-by-cell like addition.
Follow along
How to multiply A (m×n) by B (n×p)
- Check the inner numbers match Columns of A must equal rows of B. A 2×2 times a 2×1 works because 2 = 2. If they differ, stop: the product is not defined.
- Read the answer's order from the outer numbers (m×n)·(n×p) gives m×p. A 2×2 times 2×1 gives 2×1.
- For each entry cᵢⱼ: row i into column j Multiply the entries of row i of A with column j of B pair by pair, then add them up.
- Repeat for every cell of the answer Work row by row so you never lose your place.
Theory
Worked example: January revenue
Sales S (2×2) times price column P (2×1). Inner numbers: 2 = 2, so the answer is 2×1.
S = ⎡ 10 6 ⎤ P = ⎡ 9 ⎤
⎣ 8 12 ⎦ ⎣ 7 ⎦
Campus row into P: 10·9 + 6·7 = 90 + 42 = 132
Station row into P: 8·9 + 12·7 = 72 + 84 = 156
S·P = ⎡ 132 ⎤
⎣ 156 ⎦
One multiplication, and Rupa has revenue per counter.
Think first
Your turn: February revenue
February sales rows are (12 9) and (10 14), prices still ₹9 and ₹7.
Compute Feb·P on paper: two row-into-column sums.
Show the answer
Campus: 12·9 + 9·7 = 108 + 63 = 171
Station: 10·9 + 14·7 = 90 + 98 = 188
Feb·P = ⎡ 171 ⎤
⎣ 188 ⎦
Both counters earned more than in January (132, 156), which matches the all-positive growth matrix from earlier.
Quiz
A is 2×3 and B is 3×4. What is the order of AB?
- 2×4
- 3×3
- 2×3
- Not defined
Show the answer
2×4
Inner numbers 3 and 3 match, so the product exists. The answer takes the outer numbers: 2×4. If you picked "not defined" you compared the wrong pair; write (2×3)·(3×4) and look at the touching middle.
Watch out
The two classic traps
Trap 1: multiplying cell-by-cell, the way addition works. It feels natural and is completely wrong: multiplication is row into column.
Trap 2: assuming AB = BA. Usually false, and often BA does not even exist: P·S here would need (2×1)·(2×2), inner numbers 1 ≠ 2. Order of multiplication matters.
Theory
Where you will meet this again
Excel's SUMPRODUCT is exactly one row-into-column. Computer graphics moves every pixel with matrix products. Machine learning is mostly gigantic matrix multiplication. And your next two topics, the inverse and Cramer's rule, assume this page is second nature.
Summary
Key takeaways
- Addition and subtraction need identical orders and work cell by cell.
- Multiplication (m×n)·(n×p) needs the inner numbers equal and gives an m×p answer.
- Each product entry is one row of A into one column of B: multiply pairs, then add.
- AB ≠ BA in general; sometimes BA is not even defined.
- Sales matrix × price column = revenue, a bill is a matrix product.
- Memory hook: same order to add, inner match to multiply, row into column.