MAT1041 · Week 12 · - Matrices for Linear Transformations

Transformation matrices, transition matrices and similarity

You learn to find the standard matrix of a linear transformation, the matrix of a composition and of an inverse transformation, the matrix of a transformation relative to nonstandard bases, the transition matrix between two bases with the [B' | B] method, and similar matrices (A' = P⁻¹AP).

standard matrixcompositioninverse transformationmatrix relative to basescoordinate matrixtransition matrixchange of basissimilar matricessimilarity transformation

Every linear transformation from Rn\mathbb{R}^n to Rm\mathbb{R}^m is multiplication by a matrix. But which matrix? The answer depends on the basis you choose. In the standard basis the matrix of a transformation may look complicated; in another basis the same transformation can be diagonal, that is, just “stretching the axes”. This week we learn to find the matrix, to convert coordinates between bases, and the similarity relation that links the matrices of the same transformation in different bases. Next week’s diagonalization is built directly on this.

Golden rules:

  1. The columns of the transformation matrix are the images of the basis vectors.
  2. In a composition the matrix on the right is applied first.
  3. Transition matrix B→B′B \to B': turn [B′∣B][B' \mid B] into [I∣P][I \mid P] with row operations. The target basis is on the left.
  4. A′=P−1APA' = P^{-1}AP, where the columns of PP are the vectors of the new basis.

The standard matrix

If T:Rn→RmT : \mathbb{R}^n \to \mathbb{R}^m is linear, then

A=[ T(e1)∣T(e2)∣⋯∣T(en) ]A = \big[\, T(\mathbf{e}_1) \mid T(\mathbf{e}_2) \mid \cdots \mid T(\mathbf{e}_n) \,\big]

is the m×nm \times n matrix that satisfies T(x)=AxT(\mathbf{x}) = A\mathbf{x} for every x\mathbf{x}. Why: x=x1e1+⋯+xnen\mathbf{x} = x_1\mathbf{e}_1 + \dots + x_n\mathbf{e}_n, linearity gives T(x)=x1T(e1)+⋯+xnT(en)T(\mathbf{x}) = x_1T(\mathbf{e}_1) + \dots + x_nT(\mathbf{e}_n); and this is the column-combination interpretation of AxA\mathbf{x}.

Example 1. T(x,y,z)=(x−2y, 2x+z)T(x, y, z) = (x - 2y,\ 2x + z).

T(e1)=(1,2),T(e2)=(−2,0),T(e3)=(0,1)⇒A=[1−20201].T(\mathbf{e}_1) = (1, 2), \quad T(\mathbf{e}_2) = (-2, 0), \quad T(\mathbf{e}_3) = (0, 1) \quad\Rightarrow\quad A = \begin{bmatrix} 1 & -2 & 0 \\ 2 & 0 & 1 \end{bmatrix}.

Check: A(1,1,1)T=(−1,3)A(1, 1, 1)^T = (-1, 3) and T(1,1,1)=(1−2,2+1)=(−1,3)T(1, 1, 1) = (1 - 2, 2 + 1) = (-1, 3).

Composition and inverse

Let T1:Rn→RmT_1 : \mathbb{R}^n \to \mathbb{R}^m (matrix A1A_1), T2:Rm→RpT_2 : \mathbb{R}^m \to \mathbb{R}^p (matrix A2A_2). The matrix of the composition T2∘T1T_2 \circ T_1, which applies T1T_1 first and then T2T_2, is

A2A1.A_2A_1.

The order is as in function composition: T2(T1(x))=A2(A1x)T_2(T_1(\mathbf{x})) = A_2(A_1\mathbf{x}).

Example 2. First a 90∘90^\circ rotation R=[0−110]R = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}, then a reflection about y=xy = x, F=[0110]F = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}:

FR=[100−1] (reflection about the x-axis),RF=[−1001] (reflection about the y-axis).FR = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \ (\text{reflection about the } x\text{-axis}), \qquad RF = \begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix} \ (\text{reflection about the } y\text{-axis}).

When the order changed, the result changed. The geometric face of the non-commutativity of matrix multiplication.

Inverse transformation. If the standard matrix AA of TT is invertible, TT is invertible and the matrix of T−1T^{-1} is A−1A^{-1} (Q4).

Matrix relative to nonstandard bases

Let T:V→WT : V \to W, with a basis B={v1,…,vn}B = \{\mathbf{v}_1, \dots, \mathbf{v}_n\} of VV and a basis B′B' of WW. The matrix of TT relative to BB and B′B' is:

[T]B′,B=[ [T(v1)]B′∣⋯∣[T(vn)]B′ ],[T(v)]B′=[T]B′,B [v]B.[T]_{B',B} = \big[\, [T(\mathbf{v}_1)]_{B'} \mid \cdots \mid [T(\mathbf{v}_n)]_{B'} \,\big], \qquad [T(\mathbf{v})]_{B'} = [T]_{B',B}\,[\mathbf{v}]_B.

Recipe: transform each basis vector, write the result in the coordinates of the target basis, make it a column.

The same for polynomials: the derivative D:P2→P1D : P_2 \to P_1 relative to the standard bases is [010002]\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 2 \end{bmatrix}. The coordinates of 5+3x−x25 + 3x - x^2 are (5,3,−1)(5, 3, -1); multiplying gives (3,−2)(3, -2), that is, the derivative 3−2x3 - 2x. We turned calculus into matrix multiplication.

The transition matrix (changing coordinates)

How are the coordinates of the same vector v\mathbf{v} in two different bases related? Let BB and B′B' be two bases of Rn\mathbb{R}^n. The transition matrix from BB to B′B' PP is the matrix that satisfies, for every v\mathbf{v},

[v]B′=P [v]B.[\mathbf{v}]_{B'} = P\,[\mathbf{v}]_B.

Its columns are the coordinates of the vectors of BB relative to B′B'.

Computation: [B′∣B]→[I∣P][B' \mid B] \to [I \mid P]. Write the bases as column matrices (the target basis B′B' on the left) and apply Gauss-Jordan.

Example 3. B={(1,2),(1,3)}B = \{(1, 2), (1, 3)\}, B′={(1,0),(1,1)}B' = \{(1, 0), (1, 1)\}.

[B′∣B]=[11110123]→R1←R1−R2[10−1−20123]⇒P=[−1−223].[B' \mid B] = \left[\begin{array}{cc|cc} 1 & 1 & 1 & 1 \\ 0 & 1 & 2 & 3 \end{array}\right] \xrightarrow{R_1 \leftarrow R_1 - R_2} \left[\begin{array}{cc|cc} 1 & 0 & -1 & -2 \\ 0 & 1 & 2 & 3 \end{array}\right] \quad\Rightarrow\quad P = \begin{bmatrix} -1 & -2 \\ 2 & 3 \end{bmatrix}.

Check: if [v]B=(1,1)[\mathbf{v}]_B = (1, 1) then v=(1,2)+(1,3)=(2,5)\mathbf{v} = (1, 2) + (1, 3) = (2, 5). P(1,1)T=(−3,5)P(1, 1)^T = (-3, 5) and −3(1,0)+5(1,1)=(2,5)-3(1, 0) + 5(1, 1) = (2, 5). The same vector.

As a formula, P=(B′)−1BP = (B')^{-1}B (here BB and B′B' are column matrices). The transition matrix in the opposite direction is P−1=[32−2−1]P^{-1} = \begin{bmatrix} 3 & 2 \\ -2 & -1 \end{bmatrix}.

PITFALL · mixing up the direction. [B′∣B][B' \mid B] gives the transition B→B′B \to B'; [B∣B′][B \mid B'] gives B′→BB' \to B. Memorize “the target basis on the left”. If you are not sure, check one column: column 1 of PP must be the B′B'-coordinates of the 1st vector of BB.

Similar matrices

Let AA be the standard matrix of T:Rn→RnT : \mathbb{R}^n \to \mathbb{R}^n and A′A' its matrix relative to the basis BB. If PP is the matrix whose columns are the vectors of BB (the transition from BB to the standard basis), then

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

The reading order is right to left: convert the BB-coordinates to standard (PP), apply TT in the standard basis (AA), convert the result back to BB-coordinates (P−1P^{-1}).

Definition. Square matrices AA and A′A' are similar if there is an invertible PP with A′=P−1APA' = P^{-1}AP. Similar matrices are photographs of the same transformation in different bases.

Example 4. A=[3102]A = \begin{bmatrix} 3 & 1 \\ 0 & 2 \end{bmatrix}, B={(1,0),(1,−1)}B = \{(1, 0), (1, -1)\}, P=[110−1]P = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}, P−1=[110−1]P^{-1} = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}.

AP=[320−2],A′=P−1(AP)=[3+02−202]=[3002].AP = \begin{bmatrix} 3 & 2 \\ 0 & -2 \end{bmatrix}, \qquad A' = P^{-1}(AP) = \begin{bmatrix} 3 + 0 & 2 - 2 \\ 0 & 2 \end{bmatrix} = \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix}.

In this basis TT multiplies the first basis vector by 3 and the second by 2. Direct check: A(1,−1)T=(2,−2)=2(1,−1)A(1, -1)^T = (2, -2) = 2(1, -1). Next week we will call these basis vectors eigenvectors.

What similarity preserves

det⁡(P−1AP)=det⁡P−1det⁡Adet⁡P=det⁡A\det(P^{-1}AP) = \det P^{-1}\det A\det P = \det A. What is preserved in the same way:

PreservedNot preserved
determinant, trace, rankthe entries themselves
invertibilitysymmetry
characteristic polynomial, eigenvalueseigenvectors (their coordinates change)

To show matrices are not similar, one differing invariant (trace, det, rank) is enough (Q10). Equal trace and det, however, do not prove similarity.

Common mistakes

WrongRight
Writing the T(ei)T(\mathbf{e}_i) as rowsColumns
A1A2A_1A_2 for “first T1T_1” in a compositionA2A1A_2A_1
Finding B→B′B \to B' with [B∣B′][B \mid B'] in the transition matrix[B′∣B][B' \mid B]: target on the left
Making the image a column without converting to coordinates in a nonstandard basisWrite the coordinates [T(vj)]B′[T(\mathbf{v}_j)]_{B'}
A′=PAP−1A' = PAP^{-1}P−1APP^{-1}AP (the columns of PP are the new basis)
Saying “similar” because trace and det are equalNecessary, not sufficient
Thinking a 2×32 \times 3 standard matrix is R2→R3\mathbb{R}^2 \to \mathbb{R}^3R3→R2\mathbb{R}^3 \to \mathbb{R}^2

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Find the standard matrix of T(x,y)=(3x−y, x+4y)T(x, y) = (3x - y,\ x + 4y).

Show answer
[3−114]\begin{bmatrix} 3 & -1 \\ 1 & 4 \end{bmatrix}

The columns: T(e1)=T(1,0)=(3,1)T(\mathbf{e}_1) = T(1, 0) = (3, 1) and T(e2)=T(0,1)=(−1,4)T(\mathbf{e}_2) = T(0, 1) = (-1, 4).
Shortcut: the coefficients of each component become a row.

Question 2medium

Find the standard matrix of T:R3→R2T : \mathbb{R}^3 \to \mathbb{R}^2, T(x,y,z)=(x+y−z, 2y+3z)T(x, y, z) = (x + y - z,\ 2y + 3z).

Show answer
[11−1023]\begin{bmatrix} 1 & 1 & -1 \\ 0 & 2 & 3 \end{bmatrix}

T(e1)=(1,0)T(\mathbf{e}_1) = (1, 0), T(e2)=(1,2)T(\mathbf{e}_2) = (1, 2), T(e3)=(−1,3)T(\mathbf{e}_3) = (-1, 3). Side by side as columns.
The size is 2×32 \times 3: codomain ×\times domain.

Question 3medium

TT first reflects a vector in R2\mathbb{R}^2 in the xx-axis and then rotates it counterclockwise by 90∘90^\circ. Find the standard matrix of TT.

Show answer
[0110]\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}

The reflection is F=[100−1]F = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}, the rotation R=[0−110]R = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}. First FF, then RR: the matrix is RFRF (the one on the right is applied first).RF=[0⋅1+(−1)⋅00+110]=[0110]RF = \begin{bmatrix} 0 \cdot 1 + (-1) \cdot 0 & 0 + 1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}: the result is the reflection about y=xy = x.

Question 4medium

Show that T(x,y)=(2x+y, 3x+2y)T(x, y) = (2x + y,\ 3x + 2y) is invertible and find T−1T^{-1}.

Show answer
T−1(x,y)=(2x−y, −3x+2y)T^{-1}(x, y) = (2x - y,\ -3x + 2y)

A=[2132]A = \begin{bmatrix} 2 & 1 \\ 3 & 2 \end{bmatrix}, det⁡A=1≠0\det A = 1 \neq 0: invertible.A−1=[2−1−32]A^{-1} = \begin{bmatrix} 2 & -1 \\ -3 & 2 \end{bmatrix}, that is, T−1(x,y)=(2x−y,−3x+2y)T^{-1}(x, y) = (2x - y, -3x + 2y).
Check: T−1(T(1,0))=T−1(2,3)=(4−3,−6+6)=(1,0)T^{-1}(T(1, 0)) = T^{-1}(2, 3) = (4 - 3, -6 + 6) = (1, 0).

Question 5medium

Find the matrix of D:P2→P1D : P_2 \to P_1, D(p)=p′D(p) = p', relative to the standard bases {1,x,x2}\{1, x, x^2\} and {1,x}\{1, x\}.

Show answer
[010002]\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 2 \end{bmatrix}

The coordinates of the images of the basis vectors become the columns: D(1)=0→(0,0)D(1) = 0 \to (0, 0), D(x)=1→(1,0)D(x) = 1 \to (1, 0), D(x2)=2x→(0,2)D(x^2) = 2x \to (0, 2).
Check: for 5+3x−x25 + 3x - x^2, [010002](5,3,−1)T=(3,−2)\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 2 \end{bmatrix}(5, 3, -1)^T = (3, -2), that is, 3−2x3 - 2x.

Question 6easy

Let B={(1,1),(1,2)}B = \{(1, 1), (1, 2)\}. Find [v]B[\mathbf{v}]_B for v=(3,5)\mathbf{v} = (3, 5).

Show answer
(1,2)(1, 2)

a(1,1)+b(1,2)=(3,5)a(1, 1) + b(1, 2) = (3, 5): a+b=3a + b = 3, a+2b=5a + 2b = 5. Subtract: b=2b = 2, a=1a = 1.
Check: (1,1)+2(1,2)=(3,5)(1, 1) + 2(1, 2) = (3, 5).

Question 7hard

Find the transition matrix from B={(1,1),(0,1)}B = \{(1, 1), (0, 1)\} to B′={(2,1),(1,1)}B' = \{(2, 1), (1, 1)\}.

Show answer
[0−112]\begin{bmatrix} 0 & -1 \\ 1 & 2 \end{bmatrix}

[B′∣B]=[21101111][B' \mid B] = \left[\begin{array}{cc|cc} 2 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 \end{array}\right].R1←R1−R2R_1 \leftarrow R_1 - R_2: (1,0∣0,−1)(1, 0 \mid 0, -1). R2←R2−R1R_2 \leftarrow R_2 - R_1: (0,1∣1,2)(0, 1 \mid 1, 2).
The left is II, the right is PB→B′P_{B \to B'}. Check: column 1 is (0,1)(0, 1): 0(2,1)+1(1,1)=(1,1)0(2, 1) + 1(1, 1) = (1, 1), the 1st vector of BB.

Question 8medium

With BB and B′B' from the previous question, [v]B=(2,−1)[\mathbf{v}]_B = (2, -1). Find [v]B′[\mathbf{v}]_{B'}.

Show answer
(1,0)(1, 0)

[v]B′=P[v]B=[0−112][2−1]=[10][\mathbf{v}]_{B'} = P[\mathbf{v}]_B = \begin{bmatrix} 0 & -1 \\ 1 & 2 \end{bmatrix}\begin{bmatrix} 2 \\ -1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}.
Check: from BB, v=2(1,1)−(0,1)=(2,1)\mathbf{v} = 2(1, 1) - (0, 1) = (2, 1); from B′B', 1(2,1)+0(1,1)=(2,1)1(2, 1) + 0(1, 1) = (2, 1). The same vector.

Question 9hard

Let T(x,y)=(4x−2y, x+y)T(x, y) = (4x - 2y,\ x + y) and B={(1,1),(2,1)}B = \{(1, 1), (2, 1)\}. Find the matrix A′A' of TT relative to BB.

Show answer
[2003]\begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix}

T(1,1)=(2,2)=2(1,1)+0(2,1)T(1, 1) = (2, 2) = 2(1, 1) + 0(2, 1), T(2,1)=(6,3)=0(1,1)+3(2,1)T(2, 1) = (6, 3) = 0(1, 1) + 3(2, 1). The coordinates as columns: diag⁡(2,3)\operatorname{diag}(2, 3).
With the formula: A=[4−211]A = \begin{bmatrix} 4 & -2 \\ 1 & 1 \end{bmatrix}, P=[1211]P = \begin{bmatrix} 1 & 2 \\ 1 & 1 \end{bmatrix}, A′=P−1APA' = P^{-1}AP. The same result.
In this basis TT only stretches along the axes: next week's diagonalization.

Question 10medium

Are A=[1203]A = \begin{bmatrix} 1 & 2 \\ 0 & 3 \end{bmatrix} and B=[1002]B = \begin{bmatrix} 1 & 0 \\ 0 & 2 \end{bmatrix} similar?

Show answer
No

Similar matrices have the same trace. tr⁡A=4\operatorname{tr}A = 4, tr⁡B=3\operatorname{tr}B = 3. They can't be similar.
(The determinants are different too: 3 and 2.)

Question 11hard

Let T(x,y)=(x+y, x, y)T(x, y) = (x + y,\ x,\ y). Find the matrix of TT relative to B={(1,1),(1,−1)}B = \{(1, 1), (1, -1)\} for R2\mathbb{R}^2 and the standard basis for R3\mathbb{R}^3.

Show answer
[20111−1]\begin{bmatrix} 2 & 0 \\ 1 & 1 \\ 1 & -1 \end{bmatrix}

In the codomain the basis is the standard one, so the coordinates are the vector itself.T(1,1)=(2,1,1)T(1, 1) = (2, 1, 1), T(1,−1)=(0,1,−1)T(1, -1) = (0, 1, -1). These are the columns.

Verification: The standard matrices, composition products, inverse transformations, transition matrices (in two ways: row operations on [B' | B] and B'⁻¹B) and the P⁻¹AP similarity transformations were computed exactly in node with BigInt fractions; the coordinate vectors were checked by recomputing that both bases give the same vector (verify/MAT1041/12.mjs).

Review card

STANDARD MATRIX: A = [T(e1) | T(e2) | ... | T(en)] (images as COLUMNS) T(x,y) = (ax+by, cx+dy) → [a b; c d] (the coefficients form a ROW) Composition: first T1 then T2 → the matrix of T2∘T1 is A2·A1 (the RIGHT ONE FIRST). Inverse transformation: the matrix of T⁻¹ is A⁻¹ (det ≠ 0). Matrix relative to bases [T]_{B',B}: column j = [T(v_j)]_{B'}. [T(v)]_{B'} = [T]_{B',B} [v]_B TRANSITION MATRIX B → B': [B' | B] → row operations → [I | P]. P = (B')⁻¹B. [v]_{B'} = P [v]_B. In the direction B' → B: P⁻¹. Standard → B: [B | I] → [I | B⁻¹]. SIMILARITY: A' = P⁻¹AP, P = the vectors of B as COLUMNS (the transition B → standard). A: in the standard basis, A': in the basis B. Similar matrices have the SAME: det, trace, rank, characteristic polynomial, eigenvalues. Different trace or det → NOT similar.