Matrix operations

A matrix is just a rectangular grid of numbers, but the moment you start adding, scaling, and multiplying these grids, arithmetic stops behaving the way it does for ordinary numbers. Two matrices can multiply in one order and give a completely different answer in the other order — and two genuinely non-zero matrices can multiply together to give the zero matrix, something that never happens with real numbers. ISC Class 12 expects you to add, subtract, scalar-multiply, and multiply matrices of order up to 3×33\times3 fluently, to know exactly when a product is even defined, and to be able to construct examples that expose these "un-number-like" behaviours. This article rebuilds the row-by-column multiplication rule from first principles, works through a full numeric example, and flags the traps examiners love to set around non-commutativity and the zero-product surprise.

The core insight

Matrix addition and scalar multiplication act entry-by-entry, but matrix multiplication combines rows of one matrix with columns of the other via cij=∑kaikbkjc_{ij}=\sum_k a_{ik}b_{kj}, a rule that requires matching inner orders and, crucially, does not commute.

The core idea

A matrix of order m×nm\times n has mm rows and nn columns, written A=[aij]A=[a_{ij}] where aija_{ij} sits in row ii, column jj. Two matrices are equal only when their orders match and every corresponding entry is identical — there is no notion of "approximately equal" matrices in this algebra.

Addition and subtraction only make sense between matrices of the same order, and they act entry-wise:

(A±B)ij=aij±bij(A\pm B)_{ij}=a_{ij}\pm b_{ij}

where: aija_{ij} and bijb_{ij} are the entries of AA and BB in the same position, and the result has the same order as AA and BB.

Scalar multiplication stretches or shrinks every entry by the same factor:

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

where: kk is a real number (the scalar) and (kA)ij(kA)_{ij} is the entry of the scaled matrix in position (i,j)(i,j).

Matrix multiplication is the one that behaves unlike anything in ordinary arithmetic. If AA is m×nm\times n and BB is n×pn\times p — the number of columns of AA must equal the number of rows of BB — then C=ABC=AB is m×pm\times p, with

cij=∑k=1naik bkjc_{ij}=\sum_{k=1}^{n}a_{ik}\,b_{kj}

where: cijc_{ij} is built by pairing row ii of AA with column jj of BB term by term and summing, nn is the shared "inner" dimension that must match, and the outer dimensions mm and pp survive into the order of CC. The figure below shows why the inner dimensions must agree: each output entry needs a row and a column of exactly the same length to pair up.

Figure
Two matrices A of order m by n and B of order n by p multiplying to give C of order m by p, with the shared inner dimension n highlighted between them
Compatibility: inner dimensions must match A order m x n x B order n x p = C order m x p columns of A must equal rows of B, both n

Two properties matter most for exam problems. First, matrix addition and multiplication are both associative, and multiplication distributes over addition: (AB)C=A(BC)(AB)C=A(BC) and A(B+C)=AB+ACA(B+C)=AB+AC whenever the products are defined. Second, and most tested, matrix multiplication is non-commutative: AB≠BAAB\neq BA in general, even when both products exist and have the same order. A further surprise is that AB=OAB=O (the zero matrix) does not force A=OA=O or B=OB=O — two genuinely non-zero matrices can multiply to zero, unlike real numbers where xy=0xy=0 forces x=0x=0 or y=0y=0. The transpose ATA^T swaps rows and columns, with (AT)T=A(A^T)^T=A and (AB)T=BTAT(AB)^T=B^TA^T (note the order flips).

Derivation AWhy matrix multiplication does not commute

The goal is to derive the row-by-column product rule for two general 2×22\times2 matrices and show, symbolically rather than by a lucky numeric accident, that swapping the order of multiplication changes the answer in general — establishing why AB≠BAAB\neq BA is the normal case rather than an exception.

Step 1. Set up two general 2×22\times2 matrices, A=(abcd)A=\begin{pmatrix}a&b\\c&d\end{pmatrix} and B=(efgh)B=\begin{pmatrix}e&f\\g&h\end{pmatrix}. Both are 2×22\times2, so both ABAB and BABA are defined and are themselves 2×22\times2 — the compatibility condition is satisfied in both orders, so any difference we find cannot be blamed on a mismatched order.

Step 2. Apply cij=∑kaikbkjc_{ij}=\sum_k a_{ik}b_{kj} to get ABAB. Row 1 of AA against column 1 of BB gives entry (1,1)=ae+bg(1,1)=ae+bg; row 1 against column 2 gives (1,2)=af+bh(1,2)=af+bh; row 2 against column 1 gives (2,1)=ce+dg(2,1)=ce+dg; row 2 against column 2 gives (2,2)=cf+dh(2,2)=cf+dh. So AB=(ae+bgaf+bhce+dgcf+dh)AB=\begin{pmatrix}ae+bg & af+bh\\ce+dg & cf+dh\end{pmatrix}.

Step 3. Now swap the order and compute BABA the same way. Row 1 of BB against column 1 of AA gives (1,1)=ea+fc(1,1)=ea+fc; row 1 against column 2 gives (1,2)=eb+fd(1,2)=eb+fd; row 2 against column 1 gives (2,1)=ga+hc(2,1)=ga+hc; row 2 against column 2 gives (2,2)=gb+hd(2,2)=gb+hd. So BA=(ea+fceb+fdga+hcgb+hd)BA=\begin{pmatrix}ea+fc & eb+fd\\ga+hc & gb+hd\end{pmatrix}.

Step 4. Compare entry (1,1)(1,1) in both: ABAB gives ae+bgae+bg, while BABA gives ea+fcea+fc. These are built from entirely different pairings — ABAB's (1,1)(1,1) never involves ff, but BABA's (1,1)(1,1) never involves gg — so there is no algebraic reason for the two expressions to match for arbitrary a,b,c,d,e,f,g,ha,b,c,d,e,f,g,h. They agree only for special choices (for instance if BB is a multiple of the identity matrix), never as a general identity. This confirms symbolically what the compatibility diagram already hinted: multiplication mixes rows with columns in a direction-sensitive way, so the order in which you multiply two matrices is part of the answer, not a cosmetic choice. Verified: the general 2×22\times2 product formulas AB=(ae+bgaf+bhce+dgcf+dh)AB=\begin{pmatrix}ae+bg & af+bh\\ce+dg & cf+dh\end{pmatrix} and BA=(ea+fceb+fdga+hcgb+hd)BA=\begin{pmatrix}ea+fc & eb+fd\\ga+hc & gb+hd\end{pmatrix} have structurally different (1,1)(1,1) entries, confirmed with the numeric worked example below.

Worked example

Let A=(1234)A=\begin{pmatrix}1 & 2\\ 3 & 4\end{pmatrix} and B=(012−1)B=\begin{pmatrix}0 & 1\\ 2 & -1\end{pmatrix}. Find 2A−3B2A-3B, the product ABAB, and check whether AB=BAAB=BA.

Step 1. Scale each matrix first. 2A=(2468)2A=\begin{pmatrix}2 & 4\\ 6 & 8\end{pmatrix} and 3B=(036−3)3B=\begin{pmatrix}0 & 3\\ 6 & -3\end{pmatrix}, each entry simply multiplied by the scalar.

Step 2. Subtract entry-wise, since both scaled matrices are 2×22\times2: 2A−3B=(2−04−36−68−(−3))=(21011)2A-3B=\begin{pmatrix}2-0 & 4-3\\ 6-6 & 8-(-3)\end{pmatrix}=\begin{pmatrix}2 & 1\\ 0 & 11\end{pmatrix}.

Step 3. Compute ABAB using the row-by-column rule. Both matrices are 2×22\times2 so the product is defined and 2×22\times2: entry (1,1)=1(0)+2(2)=4(1,1)=1(0)+2(2)=4, entry (1,2)=1(1)+2(−1)=−1(1,2)=1(1)+2(-1)=-1, entry (2,1)=3(0)+4(2)=8(2,1)=3(0)+4(2)=8, entry (2,2)=3(1)+4(−1)=−1(2,2)=3(1)+4(-1)=-1, giving AB=(4−18−1)AB=\begin{pmatrix}4 & -1\\ 8 & -1\end{pmatrix}.

Step 4. Compute BABA the same way and compare: entry (1,1)=0(1)+1(3)=3(1,1)=0(1)+1(3)=3, entry (1,2)=0(2)+1(4)=4(1,2)=0(2)+1(4)=4, entry (2,1)=2(1)+(−1)(3)=−1(2,1)=2(1)+(-1)(3)=-1, entry (2,2)=2(2)+(−1)(4)=0(2,2)=2(2)+(-1)(4)=0, giving BA=(34−10)BA=\begin{pmatrix}3 & 4\\ -1 & 0\end{pmatrix}. This is plainly different from ABAB, confirming non-commutativity for this pair. Final answer: 2A−3B=(21011)2A-3B=\begin{pmatrix}2 & 1\\ 0 & 11\end{pmatrix}, AB=(4−18−1)AB=\begin{pmatrix}4 & -1\\ 8 & -1\end{pmatrix}, and AB≠BAAB\neq BA.

Competitive stretch

Show that two non-zero matrices can multiply to give the zero matrix, using P=(1111)P=\begin{pmatrix}1 & 1\\ 1 & 1\end{pmatrix} and Q=(11−1−1)Q=\begin{pmatrix}1 & 1\\ -1 & -1\end{pmatrix}. Every entry of PQPQ works out to 1(1)+1(−1)=01(1)+1(-1)=0, so PQ=(0000)=OPQ=\begin{pmatrix}0 & 0\\ 0 & 0\end{pmatrix}=O, even though neither PP nor QQ is the zero matrix — the "zero-product law" that holds for real numbers (xy=0⇒x=0xy=0\Rightarrow x=0 or y=0y=0) simply has no matrix analogue.

Common traps

  • Adding or multiplying matrices without checking orders first — for ABAB, the columns of AA must equal the rows of BB, or the product is not defined at all.
  • Assuming AB=BAAB=BA by habit from ordinary algebra; the symbolic derivation above shows this fails for generic matrices, so never swap multiplication order in a matrix manipulation.
  • Concluding A=OA=O or B=OB=O whenever AB=OAB=O — this cancellation law from real-number arithmetic does not carry over to matrices, as the competitive stretch example shows.
  • Mixing up scalar multiplication (every entry scaled by one number kk) with matrix multiplication (a row-by-column sum) — they use the same word "multiplication" but are structurally different operations.

Ask the tutor: if you want to practise spotting when a matrix product is defined or want more non-commutativity and zero-product examples worked step by step, ask the AI tutor about "matrix operations."

Why does matrix multiplication need matching inner dimensions at all

Because each entry of the product is built by pairing a row of the first matrix with a column of the second, term by term, and summing — see cij=∑kaikbkjc_{ij}=\sum_k a_{ik}b_{kj}. That pairing only makes sense if the row and the column have exactly the same number of entries, which is precisely "columns of A equals rows of B." If they mismatch, some terms in the row would have no partner in the column, so the sum simply cannot be formed and the product is undefined, not just unconventional.

Is there any situation where AB actually does equal BA

Yes, but it is the exception, not the rule. If one of the matrices is the identity matrix, or a scalar multiple of the identity, multiplication commutes because scaling every direction equally does not care about order. Some special pairs (for example a matrix and its own inverse, or a matrix and a suitable polynomial in itself) also commute. But for two "random" matrices, as the symbolic derivation shows, there is no reason for ABAB and BABA to agree, so you should always verify rather than assume.

How is matrix subtraction different from matrix multiplication in terms of what can go wrong

Subtraction only ever fails for one reason: the two matrices have different orders, in which case there is no entry-wise pairing possible, full stop. Multiplication can "look" fine at first glance and still fail, or succeed but not in the order you expected — you must separately check that the inner dimensions match, and separately remember that the order of multiplication changes the answer. So subtraction has one trap (order mismatch), while multiplication effectively has two (definedness, then non-commutativity).

Before this

Where this leads