math.wiki
Linear algebra › Matrices › Adding, subtracting and scaling matrices
Open on the map
Precalculus · N.VM.C.8 · N.VM.C.7

Adding, subtracting and scaling matrices

Two tables of numbers have the same rows and the same columns. How do you combine them into one table, or scale one by a single factor, and what rules does that arithmetic obey?

Where you are 12 in Matrices

When you reach for it

Ardak runs the north branch of an ice cream shop and Bolatbek runs the south branch. Each keeps the weekend’s cone sales in the same layout: one row per flavor (vanilla, chocolate, mango) and one column per day (Saturday, Sunday). Each table is a 3 \times 2 matrix. To get the weekend’s sales for the whole shop, you add the two vanilla-on-Saturday numbers, the two vanilla-on-Sunday numbers, and so on, six additions in all. To see where the north branch sold more, you subtract in the same pattern.

That is the whole idea of matrix addition: matching positions combine, and nothing else does. Scaling works the same way. If every price on a menu goes up by the same factor, every entry of the price table is multiplied by that factor. Reach for these moves whenever data comes in tables of one shape, and whenever a later topic (systems of equations, transformations, vectors) asks you to combine matrices.

The procedure

Adding and subtracting

Let A = [a_{ij}] and B = [b_{ij}] both be m \times n. Their sum A + B and difference A - B are the m \times n matrices with entries

\begin{aligned} (A + B)_{ij} &= a_{ij} + b_{ij} \\ (A - B)_{ij} &= a_{ij} - b_{ij} \end{aligned}

for every row i and column j. The entry in a position of the answer comes from the two entries in the same position, and from nothing else.

The dimensions must match. If A is 2 \times 3 and B is 3 \times 2, some position of one matrix has no partner in the other, so the rule has nothing to add there. The sum is then undefined: not zero, not some partial matrix, simply not defined. Having the same number of entries is not enough; the shapes must be the same.

48 63 37 52 21 30
N
+ 55 41 29 46 17 34
S
= 103 104 66 98 38 64
N + S
Figure 1The sum is built one position at a time. Row 2, column 2 of the sum is 52 + 46 = 98, and no other entry is involved.

Scalar multiples

In matrix work a single number is called a scalar, to keep it apart from a matrix. For a scalar k and a matrix A = [a_{ij}], the scalar multiple kA is the matrix of the same size with entries

(kA)_{ij} = k\,a_{ij}

Every entry is multiplied by the same number. Two multiples get names. The opposite of A is -A = (-1)A, every entry with its sign changed. And 0A is the zero matrix O of the same size as A.

Subtraction is adding the opposite: A - B = A + (-B), because at each position a_{ij} - b_{ij} = a_{ij} + (-b_{ij}).

The properties, and why they hold

Let A, B, C be matrices of one size m \times n, let O be the m \times n zero matrix, and let k, l be scalars. Then

PropertyStatement
CommutativeA + B = B + A
Associative(A + B) + C = A + (B + C)
Zero matrix (additive identity)A + O = A
Opposite (additive inverse)A + (-A) = O
Distributive over matrix sumsk(A + B) = kA + kB
Distributive over scalar sums(k + l)A = kA + lA
Scalars groupk(lA) = (kl)A
One and zero1A = A and 0A = O

Each one is proved the same way: both sides have the same size, so by the definition of equal matrices it is enough to compare one position (i, j), and there the statement becomes a fact about ordinary numbers. For the commutative property,

(A + B)_{ij} = a_{ij} + b_{ij} = b_{ij} + a_{ij} = (B + A)_{ij}

where the middle step is the commutative property of adding numbers. For the first distributive property,

\begin{aligned} \big(k(A + B)\big)_{ij} &= k(a_{ij} + b_{ij}) \\ &= k a_{ij} + k b_{ij} \\ &= (kA + kB)_{ij} \end{aligned}

where the middle step is the distributive property of numbers. Since the position was any position, the matrices agree everywhere, so they are equal. The other rows of the table follow by the same one-line argument, each from its own property of numbers. Matrix addition inherits its rules from number addition, one position at a time.

Subtraction inherits the failures too. A - B and B - A are opposites, B - A = -(A - B), because b_{ij} - a_{ij} = -(a_{ij} - b_{ij}) at each position. So subtraction is not commutative.

Solving a matrix equation

Because the properties match those of numbers, an equation such as 2X + A = B, where X is an unknown matrix, is solved with the moves you use on 2x + a = b. Adding the same matrix to two equal matrices gives equal matrices, since equal entries plus equal entries are equal; the same goes for multiplying both by one scalar. Add -A to both sides; the associative property and A + (-A) = O leave 2X + O, which is 2X. Then scale both sides by \displaystyle \frac{1}{2}; scalars group, and 1X = X:

\begin{aligned} 2X + A + (-A) &= B + (-A) \\ 2X &= B - A \\ X &= \tfrac{1}{2}(B - A) \end{aligned}

There is no “dividing by 2” in matrix language; multiplying by the scalar \displaystyle \frac{1}{2} does that job. Every step can be undone, so this X is the one and only solution.

Worked examples

Example 1

Sales at two branches

Ardak’s north branch (N) and Bolatbek’s south branch (S) record cones sold, with rows vanilla, chocolate, mango and columns Saturday, Sunday:

N = \begin{bmatrix} 48 & 63 \\ 37 & 52 \\ 21 & 30 \end{bmatrix} \qquad S = \begin{bmatrix} 55 & 41 \\ 29 & 46 \\ 17 & 34 \end{bmatrix}

Find N + S and N - S, and say what the entries of each mean.

Solution

Both are 3 \times 2, so both operations are defined. Add matching positions:

N + S = \begin{bmatrix} 48 + 55 & 63 + 41 \\ 37 + 29 & 52 + 46 \\ 21 + 17 & 30 + 34 \end{bmatrix}
N + S = \begin{bmatrix} 103 & 104 \\ 66 & 98 \\ 38 & 64 \end{bmatrix}

This is the whole shop’s sales in the same layout: for example, 104 vanilla cones on Sunday. Subtract matching positions:

N - S = \begin{bmatrix} -7 & 22 \\ 8 & 6 \\ 4 & -4 \end{bmatrix}

A positive entry means the north branch sold more, a negative one that the south branch did. The -7 says the south branch sold 7 more vanilla cones on Saturday. The matrix answers the question “who sold more, and by how much” for all six cases at once.

Example 2

A combination of scalar multiples

Let

A = \begin{bmatrix} 4 & -1 & 0 \\ 2 & 5 & -3 \end{bmatrix} \qquad B = \begin{bmatrix} 1 & 6 & -2 \\ -5 & 0 & 7 \end{bmatrix}
C = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{bmatrix}

Find -B and 3A - 2B. Is A + C defined?

Solution

The opposite changes every sign:

-B = \begin{bmatrix} -1 & -6 & 2 \\ 5 & 0 & -7 \end{bmatrix}

For 3A - 2B, scale first, then subtract position by position:

3A = \begin{bmatrix} 12 & -3 & 0 \\ 6 & 15 & -9 \end{bmatrix} \quad 2B = \begin{bmatrix} 2 & 12 & -4 \\ -10 & 0 & 14 \end{bmatrix}
3A - 2B = \begin{bmatrix} 10 & -15 & 4 \\ 16 & 15 & -23 \end{bmatrix}

Watch the double negatives: in row 2, column 1, 6 - (-10) = 16.

A + C is not defined. A is 2 \times 3 and C is 3 \times 2. Both have six entries, but the position row 1, column 3 exists in A and not in C, so the rule has nothing to pair it with.

Example 3

Raising every price

Dariga’s pizzeria lists prices in dollars, with rows cheese, pepperoni, veggie and columns small, large:

P = \begin{bmatrix} 9.50 & 14.00 \\ 11.00 & 16.50 \\ 10.50 & 15.00 \end{bmatrix}

Every price goes up by 10\%. Find the new price matrix, and the matrix of increases.

Solution

A 10\% rise multiplies each price by 1.1, so the new menu is the scalar multiple 1.1P:

1.1P = \begin{bmatrix} 10.45 & 15.40 \\ 12.10 & 18.15 \\ 11.55 & 16.50 \end{bmatrix}

A small cheese pizza now costs 10.45 dollars. The increases are 1.1P - P. By the distributive property over scalar sums, 1.1P - P = (1.1 - 1)P = 0.1P, so there is no need to subtract six pairs:

0.1P = \begin{bmatrix} 0.95 & 1.40 \\ 1.10 & 1.65 \\ 1.05 & 1.50 \end{bmatrix}
Example 4

Solving 2X + A = B

Solve for the matrix X:

2X + \begin{bmatrix} 3 & -4 \\ 1 & 6 \end{bmatrix} = \begin{bmatrix} 11 & 2 \\ -5 & 8 \end{bmatrix}
Solution

X must be 2 \times 2, or the left side would not be defined. As in the procedure, add the opposite of the constant matrix to both sides and then scale by \displaystyle \frac{1}{2}:

\begin{aligned} 2X &= \begin{bmatrix} 11 - 3 & 2 + 4 \\ -5 - 1 & 8 - 6 \end{bmatrix} \\ &= \begin{bmatrix} 8 & 6 \\ -6 & 2 \end{bmatrix} \end{aligned}
X = \tfrac{1}{2}\begin{bmatrix} 8 & 6 \\ -6 & 2 \end{bmatrix} = \begin{bmatrix} 4 & 3 \\ -3 & 1 \end{bmatrix}

Check. 2X = \begin{bmatrix} 8 & 6 \\ -6 & 2 \end{bmatrix}, and adding the constant matrix gives \begin{bmatrix} 11 & 2 \\ -5 & 8 \end{bmatrix}, as required.

Example 5

The unknown on both sides

Solve 3X - B = X + A, where

A = \begin{bmatrix} 1 & 4 \\ -3 & 0 \end{bmatrix} \qquad B = \begin{bmatrix} 6 & -1 \\ 2 & 7 \end{bmatrix}
Solution

Work with the letters first, as with a number equation. Add B to both sides, then add -X:

\begin{aligned} &3X - B + B + (-X) \\ &= X + A + B + (-X) \end{aligned}

On the left, -B + B = O and 3X + (-X) = (3 - 1)X = 2X by the distributive property over scalar sums. On the right, the commutative and associative properties bring X next to -X, which leaves A + B. So

2X = A + B \qquad\Longrightarrow\qquad X = \tfrac{1}{2}(A + B)

Now the numbers:

A + B = \begin{bmatrix} 7 & 3 \\ -1 & 7 \end{bmatrix} \qquad X = \begin{bmatrix} \frac{7}{2} & \frac{3}{2} \\ -\frac{1}{2} & \frac{7}{2} \end{bmatrix}

Check. Both sides come to the same matrix:

3X - B = \begin{bmatrix} \frac{9}{2} & \frac{11}{2} \\ -\frac{7}{2} & \frac{7}{2} \end{bmatrix} = X + A
Example 6

Unknown entries

Find x, y and z so that

\begin{aligned} &2\begin{bmatrix} x & 3 \\ 1 & y \end{bmatrix} + \begin{bmatrix} 4 & z \\ -2 & 5 \end{bmatrix} \\ &= \begin{bmatrix} 10 & 1 \\ 0 & -3 \end{bmatrix} \end{aligned}
Solution

The left side is the 2 \times 2 matrix with entries 2x + 4, 6 + z, 2 - 2 and 2y + 5. Two matrices are equal exactly when every position agrees, so each position gives one equation:

\begin{aligned} 2x + 4 &= 10 & 6 + z &= 1 \\ 0 &= 0 & 2y + 5 &= -3 \end{aligned}

So x = 3, z = -5 and y = -4. The bottom left position holds for any values, so it puts no condition on the unknowns. Had it read 0 = 1 instead, there would be no solution at all.

Boundaries

Same dimension, or no sum. A + B and A - B are defined only when A and B have the same number of rows and the same number of columns. Equal entry counts in different shapes do not count.

A number is not a matrix. A + 3 is not defined: a scalar can multiply a matrix, but it has no positions to add to. To add 3 to every entry of a 2 \times 2 matrix, add the 2 \times 2 matrix whose every entry is 3.

The zero matrix has a size. A + O = A holds for the zero matrix of the same size as A; there is a different zero matrix for each size.

No division by a matrix here. 2X = C is solved by multiplying both sides by the scalar \displaystyle \frac{1}{2}, which works for any nonzero scalar. Nothing in this lesson divides by a matrix.

Subtraction is neither commutative nor associative. B - A = -(A - B), and (A - B) - C and A - (B - C) differ by 2C.

Entry by entry stops at products. Multiplying two matrices is a different operation, not “multiply matching entries”, and some rules of numbers fail for it.

Where this goes next

Adding and scaling are the easy half of matrix arithmetic. The other half, matrix multiplication, combines a row of one matrix with a column of the other. It is what turns the pizzeria’s price matrix and an order table into a bill, and it does not work position by position.

The same entry by entry rules, applied to matrices with a single column, are adding and scaling vectors in any number of dimensions. And the idea is an old one met again: adding two functions adds their outputs input by input, just as adding matrices adds their entries position by position.

Exercises

Adding and subtracting

Use these matrices for Exercises 1 to 4.

P = \begin{bmatrix} 2 & -3 \\ 0 & 5 \end{bmatrix} \qquad Q = \begin{bmatrix} -4 & 1 \\ 6 & -2 \end{bmatrix}
R = \begin{bmatrix} 1 & 0 & 2 \\ 3 & -1 & 4 \end{bmatrix}
  1. Find P + Q.
  2. Find P - Q.
  3. Find Q - P, and compare it with your answer to Exercise 2.
  4. Find P + R, or explain why it is not defined.
  5. Find \begin{bmatrix} 5 & -2 & 7 \end{bmatrix} - \begin{bmatrix} 8 & -2 & -1 \end{bmatrix}.

Scalar multiples and combinations

Use P, Q and R from above.

  1. Find 4R.
  2. Find -R.
  3. Find 2P + 3Q.
  4. Find \displaystyle \frac{1}{2}P - Q.
  5. Find 5(P - Q) and 5P - 5Q. Which property says they must agree?

Matrix equations

Solve for the matrix X, or for the unknown entries.

  1. X + \begin{bmatrix} 3 & -1 \\ 2 & 0 \end{bmatrix} = \begin{bmatrix} 5 & 4 \\ -1 & 6 \end{bmatrix}
  2. 3X = \begin{bmatrix} 6 & -9 & 12 \\ 0 & 15 & -3 \end{bmatrix}
  3. 2X - A = B, where A = \begin{bmatrix} 1 & 5 \\ -3 & 2 \end{bmatrix} and B = \begin{bmatrix} 7 & -1 \\ 3 & 4 \end{bmatrix}
  4. 5X + \begin{bmatrix} 2 & -1 & 4 \end{bmatrix} = 2X + \begin{bmatrix} 11 & 8 & -2 \end{bmatrix}
  5. \begin{bmatrix} x & 2 \\ y & -1 \end{bmatrix} + 3\begin{bmatrix} 1 & z \\ 2 & w \end{bmatrix} equals \begin{bmatrix} 7 & -4 \\ 5 & 8 \end{bmatrix}

In context

  1. Ardak’s branch sells cones and cups (columns) of two flavors (rows). Week one’s sales are \begin{bmatrix} 120 & 85 \\ 96 & 70 \end{bmatrix} and week two’s are \begin{bmatrix} 134 & 79 \\ 102 & 88 \end{bmatrix}. Find the total over both weeks and the average per week.
  2. At Dariga’s pizzeria, medium and large pizzas (columns) of two kinds (rows) sell at \begin{bmatrix} 12 & 16 \\ 14 & 19 \end{bmatrix} dollars and cost \begin{bmatrix} 4.25 & 5.50 \\ 5.75 & 7.25 \end{bmatrix} dollars to make. Find the matrix of profit per pizza.
  3. A weekday special takes 20\% off the prices \begin{bmatrix} 15 & 20 \\ 17.50 & 22.50 \end{bmatrix} dollars. Find the special prices.

Reasoning

  1. Prove A + O = A and A + (-A) = O position by position.
  2. Prove (k + l)A = kA + lA, naming the property of numbers you use.
  3. Prove that B - A = -(A - B) for any two matrices of the same size. When is A - B = B - A?
  4. A 2 \times 3 matrix and a 3 \times 2 matrix both have six entries. Explain why they still cannot be added.
  5. Show that if kA = O, then k = 0 or A = O.
  6. Explain why 2X + A = B, with A and B both m \times n, has exactly one solution.
Answers
  1. \begin{bmatrix} -2 & -2 \\ 6 & 3 \end{bmatrix}. For example 2 + (-4) = -2 in the top left.
  2. \begin{bmatrix} 6 & -4 \\ -6 & 7 \end{bmatrix}. For example 5 - (-2) = 7 in the bottom right.
  3. \begin{bmatrix} -6 & 4 \\ 6 & -7 \end{bmatrix}, the opposite of P - Q: every entry has the other sign.
  4. Not defined. P is 2 \times 2 and R is 2 \times 3, so column 3 of R has no partner.
  5. \begin{bmatrix} -3 & 0 & 8 \end{bmatrix}. The last entry is 7 - (-1) = 8.
  6. \begin{bmatrix} 4 & 0 & 8 \\ 12 & -4 & 16 \end{bmatrix}. Every entry times 4.
  7. \begin{bmatrix} -1 & 0 & -2 \\ -3 & 1 & -4 \end{bmatrix}. Every sign changed; 0 stays 0.
  8. \begin{bmatrix} -8 & -3 \\ 18 & 4 \end{bmatrix}. 2P = \begin{bmatrix} 4 & -6 \\ 0 & 10 \end{bmatrix} and 3Q = \begin{bmatrix} -12 & 3 \\ 18 & -6 \end{bmatrix}.
  9. \displaystyle \begin{bmatrix} 5 & -\frac{5}{2} \\ -6 & \frac{9}{2} \end{bmatrix}. \displaystyle \frac{1}{2}P = \begin{bmatrix} 1 & -\frac{3}{2} \\ 0 & \frac{5}{2} \end{bmatrix}, then subtract Q position by position.
  10. Both are \begin{bmatrix} 30 & -20 \\ -30 & 35 \end{bmatrix}. The distributive property k(A + B) = kA + kB with B = -Q gives 5P + 5(-Q), and 5(-Q) = -(5Q) because scalars group: both equal (-5)Q.
  11. X = \begin{bmatrix} 2 & 5 \\ -3 & 6 \end{bmatrix}. Subtract the constant matrix from both sides.
  12. X = \begin{bmatrix} 2 & -3 & 4 \\ 0 & 5 & -1 \end{bmatrix}. Multiply both sides by \displaystyle \frac{1}{3}.
  13. X = \begin{bmatrix} 4 & 2 \\ 0 & 3 \end{bmatrix}. 2X = A + B = \begin{bmatrix} 8 & 4 \\ 0 & 6 \end{bmatrix}, then scale by \displaystyle \frac{1}{2}.
  14. X = \begin{bmatrix} 3 & 3 & -2 \end{bmatrix}. Subtracting 2X and the constant row gives 3X = \begin{bmatrix} 9 & 9 & -6 \end{bmatrix}.
  15. x = 4, y = -1, z = -2, w = 3. The positions give x + 3 = 7, 2 + 3z = -4, y + 6 = 5 and -1 + 3w = 8.
  16. Total \begin{bmatrix} 254 & 164 \\ 198 & 158 \end{bmatrix}; average \begin{bmatrix} 127 & 82 \\ 99 & 79 \end{bmatrix}. The average is \displaystyle \frac{1}{2} times the total.
  17. \begin{bmatrix} 7.75 & 10.50 \\ 8.25 & 11.75 \end{bmatrix} dollars: price minus cost at each position.
  18. \begin{bmatrix} 12 & 16 \\ 14 & 18 \end{bmatrix} dollars. Paying 80\% means multiplying by 0.8.
  19. At position (i, j), (A + O)_{ij} = a_{ij} + 0 = a_{ij}, and (A + (-A))_{ij} = a_{ij} + (-a_{ij}) = 0, which is the entry of O. The sizes match, so the matrices are equal.
  20. \big((k + l)A\big)_{ij} = (k + l)a_{ij}, which equals k a_{ij} + l a_{ij} by the distributive property of numbers, and that is (kA + lA)_{ij}. Every position agrees and the sizes match.
  21. At each position, b_{ij} - a_{ij} = -(a_{ij} - b_{ij}). So A - B = B - A exactly when A - B equals its own opposite, which forces every entry to be 0: that is, when A = B.
  22. Addition pairs entries by position. The 2 \times 3 matrix has a row 1, column 3 entry and the 3 \times 2 matrix has none, so that entry has no partner (and the 3 \times 2 matrix has a row 3 that the other lacks).
  23. kA = O says k a_{ij} = 0 at every position. If k \ne 0, dividing each equation by k gives a_{ij} = 0 everywhere, so A = O. Otherwise k = 0.
  24. X must be m \times n for the left side to be defined. The steps 2X = B - A and \displaystyle X = \frac{1}{2}(B - A) each lead to an equation with the same solutions, since each step can be undone (add A back, scale by 2). So \displaystyle X = \frac{1}{2}(B - A) is a solution and the only one.
kg1128 · updated 2026-10-20 · CC-BY-SA-4.0