An m×n matrix A has m rows and n columns. We write it by columns or by entries:
A=[a1a2⋯an]=a11⋮am1⋯⋯a1n⋮amn
aij is the entry in row i, column j (row first, always).
The diagonal entries are a11,a22,a33,…; a diagonal matrix is square with zeros everywhere off the diagonal (e.g. the identity In).
The zero matrix0 has every entry 0.
Two matrices are equal when they have the same size and the same corresponding entries.
Sums and Scalar Multiples
A+B is defined only when A and B have the same size: add entry by entry (column by column).
rA multiplies every entry of A by the scalar r. We write −A for (−1)A and A−B for A+(−1)B.
Theorem 1 (Lay §2.1): Let A, B, C be matrices of the same size and r, s scalars. Then
A+B=B+A
(A+B)+C=A+(B+C)
A+0=A
r(A+B)=rA+rB
(r+s)A=rA+sA
r(sA)=(rs)A
In short: matrix addition and scalar multiplication behave exactly like ordinary vector algebra.
Matrix Multiplication
Multiplying by B and then by A (that is, x↦Bx↦A(Bx)) should be a single matrix AB. That is what motivates the definition.
Definition (Lay §2.1): If A is m×n and B=[b1b2⋯bp] is n×p, then
AB=A[b1b2⋯bp]=[Ab1Ab2⋯Abp]
Each column of AB is a linear combination of the columns of A, using weights from the corresponding column of B.
The Size Rule
m×nAn×pB=m×pAB
The inner numbers must match (n=n); the outer numbers give the size of the product.
Example. If A is 3×2 and B is 2×4, then AB is 3×4, but BA is undefined (B has 4 columns, A has 3 rows).
The Row–Column Rule
For hand computation, compute one entry at a time: entry (i,j) of AB is (row i of A) ⋅ (column j of B):
(AB)ij=ai1b1j+ai2b2j+⋯+ainbnj
Mini-example. With A=[213−5] and B=[413−263], entry (1,3) of AB is row 1 of A times column 3 of B: 2(6)+3(3)=21.
Similarly, a whole row of AB is (row i of A) times B:
rowi(AB)=rowi(A)⋅B
Example 6 (Lay §2.1). Find the second row of AB, where
A=2−16−3−53−800−4−79,B=473−612
Only row 2 of A is needed:
[−13−4]473−612=[−4+21−126+3−8]=[51]
How to recognise the question type: “Compute AB in two ways” means (a) by the definition, computing Ab1,Ab2,… separately and placing them side by side, and (b) by the row–column rule. “Find the second row of AB” means: you only need row 2 of A (times all of B). “Find the first column of B given A and AB” means: solve Ax=(first column of AB).
Properties of Matrix Multiplication
Theorem 2 (Lay §2.1): Let A be m×n, and let B, C have sizes for which the sums and products are defined. Then
A(BC)=(AB)C (associative law)
A(B+C)=AB+AC (left distributive law)
(B+C)A=BA+CA (right distributive law)
r(AB)=(rA)B=A(rB) for any scalar r
ImA=A=AIn (identity for multiplication)
So IA=AI=A: the identity matrix plays the role of the number 1.
Common mistakes — matrix algebra is NOT number algebra:
In general AB=BA. Order matters: ”A times B on the right” (AB) differs from ”B times A” (BA). Even when both are defined and the same size, they are usually different.
No cancellation: AB=AC does not imply B=C (see Exercise 3 below, textbook Exercise 10).
AB=0 does not imply A=0 or B=0. For instance [1111][1−1−11]=[0000].
Powers of a Matrix
If A is square (n×n) and k is a positive integer,
Ak=k factorsA⋯A,A0=In
Akx means applying the transformation x↦Axk times. Note (A+B)2=A2+AB+BA+B2, not A2+2AB+B2 (since AB=BA in general).
The Transpose of a Matrix
The transposeAT of an m×n matrix A is the n×m matrix whose columns are the rows of A (equivalently, (AT)ij=aji).
Theorem 3 (Lay §2.1): Let A and B be matrices whose sizes are appropriate for the following sums and products.
(AT)T=A
(A+B)T=AT+BT
(rA)T=rAT for any scalar r
(AB)T=BTAT
The transpose of a product is the product of the transposes in reverse order. (Check the sizes: if A is m×n and B is n×p, then BTAT is (p×n)(n×m), which works; ATBT usually does not even exist.)
Solved Examples (Textbook Questions)
Exercise 1
(Adapted from Lay §2.1, Exercise 3)
Let A=[45−1−2]. Compute 3I2−A and (3I2)A.
Show solution ↓Hide solution ↑
Solution
3I2−A: 3I2 has 3 on the diagonal, so only the diagonal entries of A are subtracted from 3; off-diagonal entries just change sign.
So AB=AC, but clearly B=C. Cancellation fails for matrices.
Why it happens here:detA=2(6)−(−3)(−4)=12−12=0, so A is not invertible; you cannot “multiply both sides by A−1” to cancel A. (If A were invertible, AB=AC would force B=C.)
Exercise 4
(Adapted from Lay §2.1, Exercise 11)
Let A=111124135 and D=200030005. Compute AD and DA. Explain how the columns or rows of A change when A is multiplied by D on the right or on the left. Find a 3×3 matrix B, not the identity matrix or the zero matrix, such that AB=BA.
Right-multiplication by the diagonal D (AD) multiplies each column of A by the corresponding diagonal entry: column 1 by 2, column 2 by 3, column 3 by 5.
Left-multiplication by D (DA) multiplies each row of A by the corresponding diagonal entry.
Since AD=DA, this is another example that order matters.
A matrix that commutes with A: any scalar multiple of the identity works, because (rI)A=rA=A(rI). For example B=4I3:
AB=BA=4A=444481641220
(Another valid choice is B=A itself, or B=A2, since A⋅A=A⋅A.)
Exercise 5
(Adapted from Lay §2.1, Exercise 17)
If A=[1−2−25] and AB=[−162−9−13], determine the first and second columns of B.
Show solution ↓Hide solution ↑
Solution
Key idea: by the definition, AB=[Ab1Ab2Ab3]. So column j of B solves Ax=(column j of AB).
First column: solve Ax=[−16]. Row reduce, using R2←R2+2R1, then R1←R1+2R2: