4.03b, 4.03c - Adding and multiplying matrices

4.03b, 4.03c - Adding and multiplying matrices

Add and subtract matching entries, multiply matrices by scalars, and build matrix products one row and column at a time. In 4.03b4.03b you will also use powers, zero matrices and identity matrices; in 4.03c4.03c you will see why brackets can move in a product but the matrices usually cannot. The same rules work with real or complex entries.

Addition and scalar multiples

Can two non-zero matrices multiply to give the zero matrix? Ordinary numbers cannot do this, but matrices can. We will build the arithmetic needed to produce and explain an example.

You already know

Dimensions mean rows by columns. Addition needs identical dimensions; AB\mathbf{AB} needs the columns of A\mathbf{A} to match the rows of B\mathbf{B}. Complex entries obey the arithmetic you already know, with i2=−1i^2=-1.

Start with the more familiar operations. If two tables record the same quantities in the same positions, their total comes from adding corresponding entries. Thus (3214)+(5120)=(8334)\begin{pmatrix}3&2\\1&4\end{pmatrix}+\begin{pmatrix}5&1\\2&0\end{pmatrix}=\begin{pmatrix}8&3\\3&4\end{pmatrix}. Multiplying by a single number scales every entry.

Entry-by-entry operations

For matrices A\mathbf{A} and B\mathbf{B} of the same dimensions and a scalar kk,

(A±B)ij=aij±bij,(kA)ij=kaij(\mathbf{A}\pm\mathbf{B})_{ij}=a_{ij}\pm b_{ij},\qquad (k\mathbf{A})_{ij}=ka_{ij}

A scalar is a single number, real or complex, rather than a matrix. Not in the formula booklet: learn it.

Keep both matrices in the same layout while scaling; then each subtraction has a clearly matching position.

Worked example 1: a linear combination

Question. Given A=(2−134)\mathbf{A}=\begin{pmatrix}2&-1\\3&4\end{pmatrix} and B=(15−20)\mathbf{B}=\begin{pmatrix}1&5\\-2&0\end{pmatrix}, find 2A−3B2\mathbf{A}-3\mathbf{B}.

Plan. Scale each matrix, then subtract corresponding entries.

2A−3B=(4−268)−(315−60)scale every entry=(1−17128)subtract corresponding entries\begin{aligned} 2\mathbf{A}-3\mathbf{B} &=\begin{pmatrix}4&-2\\6&8\end{pmatrix}-\begin{pmatrix}3&15\\-6&0\end{pmatrix} && \text{scale every entry}\\ &=\begin{pmatrix}1&-17\\12&8\end{pmatrix} && \text{subtract corresponding entries} \end{aligned}

Why this step? Writing both scaled matrices first keeps the subtraction of a negative entry visible.

Answer. (1−17128)\begin{pmatrix}1&-17\\12&8\end{pmatrix}.

Check. Adding 3B3\mathbf{B} to the result gives (4−268)=2A\begin{pmatrix}4&-2\\6&8\end{pmatrix}=2\mathbf{A}.

The second example changes only the entry type: some entries are complex. The positions and operation stay the same.

Worked example 2: a complex linear combination

Question. Find 2C−3D2\mathbf{C}-3\mathbf{D}, where C=(1+i2−i3)\mathbf{C}=\begin{pmatrix}1+i&2\\-i&3\end{pmatrix} and D=(i121−i)\mathbf{D}=\begin{pmatrix}i&1\\2&1-i\end{pmatrix}.

Plan. Scale and subtract entry by entry, collecting real and imaginary parts within each entry.

2C−3D=(2+2i4−2i6)−(3i363−3i)scale=(2−i1−6−2i3+3i)subtract and simplify\begin{aligned} 2\mathbf{C}-3\mathbf{D} &=\begin{pmatrix}2+2i&4\\-2i&6\end{pmatrix}-\begin{pmatrix}3i&3\\6&3-3i\end{pmatrix} && \text{scale}\\ &=\begin{pmatrix}2-i&1\\-6-2i&3+3i\end{pmatrix} && \text{subtract and simplify} \end{aligned}

Why this step? Each entry is one complex number; collect its parts without mixing it with a neighbouring entry.

Answer. (2−i1−6−2i3+3i)\begin{pmatrix}2-i&1\\-6-2i&3+3i\end{pmatrix}.

Check. The bottom-right entry plus 3−3i3-3i is 66, the corresponding entry of 2C2\mathbf{C}.

Subtracting a matrix means subtracting each complete entry, including its sign.

Watch out

Wrong: 6−(−6)=06-(-6)=0. Subtracting the negative bottom-left entry in the first example gives 6+6=126+6=12. Keep the brackets until the sign is settled.

The next calculation varies the scalar as well as the entries.

Row-by-column multiplication

Matrix multiplication combines a whole row with a whole column; it does not multiply corresponding entries.

For a concrete case, suppose the row (231)\begin{pmatrix}2&3&1\end{pmatrix} records quantities and the column (456)\begin{pmatrix}4\\5\\6\end{pmatrix} records prices. Their product is the one-entry matrix (2×4+3×5+1×6)=(29)\begin{pmatrix}2\times4+3\times5+1\times6\end{pmatrix}=\begin{pmatrix}29\end{pmatrix}. There are three products because the inner dimensions are both 33.

Matrix product

If A\mathbf{A} is mm by nn and B\mathbf{B} is nn by pp, then AB\mathbf{AB} is mm by pp, with

(AB)ij=ai1b1j+ai2b2j+⋯+ainbnj(\mathbf{AB})_{ij}=a_{i1}b_{1j}+a_{i2}b_{2j}+\cdots+a_{in}b_{nj}

Use row ii of the first matrix and column jj of the second. Not in the formula booklet: learn it.

The output has one entry for each possible row-column pairing. For a 22 by 33 matrix times a 33 by 44 matrix, there are eight pairings, and each entry is a sum of three products. Numerical calculations may be done by calculator unless detailed reasoning is required, but the order and dimensions are still your responsibility.

Worked example 3: four row-column pairings

Question. Find AB\mathbf{AB} for A=(123−1)\mathbf{A}=\begin{pmatrix}1&2\\3&-1\end{pmatrix}, B=(40−25)\mathbf{B}=\begin{pmatrix}4&0\\-2&5\end{pmatrix}.

Plan. The product is 22 by 22; calculate each entry from its row and column.

AB=(1(4)+2(−2)1(0)+2(5)3(4)+(−1)(−2)3(0)+(−1)(5))row by column=(01014−5)simplify\begin{aligned} \mathbf{AB}&=\begin{pmatrix}1(4)+2(-2)&1(0)+2(5)\\3(4)+(-1)(-2)&3(0)+(-1)(5)\end{pmatrix} && \text{row by column}\\ &=\begin{pmatrix}0&10\\14&-5\end{pmatrix} && \text{simplify} \end{aligned}

Why this step? The top-right entry needs the first row and second column, not the two top-right entries.

Answer. AB=(01014−5)\mathbf{AB}=\begin{pmatrix}0&10\\14&-5\end{pmatrix}.

Check. The second column is A(05)=5(2−1)=(10−5)\mathbf{A}\begin{pmatrix}0\\5\end{pmatrix}=5\begin{pmatrix}2\\-1\end{pmatrix}=\begin{pmatrix}10\\-5\end{pmatrix}.

The second example changes only the entries to complex numbers. The row-column pattern is unchanged.

Worked example 4: a complex matrix product

Question. Find CD\mathbf{CD}, where C=(1i21−i)\mathbf{C}=\begin{pmatrix}1&i\\2&1-i\end{pmatrix}, D=(i11−i)\mathbf{D}=\begin{pmatrix}i&1\\1&-i\end{pmatrix}.

Plan. Form each row-column sum, then replace i2i^2 by −1-1.

CD=(i+i1−i22i+1−i2+(1−i)(−i))row by column=(2i21+i1−i)i2=−1\begin{aligned} \mathbf{CD}&=\begin{pmatrix}i+i&1-i^2\\2i+1-i&2+(1-i)(-i)\end{pmatrix} && \text{row by column}\\ &=\begin{pmatrix}2i&2\\1+i&1-i\end{pmatrix} && i^2=-1 \end{aligned}

Why this step? Complex arithmetic happens inside each row-column sum; it changes no matrix rule.

Answer. CD=(2i21+i1−i)\mathbf{CD}=\begin{pmatrix}2i&2\\1+i&1-i\end{pmatrix}.

Check. The bottom-right entry is 2−i+i2=1−i2-i+i^2=1-i, agreeing with the result.

Changing the shape changes the number of output entries, but each still comes from a complete row-column sum.

Watch out

Wrong: multiplying just the four corresponding pairs of entries. For example, the first example's top-left entry is 1(4)+2(−2)=01(4)+2(-2)=0, not 1(4)=41(4)=4. Matrix multiplication needs the sum across the whole row-column pair.

Keep that pattern even when the product is rectangular.

Order and brackets

You may regroup a matrix product, but you may not usually reverse its factors.

Associative and commutative

An operation is associative if regrouping three objects leaves the result unchanged. It is commutative if exchanging two objects leaves the result unchanged. For conformable matrices,

(AB)C=A(BC)(\mathbf{AB})\mathbf{C}=\mathbf{A}(\mathbf{BC})

so multiplication is associative. In general AB≠BA\mathbf{AB}\ne\mathbf{BA}, so multiplication is not commutative. These results are not in the formula booklet: learn them.

Why can brackets move? Both groupings make the same products airbrscsja_{ir}b_{rs}c_{sj} and add them; regrouping finite sums does not change their total. It also lets you calculate efficiently: if a 1010 by 22 matrix multiplies a 22 by 1010 matrix and then a 1010 by 11 column, working out the last two factors first keeps the intermediate matrix small.

Reversing the order is different. It changes the row-column pairs and may even make the product undefined. When both products exist, calculate and compare them rather than declaring that they must differ: some pairs do commute.

Worked example 5: demonstrating non-commutativity

Question. Use A=(1101)\mathbf{A}=\begin{pmatrix}1&1\\0&1\end{pmatrix} and B=(2003)\mathbf{B}=\begin{pmatrix}2&0\\0&3\end{pmatrix} to demonstrate that matrix multiplication is not commutative.

Plan. Calculate both products and compare a pair of corresponding entries.

AB=(2303)multiply in the given orderBA=(2203)reverse the factorsAB≠BAtop-right entries differ\begin{aligned} \mathbf{AB}&=\begin{pmatrix}2&3\\0&3\end{pmatrix} && \text{multiply in the given order}\\ \mathbf{BA}&=\begin{pmatrix}2&2\\0&3\end{pmatrix} && \text{reverse the factors}\\ \mathbf{AB}&\ne\mathbf{BA} && \text{top-right entries differ} \end{aligned}

Why this step? A counterexample needs both orders and a conclusion; quoting the general statement alone shows nothing about these matrices.

Answer. The top-right entries are 33 and 22, so the products are unequal and multiplication is not commutative.

Check. The other three entries agree, but one unequal pair is enough.

The second example changes only one diagonal entry into an unknown. Now the comparison finds the exceptional case where the matrices commute.

Worked example 6: when a pair does commute

Question. For A=(1101)\mathbf{A}=\begin{pmatrix}1&1\\0&1\end{pmatrix} and B=(200t)\mathbf{B}=\begin{pmatrix}2&0\\0&t\end{pmatrix}, find tt such that AB=BA\mathbf{AB}=\mathbf{BA}.

Plan. Calculate both products, then equate the entries that can differ.

AB=(2t0t),BA=(220t)row by columnt=2equate top-right entries\begin{aligned} \mathbf{AB}&=\begin{pmatrix}2&t\\0&t\end{pmatrix},\qquad \mathbf{BA}=\begin{pmatrix}2&2\\0&t\end{pmatrix} && \text{row by column}\\ t&=2 && \text{equate top-right entries} \end{aligned}

Why this step? Only the top-right equality creates a condition; the other entries agree for every tt.

Answer. t=2t=2.

Check. Then B=2I\mathbf{B}=2\mathbf{I}, and both products are 2A2\mathbf{A}.

The distinction is between a general rule and a particular pair: one pair can commute without making multiplication commutative.

Exam tip

For “demonstrate that matrix multiplication is not commutative”, finish with AB≠BA\mathbf{AB}\ne\mathbf{BA} after the calculation. OCR also accepts a correctly calculated unequal pair of corresponding entries, explicitly compared.

Use the comparison to diagnose this claim.

Powers, zero and identity

A positive integer power means repeated matrix multiplication, so square matrices are the ones whose powers you can form.

Powers and special matrices

For a square matrix A\mathbf{A} and positive integers m,nm,n,

An=AA⋯A⏟n factors,AmAn=Am+n\mathbf{A}^{n}=\underbrace{\mathbf{A}\mathbf{A}\cdots\mathbf{A}}_{n\text{ factors}},\qquad \mathbf{A}^{m}\mathbf{A}^{n}=\mathbf{A}^{m+n}

For any matrix B\mathbf{B}, with correctly sized zero and identity matrices,

B+0=B,B0=0,0B=0,IB=B=BI\mathbf{B}+\mathbf{0}=\mathbf{B},\quad \mathbf{B}\mathbf{0}=\mathbf{0},\quad \mathbf{0}\mathbf{B}=\mathbf{0},\quad \mathbf{I}\mathbf{B}=\mathbf{B}=\mathbf{B}\mathbf{I}

Not in the formula booklet: learn it.

These effects follow from the row-column rule. A zero column gives only zero products. An identity column selects exactly one entry of each row. For an mm by nn matrix, the two identity sizes differ: ImB=BIn=B\mathbf{I}_m\mathbf{B}=\mathbf{B}\mathbf{I}_n=\mathbf{B}. Associativity makes repeated multiplication unambiguous.

Worked example 7: a matrix whose square is zero

Question. For N=(0200)\mathbf{N}=\begin{pmatrix}0&2\\0&0\end{pmatrix}, find N2\mathbf{N}^2 and N3\mathbf{N}^3.

Plan. Multiply N\mathbf{N} by itself, then multiply the result by N\mathbf{N}.

N2=(0(0)+2(0)0(2)+2(0)00)=(0000)row by columnN3=N2N=0N=0zero times any conformable matrix\begin{aligned} \mathbf{N}^2&=\begin{pmatrix}0(0)+2(0)&0(2)+2(0)\\0&0\end{pmatrix}=\begin{pmatrix}0&0\\0&0\end{pmatrix} && \text{row by column}\\ \mathbf{N}^3&=\mathbf{N}^2\mathbf{N}=\mathbf{0}\mathbf{N}=\mathbf{0} && \text{zero times any conformable matrix} \end{aligned}

Why this step? Squaring a matrix means a product of matrices, so the non-zero entry need not survive.

Answer. Both powers are the 22 by 22 zero matrix.

Check. N≠0\mathbf{N}\ne\mathbf{0}, yet every row-column sum in its square is zero. This answers the opening question.

The second example changes the matrix size to three dimensions, keeping the same idea of entries moving along a chain.

Worked example 8: a three-step chain

Question. For P=(010001000)\mathbf{P}=\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix}, find P2\mathbf{P}^2 and P3\mathbf{P}^3.

Plan. Use the row-column rule twice, keeping the order unchanged.

P2=(001000000)multiply P by itselfP3=(001000000)(010001000)=(000000000)multiply once more\begin{aligned} \mathbf{P}^2&=\begin{pmatrix}0&0&1\\0&0&0\\0&0&0\end{pmatrix} && \text{multiply }\mathbf{P}\text{ by itself}\\ \mathbf{P}^3&=\begin{pmatrix}0&0&1\\0&0&0\\0&0&0\end{pmatrix}\begin{pmatrix}0&1&0\\0&0&1\\0&0&0\end{pmatrix} =\begin{pmatrix}0&0&0\\0&0&0\\0&0&0\end{pmatrix} && \text{multiply once more} \end{aligned}

Why this step? Multiplying the first row of P2\mathbf{P}^2 by P\mathbf{P} selects its third row, which is zero.

Answer. P2=(001000000)\mathbf{P}^2=\begin{pmatrix}0&0&1\\0&0&0\\0&0&0\end{pmatrix} and P3=0\mathbf{P}^3=\mathbf{0}.

Check. Acting on (xyz)\begin{pmatrix}x\\y\\z\end{pmatrix}, P\mathbf{P} gives (yz0)\begin{pmatrix}y\\z\\0\end{pmatrix}, then (z00)\begin{pmatrix}z\\0\\0\end{pmatrix}, then zero.

The chain calculation explains why powers can vanish even though the starting matrix contains a non-zero entry.

Watch out

Wrong: (0200)2=(0400)\begin{pmatrix}0&2\\0&0\end{pmatrix}^{2}=\begin{pmatrix}0&4\\0&0\end{pmatrix}. This squares individual entries. A matrix square uses row-column multiplication and is zero here. Also, AB=0\mathbf{AB}=\mathbf{0} does not force either factor to be zero.

A final variation lengthens the links but keeps the same shape.

Quick Recap

  • Add or subtract corresponding entries; a scalar multiplies every entry.
  • A matrix product uses row-column sums, and its dimensions are the outer dimensions.
  • Matrix multiplication is associative, so brackets can move; it is not commutative in general, so factor order matters.
  • A matrix power is repeated multiplication. The identity leaves a conformable matrix unchanged; multiplying by a zero matrix gives a zero matrix.

Yes: the non-zero matrix (0200)\begin{pmatrix}0&2\\0&0\end{pmatrix} multiplied by itself gives the zero matrix.