Adding Matrices

Two spreadsheets, one total

Imagine a little shop that tracks sales in a spreadsheet: one row per product, one column per region. January's spreadsheet is a grid of numbers. So is February's. If your boss asks "how much did we sell in total, product by product, region by region?" you don't need anything clever — you just add the two spreadsheets cell by cell. January's North-region Widget sales plus February's North-region Widget sales gives the total North-region Widgets. That's it. That grid-of-numbers-added-cell-by-cell operation is exactly what mathematicians call matrix addition.

Nothing exotic is happening — no mixing rows with columns, no strange new rule to memorise. A matrix is just a rectangular table of numbers, and adding two matrices means adding whatever sits in the same box in each table. You already know how to do this; it just now has a name.

It's worth pausing on why this is the natural definition and not some other rule. A matrix is really just several vectors stacked together — each row (or each column) of that spreadsheet is a list of numbers, exactly like a vector. And you already know how to add two vectors: entry by entry. So matrix addition isn't a brand-new idea bolted onto matrices — it's simply "do vector addition on every row (or column) at once." Once you see a matrix as a bundle of vectors, the rule stops needing to be memorised; it falls straight out of what you already knew.

The rule, written out

Matrices add the same friendly way vectors do — entry by entry. Line them up and add the numbers that share a position:

\begin{bmatrix} a & b \\ c & d \end{bmatrix} + \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} a+e & b+f \\ c+g & d+h \end{bmatrix}.

Because the entries must line up, you can only add matrices of the same size — a 2\times 2 to a 2\times 2, never a 2\times 2 to a 2\times 3. Subtraction and scalar multiplication work entry-wise too: 3A just triples every number in A, and A - B subtracts entry by entry, exactly the way vector addition and scalar multiplication already work — matrices are just bigger boxes of numbers than vectors.

One cell at a time

Step through the four positions below. Each move adds the two highlighted numbers to fill the matching cell of the answer. That's the whole operation — no surprises.

Worked example: two 2×2 matrices

Let's do a full one by hand. Add A = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix} and B = \begin{bmatrix} -1 & 4 \\ 2 & 6 \end{bmatrix}. Four cells, four tiny additions:

3 + (-1) = 2 \qquad -2 + 4 = 2 \qquad 5 + 2 = 7 \qquad 1 + 6 = 7

So A + B = \begin{bmatrix} 2 & 2 \\ 7 & 7 \end{bmatrix}. Each answer entry only ever depends on the two numbers directly above it in A and B — nothing from any other row or column ever gets involved.

Worked example: two months of real sales data

Back to the shop. Say it sells two products (Widgets, Gadgets) across three regions (North, South, East). January's and February's sales, as matrices, are:

M_1 = \begin{bmatrix} 120 & 85 & 60 \\ 40 & 95 & 70 \end{bmatrix} \qquad M_2 = \begin{bmatrix} 110 & 90 & 75 \\ 55 & 80 & 65 \end{bmatrix}

Row 1 is Widgets, row 2 is Gadgets; column 1 is North, column 2 is South, column 3 is East. Adding the two spreadsheets entry by entry gives the two-month total, product by product and region by region:

M_1 + M_2 = \begin{bmatrix} 230 & 175 & 135 \\ 95 & 175 & 135 \end{bmatrix}

Read that off in words: 230 Widgets sold in the North over the two months, 135 Gadgets sold in the East, and so on. Every real spreadsheet total you've ever computed by summing two ranges of cells was a matrix addition — you just didn't need the word for it.

Subtraction tells a different, equally useful story: it measures change. Compute M_2 - M_1 entry by entry — 110-120=-10 for North Widgets, 90-85=5 for South Widgets, and so on — and you get \begin{bmatrix} -10 & 5 & 15 \\ 15 & -15 & -5 \end{bmatrix}, a matrix of month-on-month changes. Negative entries mean sales fell in that product/region, positive entries mean they grew. Addition builds totals; subtraction, its close cousin, reveals trends — both are the same entry-by-entry machinery pointed at a different question.

Worked example: mixing addition with scaling

Addition gets more useful once you combine it with scalar multiplication. Suppose A = \begin{bmatrix} 4 & -3 \\ 2 & 5 \end{bmatrix} and B = \begin{bmatrix} 1 & 6 \\ -2 & 3 \end{bmatrix}, and you need 2A - B. First scale — double every entry of A:

2A = \begin{bmatrix} 8 & -6 \\ 4 & 10 \end{bmatrix}

Then subtract B entry by entry:

2A - B = \begin{bmatrix} 8-1 & -6-6 \\ 4-(-2) & 10-3 \end{bmatrix} = \begin{bmatrix} 7 & -12 \\ 6 & 7 \end{bmatrix}.

This kind of expression — a scalar times one matrix, plus (or minus) a scalar times another — is called a linear combination of matrices. It looks fiddly the first time, but it's only ever two operations you already know, done in order: scale, then add.

These combinations show up constantly once you're looking for them. A shop planning next year might compute 1.1A ("this year's sales, grown 10%") and then subtract a matrix of fixed costs to estimate profit by product and region. A weather model might average two forecasts by computing \tfrac{1}{2}A + \tfrac{1}{2}B, entry by entry, to blend them into one. In every case, the arithmetic is still just "scale each matrix, then add entry by entry" — the same two moves as above, wearing a new outfit.

For matrices of the same size, addition behaves exactly like ordinary number addition:

Addition is the calm, well-behaved operation. Matrix multiplication, coming up later, throws several of these comfortable habits away.

Why "order doesn't matter" is more than a technicality

Suppose the shop wants a whole year's total sales, and the bookkeeper hands you twelve monthly matrices in a messy pile. Commutativity and associativity together say something genuinely useful: it does not matter which order you add them in, or which ones you group together first. Add January and February, then add March; or add November and December first and work backwards; or hand six matrices to one assistant and six to another and add the two half-year totals at the end — every path arrives at the same yearly total matrix. That's not obvious in every kind of maths (you'll meet operations later, including matrix multiplication, where order suddenly matters enormously) — so it's worth noticing that addition is the one place you can always take the easiest route.

The zero matrix plays its usual role too: it's the "nothing happened" matrix. Adding a month with zero sales everywhere to any running total leaves that total exactly as it was — the matrix equivalent of adding 0 to a number.

You can check the grouping claim on tiny matrices, too. Let A = \begin{bmatrix} 1 & 2 \end{bmatrix}, B = \begin{bmatrix} 3 & -1 \end{bmatrix}, and C = \begin{bmatrix} -2 & 4 \end{bmatrix} (three 1\times 2 matrices — really just row vectors). Group the first way: (A+B)+C = \begin{bmatrix} 4 & 1 \end{bmatrix} + \begin{bmatrix} -2 & 4 \end{bmatrix} = \begin{bmatrix} 2 & 5 \end{bmatrix}. Group the other way: A+(B+C) = \begin{bmatrix} 1 & 2 \end{bmatrix} + \begin{bmatrix} 1 & 3 \end{bmatrix} = \begin{bmatrix} 2 & 5 \end{bmatrix}. Same answer either way, exactly as the property promises.

It's a tempting shortcut: "my matrices are different sizes, so I'll just glue on some zero rows or columns until they match, then add." Don't. Matrix addition is only defined for two matrices of the exact same size — same number of rows, same number of columns. If A is 2\times 3 and B is 3\times 2, then A + B simply does not exist. There is no rule that rescues it, no "pad with zeros and hope" — two spreadsheets with different shapes just don't have a cell-by-cell sum. If you ever find yourself wanting to pad a matrix to make an addition work, that's a signal you've reached for the wrong operation.

Because + and \times feel like a matched pair for ordinary numbers, it's easy to assume matrix addition and matrix multiplication must work the same way — just "add entries" versus "multiply entries." They don't. Addition is entry-by-entry. Multiplication is a completely different, much stranger beast that mixes whole rows with whole columns and doesn't even require the two matrices to be the same shape. Keep them firmly separate in your head — one is the easy operation, the other rewrites the rules.

Every time photo-editing software blends two images — a double exposure, a "screen" or "lighten" blend mode, compositing a character over a background — it is treating each image as a matrix of pixel brightness values and combining them with (scaled) matrix addition, one pixel at a time. A video call that shows your face over a virtual background is doing the same thing thirty or sixty times a second, one new matrix addition per frame. And every time a spreadsheet program sums two ranges of cells with =A1:C2 + D1:F2, it's running matrix addition under the hood — you've almost certainly triggered this exact operation without ever calling it that.