Lecture 32 · Week 8· 22:29

The matrix of a linear map

Representation in bases, change of basis, similar matrices.

Play: Lecture 32: The matrix of a linear map
Lecture · 22:29 · Open on YouTube · Report a problem with this video
TranscriptThe full text of the lecture. Click any sentence to play the video from there.

Today: a matrix for every linear map

Welcome back. In lecture thirteen we saw that every linear map from F n to F m is multiplication by a matrix, its standard matrix. The columns of that matrix are the images of the standard basis vectors. In lecture twenty nine we met linear maps between any two vector spaces, for example spaces of polynomials. A polynomial is not a column of numbers, so a linear map T from V to W has no matrix yet. But a basis turns vectors into columns. In lecture twenty five, a basis B of V gave each vector v its coordinate vector, a column in F n. A basis C of W does the same for W, with columns in F m.

So the plan is this. With a basis of V and a basis of W, the map T becomes a matrix. We build this matrix, compute it in examples, and see that composition, kernels and images all carry over to matrices. Then we change the bases, and this leads to similar matrices.

The matrix of a linear map

Let V and W be vector spaces over a field F. Let B, the list b one up to b n, be a basis of V, and let C, the list c one up to c m, be a basis of W. And let T from V to W be a linear map. The next steps are the heart of today's lecture, so take them slowly, and pause if you need to. Take a vector v in V, and let its coordinates relative to B be x one up to x n. So v is x one b one, plus and so on, up to x n b n. Since T is linear, it keeps combinations, by lecture twenty nine. So T of v is x one times T of b one, plus and so on, up to x n times T of b n.

Now take coordinates relative to C. The coordinate map keeps combinations too, by lecture twenty five. So the coordinate vector of T of v is x one times the coordinate vector of T of b one, plus and so on, up to x n times the coordinate vector of T of b n. This is a combination of n columns, with the weights x one up to x n. By lecture twelve, it is the matrix with these columns, times the column x. So put the coordinate vector of T of b j, relative to C, into column j of an m by n matrix A. Then the coordinates of T of v relative to C are A times the coordinates of v relative to B.

Here is the theorem. Let V and W be vector spaces over a field F, with a basis B of n vectors in V and a basis C of m vectors in W, and let T from V to W be linear. Then there is exactly one m by n matrix A such that, for every v in V, the coordinates of T of v relative to C are A times the coordinates of v relative to B. Its column j is the coordinate vector of T of b j relative to C. We have just shown that this matrix works. Why is it the only one? Suppose a matrix Q works too, and take v to be b j. Since b j is one times b j plus zero times the other basis vectors, its coordinates relative to B are e j. So Q times e j, which is column j of Q, equals the coordinates of T of b j relative to C. But that is also column j of A. So column j of Q has to be column j of A: Q has no other choice. This holds for every j, so Q and A have the same columns, and Q is A. This matrix is called the matrix of T relative to B and C. It is written T in square brackets, C from B. As with transition matrices, read it from right to left: coordinates relative to B go in on the right, and coordinates relative to C come out on the left.

When T maps V to itself, we usually take the same basis on both sides. Then we write T in square brackets with the single subscript B, and call it the matrix of T relative to B. A square diagram sums it up. Across the top, T sends v to T of v. Down the sides, we take coordinates. Going down and then across by the matrix gives the same column as going across and then down. To remember the columns: column j is the image of the j th basis vector of V, written in the basis C.

First examples

First, two matrices we already know. Let A be an m by n matrix, and let T A be the map that sends x to A x. In the standard bases, every vector is its own coordinate vector. So the matrix of T A relative to the standard bases has the columns A e one up to A e n, which are the columns of A. It is the standard matrix A itself. Second, the identity map of V, which sends every vector to itself. Its matrix from B to C has the columns b one up to b n, written in the basis C. That is exactly the transition matrix from B to C of lecture twenty eight. A change of basis is the matrix of the identity map. Now a map from lecture twenty nine. Let T from P two of R to R two send a polynomial p to the column of its values at zero and at one: p of zero, and p of one. In lecture twenty nine we checked that T is linear.

Take the basis B of P two: one, x, and x squared. In R two, take the standard basis E. To find the columns, we apply T to each polynomial of B. One has the value one at zero and at one, so T of one is (one, one). The polynomial x has the values zero and one, so T of x is (zero, one). And x squared also has the values zero and one, so T of x squared is (zero, one), too. In the standard basis, these columns are their own coordinate vectors. So they are the columns of the matrix of T, E from B: the first column is (one, one), and the second and third columns are both (zero, one).

Let's test it on the polynomial p of lecture twenty eight: two plus three x plus x squared. Its coordinate vector relative to B is (two, three, one). We multiply. In the first entry, one times two, plus zero times three, plus zero times one, is two. In the second entry, one times two, plus one times three, plus one times one, is six. So the matrix gives (two, six). And indeed, p of zero is two, and p of one is two plus three plus one, which is six. So from the coordinates of p, the matrix computes both values of p.

Composition and the space of maps

Matrices of maps combine the way the maps do. Let U, V and W be finite dimensional vector spaces over F, with bases B, C and D. Let T from U to V and S from V to W be linear. Then the matrix of S after T, D from B, is the matrix of S, D from C, times the matrix of T, C from B. Here is the proof. By lecture thirty one, S after T is linear, so it has a matrix. Take u in U. The matrix of T turns the coordinates of u relative to B into the coordinates of T of u relative to C. Then the matrix of S turns these into the coordinates of S of T of u relative to D.

Matrix products are associative, so this is the product of the two matrices, times the coordinates of u. So the product does the job of the matrix of S after T, and by uniqueness in the theorem, it is that matrix. This is why matrix multiplication is defined the way it is: multiplying matrices composes the maps they describe. In lecture fourteen we saw this for maps between spaces F n. Now it holds in every finite dimensional space. And as for transition matrices, the labels in the middle match: C next to C. Sums and scalar multiples carry over too. For linear maps S and T from V to W, and a scalar c, the matrix of S plus T is the matrix of S plus the matrix of T, and the matrix of c T is c times the matrix of T.

The proof uses uniqueness once more. By lecture thirty one, S plus T and c T are linear. The coordinate vector of S of v plus T of v is the sum of the two coordinate vectors, which is the sum of the two matrices, times the coordinates of v. So that sum does the job of the matrix of S plus T. In the same way, c times the matrix of T does the job of the matrix of c T. So taking matrices is a linear map, from Hom of V and W, the space of linear maps, to the m by n matrices. Is it one to one and onto? Column j of the matrix records T of b j, written in the basis C. Since the coordinate map of C is one to one and onto, the matrix fixes the values T of b one up to T of b n, and any matrix gives such a list of values. By lecture twenty nine, a linear map is fixed by its values on a basis, and these values can be chosen freely. So different maps have different matrices, and every m by n matrix is the matrix of exactly one linear map. Taking matrices is an isomorphism.

Isomorphic spaces have the same dimension, so the dimension of Hom of V and W is m times n. For example, the linear maps from P two to R two form a space of dimension two times three, which is six.

Kernel and image in coordinates

The matrix also carries the kernel and the image of T. Let A be the matrix of T, C from B. A vector v of V is in the kernel of T exactly when its coordinate vector is in the null space of A. Here is why. The vector T of v is zero exactly when its coordinate vector is zero, because the coordinate map is one to one, and the zero vector has the zero column. And the coordinate vector of T of v is A times the coordinates of v. So T of v is zero exactly when A times the coordinates of v is zero. And a vector w of W is in the image of T exactly when its coordinate vector is in the column space of A.

If w is T of v, then its coordinate vector is A times the coordinates of v, which lies in the column space. Conversely, suppose the coordinate vector of w is A times some column x. The coordinate map of B is onto, so x is the coordinate vector of some v. Then T of v and w have the same coordinate vector, so they are equal. So the coordinate map of B matches the kernel of T with the null space of A, one to one and onto, and the coordinate map of C matches the image of T with the column space of A. Spaces matched in this way are isomorphic, so they have the same dimension. So the nullity of T is the dimension of the null space of A, and the rank of T is the rank of A. Back to the map that sends p to its values at zero and at one. In lecture twenty nine we found its kernel and its image directly. Now the matrix does the work. Its two rows are independent, since neither is a multiple of the other, so its rank is two. So the image of T is a subspace of R two of dimension two, which by lecture twenty three is all of R two: T is onto.

The null space comes from two equations. The first row says x one is zero. The second row says x one plus x two plus x three is zero, so x two is minus x three. So the null space is spanned by the vector (zero, minus one, one). This column is the coordinate vector of x squared minus x. So the kernel of T is spanned by x squared minus x, as we found in lecture twenty nine. Its dimension is one, and three equals two plus one, as rank nullity says.

Changing the bases

A linear map has many matrices, one for each choice of bases. How are they related? Let B and B prime be two bases of V, and let C and C prime be two bases of W. Then the matrix of T, C prime from B prime, is the transition matrix from C to C prime, times the matrix of T, C from B, times the transition matrix from B prime to B. Here is the proof. Start with the coordinates of v relative to B prime. The transition matrix on the right turns them into coordinates relative to B. The matrix of T, C from B, gives the coordinates of T of v relative to C. And the transition matrix on the left turns them into coordinates relative to C prime.

By associativity, the product of the three matrices does the job of the matrix of T, C prime from B prime. By uniqueness, it is that matrix. Read from right to left, the labels match at every step. Let's try it on the map that takes values at zero and at one. Keep the standard basis E of R two, and in P two take the new basis B prime: one, x minus one, and x minus one squared, from lecture twenty eight. Only the basis of V changes, so the new matrix is the old matrix, times the transition matrix from B prime to B. Its columns are the new basis polynomials, written in the basis one, x, x squared: the first column is (one, zero, zero), the second is (minus one, one, zero), and the third is (one, minus two, one).

We multiply. The first row of the old matrix is one, zero, zero, so it picks the first row of the transition matrix. The second row is one, one, one, so it adds up each column: one, then minus one plus one, which is zero, then one minus two plus one, which is zero. So the new matrix has the rows (one, minus one, one), and (one, zero, zero). Check the second column: x minus one has the value minus one at zero, and zero at one. The map is the same, but in the new basis it has a new matrix. Its second row says that p of one is the first coordinate of p, as we saw in lecture twenty eight. The most important case is a linear map from V to itself, with the same basis on both sides. Let B and B prime be bases of V, and let P be the transition matrix from B prime to B.

By the theorem, with B and B prime on both sides, the matrix of T relative to B prime is the transition matrix from B to B prime, times the matrix relative to B, times P. And the transition matrix from B to B prime is P inverse, by lecture twenty eight. So the matrix of T relative to B prime is P inverse, times the matrix of T relative to B, times P.

An example in the plane

Let T be the map of the plane that sends x to A x, where A has the rows (zero, two), and (one, one). Relative to the standard basis, its matrix is A. From A alone, it is hard to see what T does. Now take the basis B of lecture twenty eight: b one is (one, one), and b two is (minus two, one). First, T of b one. In the first entry, zero times one, plus two times one, is two. In the second entry, one times one, plus one times one, is two. So T of b one is (two, two), which is two times b one.

Next, T of b two. In the first entry, zero times minus two, plus two times one, is two. In the second entry, one times minus two, plus one times one, is minus one. So T of b two is (two, minus one), which is minus b two. So T of b one is two b one plus zero b two, and T of b two is zero b one minus b two. So the matrix of T relative to B has the first column (two, zero), and the second column (zero, minus one). It is diagonal. In this basis, we can see what T does. It stretches the direction of b one by the factor two, and it flips the direction of b two.

The change of basis formula gives the same matrix. Here the old basis is the standard basis and the new basis is B. So P is the transition matrix from B to the standard basis, whose columns are b one and b two. By the formula for two by two inverses, P inverse is one third times the matrix with rows (one, two), and (minus one, one). The product A P has the columns A b one and A b two, which we found: (two, two), and (two, minus one). Now multiply by P inverse, one entry at a time, with the factor one third. The first row times the first column: one times two, plus two times two, is six. The second row times the first column: minus two plus two is zero. The first row times the second column: two minus two is zero. The second row times the second column: minus two minus one is minus three.

One third of these entries gives the first column (two, zero), and the second column (zero, minus one). It is the diagonal matrix again.

Try it yourself

You can try this yourself, on this lecture's page at opensemester.com. The blue arrows are b one and b two, and the dashed green arrows are their images under T. Below the picture is the matrix of T relative to this basis. It starts with the standard basis, so the matrix is A itself. The image of b one does not lie on the line of b one. Now drag b one to (one, one). Its image lands on its own line, at twice its length, and the first column becomes (two, zero).

Then drag b two to (minus two, one). Its image is minus b two, and the matrix is diagonal, as we found. Try other bases and other maps: the map stays the same, only its matrix changes, and the trace never does.

Similar matrices

This relation between two matrices has a name. Let A and B be n by n matrices over F. We say that B is similar to A if there is an invertible n by n matrix P such that B equals P inverse A P. So in our example, the diagonal matrix with entries two and minus one is similar to A. Similarity behaves like equality. Every matrix is similar to itself, with P the identity. If B is P inverse A P, then A is P B P inverse, so A is similar to B, with P inverse in place of P. And if M is Q inverse B Q, then M is Q inverse P inverse A P Q, which is the inverse of P Q, times A, times P Q. So M is similar to A. So we can simply say that A and B are similar.

The theorem says what similarity means. Two n by n matrices are similar exactly when they are the matrices of one linear map from an n dimensional space to itself, relative to two bases. One direction is the change of basis formula. If A and B are the matrices of T relative to bases C and D, then B is P inverse A P, where P is the transition matrix from D to C, which is invertible. For the other direction, suppose B equals P inverse A P. Take the map T A on F n, whose matrix relative to the standard basis is A. The matrix P is invertible, so by the invertible matrix theorem, its columns form a basis of F n. Call this basis D. The transition matrix from D to the standard basis has the vectors of D as its columns, so it is P. By the formula, the matrix of T A relative to D is P inverse A P, which is B.

Similar matrices share everything that belongs to the map, and not to the basis. They have the same rank, because both ranks equal the rank of the map. And they have the same trace: by lecture fifteen, the trace of a product does not change when we swap the two factors. So the trace of P inverse times A P is the trace of A P times P inverse, which is the trace of A. In our example, the trace of A is zero plus one, which is one, and the trace of the diagonal matrix is two plus minus one, which is one too. But the same rank and trace are not enough. The identity matrix, and the matrix with rows (one, one), and (zero, one), both have rank two and trace two. Yet P inverse times the identity times P is always the identity, so the identity is similar only to itself.

Later in the course we meet more quantities that similar matrices share: the determinant from lecture thirty three, and the eigenvalues from lecture thirty seven. In lecture thirty nine we ask which linear maps have a diagonal matrix in some basis, as our map of the plane did.

Summary

Let's summarise. Choose a basis B of V and a basis C of W. The matrix of a linear map T, C from B, turns the coordinates of v into the coordinates of T of v. Its column j is T of b j, written in the basis C. Composition becomes multiplication, sums become sums, and the space of maps from V to W is isomorphic to the m by n matrices. The kernel and the image become the null space and the column space, so the rank of T is the rank of its matrix. Changing the bases multiplies the matrix by transition matrices on both sides. For a map from V to itself, the new matrix is P inverse times the old one times P: the two matrices are similar.

Before the next lecture, read section six point four of the course book, try the problems on sheet eight about the matrix of a linear map, and do the lecture check on this lecture's page at Open Semester dot com. Next time, we begin week nine with determinants. See you there.

In this lecture

  1. 0:00Today: a matrix for every linear map
  2. 1:03The matrix of a linear map
  3. 4:27First examples
  4. 6:50Composition and the space of maps
  5. 9:42Kernel and image in coordinates
  6. 12:03Changing the bases
  7. 14:58An example in the plane
  8. 17:30Try it yourself
  9. 18:16Similar matrices
  10. 21:13Summary

Materials

Try it

One map, a matrix for every basis

A =

Drag the tips of b₁ and b₂, or pick a basis. The dashed arrows are T(b₁) and T(b₂). Column j of [T]ℬ holds the coordinates of T(bⱼ) in the basis b₁, b₂. The map stays the same and only its matrix changes. When both images lie on the lines of their own basis vectors, the matrix is diagonal.

Check yourself

3 questions, from warm-up to stretch

Work each one out on paper, type your answer and press Check. Stuck? Open a hint; the worked solution is there when you need it.

  1. Question 1 of 3 Warm-up

    Let , , with the basis of and the standard basis of , and let . How many rows and columns does have? Find its entry in row , column . Then use to find the second entry of for .

    Hint 1 of 2

    Column of is (Definition 6.4.2): one column for each vector of , and one row for each entry of a vector in . So the columns are , and .

    Hint 2 of 2

    . For , multiply by , as in Example 6.4.4.

    Worked solution
    1. , and . These are the columns (Definition 6.4.2): , a matrix with in row , column .
    2. , and . So the second entry is .
    3. Check directly (Theorem 6.4.1): and .
  2. Question 2 of 3 Core

    Let , , and take the bases and . Find .

    Hint 1 of 2

    Column is (Definition 6.4.2): apply to each vector of , then write the result in the basis .

    Hint 2 of 2

    and . A combination of is .

    Worked solution
    1. and .
    2. In : . For : and , so , and . For : and , so .
    3. These are the columns: .
    4. Check with Theorem 6.4.9: , where and . Then , and .
  3. Question 3 of 3 Stretch

    Let on with , and take the basis with and . Find . Is similar to ?

    is similar to :
    Hint 1 of 2

    Compute and and write each in the basis : these are the columns of . Or use Corollary 6.4.10 with , whose columns are the new basis vectors.

    Hint 2 of 2

    Similar matrices have the same rank and the same trace (Proposition 6.4.15). Compare both.

    Worked solution
    1. and .
    2. So : stretches the direction of by the factor and the direction of by the factor .
    3. Check with Corollary 6.4.10: has , so (Theorem 3.5.6). Then and .
    4. Similarity: , the same as the trace of (and of ). But , since its columns and are not multiples of each other, while the other matrix has rank . By Proposition 6.4.15, they are not similar.

Found a mistake, or something not working on this page? Report it and we'll fix it. See what we've corrected.