What an m by n matrix is, how to read its size and entries, how to compute a matrix-vector product as a weighted sum of columns or row by row, and how matrix addition, scalar multiples and the transpose work.
A gift shop packs two kinds of boxes. A small box holds 2 candles and 1 card, and a large box holds 3 candles, 1 card and 2 bars of soap. How many candles, cards and soaps does an order of 4 small boxes and 1 large box need, and how can the count be redone quickly whenever the order changes? Writing the contents of the two boxes as the columns of one array, a matrix, makes every such count a single product of the matrix with the order. This lesson defines matrices and that product, and then matrix addition, scalar multiples and the transpose, each through the entries.
Key terms
Matrix
Definition Let m and n be positive integers. An m×n matrix is a rectangular array of real numbers with m rows and n columns. Its size is m×n, read as m by n, with the number of rows first. The entry in row i and column j of a matrix A is written aij, again row first, and we write A=[aij]. Column j of A is a vector aj in Rm, and listing the columns gives
A=[a1a2⋯an].
Two matrices are equal when they have the same size and the same entry in every position. A matrix with as many rows as columns is square. In running text a tuple such as (2,1,0) stands for a column vector.
In plain words Rows run across and columns run down. The size and the label of an entry both name the row first and the column second.
Example The gift shop’s boxes give the 3×2 matrix
G=210312.
Its rows count candles, cards and soaps, in that order, and its columns are the small box g1=(2,1,0) and the large box g2=(3,1,2). The entry g32=2 says that a large box holds two soaps, and g31=0 says that a small box holds none. Keep the notation straight. The number g21=1 is a single entry, while the bold g1 is a whole column.
Matrix-vector product
Definition Let A be an m×n matrix with columns a1,…,an, and let x=(x1,…,xn) be a vector in Rn. The matrix-vector product Ax is the weighted sum of the columns of A with the entries of x as weights,
Ax=x1a1+x2a2+⋯+xnan.
In other words, Ax is the linear combination of the columns of A whose coefficients are the entries of x. The product is defined only when x has exactly n entries, one weight for each column. Since every column lies in Rm, so does Ax. An m×n matrix therefore takes inputs in Rn and gives outputs in Rm, and we say that A maps Rn to Rm.
In plain words Each entry of the input says how much of the matching column to take. Count the columns to see which inputs are allowed and the rows to see how long the answer is.
Example The order of 4 small boxes and 1 large box is x=(4,1), and
Gx=4210+1312=1152.
The order needs 11 candles, 5 cards and 2 soaps. A new order changes only x, never the matrix. The matrix G maps R2 to R3, so a product such as G times (4,1,0) is not defined, since G has only two columns to weight.
Row-by-row calculation
Definition For an m×n matrix A=[aij] and a vector x in Rn, entry i of Ax is
(Ax)i=ai1x1+⋯+ainxn=j=1∑naijxj
for i=1,…,m. This follows from the column definition, because entry i of xjaj is aijxj and a sum of vectors is added one position at a time. The summation sign adds the terms for j=1,…,n. The row index i stays fixed while j runs across row i.
In plain words To get one output entry, run along that row of the matrix and down the input at the same time, multiply matching entries and add.
Example Let
M=[32−14],x=[2−3].
Row by row, 3⋅2+(−1)(−3)=6+3=9 and 2⋅2+4⋅(−3)=4−12=−8, so Mx=(9,−8). The columns confirm it, since 2(3,2)−3(−1,4)=(6,4)+(3,−12)=(9,−8). A first entry of 3 would mean the product (−1)(−3) was taken as −3, and comparing with the column calculation exposes that slip.
Matrix addition
Definition Let A=[aij] and B=[bij] be matrices of the same size m×n. Their sum A+B is the m×n matrix with entries
(A+B)ij=aij+bij.
Matrices of different sizes cannot be added. For every x in Rn the sum satisfies (A+B)x=Ax+Bx, because in each row the entry aij+bij multiplies xj, and the products split and regroup into the row calculations for Ax and Bx.
In plain words Add matching entries. Running both matrices on the same input and adding the outputs gives the same answer as running their sum.
Example For
A=[10−23],B=[4−112],
the sum is
A+B=[5−1−15].
With x=(1,2) the separate outputs are Ax=(−3,6) and Bx=(6,3), which add to (3,9), and directly (A+B)x=(5−2,−1+10)=(3,9). The 3×2 matrix G cannot be added to A, because G has a third row with nothing to match.
Scalar multiple of a matrix
Definition For a scalar c and an m×n matrix A=[aij], the scalar multiple cA is the m×n matrix with entries
(cA)ij=caij.
The matrix (−1)A is written −A, and for matrices of the same size A−B means A+(−1)B. For every x in Rn the scalar multiple satisfies (cA)x=c(Ax).
In plain words Multiply every entry by the same number. Every output is then multiplied by that number too.
Example With A, B and x=(1,2) as above,
3A=[30−69],A−B=[−31−31].
Then (3A)x=(3−12,0+18)=(−9,18), which is 3(−3,6)=3(Ax). Likewise (A−B)x=(−3−6,1+2)=(−9,3), which equals Ax−Bx=(−3,6)−(6,3).
Transpose
Definition The transpose of an m×n matrix A=[aij] is the n×m matrix A⊤ with entries
(A⊤)ij=aji
for i=1,…,n and j=1,…,m. Row i of A becomes column i of A⊤, so the entry in row i and column j of A moves to row j and column i without changing its value. Transposing twice returns the original matrix, (A⊤)⊤=A. The superscript ⊤ names an operation, not a power. The transpose only rearranges entries, and in general it does not undo multiplication by A.
In plain words Turn each row into a column. The two numbers in the size swap places, and in a square matrix the entries on the diagonal from the top left stay where they are.
Example For the gift shop matrix,
G=210312,G⊤=[231102],
so the 3×2 matrix has a 2×3 transpose. For the square matrix M from above,
M=[32−14],M⊤=[3−124],
and only the two entries off the diagonal trade places. Since G⊤ accepts vectors in R3, it can be applied to an output of G, but it does not undo G. With x=(1,0) we get Gx=(2,1,0), and then G⊤(Gx)=(5,7), not x.
Check yourself
Let
K=[13−210−1].
Give the size of K, the entry k23, and the transpose K⊤ with its size.
Show the answer
The matrix K has 2 rows and 3 columns, so its size is 2×3. The entry in row 2 and column 3 is k23=−1. Turning rows into columns gives
K⊤=1−2031−1,
which is 3×2.
With K as above and z=(2,1,4), compute Kz row by row, then check the result with the columns.
Show the answer
The product is defined, since K has three columns and z has three entries. By rows, 1⋅2+(−2)⋅1+0⋅4=0 and 3⋅2+1⋅1+(−1)⋅4=3, so Kz=(0,3). By columns,
Let y=(1,2). Which of Ky, K+K⊤ and K⊤y are defined? Compute those that are.
Show the answer
The product Ky is not defined. The matrix K has three columns, so it needs an input with three entries, and y has two. The sum K+K⊤ is not defined either, because K is 2×3 and K⊤ is 3×2, and only matrices of the same size can be added. The product K⊤y is defined, since K⊤ has two columns, and its output has three entries,
May we count page visits to understand which courses and learning features are useful? Cloudflare collects visit and performance statistics, without your account details or answers. Your choice does not affect access. Details