Back to the on-screen lesson ·

Matrices: a first look

Shape and entries, sums and scalar multiples, the transpose, the named shapes, the trace, and a matrix times a vector read as a combination of the columns.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to state the shape of a matrix and name any entry of it row first, add matrices and scale them entry by entry while refusing the combinations whose shapes do not agree, transpose a rectangular matrix and predict the shape of the result, recognise a symmetric, triangular, diagonal or identity matrix and say which of those descriptions imply which, compute a trace and use its linearity as a check, and read a matrix times a vector as a combination of the columns of the matrix.

2. What the last unit left you with

Elimination turned a system into an array of numbers and operated on its rows. That array was a bookkeeping device: a convenient place to keep the coefficients while the real work happened. This lesson promotes it. A matrix is an object in its own right, with an arithmetic of its own, and the array you have been reducing is one example of it.

3. The words for the parts

An $m \times n$ matrix has $m$ rows and $n$ columns — rows first, always. Its entry $a_{ij}$ sits in row $i$ and column $j$, again rows first. The main diagonal is the entries $a_{11}, a_{22}, \dots$ running from the top left; the trace is their sum, written $\operatorname{tr}(A)$. The transpose $A^{T}$ has $(A^{T})_{ij} = a_{ji}$. A square matrix has $m = n$; a column vector is $n \times 1$. The zero matrix is all zeros and the identity $I_n$ has ones down the main diagonal and zeros elsewhere.

4. An array with an arithmetic

Two matrices of the same shape are added entry by entry, and a matrix is multiplied by a number entry by entry. That is all there is to those two operations, and both inherit everything you expect from ordinary arithmetic: addition is commutative and associative, the zero matrix behaves like zero, and $p(A + B) = pA + pB$.

The shape condition is not a technicality. $A + B$ is undefined when the shapes differ — not zero, not something clever, undefined — and a great deal of later care about shapes starts here.

The transpose flips the array about its main diagonal, so an $m \times n$ matrix becomes $n \times m$. It satisfies $(A^{T})^{T} = A$, $(A + B)^{T} = A^{T} + B^{T}$ and $(pA)^{T} = pA^{T}$; the one rule that surprises people involves products and waits for the next lesson.

Four shapes get names, because the whole course keeps pointing at them. $A$ is symmetric when $A^{T} = A$, that is when $a_{ij} = a_{ji}$ for every pair. It is upper triangular when every entry below the diagonal is zero and lower triangular when every entry above it is zero. It is diagonal when both hold at once, and the identity is the diagonal matrix whose diagonal entries are all $1$.

Finally, the product of a matrix and a column vector. $Ax$ is defined when $A$ is $m \times n$ and $x$ is $n \times 1$, and the answer is $m \times 1$. The definition to carry with you is not the row-by-row one but this: $Ax$ is a combination of the columns of $A$, weighted by the entries of $x$.

Another way: picture

Lay the columns of $A$ out as arrows. Then $Ax$ says: take $x_1$ of the first arrow, $x_2$ of the second, and so on, and add them nose to tail. The set of everything $Ax$ can be, as $x$ ranges over all of its possibilities, is therefore the set of all combinations of the columns — which is the reason the question is $Ax = b$ solvable? will turn out to mean is $b$ a combination of the columns of $A$? and nothing else.

Another way: steps

  1. Write the shape of every matrix down before doing anything with it.
  2. For a sum or a scalar multiple, work entry by entry; nothing moves.
  3. For a transpose, send row $i$ to column $i$; check the shape has turned over.
  4. For $Ax$, weight the columns of $A$ by the entries of $x$ and add.
  5. Check the shape of the answer against what the question asked for.

5. Why the trace is worth a name

Adding up three of the nine entries of a matrix and ignoring the rest looks arbitrary. It is not, and the reason is worth stating now even though the proof is several lessons away.

The trace is linear: $\operatorname{tr}(A + B) = \operatorname{tr}(A) + \operatorname{tr}(B)$ and $\operatorname{tr}(pA) = p\operatorname{tr}(A)$, both immediately from the definition. It is unchanged by transposing, because the main diagonal is exactly the part of a matrix the transpose leaves where it is. And — the fact that matters — $\operatorname{tr}(AB) = \operatorname{tr}(BA)$ even though $AB$ and $BA$ are usually different matrices.

That last identity is what makes the trace a property of the map a matrix represents rather than of the particular array, and by the eigenvalue unit it will be the sum of the eigenvalues. Two numbers attached to a square matrix survive a change of coordinates: the trace and the determinant. Everything else in the array can be rearranged out of recognition.

6. Symmetry, and where it comes from

Symmetric matrices are not a curiosity. They arrive whenever a matrix records a relation that has no direction:

Any square $A$ splits as $A = \tfrac{1}{2}(A + A^{T}) + \tfrac{1}{2}(A - A^{T})$, a symmetric part plus a part satisfying $S^{T} = -S$. The last unit of this course shows that symmetric matrices have real eigenvalues and orthogonal eigenvectors, which is as clean as this subject ever gets, and it is why so much applied work arranges to be about a symmetric matrix.

7. Row first, and shapes before anything

$a_{ij}$ is row $i$, column $j$. Reading it the other way round does not give an error message; it gives the entry of the transpose, silently, and everything built on it is wrong in a way nothing will report.

A sum of differently shaped matrices is undefined, not zero-padded. There is no convention that quietly extends the smaller one. If the shapes do not agree the expression has no meaning, and an expression with no meaning is the right thing to notice.

Diagonal is not a fourth shape alongside symmetric and triangular. It is both of them at once. Every diagonal matrix is symmetric, upper triangular and lower triangular; the words are nested, not parallel.

The trace is the main diagonal, not the other one. The anti-diagonal, running from bottom left to top right, has no comparable properties: it is not preserved by transposing, and it has no relation to eigenvalues.

$Ax$ is not "multiply the matrix by the number in $x$". It is a combination of columns, and the answer is a vector whose height is the number of rows of $A$ — not necessarily the height of $x$.

8. A combination, an entry at a time

  1. $A = \begin{pmatrix} 1 & 3 \\ 2 & 0 \end{pmatrix}$, $B = \begin{pmatrix} 4 & 1 \\ 5 & 2 \end{pmatrix}$. Same shape, so $2A - B$ is defined.

    Check the shapes first, every time.

  2. Scale: $2A = \begin{pmatrix} 2 & 6 \\ 4 & 0 \end{pmatrix}$. Then subtract $B$ place by place.

    Nothing moves; each entry minds its own business.

  3. $2A - B = \begin{pmatrix} -2 & 5 \\ -1 & -2 \end{pmatrix}$. Its trace is $-2 + (-2) = -4$, which is $2\operatorname{tr}(A) - \operatorname{tr}(B) = 2 - 6 = -4$ as linearity promised.

    A free check, and a demonstration of why linearity is useful.

9. Reading a product as a combination of columns

  1. $A = \begin{pmatrix} 1 & 4 \\ 2 & 5 \\ 3 & 6 \end{pmatrix}$ and $x = \begin{pmatrix} 2 \\ -1 \end{pmatrix}$. Shapes $3 \times 2$ and $2 \times 1$ fit, and the answer will be $3 \times 1$.

    The inner numbers agree; the outer ones give the shape.

  2. Two of the first column, minus one of the second: $2\begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix} - \begin{pmatrix} 4 \\ 5 \\ 6 \end{pmatrix}$.

    Weight the columns, do not hunt for rows.

  3. $= \begin{pmatrix} -2 \\ -1 \\ 0 \end{pmatrix}$. The row-by-row rule gives the same three numbers; the column reading is the one that generalises.

    Two routes, one answer — and one of them explains the next four units.

10. Your turn: is $A + A^{T}$ symmetric, for every square $A$?

  1. Transpose it: $(A + A^{T})^{T} = A^{T} + (A^{T})^{T}$, using the rule for the transpose of a sum.

    Transposing distributes over addition.

  2. $(A^{T})^{T}$ is $A$ again, so the result is $A^{T} + A$.

    Flipping twice restores the original.

  3. Your turn: work this step out. Its working is at the end of the packet.

    That is the same matrix as $A + A^{T}$, because addition is commutative — so yes, always, whatever $A$ is.

11. Guided practice

With $A = \begin{pmatrix} 6 & 5 \\ 4 & 2 \end{pmatrix}$ and $B = \begin{pmatrix} 5 & 4 \\ 5 & 3 \end{pmatrix}$, write $4A + 3B$.

This task has no paper form; do it on a device.

12. Guided practice

Write $A^{T}$ for $A = \begin{pmatrix} 3 & 2 & 2 \\ 9 & 8 & 2 \end{pmatrix}$.

This task has no paper form; do it on a device.

13. Practice

Find the trace of $\begin{pmatrix} 4 & 3 & 4 \\ 7 & 7 & 3 \\ 6 & 2 & 3 \end{pmatrix}$.

Answer:

14. Practice

Each of these matrices is described exactly by one of the three words. Match them up.

Symmetric, but not triangularUpper triangular, but not symmetricDiagonal
$\begin{pmatrix} 8 & 3 \\ 3 & 3 \end{pmatrix}$
$\begin{pmatrix} 8 & 3 \\ 0 & 3 \end{pmatrix}$
$\begin{pmatrix} 8 & 0 \\ 0 & 3 \end{pmatrix}$

15. Practice

A $2 \times 3$ matrix $M$ is defined by $m_{ij} = 2i + 3j$, where $i$ is the row number and $j$ the column number. Fill in its entries.

Column 1Column 2Column 3
Row 1
Row 2

16. Somewhere new

A workshop builds $8$ desks and $4$ shelves. One desk takes $4$ planks, $5$ screws and $4$ hinges; one shelf takes $2$ planks, $3$ screws and $1$ hinges. Write the column of total planks, screws and hinges needed.

This task has no paper form; do it on a device.

17. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

18. Test question

With $A = \begin{pmatrix} 2 & 4 \\ 5 & 6 \end{pmatrix}$ and $B = \begin{pmatrix} 3 & 3 \\ 5 & 6 \end{pmatrix}$, write $4A + 4B$.

This task has no paper form; do it on a device.

19. What you can do now

You can compute sums, scalar multiples, transposes and traces, name the shapes, and read $Ax$ as a weighted combination of the columns. Say in your own words why every diagonal matrix is also symmetric. Next: the one product whose definition is not entry by entry, and the reason it is not.

Working for the steps left to you

10. Your turn: is $A + A^{T}$ symmetric, for every square $A$?, step 3

A proof about every matrix, from two rules and no arithmetic.