Jump to content

Introduction: Matrices – "Math for Non-Geeks"

From Wikibooks, open books for an open world

In this article, we introduce matrices as an efficient representation of linear maps. A matrix (of a linear map f:KnKm) is a rectangular arrangement of elements from K ("numbers") that specifies where the standard basis of Kn is mapped by f.

Derivation

[edit | edit source]

Let K be a field and f:KnKm a linear map. We want to describe this map in the most efficient way. Since we know from the article "vector space of a linear map" that the space of linear maps from Kn to Km has dimension nm, and that f is an element of this space. So we need nm numbers to describe our linear map. We are looking for a way to write down these numbers in an organized way.

Let {e1,,en} be the standard basis of Kn. Then, following the principle of linear continuation, f is already completely determined by the vectors f(e1),,f(en)Km : If xKn is an arbitrary vector, we can write it as a linear combination x=x1e1++xnen of the basis elements, and because of linearity we know the value f(x)=x1f(e1)++xnf(en).

So we need the "data" f(e1),,f(en) to describe the linear map. These data are n vectors in Km. So we can write them as

f(e1)=(a11am1),,f(en)=(a1namn)

for certain "numbers" aijK. This is a notation for tracking all necessary data of the linear map. But we can still make it more efficient: We just omit the "f(ei)=" and agree on the convention that the i-th column describes the image of the i-th basis vector:

(a11am1),,(a1namn)

To save even more space, we can also combine the entries of these vectors into a single "table", still with the image of the i-th basis vector being in the i-th column:

(a11a1nam1amn)

We call this "table in parentheses" a matrix. It is the matrix associated with the linear map f.

The matrix completely determines f and it consists of nm numbers as entries, which is consistent with our considerations above.

Definiton

[edit | edit source]
Definition (Matrix)

Let K be a field and n,m. Let aijK for all 1im and 1jn. Then we call

A:=(a11a1nam1amn)=(aij)1im,1jn

an m×n-matrix. We denote the set of all m×n matrices by Km×n.

Example (Linear map from 3 to 2)

We consider the linear map

f:32;f(v1v2v3):=(v2v33v1+5v3).

We can see that f is indeed linear in an exercise.

In the derivation we have seen that we can describe f by a matrix. We want to compute this matrix here explicitly. To do so, we need to determine the images of the standard basis vectors

e1=(100),e2=(010),e3=(001)

For these,

f(e1)=f(100)=(03)f(e2)=f(010)=(10)f(e3)=f(001)=(15)

Thus, the three vectors

(03),(10),(15)

contain all the information of the linear map f. If we write these side by side in a table, we get the matrix

(011305)

which represents f.

Example (Embedding 23)

Let us now consider the standard embedding of 2 into 3, that is, the linear map

ι:23;ι(xy):=(xy0).

For the vectors of the standard basis, we have

ι(10):=(100), ι(01):=(010).

So the embedding ι is represented by the matrix

(100100).

Example (Reflection of 2 along an axis)

Let's still examine the reflection of 2 along the x-axis. When we mirror a vector (xy) along the x-axis, we keep its x-component fixed and change the sign of its y-component. The reflection is thus given by

s:22;s(xy):=(xy)

The first basis vector lies on the x-axis and is therefore not affected by the reflection. Formally:

s(10)=(10).

The second basis vector is perpendicular to the x-axis and is therefore mapped to its negative. Formally:

s(01)=(01).

As the matrix associated with this reflection, we thus obtain:

(1001).

Matrix-Vector Multiplication

[edit | edit source]

Derivation

[edit | edit source]

We have just seen how we can represent a linear map by a matrix. Suppose, we now do not have a linear map, but only its associated matrix. What does the image of an arbitrary vector under this linear map look like?

First, for simplicity, let's consider the vector space 2 and any linear map f:22 be a linear map, of which we know that the associated matrix is

A=(abcd)2×2

That means, we have

f(10)=(ac) and f(01)=(bd).

We want to calculate the image of an arbitrary vector (x,y)T2 under the map f, using the entries of the matrix A.

To do so, we represent our vector as a linear combination of the standard basis vectors, i.e.

(xy)=x(10)+y(01).

Now we can exploit the linearity of f and calculate:

f(xy)=f(x(10)+y(01))=xf(10)+yf(01)=x(ac)+y(bd)=(xaxc)+(ybyd)=(ax+bycx+dy)

By this calculation, we can describe the effect of applying a linear map f to a vector, only by using the matrix A. This calculation works for any vector and any 2×2-matrix. To simplify the notation, let us define a "multiplication operation" for matrices and vectors:

(abcd)(xy):=(ax+bycx+dy)

We call this the "matrix-vector multiplication" and formally write it as a product. The generalization from a 2×2 to an n×n-matrix is given in the following exercise:

Exercise

Let f:KnKm be a linear map and A the associated matrix. Find a formula to calculate the value f(v) for a given vector vKn by using the entries of the matrix A.

Solution

We write v as a linear combination of the standard basis vectors: let v1,,vnK be the "coordinates", such that v=v1e1++vnen holds. That A is the matrix associated with f means that f(ei)=(a1i,,ami)T is satisfied for all i=1,,n. Thus, it follows for v that

f(v)=v1f(e1)++vnf(en)=v1(a11am1)++vn(a1namn)=(v1a11++vna1nv1am1++vnamn)

Using the sum notation, we can write the result as

f(v)=(j=1nvja1jj=1nvjamj)

The solution of this exercise provides us with a formula to calculate the value of a vector under a mapping, using the associated matrix. We now define Av using the formula found in the solution.

Definition

[edit | edit source]
Definition (Matrix-Vector Multiplication)

Let K be a field A=(aij)Km×n and xKn. Then we define

Ax=(a11a1nam1amn)(x1xn)=(j=1na1jxjj=1namjxj)=(j=1naijxj)i

From another point of view this means: If we consider the matrix A as a collection of column vectors

A=(||a1an||)

then the product Ax is a linear combination of the columns of A with the coefficients in x, namely Ax=x1a1+xnan.

How can you best remember how applying a matrix to a vector works?

[edit | edit source]
To apply a matrix to a vector, you need to compute "row times column".

You may perform a matrix-vector multiplication by using the rule "row times column": The first entry of the result is the first row of the matrix times the column vector. The second entry is the second row of the matrix times the column vector, etc. for larger matrices. For each "row times column" product, you multiply the related entries (first times first, second times second, etc.) and add the results.

It is important that the type of the matrix and the type of the vector match. If you have set up everything correctly so far, this should always be the case, because a linear map f:KnKm includes an m×n matrix. You can apply this matrix to vectors of Kn, since rows and columns have both length n.

Reverse direction: The induced linear map

[edit | edit source]

We have seen that every linear map has an associated matrix. Given a linear map f, we constructed a matrix A such that f(v)=Av. That is, some matrices define a linear map. But do all matrices define a linear map? And if yes, what does the corresponding mapping look like?

If a matrix A is derived from a linear map f, then we can get f back from A by defining it as the map vAv. More generally, we can apply this rule to any matrix A and obtain corresponding a linear map f.

So let A be an m×n matrix. We consider KnKn, vAv. This map is indeed linear:

A(v+w)=(a11a1nam1amn)[(v1vn)+(w1wn)]=(j=1na1j(vj+wj)j=1namj(vj+wj))=(j=1na1jvjj=1namjvj)+(j=1na1jwjj=1namjwj)=Av+Aw.

That means, every matrix defines a linear map.

Definition (Induced linear map)

Let AKm×n be a matrix over the field K. Then the linear map

fA:KnKm,fA(v):=Av

is called the linear map induced by the matrix A.

Thus, we now know that for each linear map there is an associated matrix, and for each matrix there is an associated linear map. For a linear map f, we call the associated matrix M(f). Our construction of the induced mapping is built exactly such that f=fM(f). This is quite intuitive: the linear map induced by the matrix associated to a linear map f is just map f itself. We can now ask the "reverse question": If we consider the associated matrix of a linear map induced by some original matrix, is this the original matrix, again? So in mathematical terms: Is A=M(fA)? The following theorem answers this question in the affirmative:

Theorem

The mappings Hom(Kn,Km)Km×n;fM(f) and Km×nHom(Kn,Km);AfA are bijections and each other's inverse. In particular, M(fA)=A.

Proof

To show that the two mappings are inverse to each other, it suffices to show that applying them after each other (in any of the two orders) yields the identity. This would directly imply that both mappings are bijective. So it suffices to show that fM(f)=f and that M(fA)=A. We already know that the first equation holds. So it only remains to show the second. Let A be any m×n-matrix. Let Aij be the entry in the i-th row and j-th column of A and let Mij be the corresponding entry of the matrix M(fA).

By definition of fA we have

fA(ej)=Aej=(A1jAmj).

So the i-th entry of the vector fA(ej) is equal to Aij. That is, (fA(ej))i=Aij.

By definition of the matrix M(fA) associated with fA, the j-th column of M(fA) is equal to the image of ej under fA. Thus,

fA(ej)=(M1jMmj).

In particular, it follows for the i-th entry of fA(ej), that (fA(ej))i=Mij.

Overall, we get Aij=(fA(ej))i=Mij. Since i and j were arbitrarily chosen, all entries of the two matrices are equal and indeed A=M(fA).

We have thus shown that matrices and linear maps are in a "one-to-one-correspondence".