Unit 4, lesson 20

Matrices in Different Bases

How to find the matrix of a linear map in chosen input and output bases, why one linear operator in two bases gives similar matrices, and how a commutative diagram keeps the map separate from its matrix.

  • Video 20
  • Change of Basis

The map that doubles the first coordinate of every vector in the plane has the diagonal matrix with entries 22 and 11 in standard coordinates. Described in the basis (1,0)(1, 0), (1,1)(1, 1), where each tuple stands for a column vector, the same map has a matrix with a 11 above the diagonal, which looks like a shear. Nothing about the map has changed, only the coordinates used to write its inputs and outputs. This lesson shows how to compute the matrix of a linear map in any chosen input and output bases, why one operator described in two bases gives similar matrices, and how to tell which features belong to the map and which belong to its description.

Key terms

Matrix of a linear map in chosen bases

Definition Let T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m be linear, let B=(b1,…,bn)\mathcal{B} = (\mathbf{b}_1, \dots, \mathbf{b}_n) be an ordered basis of Rn\mathbb{R}^n, and let C\mathcal{C} be an ordered basis of Rm\mathbb{R}^m. The matrix of TT relative to B\mathcal{B} and C\mathcal{C} is the m×nm \times n matrix

[T]C←B=[[T(b1)]C⋯[T(bn)]C],\begin{aligned} &[T]_{\mathcal{C} \leftarrow \mathcal{B}} \\[0.4em] &= \begin{bmatrix} [T(\mathbf{b}_1)]_{\mathcal{C}} & \cdots & [T(\mathbf{b}_n)]_{\mathcal{C}} \end{bmatrix}, \end{aligned}

whose jjth column describes the image of the jjth input basis vector in the output basis. It is the only matrix with

[T(x)]C=[T]C←B [x]B[T(\mathbf{x})]_{\mathcal{C}} = [T]_{\mathcal{C} \leftarrow \mathcal{B}}\,[\mathbf{x}]_{\mathcal{B}}

for every x\mathbf{x} in Rn\mathbb{R}^n. This works because TT sends c1b1+⋯+cnbnc_1\mathbf{b}_1 + \cdots + c_n\mathbf{b}_n to c1T(b1)+⋯+cnT(bn)c_1T(\mathbf{b}_1) + \cdots + c_nT(\mathbf{b}_n), and taking C\mathcal{C}-coordinates respects sums and scalar multiples. When both bases are the standard ones, it is the standard matrix of TT.

In plain words Map each input basis vector, then measure the result with the output basis. Those measurements, written as columns, make up the matrix.

Example Let T(x,y,z)=(x+z,y+z)T(x, y, z) = (x + z, y + z), with input basis B=((1,0,0),(0,1,0),(1,0,1))\mathcal{B} = ((1, 0, 0), (0, 1, 0), (1, 0, 1)) and output basis C=(c1,c2)\mathcal{C} = (\mathbf{c}_1, \mathbf{c}_2), where c1=(1,0)\mathbf{c}_1 = (1, 0) and c2=(1,1)\mathbf{c}_2 = (1, 1). The input basis vectors map to (1,0)(1, 0), (0,1)(0, 1) and (2,1)(2, 1). In the output basis these are c1\mathbf{c}_1, then −c1+c2-\mathbf{c}_1 + \mathbf{c}_2, then c1+c2\mathbf{c}_1 + \mathbf{c}_2, so

[T]C←B=[1−11011].[T]_{\mathcal{C} \leftarrow \mathcal{B}} = \begin{bmatrix} 1 & -1 & 1 \\ 0 & 1 & 1 \end{bmatrix}.

It is still a 2×32 \times 3 matrix, with three input slots and two output slots.

Input and output bases

Definition For a linear map T ⁣:Rn→RmT \colon \mathbb{R}^n \to \mathbb{R}^m with standard matrix AA, the input basis B\mathcal{B} is an ordered basis of the domain Rn\mathbb{R}^n, with an invertible n×nn \times n basis matrix BB, and the output basis C\mathcal{C} is an ordered basis of the codomain Rm\mathbb{R}^m, with an invertible m×mm \times m basis matrix CC. The two choices are independent of each other. For an input with B\mathcal{B}-coordinates c\mathbf{c}, the vector itself is BcB\mathbf{c}, its image is ABcAB\mathbf{c}, and the C\mathcal{C}-coordinates of that image are C−1ABcC^{-1}AB\mathbf{c}. Hence

[T]C←B=C−1AB.[T]_{\mathcal{C} \leftarrow \mathcal{B}} = C^{-1}AB.

The sizes match, since C−1C^{-1} is m×mm \times m, AA is m×nm \times n and BB is n×nn \times n, so the product is m×nm \times n like AA. For the identity map of Rn\mathbb{R}^n the formula gives C−1B=PC←BC^{-1}B = P_{\mathcal{C} \leftarrow \mathcal{B}}, the change-of-basis matrix.

In plain words The input basis decides how inputs are written, and the output basis decides how outputs are measured. Read C−1ABC^{-1}AB from right to left as build, apply, describe.

Example For the map and bases of the previous card,

AB=[101011][101010001]=[102011],\begin{aligned} AB &= \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \end{bmatrix}\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 1 \end{bmatrix}, \end{aligned}

whose columns are the images of the input basis vectors. Then

C−1AB=[1−101][102011]=[1−11011],\begin{aligned} C^{-1}AB &= \begin{bmatrix} 1 & -1 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 1 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} 1 & -1 & 1 \\ 0 & 1 & 1 \end{bmatrix}, \end{aligned}

the same matrix as before. As a test, the input with B\mathcal{B}-coordinates (1,2,1)(1, 2, 1) is the vector (2,2,1)(2, 2, 1), its image is (3,3)(3, 3), and (3,3)=0c1+3c2(3, 3) = 0\mathbf{c}_1 + 3\mathbf{c}_2. The matrix gives the same list directly, (1−2+1,2+1)=(0,3)(1 - 2 + 1, 2 + 1) = (0, 3).

Linear operator

Definition A linear operator is a linear map from a vector space to itself, such as T ⁣:Rn→RnT \colon \mathbb{R}^n \to \mathbb{R}^n. For an operator one normally uses the same ordered basis B\mathcal{B} for inputs and outputs and writes [T]B[T]_{\mathcal{B}} for [T]B←B[T]_{\mathcal{B} \leftarrow \mathcal{B}}. With C=BC = B the formula becomes

[T]B=B−1AB,[T]_{\mathcal{B}} = B^{-1}AB,

an n×nn \times n matrix whose jjth column is [T(bj)]B[T(\mathbf{b}_j)]_{\mathcal{B}}.

In plain words An operator moves vectors around inside one space, so one grid describes both where a vector starts and where it lands.

Example Let T(x,y)=(2x,y)T(x, y) = (2x, y) and B=((1,0),(1,1))\mathcal{B} = ((1, 0), (1, 1)), so

A=[2001],B=[1101].A = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}, \qquad B = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}.

Then

[T]B=B−1AB=[1−101][2201]=[2101].\begin{aligned} [T]_{\mathcal{B}} = B^{-1}AB &= \begin{bmatrix} 1 & -1 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 2 & 2 \\ 0 & 1 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} 2 & 1 \\ 0 & 1 \end{bmatrix}. \end{aligned}

The columns can be read off directly. The vector T(b1)=(2,0)=2b1T(\mathbf{b}_1) = (2, 0) = 2\mathbf{b}_1 gives the first column (2,0)(2, 0), and T(b2)=(2,1)=b1+b2T(\mathbf{b}_2) = (2, 1) = \mathbf{b}_1 + \mathbf{b}_2 gives the second column (1,1)(1, 1).

Similar matrices

Definition Two n×nn \times n matrices AA and A′A' are similar if there is an invertible n×nn \times n matrix PP with

A′=P−1AP.A' = P^{-1}AP.

The matrices of one linear operator in two ordered bases are always similar. If [T]B=B−1AB[T]_{\mathcal{B}} = B^{-1}AB and [T]D=D−1AD[T]_{\mathcal{D}} = D^{-1}AD, then [T]D=P−1[T]BP[T]_{\mathcal{D}} = P^{-1}[T]_{\mathcal{B}}P with P=B−1D=PB←DP = B^{-1}D = P_{\mathcal{B} \leftarrow \mathcal{D}}. Conversely, if AA is the standard matrix of TT and PP is any invertible n×nn \times n matrix, then P−1APP^{-1}AP is the matrix of TT in the ordered basis formed by the columns of PP. Similarity uses the same change of basis on the input side and the output side, so it is a relation for operators. Passing from AA to C−1ABC^{-1}AB, with two unrelated bases for input and output, is more general and should not be called similarity. Similar matrices have the same rank and nullity, and later they turn out to share the determinant and the eigenvalues as well.

In plain words Similar matrices are two descriptions of one operator, written in two different grids.

Example The matrices

[2001]and[2101]\begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} \quad \text{and} \quad \begin{bmatrix} 2 & 1 \\ 0 & 1 \end{bmatrix}

are similar, with P=BP = B from the previous card, since both describe the doubling map. On the other hand, the identity matrix is similar only to itself, because P−1IP=IP^{-1}IP = I for every invertible PP. So the matrix

[1101]\begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}

has the same rank as II, but it is not similar to II.

Commutative diagram

Definition For an operator TT on Rn\mathbb{R}^n with standard matrix AA and an ordered basis B\mathcal{B} with basis matrix BB, the four descriptions of an input and its output fit in a square,

[x]B→[T]B[T(x)]BB↓↑B−1x→AT(x)\begin{CD} [\mathbf{x}]_{\mathcal{B}} @>{[T]_{\mathcal{B}}}>> [T(\mathbf{x})]_{\mathcal{B}} \\ @V{B}VV @AA{B^{-1}}A \\ \mathbf{x} @>{A}>> T(\mathbf{x}) \end{CD}

The diagram commutes when the top route and the route down, across and up give the same result for every starting column. A matrix MM on the top edge makes it commute exactly when M=B−1ABM = B^{-1}AB, or equivalently BM=ABBM = AB, so the matrix [T]B[T]_{\mathcal{B}} is the one matrix that fits there. For a map between two spaces the same square works with C\mathcal{C}-coordinates in the top right corner, C−1C^{-1} on the right edge and [T]C←B=C−1AB[T]_{\mathcal{C} \leftarrow \mathcal{B}} = C^{-1}AB on the top edge. Checking one starting column is a useful test, but it proves agreement only for that column and its multiples. The matrix equation covers every input at once.

In plain words There are two ways to get from the coordinates of an input to the coordinates of its output. Use the new matrix directly, or rebuild the vector, apply the map in standard coordinates and translate back. A correct matrix makes both ways agree.

Example For the doubling map, start at [x]B=(1,2)[\mathbf{x}]_{\mathcal{B}} = (1, 2). The long route goes from (1,2)(1, 2) to B(1,2)=(3,2)B(1, 2) = (3, 2), then to A(3,2)=(6,2)A(3, 2) = (6, 2), then to B−1(6,2)=(4,2)B^{-1}(6, 2) = (4, 2). The top route gives directly

[2101][12]=[42].\begin{bmatrix} 2 & 1 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 1 \\ 2 \end{bmatrix} = \begin{bmatrix} 4 \\ 2 \end{bmatrix}.

Both routes end at (4,2)(4, 2), the B\mathcal{B}-coordinates of (6,2)(6, 2), since 4(1,0)+2(1,1)=(6,2)4(1, 0) + 2(1, 1) = (6, 2).

Operator versus its matrix

Definition A linear operator TT is a rule on vectors and does not depend on any choice of basis. A matrix such as [T]B[T]_{\mathcal{B}} is one description of TT, and it depends on the chosen basis. Changing the basis can change the entries, but it never changes the operator. In particular, the kernel and the image of TT are the same sets of vectors in every description, even though the coordinate lists that describe them depend on the basis. For a map between two spaces the same holds for C−1ABC^{-1}AB. A column c\mathbf{c} lies in the null space of C−1ABC^{-1}AB exactly when BcB\mathbf{c} lies in Null⁡A\operatorname{Null} A, and the column space of C−1ABC^{-1}AB is the set of all C−1yC^{-1}\mathbf{y} with y\mathbf{y} in Col⁡A\operatorname{Col} A. Invertible matrices preserve dimension, so C−1ABC^{-1}AB has the same rank and the same nullity as AA.

In plain words The operator is the action itself, and a matrix is one way of writing it down. A surprising entry in a matrix is a fact about the chosen grid, not a new action.

Example Let Q(x,y)=(x,0)Q(x, y) = (x, 0) project the plane onto the xx-axis, and keep B=((1,0),(1,1))\mathcal{B} = ((1, 0), (1, 1)). Both basis vectors land on (1,0)=b1(1, 0) = \mathbf{b}_1, so

[1000]becomes[Q]B=[1100].\begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} \quad \text{becomes} \quad [Q]_{\mathcal{B}} = \begin{bmatrix} 1 & 1 \\ 0 & 0 \end{bmatrix}.

The null space of [Q]B[Q]_{\mathcal{B}} consists of the columns t(1,−1)t(1, -1) with tt real, which rebuild to tb1−tb2=(0,−t)t\mathbf{b}_1 - t\mathbf{b}_2 = (0, -t). That is the yy-axis, exactly the kernel of the projection, and both matrices have rank 11. In the same way, the upper right entry 11 in the doubling example does not mean the doubling map shears anything. It only records that T(b2)=b1+b2T(\mathbf{b}_2) = \mathbf{b}_1 + \mathbf{b}_2.

Check yourself

  1. Let T(x,y)=(x+2y,3y)T(x, y) = (x + 2y, 3y) and B=((1,0),(1,1))\mathcal{B} = ((1, 0), (1, 1)). Find [T]B[T]_{\mathcal{B}}.
Show the answer

Map the basis vectors. The first goes to T(1,0)=(1,0)=b1T(1, 0) = (1, 0) = \mathbf{b}_1, and the second goes to T(1,1)=(3,3)=3b2T(1, 1) = (3, 3) = 3\mathbf{b}_2. So

[T]B=[1003].[T]_{\mathcal{B}} = \begin{bmatrix} 1 & 0 \\ 0 & 3 \end{bmatrix}.

The formula agrees, since

B−1AB=[1−101][1303]=[1003].\begin{aligned} B^{-1}AB &= \begin{bmatrix} 1 & -1 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 1 & 3 \\ 0 & 3 \end{bmatrix} \\[0.4em] &= \begin{bmatrix} 1 & 0 \\ 0 & 3 \end{bmatrix}. \end{aligned}

In this basis the operator fixes b1\mathbf{b}_1 and stretches b2\mathbf{b}_2 by 33.

  1. Let S(x,y)=(y,x)S(x, y) = (y, x) swap the coordinates. Find [S]B[S]_{\mathcal{B}} for the same basis B\mathcal{B}, and check both routes of the commutative diagram for [x]B=(2,−1)[\mathbf{x}]_{\mathcal{B}} = (2, -1).
Show the answer

The first basis vector goes to S(1,0)=(0,1)=−b1+b2S(1, 0) = (0, 1) = -\mathbf{b}_1 + \mathbf{b}_2, and the second goes to S(1,1)=(1,1)=b2S(1, 1) = (1, 1) = \mathbf{b}_2. So

[S]B=[−1011].[S]_{\mathcal{B}} = \begin{bmatrix} -1 & 0 \\ 1 & 1 \end{bmatrix}.

The long route rebuilds B(2,−1)=(1,−1)B(2, -1) = (1, -1), swaps it to (−1,1)(-1, 1), and describes the result as B−1(−1,1)=(−1−1,1)=(−2,1)B^{-1}(-1, 1) = (-1 - 1, 1) = (-2, 1). The top route gives (−2,2−1)=(−2,1)(-2, 2 - 1) = (-2, 1). The two routes agree.

  1. Use the input basis B=((1,0),(1,1))\mathcal{B} = ((1, 0), (1, 1)) and the output basis C=((1,1),(1,−1))\mathcal{C} = ((1, 1), (1, -1)) for the identity map of R2\mathbb{R}^2. Find its matrix MM. Does M≠IM \ne I mean the identity map moves vectors? Is MM similar to II?
Show the answer

The matrix is

M=C−1IB=C−1B=[121120],M = C^{-1}IB = C^{-1}B = \begin{bmatrix} \tfrac{1}{2} & 1 \\[0.2em] \tfrac{1}{2} & 0 \end{bmatrix},

which is the change-of-basis matrix PC←BP_{\mathcal{C} \leftarrow \mathcal{B}}. The map moves nothing. For example, MM sends [b1]B=(1,0)[\mathbf{b}_1]_{\mathcal{B}} = (1, 0) to (12,12)(\tfrac{1}{2}, \tfrac{1}{2}), and 12(1,1)+12(1,−1)=(1,0)=b1\tfrac{1}{2}(1, 1) + \tfrac{1}{2}(1, -1) = (1, 0) = \mathbf{b}_1, the same vector described in C\mathcal{C}. The entries differ from II only because inputs and outputs are measured in different bases. The matrix MM is not similar to II, because P−1IP=IP^{-1}IP = I for every invertible PP and M≠IM \ne I. With B\mathcal{B} used on both sides, the identity map has matrix B−1IB=IB^{-1}IB = I, as similarity requires.

How this lesson connects