
A First Course in Linear Algebra
A.G. Hamilton · Study material generated by AI from this edition. Not affiliated with the publisher.

A.G. Hamilton · Study material generated by AI from this edition. Not affiliated with the publisher.
Chapter 3 · pp. 32–41
A matrix is a rectangular array of numbers. Arrays like this were first used as shorthand in Gaussian elimination, and this chapter turns them into objects with their own arithmetic. You will learn how to add, scale and multiply matrices, how a whole system of equations becomes one short equation, and why matrix multiplication breaks one familiar rule of number arithmetic.
A p×q matrix has p rows and q columns, and its numbers are called entries. The entry in row i and column j is the (i,j)-entry, written . The first subscript is the row and the second is the column, so sits in row 2, column 3. The notation stands for the p×q matrix whose (i,j)-entry is for every i and j. (p. 32)
Two special shapes come up constantly.
Column vectors are the standard way to write the unknowns of simultaneous equations. (p. 32)
Matrices are added or subtracted entry by entry, so they must be the same size. If A and B are both p×q, then A+B has (i,j)-entry , and A−B has (i,j)-entry . A 2×3 matrix and a 3×2 matrix cannot be added, because some entries would have no partner. The same rule holds for row and column vectors. (p. 32)
To multiply a matrix by a number k, multiply every entry by k. The (i,j)-entry of kA is . This idea comes from repeated addition: A+A doubles every entry, so A+A = 2A. The number k can be any real number, not just a whole number. For example, times a matrix with entries 4 and 6 gives a matrix with entries 2 and 3. (p. 34)
To multiply a p×q matrix A by a column vector with q entries, build each entry of the result from one row of A. Multiply that row's entries by the matching entries of the vector, then add. For example:
The matrix must have as many columns as the vector has entries. The answer is a column vector with p entries, one for each row of the matrix. (pp. 33–34)
The row-by-row rule is designed so that the product gives the left-hand sides of equations. That means any set of p linear equations in q unknowns can be written as a single matrix equation .
For example, the equations and become
Multiplying out the left side gives in the first row and in the second. This works no matter how many equations or unknowns there are. (pp. 33–34, 36)
If A is p×q and B is q×r, the product AB is a p×r matrix. Its (i,j)-entry is
the sum of products of row i of A with the matching entries of column j of B. Another way to see it: each column of AB is A times the matching column of B. This is just the matrix-times-vector rule applied once per column. (pp. 35–36)
Example: let (2×3) and (3×2). Then AB is 2×2:
There are 4 entries, each a sum of 3 products.
AB exists only when the number of columns of A equals the number of rows of B. A helpful picture is dominoes. A p,q domino can sit next to a q,r domino because the middle numbers match, and the outer numbers p and r are what remain. (p. 36)
Because of this, AB may exist while BA does not. A 2×3 matrix times a 3×4 matrix works and gives a 2×4 matrix. In the reverse order, the 4 columns of the first matrix do not match the 2 rows of the second, so the product fails. (p. 36)
Whenever the sizes allow the sums and products, these laws are true:
They let you regroup and expand products much as you do with numbers. The rules about scaling are easy to check entry by entry. Associativity and distributivity need longer proofs. For distributivity, the key step is
which shows that the (i,j)-entry of equals the sum of the (i,j)-entries of AB and AC. (pp. 36–38)
Matrix multiplication is not commutative. Even when both AB and BA exist, they usually differ. Take and . Then
This changes how you expand brackets. Distributivity gives
You cannot merge the middle terms into unless AB = BA. So the school formula is not valid for matrices in general. (pp. 37–38)
A zero matrix has every entry 0. Multiplying it by any matrix of suitable size, on either side, gives a zero matrix. It acts like the number 0.
The identity matrix I has 1s on the main diagonal (top left to bottom right) and 0s everywhere else. Multiplying a matrix by I of suitable size, on either side, leaves it unchanged. It acts like the number 1. For instance,
Two more shapes are worth knowing. A diagonal matrix has nonzero entries only on the main diagonal. A triangular matrix has zeros on one side of the main diagonal: all zeros below it for upper triangular, all zeros above it for lower triangular. (p. 41)