Multiplication of Matrices

The rule: rows meet columns

Definition. The product ABAB is defined only when the number of columns of AA equals the number of rows of BB. If A=[aik]m×nA = [a_{ik}]_{m \times n} and B=[bkj]n×pB = [b_{kj}]_{n \times p}, then AB=[cij]m×pAB = [c_{ij}]_{m \times p} with cij=∑k=1naik bkj=ai1b1j+ai2b2j+⋯+ainbnjc_{ij} = \sum_{k=1}^{n} a_{ik}\,b_{kj} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{in}b_{nj} — the entry at (i,j)(i, j) is row ii of AA times column jj of BB: multiply across the row and down the column, then add.

Row-by-column multiplication mechanic and conformability rule with two surprises

Order bookkeeping: (m×n)(n×p)→m×p(m \times n)(n \times p) \to m \times p — the inner numbers must match and cancel; the outer numbers survive.

Worked product. AB=(1234)(2013)=(1⋅2+2⋅11⋅0+2⋅33⋅2+4⋅13⋅0+4⋅3)=(461012)AB = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\begin{pmatrix} 2 & 0 \\ 1 & 3 \end{pmatrix} = \begin{pmatrix} 1\cdot 2 + 2 \cdot 1 & 1 \cdot 0 + 2 \cdot 3 \\ 3 \cdot 2 + 4 \cdot 1 & 3 \cdot 0 + 4 \cdot 3 \end{pmatrix} = \begin{pmatrix} 4 & 6 \\ 10 & 12 \end{pmatrix}

Surprise 1: AB≠BAAB \neq BA

With the same matrices in the other order: BA=(2013)(1234)=(241014)≠ABBA = \begin{pmatrix} 2 & 0 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 2 & 4 \\ 10 & 14 \end{pmatrix} \neq AB Matrix multiplication is not commutative in general. Worse, BABA may not even exist: if AA is 2×32 \times 3 and BB is 3×43 \times 4, then ABAB is 2×42 \times 4 but BABA pairs (3×4)(2×3)(3 \times 4)(2 \times 3) — inner numbers 4 and 2 clash. Both products exist and have the same order only when AA and BB are square of the same order — and even then they usually differ.

Surprise 2: zero divisors

For numbers, ab=0ab = 0 forces a=0a = 0 or b=0b = 0. For matrices: (0−102)(3500)=(0000)\begin{pmatrix} 0 & -1 \\ 0 & 2 \end{pmatrix}\begin{pmatrix} 3 & 5 \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} — the product of two nonzero matrices can be the zero matrix. Consequently there is no cancellation law: AB=ACAB = AC does not imply B=CB = C.

Properties That Do Survive

The good news

For matrices with compatible orders:

Property Statement
associativity (AB)C=A(BC)(AB)C = A(BC)
distributivity (left) A(B+C)=AB+ACA(B + C) = AB + AC
distributivity (right) (A+B)C=AC+BC(A + B)C = AC + BC
multiplicative identity AI=IA=AAI = IA = A (identity of the appropriate order)
scalars slide through k(AB)=(kA)B=A(kB)k(AB) = (kA)B = A(kB)

Associativity is what makes powers unambiguous: A3=AAAA^3 = AAA needs no brackets. And because multiplication does not commute, left and right distributivity are separate facts — expand (A+B)2(A + B)^2 carefully: (A+B)2=A2+AB+BA+B2(NOT A2+2AB+B2 unless AB=BA)(A + B)^2 = A^2 + AB + BA + B^2 \qquad (\text{NOT } A^2 + 2AB + B^2 \text{ unless } AB = BA) The same caution kills the familiar identities: (A+B)(A−B)=A2−AB+BA−B2≠A2−B2(A+B)(A-B) = A^2 - AB + BA - B^2 \neq A^2 - B^2 in general.

Row and column vectors as products

A 1×n1 \times n row times an n×1n \times 1 column is a 1×11 \times 1 matrix — essentially a number: (1−23)(231)=[ 1⋅2−2⋅3+3⋅1 ]=[−1]\begin{pmatrix} 1 & -2 & 3 \end{pmatrix}\begin{pmatrix} 2 \\ 3 \\ 1 \end{pmatrix} = [\,1 \cdot 2 - 2 \cdot 3 + 3 \cdot 1\,] = [-1] In the other order, (n×1)(1×n)(n \times 1)(1 \times n) blows up into an n×nn \times n matrix — a dramatic illustration of how much the order matters.

Multiplication as aggregation (the word problems)

A bookshop holds 120 chemistry, 96 physics and 120 economics books, selling at 80, 60 and 40 rupees. The total revenue is the product (12096120)(806040)=[ 9600+5760+4800 ]=[20160]\begin{pmatrix} 120 & 96 & 120 \end{pmatrix}\begin{pmatrix} 80 \\ 60 \\ 40 \end{pmatrix} = [\,9600 + 5760 + 4800\,] = [20160] i.e. ₹ 20160 — quantities-row times prices-column. Every cost/revenue/audience word problem in the exercises is this pattern, sometimes with several rows (several shops) or several columns (several price lists) at once.

Common mistakes to avoid

Mistake 1 — multiplying entrywise. (AB)ij(AB)_{ij} is a sum of products along row ii and column jj, never aijbija_{ij}b_{ij}.

Mistake 2 — assuming AB=BAAB = BA. Never assume it; when a problem says the matrices commute, that is a special hypothesis to be used.

Mistake 3 — expanding (A+B)2(A+B)^2 with the binomial formula. Keep ABAB and BABA separate unless told they are equal.

Mistake 4 — cancelling matrices. From AB=ACAB = AC you may NOT conclude B=CB = C (no division; zero divisors exist).

Mistake 5 — order bookkeeping. Before computing anything, check conformability and write down the product's order — half the MCQs are settled by the orders alone.

Solved Examples

Example 1 — A full 2×22 \times 2 product, both orders

For A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} and B=(2013)B = \begin{pmatrix} 2 & 0 \\ 1 & 3 \end{pmatrix}, compute ABAB and BABA and compare.

Step 1 — ABAB row-by-column: AB=(461012)AB = \begin{pmatrix} 4 & 6 \\ 10 & 12 \end{pmatrix}

Step 2 — BABA: BA=(2⋅1+0⋅32⋅2+0⋅41⋅1+3⋅31⋅2+3⋅4)=(241014)BA = \begin{pmatrix} 2 \cdot 1 + 0 \cdot 3 & 2\cdot 2 + 0 \cdot 4 \\ 1 \cdot 1 + 3 \cdot 3 & 1 \cdot 2 + 3 \cdot 4 \end{pmatrix} = \begin{pmatrix} 2 & 4 \\ 10 & 14 \end{pmatrix}

Answer: AB≠BAAB \neq BA — already the (1,1)(1,1) entries (4 vs 2) disagree. One disagreement suffices.

Example 2 — Row times column, column times row

For A=(1−23)A = \begin{pmatrix} 1 & -2 & 3 \end{pmatrix} and B=(231)B = \begin{pmatrix} 2 \\ 3 \\ 1 \end{pmatrix}, find ABAB and the order of BABA.

Step 1 — ABAB: (1×3)(3×1)→1×1(1 \times 3)(3 \times 1) \to 1 \times 1: AB=[ 2−6+3 ]=[−1]AB = [\,2 - 6 + 3\,] = [-1]

Step 2 — BABA: (3×1)(1×3)→3×3(3 \times 1)(1 \times 3) \to 3 \times 3 — a full 3×33 \times 3 matrix (each entry biajb_i a_j).

Answer: AB=[−1]AB = [-1] while BABA is 3×33 \times 3 — the two orders do not even have the same shape.

Example 3 — Nonzero matrices with zero product

Show that A=(0−102)A = \begin{pmatrix} 0 & -1 \\ 0 & 2 \end{pmatrix} and B=(3500)B = \begin{pmatrix} 3 & 5 \\ 0 & 0 \end{pmatrix} satisfy AB=OAB = O although A≠OA \neq O and B≠OB \neq O.

Step 1 — compute: AB=(0⋅3+(−1)⋅00⋅5+(−1)⋅00⋅3+2⋅00⋅5+2⋅0)=(0000)AB = \begin{pmatrix} 0 \cdot 3 + (-1) \cdot 0 & 0 \cdot 5 + (-1) \cdot 0 \\ 0 \cdot 3 + 2 \cdot 0 & 0 \cdot 5 + 2 \cdot 0 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix}

Answer: AB=OAB = O with both factors nonzero — matrices admit zero divisors, so "AB=O⇒A=OAB = O \Rightarrow A = O or B=OB = O" is FALSE, and cancellation fails with it.

Example 4 — Conformability bookkeeping

AA is 2×32 \times 3, BB is 3×43 \times 4, CC is 4×24 \times 2. Which of ABAB, BABA, BCBC, CACA, (AB)C(AB)C, C(AB)C(AB) are defined, and with what orders?

Step 1 — test inner numbers pair by pair: ABAB: (2×3)(3×4)→2×4(2 \times 3)(3 \times 4) \to 2 \times 4 ✓.  BA\ BA: (3×4)(2×3)(3 \times 4)(2 \times 3) — inner 4 vs 2 ✗.  BC\ BC: (3×4)(4×2)→3×2(3 \times 4)(4 \times 2) \to 3 \times 2 ✓.  CA\ CA: (4×2)(2×3)→4×3(4 \times 2)(2 \times 3) \to 4 \times 3 ✓.

Step 2 — chain: (AB)C(AB)C: (2×4)(4×2)→2×2(2 \times 4)(4 \times 2) \to 2 \times 2 ✓;  C(AB)\ C(AB): (4×2)(2×4)→4×4(4 \times 2)(2 \times 4) \to 4 \times 4 ✓.

Answer: all but BABA are defined, with the orders listed — order bookkeeping first, arithmetic second.

Example 5 — Verifying associativity on numbers

For A=(1102)A = \begin{pmatrix} 1 & 1 \\ 0 & 2 \end{pmatrix}, B=(2011)B = \begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix}, C=(1011)C = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}, verify (AB)C=A(BC)(AB)C = A(BC).

Step 1 — left grouping: AB=(3122)AB = \begin{pmatrix} 3 & 1 \\ 2 & 2 \end{pmatrix}, then (AB)C=(3+112+22)=(4142)(AB)C = \begin{pmatrix} 3 + 1 & 1 \\ 2 + 2 & 2 \end{pmatrix} = \begin{pmatrix} 4 & 1 \\ 4 & 2 \end{pmatrix}.

Step 2 — right grouping: BC=(2021)BC = \begin{pmatrix} 2 & 0 \\ 2 & 1 \end{pmatrix}, then A(BC)=(2+2142)=(4142)A(BC) = \begin{pmatrix} 2 + 2 & 1 \\ 4 & 2 \end{pmatrix} = \begin{pmatrix} 4 & 1 \\ 4 & 2 \end{pmatrix}.

Answer: both groupings agree — associativity in action (it holds always; a numerical verification is how boards ask it).

Example 6 — The identity in action

Show that AI=IA=AAI = IA = A for A=(abcd)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} and I=(1001)I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}.

Step 1 — AIAI: row-by-column gives (abcd)\begin{pmatrix} a & b \\ c & d \end{pmatrix} back (each row of AA picks out the matching column of II).

Step 2 — IAIA: likewise returns AA.

Answer: II is the multiplicative identity — the one matrix that commutes with everything of its order.

Example 7 — A revenue product

A bookshop has 120 chemistry, 96 physics and 120 economics books, priced at 80, 60 and 40 rupees respectively. Use a matrix product to find the total revenue if all are sold.

Step 1 — quantities row times prices column: (12096120)(806040)=[ 9600+5760+4800 ]=[20160]\begin{pmatrix} 120 & 96 & 120 \end{pmatrix}\begin{pmatrix} 80 \\ 60 \\ 40 \end{pmatrix} = [\,9600 + 5760 + 4800\,] = [20160]

Answer: ₹ 20160. The row-times-column sum is the natural "quantity times price, added up" — which is why matrix multiplication is defined the way it is.