Jump to content

Basis change via matrices – "Math for Non-Geeks"

From Wikibooks, open books for an open world

In this article, you will learn about basis change via matrices. Basis change matrices can be used to convert coordinates with respect to a given basis into coordinates with respect to another basis. This is particularly useful for matrices of linear maps, which are always taken with respect to two specific bases.

Derivation

[edit | edit source]

We have seen in the article on bases that every finite-dimensional vector space has a basis. This means if V is an n-dimensional K-vector space, then there is a basis B={b1,…,bn} of V. Every vector v∈V can therefore be written uniquely as a linear combination of the basis vectors b1,…,bn, i.e. v=∑i=1nλibi with unique λ1,…,λn∈K.

We also know that vector spaces usually have more than one basis. Let C={c1,…,cn} be a second basis of V. Then we can also write v uniquely as a linear combination of ci, i.e. v=∑i=1nμici with unique coefficients μ1,…,μn∈K.

We therefore have two representations of the vector v. Using the basis B we get the representation v=∑i=1nλibi and using the basis C we get v=∑i=1nμici.


How can we convert the basis representation with respect to B of the vector v into the representation with respect to C?

This question is particularly interesting in the context of matrices of linear maps, as we will see below in the section Application of basis change via matrices. Mapping matrices allow us to calculate with coordinates instead of vectors of V. However, the coordinates of a vector always depend on the chosen basis in V. We want a simple way to convert the coordinates of any vector in V with respect to a basis B into coordinates with respect to another basis C.

The situation in Kn

[edit | edit source]

To answer this question, we start with a simpler special case. We consider Kn as a vector space and set B=(e1,…,en) as the (ordered) standard basis. Let further C=(c1,…,cn) be any ordered basis of Kn. Since matrices of linear maps depend on the order of the basis vectors, we have to use ordered bases B and C.

Let v=(x1,…,xn)T=∑i=1nxiei be a vector for whom we know the coordinates with respect to the standard basis B. The vector v∈Kn can be written in the basis C as v=λ1c1+⋯+λncn for unique λ1,…,λn∈K. How can we calculate the coordinates λ1,…,λn∈K of v with respect to C simply from the coordinates x1,…,xn of v with respect to the standard basis B?

To do this, we need to describe the mapping Kn→Kn, which maps each vector v=(x1,...,xn)T∈Kn to its coordinate vector (λ1,…,λn)T∈Kn with respect to C. This is done by the coordinate mapping kC:Kn→Kn, which is a linear map that we know from the article on isomorphisms.

In order to describe kC, we calculate its matrix MStdStd(kC) with respect to the standard basis B=(e1,…,en). By using matrix-vector multiplication in Kn, we then obtain the coordinate vector (λ1,…,λn)T by multiplying v=(x1,…,xn)T from the left by MStdStd(kC).

To calculate the matrix MStdStd(kC), we need to determine kC(e1),…,kC(en). These will then be the columns of MStdStd(kC). We are therefore looking for the coordinates of e1,…,en with respect to C, so we have to write these as a linear combination of vectors in C. This gives us n equations

e1=∑i=1nai1ci⋮en=∑i=1nainci

where aij are the coordinates we are looking for. The coefficients aij can be determined by solving a linear system of equations.

Example (Change to standard basis)

We will examine this procedure using a concrete example. To do so, we consider ℝ3 as a vector space with the ordered standard basis

B=((100),(010),(001))

We also choose the ordered basis C=(c1,c2,c3) as follows:

c1:=(110), c2:=(0−11), c3:=(201)

Each vector in ℝ3 can be represented in the basis B and the basis C to obtain the above-mentioned coefficients x1,x2,x3 or λ1,λ2,λ3. For example, for the vector (6,1,3)T, the coefficients are x1=6, x2=1, x3=3 and λ1=2, λ2=1, λ3=2, because

(613)=2⋅(110)+1⋅(0−11)+2⋅(201)

To make it easier to determine the coefficients λ1,λ2,λ3, we express the standard basis in the basis C. This means we want to find the coefficients aij∈ℝ with

(100)=a11⋅(110)+a21⋅(0−11)+a31⋅(201)(010)=a12⋅(110)+a22⋅(0−11)+a32⋅(201)(001)=a13⋅(110)+a23⋅(0−11)+a33⋅(201)

By solving the linear system, we can determine and obtain the coefficients:

(100)=−1⋅(110)+(−1)⋅(0−11)+1⋅(201)(010)=2⋅(110)+1⋅(0−11)+(−1)⋅(201)(001)=2⋅(110)+2⋅(0−11)+(−1)⋅(201)

Then kC(ej)=(a1j,a2j,…,anj)T for j=1,…,n. This gives us the matrix

MStdStd(kC)=(a11a12…a1na21a22…a2n⋮⋮⋱⋮an1an2…ann).

We obtain MStdStd(kC)y=kC(y) for all y∈Kn. The required coefficients λ1,…,λn are therefore obtained by

MStdStd(kC)(x1⋮xn)=(λ1⋮λn).

Example (Change to standard basis 2)

For our example above, we can also specify the matrix MStdStd(kC):

MStdStd(kC)=(−122−1121−1−1).

With this matrix, we can also easily calculate the coefficients λ1,λ2,λ3 of the vector (6,1,3)T:

(λ1λ2λ3)=MStdStd(kC)(613)=(−122−1121−1−1)(613)=(212).

This means λ1=2, λ2=1, λ3=2, as we have already calculated above.

Generalization to arbitrary finite-dimensional vector spaces

[edit | edit source]

In a general finite-dimensional vector space V, unlike in Kn, there is no standard basis. In this situation, we have two ordered bases B=(b1,…,bn) and C=(c1,…,cn). Usually, we are then given an arbitrary vector v∈V as a linear combination v=x1b1+…+xnbn with respect to the basis B with x1,…,xn∈K. The coefficients x1,…,xn are also called the coordinates of v with respect to B. Correspondingly, the coordinates with respect to C are the scalars λ1,…,λn∈K with v=λ1c1+…+λncn.

We are looking for a method to convert the coordinates x1,…,xn with respect to B of any vector v∈V into the coordinates λ1,…,λn with respect to C. For this, we need a mapping Kn→Kn, which sends (x1,…,xn)T to (λ1,…,λn)T.

We already know the coordinate mappings kB:V→Kn with kB(v)=(x1,…,xn)T∈Kn and kC:V→Kn with kC(v)=(λ1,…,λn)T. From (x1,…,xn)T∈Kn we want to obtain the vector (λ1,…,λn)T∈Kn. The coordinate mappings are isomorphisms. So kB−1:Kn→V maps the vector (x1,…,xn)T to v and kC:V→Kn maps v to (λ1,…,λn)T. If we first execute kB−1 and then kC, we obtain a mapping that sends (x1,…,xn)T to (λ1,…,λn)T.

Our desired transformation is therefore realized by the linear map kC∘kB−1:Kn→Kn. As above for the situation in Kn, we can then determine the matrix of this linear map in Kn with respect to the standard basis. This matrix is given by MStdStd(kC∘kB−1). If we remember the article on matrices of linear maps, however, this matrix is just MCB(idV), because kC∘kB−1=kC∘idV∘kB−1.

It also makes intuitive sense that the matrix executing the basis change from B to C is given exactly by MCB(idV) representing the identity from basis B to C. This is because, if we multiply the coordinate vector kB(v) of v∈V with respect to B from the left with MCB(idV), then we obtain exactly the coordinate vector of idV(v)=v with respect to C, just by definition of the representing matrix. That is,

kC(v)=MCB(idV)⋅kB(v)

for all v∈V. The matrix MCB(idV) therefore converts coordinates with respect to B into coordinates with respect to C. This is exactly what a basis change matrix does.

Definition

[edit | edit source]
Definition (Basis change matrix)

Let V be a finite-dimensional vector space, and let B and C be two ordered bases of V. Then the basis change matrix from B to C is the matrix of the identity map idV with respect to the bases B and C, i.e. MCB(idV⁡). We call this matrix TCB.

The basis change matrix has many other names. It is also referred to in the literature as a transition matrix, basis transition matrix, transformation matrix or coordinate change matrix.

Warning

In the literature, the names transformation or transition matrix sometimes also refer to matrices that are not basis change matrices.

Application of basis change via matrices

[edit | edit source]

The problem with matrices of linear maps

[edit | edit source]

We can find a matrix MCB(f) for every linear map f:V→W between two finite-dimensional vector spaces, with respect to bases B and C. However, this matrix depends on B and C, and their order. If we choose other bases B′ or C′, we will very likely get a different matrix. We can see this in the following example:

Example (Different matrices of one linear map)

Let us consider the map

f:ℝ2→ℝ2,(xy)↦(x+y2y)

Let B=(e1,e2) be the standard basis of ℝ2. We also consider the ordered bases C=((1,1)T,(1,0)T) and C′=((1,2)T,(1,0)T). Then

f(e1)=(1+02⋅0)=(10)f(e2)=(0+12⋅1)=(12).

Since

(10)=0⋅(11)+1⋅(10)  and(12)=2⋅(11)+(−1)⋅(10)

the matrix of f with respect to B and C looks as follows:

MCB(f)=(021−1)

If we carry out the same calculation with the bases B and C′, we get

(10)=0⋅(12)+1⋅(10)  and(12)=1⋅(12)+0⋅(10).

This means that the matrix of f with respect to the bases B and C′ is

MC′B(f)=(0110).

Therefore, MCB(f)≠MC′B(f).

Solution of this problem

[edit | edit source]

Consider a linear map f:V→W and two ordered bases B and B′ of V as well as C and C′ of W. We are asking now: How can we convert the matrix MCB(f) into MC′B′(f)?

Theorem (Basis change of matrices for linear maps)

Let f:V→W be a linear map and consider the ordered bases B and B′ of V as well as C and C′ of W. Then

MC′B′(f)=TC′C⋅MCB(f)⋅TBB′.

The matrix representing f with respect to B′ and C′ is therefore obtained from the matrix of f with respect to B and C by multiplying from the left and from the right with the corresponding basis change matrices.

In the following, we will consider why the formula in this theorem is correct and how we arrived at it.

From the definition of the matrix of a linear map we know that for all vectors x∈Kn, we have MCB(f)x=kC∘f∘kB−1(x) and MC′B′(f)x=kC′∘f∘kB′−1(x). We can visualize this equation in a diagram:

Representation of the same linear map with respect to different bases as two diagrams
Representation of the same linear map with respect to different bases as two diagrams

In these two diagrams, it doesn't matter which way you go. For example, it does not matter whether we use f to go directly from V to W or take the detour via Kn and Km. If the same map is constructed along each path, this is referred to as a commutative diagram.

We can join the two diagrams together:

Representation of the same linear map with respect to different bases as a diagram
Representation of the same linear map with respect to different bases as a diagram

This diagram is also commutative. That means, if you have a fixed start and end point, it still doesn't matter which path you take in the diagram. If we start at the top left at Kn, it doesn't matter which path we use to get to Km at the bottom left. We can get from Kn to Km via x↦MC′B′(f)x, or using first kB∘kB′−1:Kn→Kn, then x↦MCB(f)x and finally kC′∘kC−1:Km→Km.

The various compositions are shown in blue and red
The various compositions are shown in blue and red

Consequently, the map Kn→Km, x↦MC′B′(f)x is equal to the combination of the maps kB∘kB′−1, x↦MCB(f)x, and kC′∘kC−1. We have now seen that the x↦MCB(f)x can be transformed into the map x↦MC′B′(f)x. Originally, however, we wanted to transform the matrix MCB(f) into the matrix MC′B′(f). How do we get from the map Kn→Km, x↦MC′B′(f)x back to the matrix MC′B′(f)∈Km×n?

The matrix MC′B′(f) looks complicated. We therefore consider how we can answer this question for a general matrix A∈Km×n. We consider the linear map LA:Kn→Km, x↦Ax associated with A. The matrix of LA with respect to the standard bases of Kn and Km is again A. Let us now plug in the matrix MC′B′(f) for A. The matrix of the linear map x↦MC′B′(f)x with respect to the standard bases is exactly MC′B′(f).

As we have already seen, the map x↦MC′B′(f)x is equal to the combination of the three maps kB∘kB′−1, x↦MCB(f)x, and kC′∘kC−1. Therefore, the matrix of the combination of kB∘kB′−1, x↦MCB(f)x, and kC′∘kC−1 corresponds to MC′B′(f) with regard to the standard bases.

However, we can also determine the matrix of the concatenation in another way. In the article on matrix multiplication, we saw that concatenation between linear maps correspond exactly to the multiplication of the respective matrices. Therefore, we write down the matrices of the concatenated linear maps individually and then multiply them.

  • As we have already seen for MC′B′(f), the matrix of x↦MCB(f)x with respect to the standard bases of Kn and Km is again MCB(f).
  • We have already derived the matrix of kC′∘kC−1 above; it is MC′C(id⁡). This is exactly the basis change matrix TC′C.
  • Similarly, the matrix of kB∘kB′−1 is given by the basis change matrix TBB′=MBB′(id⁡).

If we multiply these three matrices, we obtain MC′B′(f):

MC′B′(f)=TC′CMCB(f)TBB′

So MC′B′(f) can be calculated from MCB(f) by left multiplication with TC′C and right multiplication with TBB′.

Example for a basis change

[edit | edit source]

We now know, how we can convert matrices of a linear map with respect to different bases into each other. Let's look at the example above again. We consider the linear map

f:ℝ2→ℝ2,(xy)↦(x+y2y)

as well as the ordered bases B=(e1,e2), C=((1,1)T,(1,0)T), and C′=((1,2)T,(1,0)T). We have already calculated the matrix MCB(f):

MCB(f)=(021−1)

We want to determine MC′B(f) by matrix multiplication, i.e., by MC′B(f)=TC′CMCB(f)TBB. We have to determine TBB and TC′C. Now, TBB=I2, since the basis B does not change. Now let us turn to computing the basis change matrix TC′C: We know that TC′C=MC′C(id⁡). In order to determine this matrix, we need to express the basis vectors of C in the basis C′:

(11)=12⋅(12)+12⋅(10)(10)=0⋅(12)+1⋅(10).

Hence,

TC′C=(120121).

Therefore

MC′B(f)=TC′CMCB(f)=(120121)⋅(021−1)=(0110).

You may convince yourself that this result agrees with the result above.

Examples

[edit | edit source]

Basis change for a matrix of a linear map

[edit | edit source]

Consider the bases

B′=((21),(11))andB=((0−1),(23))

of ℝ2, as well as the bases

C=((1−23),(00−1),(211))andC′=((111),(110),(100))

of ℝ3. Let f:ℝ2→ℝ3 be a map with the following matrix with respect to B and C:

MCB(f)=(5−3240−2)

We want to determine the matrix of f with respect to the bases B′ and C′. This can be done by matrix multiplication MC′B′(f)=TC′CMCB(f)TBB′. To do so, we must first calculate the basis change matrices TBB′ and TC′C.

Example (Basis change in ℝ2)

Consider the two bases

B′=((21),(11))andB=((0−1),(23))

in ℝ2 . In order to determine the transition matrix TBB′ from B′ to B, we proceed as follows:

1. We represent the basis vectors of B′ as a linear combination of the vectors of B:

(21)=2⋅(0−1)+1⋅(23)(11)=12⋅(0−1)+12⋅ (23)

2. We write the determined coefficients of the linear combinations as column vectors in a matrix. This is exactly the transition matrix we are looking for:

TBB′=(212112)

Example (Basis change in ℝ3)

We consider the bases

C=((1−23),(00−1),(211))andC′=((111),(110),(100))

in ℝ3. We want to calculate the basis change matrix TC′C from C to C′. To do this, we represent the basis vectors of C as a linear combination of the vectors of C′:

(1−23)=3⋅(111)−5⋅(110)+3⋅(100)(00−1)=−1⋅(111)+1⋅(110)+0⋅(100)(211)=1⋅(111)+0⋅(110)+1⋅(100)

As above, we obtain the transition matrix TC′C by writing the coefficients of the linear combinations as columns in a matrix:

TC′C=(3−11−510301)

Example (Basis change for a matrix of a linear map)

Consider the bases B′=((2,1)T,(1,1)T) and B=((0,−1)T,(2,3)T) of ℝ2 and the bases C=((1,−2,3)T,(0,0,−1)T,(2,1,1)T) and C′=((1,1,1)T,(1,1,0)T,(1,0,0)T) of ℝ3. Let f:ℝ2→ℝ3 be a linear map with the following matrix with respect to B and C:

MCB(f)=(5−3240−2)

We want to determine the matrix of f with respect to the bases B′ and C′. We do this via matrix multiplication MC′B′(f)=TC′CMCB(f)TBB′. In the previous examples, we have already determined TBB′ and TC′C. So we can simply calculate:

MC′B′(f)=TC′CMCB(f)TBB′=(3−11−510301)⋅(5−3240−2)⋅(212112)=(3−11−510301)⋅(7183−2−1)=(11−1−27−2192)

The matrix of f with respect to the bases B′ and C′ is therefore

MC′B′(f)=(11−1−27−2192).

Exercises

[edit | edit source]
Exercise

We consider the following linear map

f:ℝ[x]≤3→ℝ,p=a0+a1x+a2x2+a3x3↦f(p)=a0+a1+a2+a3

as well as the bases B={1,x,x2,x3} and B′={1,x+1,x2+x,x3+x2} of ℝ[x]≤3 and the bases C={1} and C′={2} of ℝ.

  1. Calculate the matrix of f with respect to B and C, as well as the matrix with respect to B′ and C′.
  2. Calculate the basis change matrix from B to B′, and vice versa from B′ to B.
  3. Calculate the basis change matrix from C to C′, and vice versa from C′ to C.
  4. Verify that you can calculate the matrix MC′B′(f) from the matrix MCB(f) using the basis change matrices.
Solution

Solution sub-exercise 1:

We calculate the images of the basis vectors:

f(1)=1=1⋅1f(x)=1=1⋅1f(x2)=1=1⋅1f(x3)=1=1⋅1

The corresponding matrix of f is therefore

MCB(f)=(1111)

As above, we calculate the images of the basis vectors:

f(1)=1=12⋅2f(x+1)=2=1⋅2f(x2+x)=2=1⋅2f(x3+x2)=2=1⋅2

In the second step, we express the images in the basis C′={2}. The desired matrix is therefore

MC′B′(f)=(12111)

Solution sub-exercise 2:

To determine the basis change matrix TBB′ from B′ to B, we first represent the basis vectors of B′ as a linear combination of the vectors of B:

1=1⋅1+0⋅x+0⋅x2+0⋅x3x+1=1⋅1+1⋅x+0⋅x2+0⋅x3x2+x=0⋅1+1⋅x+1⋅x2+0⋅x3x3+x2=0⋅1+0⋅x+1⋅x2+1⋅x3

The coefficients of the linear combinations are the column vectors of the matrix we are looking for:

TBB′=(1100011000110001)

Likewise, we can calculate the basis change matrix TB′B from B′ to B. Alternatively, we can also calculate the inverse matrix of TBB′:

TB′B=(TBB′)−1=(1−11−101−11001−10001)

Solution sub-exercise 3:

As in the previous part, we represent the basis vectors of C′ as a linear combination of the vectors of C:

2=2⋅1

Hence,

TCC′=(2)

For the inverse, we have

1=12⋅2

Thus,

TC′C=(12)

Solution sub-exercise 4:

According to the above formula, we should have MC′B′(f)=TC′CMCB(f)TBB′. Indeed, the left-hand side is

MC′B′(f)=(12111)

On the right-hand side, we get

TC′CMCB(f)TBB′=(12)(1111)(1100011000110001)=(12)(1222)=(12111)

And in fact, both matrices agree!