Jump to content

Matrix of a linear map – "Math for Non-Geeks"

From Wikibooks, open books for an open world

In this article, we will learn how to describe linear maps between arbitrary finite-dimensional vector spaces using matrices. The matrix representing such a linear mapping f:VW depends on the choice of bases in V and in W. Their columns are the coordinates of the images of the base vectors of V.

Generalization to abstract vector spaces

[edit | edit source]

In the article on introduction to matrices, we saw how we can describe a linear mapping KnKm using a matrix. In this way, we can specify and classify linear mappings between Kn and Km quite easily. Can we also find such a description for linear mappings between general vector spaces?

Formally speaking, we care asking: Given two finite-dimensional K vector spaces V and W, how can we completely describe a linear mapping f:VW?

To answer this question, we can try to trace it back to the case of Kn and Km. In the article on isomorphisms we have seen that every finite-dimensional vector space is isomorphic to Kn. This means VKn and WKm, where we set n=dim(V) and m=dim(W). This isomorphism works as follows: We choose an ordered basis B=(b1,,bn) from V. By representing a vector in V with respect to B, we obtain the coordinate mapping kB:VKn, which maps v=λ1b1++λnbnV to (λ1,,λn)TKn. In the same way, we obtain the isomorphism kC:WKm after choosing a basis C of W. It is important here that B and C are ordered bases, as we would get a different mapping for different arrangements of the basis vectors.

Using these isomorphisms, we can turn our mapping f:VW into a mapping f:KnKm: We set f=kCfkB1

Shifting a linear map in coordinate space
Shifting a linear map in coordinate space

We can assign a matrix M to this mapping f as described in the article Introduction to matrices.

Have we achieved our goal? If so, we can reconstruct the mapping f from M. From the article introduction to matrices, we already know that we can reconstruct the mapping f:KnKm from M using the induced mapping. Now kB and kC are isomorphisms. This means that we can reconstruct f from f via kC1fkB=kC1kCfkB1kB=f.

We can therefore call M the matrix assigned to f. However, we have to be careful with this name: the matrix depends on the choice of the two ordered bases B of V and C of W. This means we have actually found several ways to construct a matrix from f. Only after fixing the bases B and C have we found a unique way to get a matrix for f. Thus, the matrix M constructed above should actually be called "the matrix assigned to f with respect to the bases B and C". Appropriately, we can denote M by MCB(f). By construction, this matrix fills exactly the bottom row in the following diagram:

Diagram characterizing the transformation matrix
Diagram characterizing the transformation matrix

Definition

[edit | edit source]
Definition (Matrix of a linear map)

Let K be a field, V and W two K-vector spaces of dimension n and m respectively. Let B be a basis of V with coordinate mapping kB:VKn and C a basis of W with coordinate mapping kC:WKm. Further, let f:VW be a linear mapping. Define g:KnKm by g=kCfkB1. Now the matrix of f with respect to the bases B and C is given by the corresponding matrix of g, i.e., the i-th column of the m×n matrix contains the image g(ei) of the i-th standard basis vector under g. We write this as MCB(f).

Warning

Note that the matrix MCB(f) depends on the selected (ordered) bases B and C! If you choose other bases, you generally get a different matrix. This also applies if you only change the order of the base vectors. This is why we use ordered bases.

Hint

The matrix of a linear map is also called the representation matrix or assigned matrix.

Calculating with matrices of linear maps

[edit | edit source]

Computing the matrix of a linear map

[edit | edit source]
Relationship between the elements bj,ej,f(bj) and a_j=(a1j,,amj)T.

How can we find the corresponding matrix for f:VW? That is, how can we specifically calculate the entries of the matrix MCB(f)?

The j-th column vector of the matrix MCB(f) is given by (kCfkB1)(ej). We therefore want to determine this vector. Now, (kCfkB1)(ej)=kC(f(kB1(ej))). The defining property of the coordinate mapping kB is that it maps the basis vector bj to ej. Therefore, kB1(ej)=bj. Thus, the j-th column of MCB(f) is the vector (kC(f(bj)). To find out how kC represents the vector f(bj), we need to represent this vector in the basis C. There are scalars a1j,a2j,,amjK, so that f(vj)=i=0maijci. Then,

kC(f(bj))=(a1ja2jamj).

This means that the ij-th entry of MCB(f) is given by the entry aij from the basic representation f(bj)=i=0maijci.

Definition (Matrix of a linear map, alternative definition)

Let K be a field and V and W two finite-dimensional K-vector spaces. Let B={b1,,bn} be a basis of V and C={c1,,cm} a basis of W. Let f:VW be a linear mapping. Further, let aijK be such that f(bj)=i=1maijci for all j{1,,n}. Then we define the matrix of f with respect to B and C as the matrix MCB(f)=(aij)ij.

Hint

The columns of MCB(f) are therefore the coordinates with respect to C of the images of the basis vectors of B. We can also write this down like this: MCB(f)=(kC(f(b1))kC(f(b2))kC(f(bn))). Here, each entry in the row is a column vector.

Example (Computing the matrix of a linear map)

Let [x]2 be the vector space of polynomials of degree at most 2 with coefficients from and [x]1 the vector space of polynomials of degree at most 1 with coefficients from . We define the following linear mapping:

f:[x]2[x]1p=p2x2+p1x+p0(p2+p1)(x+1)+p0

It is easy to check that f is actually a linear mapping. We have the bases B=(x2,x,1) of [x]2 and C=(x,1) of [x]1.

We are looking for the matrix MCB(f).

To find it, we calculate the images of the basis vectors from B and express the result in the basis C:

f(x2)=f(1x2+0x+0)=(1+0)(x+1)+0=x+1=1x+11f(x)=f(0x2+1x+0)=(0+1)(x+1)+0=x+1=1x+11f(1)=f(0x2+0x+1)=(0+0)(x+1)+1=11

The coefficients in front of the basis vectors in C are the entries of the matrix we are looking for. Therefore

MCB(f)=(110111)

Using the matrix of a linear map

[edit | edit source]

Now we know how to calculate the matrix of f with respect to the bases B={b1,,bn} and C={c1,,cm}. What can we use this matrix for?

This matrix can be used to calculate the image vector f(v) of each vV. To do so, we first represent v with respect to the basis B of V, i.e., v=λ1b1+λ2b2++λnbn. We denote the entries of the mapping matrix with MCB(f)=(aij). Then we have

f(v)=f(j=1nλjbj) linearity of f=j=1nλjf(bj) definition of the matrix MCB(f)=(aij)=j=1nλj(i=1maijci) re-arranging the sum =i=1m(j=1naijλj)ci

We therefore obtain a representation of the vector f(v)=i=1mμici as a linear combination of the basis vectors of C, with coordinates

μi=j=1naijλj.

Using the matrix multiplication with a vector ("row times column") we can also express this as follows:

(μ1μ2μm)=(a11a1nam1amn)(λ1λ2λn)=(j=1na1jλjj=1na2jλjj=1namjλj)

Using the matrix of f, we therefore obtain the coordinate vector kB(v)=(λ1,,λn) of v from the coordinate vector kC(f(v)) of f(v): We multiply kB(v) from the left by the matrix MCB(f).

kC(f(v))=MCB(f)kB(v)

The equation states that, starting from a vector vV, the red and blue paths in the diagram for the matrix to be displayed provide the same result.

The defining diagram for a matrix of a linear map
The defining diagram for a matrix of a linear map

Instead of starting with a vector vV, we can also start with any vector x=(x1,,xn)TKn. Then x is the coordinate vector of kB1(x)=x1b1++xnbn=:v. We can also understand the product y=MCB(f)xKm as a coordinate vector of kC1(y)=y1c1++ymcm. From the diagram, we know that y is the coordinate vector of f(v). Therefore,

f(kB1(x))=kC1(MCB(f)x)

Here we have used the fact that the coordinate mappings are isomorphisms, so we can also reverse the arrows of kB and kC in the diagram. The equation states that the red and blue paths in the following diagram give the same result:

The defining diagram of a mapping matrix with inverted coordinate mapping
The defining diagram of a mapping matrix with inverted coordinate mapping
Example (Using the matrix of a linear map)

As above, we consider the linear map

f:[x]2[x]1p=p2x2+p1x+p0(p2+p1)(x+1)+p0

and the bases B=(x2,x,1) of [x]2 or C=(x,1) of [x]1.

We have already calculated the matrix of f with respect to these bases:

MCB(f)=(110111)

We can now use this matrix to calculate f(p) for a polynomial p[x]2. We have seen above that

kC(f(p))=MCB(f)kB(p)

To understand this, let's look at a concrete example: We consider the polynomial p:=5x23x+10. First, we need to calculate kB(p), i.e., the coordinates with respect to the basis B. The coordinate vector is formed from the prefactors of the linear combination in the basis B=(x2,x,1). We have

p:=5x23x+10

This allows us to find the coordinate vector

kB(p)=(5310)

We can multiply this vector with the matrix MCB(f):

MCB(f)kB(p)=(110111)(5310)=(212)

This vector (2,12)T is kC(f(p)), i.e., the coordinate vector of f(p) in the basis C=(x,1). In order to obtain f(p) from this, we must write the coordinates in the vector (2,12)T as prefactors in the linear combination of C. Thus

f(p)=kC1((212))=2x+121=2x+12

Matrix of a composition of linear maps

[edit | edit source]

In the following theorem we show that the combination of linear mappings corresponds to the multiplication of their representing matrices.

Theorem (Matrix of a composition of linear maps)

Let f:VW and g:WX be linear mappings between finite-dimensional vector spaces. Furthermore, let B={v1,,vm} be a basis of V, C={w1,,wn} a basis of W and D={x1,,xs} a basis of X. Then

MDB(gf)=MDC(g)MCB(f).

Proof (Matrix of a composition of linear maps)

Let h=gf and let (hij)ij=MDB(h)Ks×m. Further, let MCB(f)=(fij)ijKn×m and MDC(g)=(gij)ijKs×n be the matrices of f and g respectively.

We now know that the hij are the unique scalars, satisfying

h(vj)=i=1shijxi

for all j{1,,m}. In order to prove (hij)=(gij)(fij), we need to verify

hij=k=1ngikfkj

Indeed,

h(vj)=g(f(vj))definition of MCB(f)=g(k=1nfkjwk)linearity of g=k=1nfkjg(wk)definition of MDC(g)=k=1nfkji=1sgikxi=i=1s(k=1ngikfkj)xi.

From the uniqueness of the coordinates in the linear combination of xi, we conclude hij=k=1ngikfkj.

Warning

For the reduction rule, it is important that the same ordered basis C of W is chosen in both cases for the matrices representing f and g. If MDC~(g) is formed for a different basis C~C of W, then the reduction rule no longer applies: The equation

MDB(gf)=MDC~(g)MCB(f)

is generally false. Because representing matrices depend on the order of the basis vectors, this also applies if C~ is only a rearrangement of C.

One-to-one correspondence between matrices and linear maps

[edit | edit source]

We can uniquely assign a matrix MCB(f) to a linear map f after a fixed choice of ordered bases B and C. This gives us a function that sends a mapping f to its associated matrix MCB(f):

Hom(V,W)Km×nfMCB(f)

In this formula, Hom(V,W) is the set of all linear maps from V to W and Km×n is the set of all m×n matrices.

How did we arrive at the assignment of the matrix MCB(f) to the linear map f? We first found a unique mapping f:KnKm for f using the bases B and C and then determined the matrix assigned to f. The mapping f is defined by the coordinate mappings: f=kCfkB1. So we have the assignment:

Hom(V,W)Hom(Kn,Km)ff:=kCfkB1

Because kC and kB are bijections, we can also get a unique f:VW from an f:KnKm, to which f is assigned. All we have to do is to set f:=kC1fkB.

So we have a bijection between Hom(V,W) and Hom(Kn,Km).

The assignment

Hom(Kn,Km)Km×nfM(f)

is a bijection, as we already saw in the introduction article to matrices.

Therefore, Hom(V,W)Km×n is also a bijection, because it is the combination of the two bijections Hom(V,W)Hom(Kn,Km) and Hom(V,W)Km×n. But what does the inverse of the bijection Hom(V,W)Km×n look like?

The inverse mapping Km×nHom(V,W) sends a matrix AKm×n to a linear map f:VW such that MCB(f)=A. Let B=(b1,,bn) and C=(c1,,cm) be ordered bases of V and W and A=(aij), i.e., aij is the i,j-th component of the matrix A. Because MCB(f)=A, the following must hold:

f(bj)=i=1maijci

Because of the principle of linear continuation, f is already completely defined. Here, we see that aij is the weight of ci in f(bj). Intuitively, the j-th column of the mapping matrix again stores the image of the j-th basis vector, i.e., f(bj).

Example (One-to-one correspondence)

We want to better understand the one-to-one correspondence between matrices and linear mappings using an example. The bijection is given by

Hom(V,W)Km×nfMCB(f),

where B is an (ordered) basis of V and C is an (ordered) basis of W. We consider the two vector spaces V=[x]2 and W=[x]1, i.e., the vector spaces of the polynomials with coefficients from and degree at most 2 or 1. For the one-to-one correspondence, we still need an ordered basis of V and of W. We choose the canonical bases B:=(x2,x,1) and C:=(x,1). What are the variables m and n in this example? The number m is the dimension of the vector space W and n is the dimension of V. So m=2 and n=3.

We therefore have the bijection

Hom([x]2,[x]1)2×3fMCB(f)

This means every linear map f from [x]2 to [x]1 provides a (2×3) matrix

MCB(f)=(a11a12a13a21a22a23)

with coefficients aij. For example, we have seen above that for the linear map

f:[x]2[x]1p=p2x2+p1x+p0(p2+p1)(x+1)+p0

and the bases B and C, we get the corresponding matrix

MCB(f)=(110111).

However, the one-to-one correspondence says even more: For every (2×3)-matrix A with coefficients in there is a unique linear mapping f from [x]2 to [x]1, so that A is the mapping matrix of f, i.e., MCB(f)=A.

Hint

If we choose a suitable vector space structure on the set of matrices Km×n, the bijection explained above is even an isomorphism. The vector space structure we have to fix for the matrices is componentwise addition and scalar multiplication. We look at this in more detail in the article "Vector space structure on matrices".

Examples

[edit | edit source]

We calculate the matrix representing a specific linear map 32 with respect to the standard basis.

Example (Concrete example)

We consider the linear map

f:32,f(xyz)=(2x3yx2y+z)

The canonical standard basis is selected both in the original space 3 and in the target space 2:

B=((100),(010),(001)),C=((10),(01))

We have:

f(100)=(21),f(010)=(32),f(001)=(01)

This means that the matrix of L with respect to the selected bases B and C is:

MCB(f)=(230121)

Now let's look at the same linear map, but a different basis in the target space.

Example (Concrete example with a different basis)

Again, we consider the linear map f of the above example, i.e.,

f:32,f(xyz)=(2x3yx2y+z)

This time we use the ordered basis in the target space 2

C=((21),(11))

Now,

f((100))=(21)=1(21)+0(11),

f((010))=(32)=1(21)1(11),

f((001))=(01)=1(21)+2(11)

This gives the following matrix of f with respect to the bases B and C:

MCB(f)=(111012)

We can see that this matrix is not equal to MCB(f) from the first example.

From the two previous examples, we see that the matrix representing a linear map depends on the chosen bases. It is important that we consider ordered bases: The representing matrix also depends on the order of the basis vectors.

Example (Concrete example with a re-arranged basis)

Again, we consider the linear map f of the above example, i.e.,

f:32,f(xyz)=(2x3yx2y+z)

This time we use the reordered standard basis in the target space 2

C=((01),(10))

Now,

f((100))=(21)=1(01)+2(10),

f((010))=(32)=2(01)3(10),

f((001))=(01)=1(01)+0(10)

This gives the following matrix of f with respect to the bases B and C:

MCB(f)=(121230)

We can see that this matrix is neither equal to MCB(f) from the first nor to the one from the second example. (In fact, it is the MCB(f) from the first example with the rows being swapped.)

Conversely, different mappings can also have the same mapping matrix if they are evaluated for different bases:

Example (Concrete example with a different linear map but the same matrix)

Consider the linear map

F:32,F(xyz)=(xyzy+2z)

We select the standard basis for both the original and target space:

B=((100),(010),(001)),C=((10),(01))

and, as in the previous examples, we calculate the matrix representing F with respect to these bases as

MCB(F)=(111012).

This is the same matrix as the MCB(f) from the previous example. But the linear maps F and f are not identical, because

f((100))=(21)(10)=F((100)).

Let us now look at a somewhat more abstract example:

Example (Polynomials of different degrees)

Let K= and let V be the vector space of polynomials of degree at most 3 with coefficients from . Further, let W the vector space of polynomials of degree at most 2 with coefficients from . We define f:VW as the derivative of a polynomial, i.e., for all p(x)V we set p=p0+p1x+p2x2+p3x3p=p1+2p2x+3p3x2. When considering the bases: B=(1,x,x2,x3) and C=(1,x,x2), then the following applies:

f(b1)=f(1)=0=0c1+0c2+0c3

f(b2)=f(x)=1=1c1+0c2+0c3

f(b3)=f(x2)=2x=0c1+2c2+0c3

f(b4)=f(x3)=3x2=0c1+0c2+3c3

This gives the following matrix of f with respect to the bases B and C:

MCB(f)=(010000200003)