Skip to content
ImagineWorld

Linear Transformations

node_idnode-book_mathematics-of-machine-learning_chapter-04-linear-transformations
node_typechapter_node
schema_profileworld.chapter_node.v1
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
statusactive
chapter_num4
chapter_titleLinear Transformations
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

”Why do my eyes hurt?” ”You’ve never used them before.”

— Morpheus to Neo, when waking up from the Matrix for the first time

In most linear algebra courses, the curriculum is all about matrices. In machine learning, we work with them all the time. Here is the thing: matrices don’t tell the whole story. It is hard to understand the patterns by looking only at matrices. For instance, why is matrix multiplication defined in such a complex way as it is? Why are relations like B = T−1AT important? Why are some matrices invertible and some are not?

To really understand what is going on, we have to look at what gives rise to matrices: linear transformations. Like for Neo, this might hurt a bit, but it will greatly reward us later down the line. Let’s get to it!

day-mode Bookmark

With the introduction of inner products, orthogonality, and orthogonal/orthonormal bases, we know everything about the structure of our feature spaces. However, in machine learning, our interest mainly lies in transforming the data.

From this viewpoint, a neural network is just a function composed of smaller parts (known as layers), transforming the data to a new feature space in every step. One of the key components of models in machine learning are linear transformations.

You probably encountered them as functions of the form f(x) = Ax, but this is only one way to look at them. This section will start from a geometric viewpoint, then move towards the algebraic representation that you are probably already familiar with. To understand how neural networks can learn powerful high-level representations of the data, looking at the geometry of transforms is essential.

So, what linear transformations are? Let’s not hesitate a moment further, and jump into the definition right away!

Definition 16. (Linear transformations)

Let U and V be two vector spaces (over the same scalar field), and let f : U →V be a function between them. We say that f is linear if

f( ax + by) = af(x) + bf(y)

(4.1)

holds for all vectors x,y ∈U and all scalars a,b.

This is why linear algebra is called linear algebra. In essence, a linear transformation is a mapping between two vector spaces that preserves the algebraic structure: addition and scalar multiplication. (Functions between vector spaces are often called transformations, so we will use this terminology.)

Remark 5.

Linearity is essentially combining two properties in one: f(x + y) = f(x) + f(y) and f(ax) = af(x) for all vectors x,y and all scalars a. From these two, (4.1) follows by

f(ax + by) = f(ax) + f(by) = af(x)+ bf (y ).

Two properties immediately jump out from the definition. First, since

f(x) = f(x + 0) = f(x) + f(0),

f(0) = 0 holds for every linear transformation. In addition, the composition of linear transformations is still linear, as

f (g(ax + by)) = f(ag(x)+ bg(y)) = af(g(x))+ bf(g(y))

shows for any linear f and g and scalars a and b.

As usual, let’s see some examples to build intuition.

Example 1. For any scalar c, the scaling transformation f(x) = cx is linear.

This is probably the simplest example out there, and it can be defined in all vector spaces.

PIC

Figure 4.1: Scaling as a linear transformation

It’s easy to see that scaling is linear:

c(ax + by) = c(ax)+ c(by) = a(cx)+ b(cy).

Example 2. In ℝ2, rotations around the origin by an angle α are also linear.

PIC

Figure 4.2: Rotation in the Euclidean plane as a linear transformation

To show that rotations are indeed linear, I pull the definition out from the hat: the rotation of a planar vector x = (x1,x2) with the angle α is described by

f(x) = (x1cosα − x2 sinα, x1sinα + x2cos α),

from which (16) is easily confirmed. I know that this looks like magic, but trust me, the rotation formula will be explained in detail. You can sweat it out with some basic trigonometry, or wait until we do this later with matrices.

In general, linear transformations have a strong connection with the geometry of the space. Later, we are going to study the linear transformations of ℝ2 in detail, with an emphasis on geometric ones such as this. (Note that rotations are slightly more complicated in higher dimensions, as they will require an axis to rotate around.)

Example 3. In any vector space V and a nonzero vector v ∈V , the translation defined by f(x) = x + v is not linear, as f(0) = v≠0.

We’ll see more examples later in the section. For now, let’s move on to some general properties of linear transformations. For any linear transformation f : U →V , the image

im(f) = {v ∈ V : v = f (u) for some u ∈ U }

is always a subspace Section 1.2.7 of V. This is easy to check: if v1, v2 ∈ im f , then there exist u1,u2 ∈ U such that f(u1) = v1 and f(u2) = v2, as

av1 + bv2 = af(u1)+ bf (u2 ) = f (au1 + bu2) ∈ im f.

To add one more level of abstraction, we will see that the set of all linear transformations form a vector space.

Theorem 18.

Let U and V be two vector spaces over the same field F. Then the set of all linear transformations

L(U,V ) = {f : U → V | f is linear}

(4.2)

is also a vector space over F, with the usual definitions for function addition and scalar multiplication.

The proof of this is just a boring checklist, going through the items of the definition of vector spaces (Definition 2). I recommend you walk through it at least once to solidify your understanding of vector spaces, but there is really nothing special there.

The definition of linear transformations, as we saw, is a bit abstract. However, there is a simple and expressive way to characterize them.

To see this, let f : U →V be a linear transformation between two vector spaces U and V . Suppose that {u1,…,um} is a basis in U, while {v1,…,vn} is a basis in V . Since every x ∈U can be written in the form

 m ∑ x = xiui, i=1

the linearity of f implies

f( ∑ j=1m xj uj ) = ∑ j=1m xj f(uj),

(4.3)

meaning that f(x) is a linear combination of f(u1),…,f(um). In other words, every linear transformation is completely determined by the images of basis vectors. To expand this idea, suppose that for every uj, we have

 ∑n f(uj) = ai,jvi i=1

for some scalars ai,j.

These n ×m numbers completely describe f. For notational simplicity, we store these in a n ×m-sized table called a matrix, which we’ll denote by Af:

 ⌊ ⌋ a1,1 a1,2 ... a1,m | | ||a2,1 a2,2 ... a2,m|| f ↔ Af = || .. .. ... .. || , ⌈ . . . ⌉ an,1 an,2 ... an,m

meaning that linear transformations are represented by matrices. This connection is heavily utilized throughout machine learning.

Expanding (4.3) further, for every x = ∑ j=1mxjuj we have

 ∑m f(x) = xjf(uj) j=1 ∑m ∑n = xj ai,jvi j=1 i=1 n ( m ) = ∑ ( ∑ a x ) v . i,j j i i=1 j=1

Thus, the image of x can be expressed as Afx:

 ⌊ ⌋ ⌊ ⌋ ⌊∑m ⌋ |a1,1 a1,2 ... a1,m | |x1 | | j=1 a1,jxj| |a2,1 a2,2 ... a2,m | |x2 | |∑m a2,jxj| f(x) = || . . . . || || . || = || j=1. || . |⌈ .. .. .. .. |⌉ |⌈ .. |⌉ |⌈ .. |⌉ a a ... a , x ∑m a x n,1 n,2 n,m m j=1 n,j j

Two things to note here. First, we implicitly chose to represent vectors as columns instead of rows. This is a seriously impactful decision and will affect many of the computations later in this book. We’ll keep pointing it out.

Second, the matrix representation depends on the choice of the basis! If, say, P = {p1,…,pn}⊂U is the basis of our matrix, we denote this dependence in the subscript, writing Af,P .

To avoid confusion, we’ll almost exclusively define linear transformations by giving their matrices in the standard orthonormal basis. In practical scenarios, this makes it much easier to understand what is going on. So, whenever I write something like “let A be the matrix of a linear transformation f”, it is implictly assumed that A is written in the basis e1 = (1,0,…,0),e2 = (0,1,…,0),…,en = (0,0,…,1).

On a philosophical note, have you heard about Plato’s allegory of the cave? In this thought experiment, people are assumed to be living in a cave constantly facing a single wall, only observing their shadows projected by a fire behind them. What they observe and use to build an internal representation of the world is very different from reality. Applying this analogy to linear algebra, matrices are the shadows that we observe and use in practical scenarios. In many introductory courses, linear transformations are hidden, and only matrix calculus is taught. My first exposition into the subject was similar: the first linear algebra course I took talked exclusively about matrices. It was as complicated and confusing as a math course can be. (Which, I can assure you, can be very complicated and confusing.) Later in my studies, everything clicked when I discovered that you could look at matrices from the perspective of linear transformations.

Without seeing what is behind matrices, it is impossible to master linear algebra. If my approach feels too abstract for you, keep this in mind: years later, when you are a practicing data scientist/machine learning engineer/researcher or whatever, going below the surface will pay huge dividends.

Let’s get back on track and continue our discussion about linear transformations. The most commonly used matrix is the matrix of the identity transformation id : x→x. We’ll denote this by I. It is easy to see that

L(U,V ) = {f : U → V | f is linear}

(4.4)

To summarize, for a matrix A, a linear transformation can be given by x→Ax. In fact, the mapping

f ↦→ Af,P

defines a one-to-one correspondence between the space of linear transformations L(U,V ) defined by (4.2) and the set of n ×m matrices, where n and m are the corresponding dimensions.

Functions can be added and composed. Because of the connection between linear transformations and matrices, matrix operations are inherited from the corresponding function operations.

With this principle in mind, we defined matrix addition so that the the matrix of the sum of two linear transformations is the sum of the corresponding matrices.

Mathematically speaking, if f,g : U →V are two linear transformations with matrices, f ↔︎A and g ↔︎B, then

 n (f + g)(u ) = f (u )+ g(u ) = ∑ (a + b )v . j j j i=1 i,j i,j i

Thus, the corresponding matrices can be added together elementwise:

A + B = (ai,j + bi,j)n,m . i,j=1

Multiplication between matrices is defined by the composition of the corresponding transformations.

To see how, we study a special case first. (In general, it is a good idea to look at special cases first, as they often reduce the complexity and allow you to see patterns without information overload.) So, let f,g : U →U be two linear transformations, mapping U onto itself. To determine the elements of the matrix corresponding to f ∘g, we have to express f(g(uj)) in terms of all the basis vectors u1,…,un. For this, we have

 n (f g)(u ) = f(g(u )) = f(∑ b u ) j j k,j k n k=1 ∑ = bk,jf(uk) k=n1 n ∑ ∑ = bk,j ai,kui k=1 i=1 ∑n ∑n = ( ai,kbk,j)ui. i=1 k=1

By considering how we defined a transformation’s matrix, the scalar (∑ k=1nai,kbk,j) is the element in the i-th row and j-th column of the matrix of f ∘g. Thus, matrix multiplication can be defined by

 ( )n ∑n AB = ai,kbk,j . k=1 i,j=1

In the general case, we can only define the product of matrices if the corresponding linear transformations can be composed. That is, if f : U →V , then g must start from V . Translating this into the language of the matrices, the number of columns in A must match the number of rows in B. So, for any A ∈ℝn×m and B ∈ℝm×l, their product is defined by

 ∑m AB = ( ai,kbk,j)n,l ∈ ℝn×l. k=1 i,j=1

Regarding linear transformations, the question of invertibility is extremely important. For example, have you encountered a system of equations like this?

2x1 + x2 = 5 x1 − 3x2 = − 8

If we define

 ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ 2 1 5 x1 A = ⌈ ⌉ , b = ⌈ ⌉ , x = ⌈ ⌉ , 1 − 3 − 8 x2

the above system can be written in the form Ax = b. These are called linear equations, modeling various processes from finance to biology.

How would you write the solution of such an equation? If there would be a matrix A−1 such that A−1A is the identity matrix I (defined by (4.4)), then multiplying the equation Ax = b from the left by A−1 would yield the solution in the form x = A−1b.

The matrix A−1 is called the inverse matrix of A. It might not always exist, but when it does, it is extremely important for several reasons. We’ll talk about linear equations later, but first, let’s study the fundamentals of invertibility! Here is the general definition.

Definition 17. (Inverse of a linear transformation)

Let f : U →V be a linear transformation between the vector spaces U and V . We say that f is invertible if there is a linear transformation f−1 such that f−1 ∘f and f ∘f−1 are the identity functions; that is,

f− 1(f (u )) = u, − 1 f(f (v )) = v

holds for all u ∈U,v ∈V . f−1 is called the inverse of f.

Not all linear transformations are invertible. For instance, if f maps all vectors to the zero vector, you cannot define an inverse.

There are certain conditions that guarantee the existence of the inverse. One of the most important ones connects the concept of basis with invertibility.

Theorem 19. (Invertibility of linear transformations)

Let f : U →V be a linear transformation and let u1,…,un be a basis in U. Then f is invertible if and only if f(u1),…,f(un) is a basis in V .

The following proof is straightforward, but can be a bit overwhelming. Feel free to skip this at the first reading, you can always revisit it later.

Proof. As usual, the proof of the if and only if type theorems consist of two parts, as these statements involve two implications.

(a) First, we prove that f is invertible, then f(u1),…,f(un) is a basis. That is, we need to show that f(u1),…,f(un) is linearly independent and every y ∈V can be written as their linear combination.

Since f is invertible, f(0) = 0, moreover there are no nonzero vectors x ∈ U such that f(x) = 0. In other words, 0 cannot be written as the nontrivial linear combination of f(u1),…,f(un), from which Theorem 3 implies the linear independence.

On the other hand, invertibility implies that every

can be obtained as

for some

. (With the choice

.) As

is a basis,

. Thus,

y = f(x) ∑n = f( xiui) i=1 ∑n = xif(ui), i=1

showing that span(f(u1),…,f(un)) = V .

The linear independence f(u1),…,f(un) and the fact that it spans V gives that it is indeed a basis.

(b) Now we prove the other implication: if f(u1),…,f(un) is a basis, then f is invertible.

If f(u1),…,f(un) is indeed a basis, then every y ∈V can be written as

 n n ∑ ∑ y = yif (ui) = f( yiui), i=1 i=1

which shows the surjectivity. Regarding the injectivity, if y = f(a) = f(b) for some a,b ∈U, then, since both a and b can be written as a linear combination of the ui basis vectors, we would have

 n n ∑ ∑ y = f(a) = f( aiui) = aif (ui) i=1 i=1

and

 ∑n ∑n y = f(b) = f( biui) = yif(ui). i=1 i=1

Thus, 0 = ∑ i=1n(ai−bi)ui, and since u1,…,un is a basis in U, ai = bi must hold. Hence f is injective.

A consequence of this theorem is that a linear transformation f : U →V is not invertible if the dimensions of U and V are different. We can look at invertibility from the aspect of matrices as well. For any A ∈ℝn×n, if the corresponding linear transformation is invertible, there exists a matrix A−1 ∈ℝn×n such that A−1A = AA−1 = I. If a matrix is not square, it is not invertible in the classical sense.

Regarding the invertibility of a linear transformation, two special sets play an essential role: the kernel and the image. Let’s see them!

Definition 18. (Kernel and image of linear transformations)

Let f : U →V be a linear transformation. Its image and kernel is defined by

im f := {f(u) : u ∈ U} ⊆ V

and

kerf := {u ∈ U : f(u ) = 0} ⊆ U.

Often, we write imA and kerA for some matrix A, referring to the linear transformation defined by x→Ax. Due to the linearity of f, it is easy to see that imf is a subspace of V and kerf is a subspace of U. As mentioned, they are closely connected with invertibility, as we shall see next.

Theorem 20. (Invertibility in terms of linear transformations)

Let f : U →V be a linear transformation.

(a) A is injective if and only if kerf = {0}.

(b) A is surjective if and only if imf = V .

(c) A is bijective (that is, invertible) if and only if kerf = {0}and imf = V .

Proof. (a) If f is injective, there can only be one vector in U that is mapped to 0. Since f(0) = 0 for any linear transformation, kerf = {0}.

On the other hand, if there are two different vectors x,y ∈ U such that f(x) = f(y), then f(x−y) = f(x) −f(y) = 0, so x−y ∈ kerf. Thus, kerf = {0} implies x = y, which gives the injectivity.

(b) This is just the definition of surjectivity.

(c) This immediately follows from combining (a) and (b) above.

Because matrices define linear transformations, it makes sense to talk about the inverse of a matrix.

Algebraically speaking, the inverse of an A ∈ℝn×n is the matrix A−1 ∈ℝn×n such that A−1A = AA−1 = I holds. The connection between linear transforms and matrices imply that A−1 is the matrix of f−1, so no surprise here.

Don’t worry if this section about invertibility feels like a bit too much algebra. Later, when talking about the determinant of a transformation, we are going to study invertibility from a geometric perspective later in this chapter. In terms of matrices, later we are going to see a general method to calculate the inverse matrix in Section 5.1.6. We’ll be there soon, but first, we take a look at how the choice of basis determines the matrix representation.

day-mode Bookmark

Previously in this section, we have seen that any linear transformation can be described with the images of the basis vectors (see Section 4.1.1). This gave us the matrix representation that we use all the time. However, this very much depends on the choice of basis. Different bases yield different matrices for the same transformation.

For instance, let’s take a look at f : ℝ2 →ℝ2, which maps e1 = (1,0) to the vector (2,1) and e2 = (0,1) to (1,2). Its matrix in the standard orthonormal basis E = {e1,e2} is given by

L(U,V ) = {f : U → V | f is linear}

(4.5)

PIC

Figure 4.3: The linear transformation f, defined by (5.2)

The effect of f is visualized in Figure 4.3.

What if we select a different basis, say P = {p1 = (1,1),p2 = (−1,1)}? With a quick calculation, we can check that

⌊ ⌋ ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ |2 1| 1 3 |2 1| − 1 − 1 |⌈1 2|⌉ ⌈ ⌉ = ⌈ ⌉ , |⌈1 2|⌉ ⌈ ⌉ = ⌈ ⌉ . 1 3 1 1

In other words, f(p1) = 3p1 + 0p2 and f(p2) = 0p1 + p2. This is visualized by Figure 4.4.

PIC

Figure 4.4: The effect of f on p1 = (1,1) and p2 = (−1,1)

This means that if P = {p1,p2} is our basis (thus, if writing (a,b) means ap1 + bp2), the matrix of f becomes

 ⌊ ⌋ |3 0| Af,P = |⌈0 1|⌉ .

In this form, Af,P is a diagonal matrix. (That is, its elements below and above the diagonal are zero.) As you can see, having the right basis can significantly simplify the linear transformation. For instance, in n dimensions, applying a transformation in diagonal form requires only n operations, as

⌊ ⌋⌊ ⌋ ⌊ ⌋ d1 0 ... 0 x1 d1x1 || 0 d ... 0 |||| x || || d x || || 2 |||| 2|| = || 2 2|| |⌈ ... ... ... ... |⌉|⌈ ...|⌉ |⌈ ... |⌉ 0 0 ... dn xn dnxn

Otherwise, n2 operations are needed. So, we can save a lot there.

We have just seen that the matrix of a linear transformation depends on our choice of basis. However, there is a special relation between matrices of the same transformation. We’ll explore this next. Let f : U →U be a linear transformation, and let P = {p1,…,pn} and Q = {q1,…,qn be two bases. As before, Af,S denotes the matrix of f in some basis S.

Suppose that we know Af,P , but we have our vectors represented in terms of the other basis Q. How do we calculate the images our vectors under the linear transformation? A natural idea is to first transform our vector representations from Q to P, apply Af,P , then transform the representations back. In the following, we are going to make this precise.

Let

be a transformation defined by

for all

. (In other words,

maps one set of basis vectors to another.) Since

and

are bases (so the sets are linearly independent),

is invertible.

Suppose that the matrix

is known to us, that is,

 ∑n Q f(qj) = Af,Qqj = ai,jqi i=1

holds for all

. So, we have

 −1 −1 (t ft)(pj ) = t f(qj) ∑n = t−1( aQi,jqi) i=1 ∑n = aQi,jt−1(qi) i=1 ∑n = aQi,jpi. i=1

In other words, the matrix of the composed transformation t−1ft in the basis P is the same as the matrix of f in Q. In terms of formulas,

T−1 A f,P T = Af,Q,

(4.6)

where T denotes the matrix of t in P. (For notational simplicity, we omit the subscript. Most often, we don’t care what base it is in.)

We’ll call T the change of basis matrix. These types of relations are prevalent in linear algebra, so we’ll take the time to introduce a definition formally.

Definition 19. (Similar matrices)

Let A,B ∈ℝn×n be two arbitrary matrices. A and B are called similar if there exists a matrix T ∈ℝn×n such that

 − 1 B = T AT

holds. We call mappings of the form A→T−1AT similarity transformations.

In these terms, (4.6) says that the matrices of a given linear transformation are all similar to each other.

With this under our belt, we can finish up with the example (4.5). In this case, T and T−1 can be written as

 ⌊ ⌋ ⌊ ⌋ | 1 − 1| | 1∕2 1∕2| T = |⌈ 1 1|⌉ , T −1 = |⌈− 1∕2 1∕2|⌉ .

(Later, we’ll see a general method to compute the inverse of any matrix, but for now, you can verify this by hand.) Thus,

L(U,V ) = {f : U → V | f is linear}

(4.7)

or equivalently,

L(U,V ) = {f : U → V | f is linear}

(4.8)

Figure 4.5 shows what (4.8) looks like in geometric terms.

PIC

Figure 4.5: Change of basis, illustrated

From this example, we can see that a properly selected similarity transformation can diagonalize certain matrices. Is this a coincidence? Spoiler alert: no. In Chapter 7, we will see exactly when and how this can be done.

I know, this is a bit too abstract. As always, examples illustrate a concept best, so let’s see some!

day-mode Bookmark

4.3 Linear transformations in the Euclidean plane

Section titled “4.3 Linear transformations in the Euclidean plane”

We have just seen that a linear transformation can be described by the image of a basis set. From a geometric viewpoint, they are functions mapping parallelepipeds to parallelepipeds.

Because of the linearity, you can imagine this as distorting the grid determined by the bases.

PIC

Figure 4.6: How linear transforms distort the grid determined by the basis vectors

In two dimensions, we have seen a few examples of geometric maps such as scaling and rotation as linear transformations. Now we can put them into matrix form. There are five of them in particular that we will study: stretching, shearing, rotation, reflection, and projection.

These simple transformations are not only essential to build intuition, but they are also frequently applied in computer vision. Flipping, rotating, and stretching are essential parts of image augmentation pipelines, greatly enhancing the performance of models.

The simplest one is a generalization of scaling. We have seen a variant of this in Example 1 above (see Section 4.1). In matrix form, this is given by

 ⌊ ⌋ c1 0 A = ⌈ ⌉ , c1,c2 ∈ ℝ. 0 c2

Linear transformations such as this can be visualized by plotting the image of the unit square determined by the standard basis e1 = (1,0),e2 = (0,1).

PIC

Figure 4.7: Stretching

Rotations are given by the matrix

 ⌊ ⌋ cosα − sinα R α = ⌈ ⌉. sinα cosα

To see why, recall that each column of the transformation’s matrix describes the image of the basis vectors. The rotation of (1,0) is given by (cosα,sinα), while the rotation of (0,1) is (cos(α + π∕2),sin(α + π∕2)). This is illustrated by Figure 4.8.

PIC

Figure 4.8: The rotation matrix explained

Like above, we can visualize the image of the unit square to gain a geometric insight into what is happening.

PIC

Figure 4.9: Rotation

Another essential geometric transform is shearing, which is frequently applied in physics. A shearing force (https://en.wikipedia.org/wiki/Shear_force) is a pair of forces with opposite directions, acting on the same body.

PIC

Figure 4.10: Shearing

Its matrix is given in the form

 ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ Sx = ⌈1 kx⌉ , Sy = ⌈ 1 0⌉, S = ⌈1 kx⌉ , 0 1 ky 1 ky 1

where Sx, Sy, and S represent shearing transformations in the x, y, and in both directions.

Until this point, all the transformations we have seen in the Euclidean plane preserved the “orientation” of the space. However, this is not always the case. The transformation given by the matrices

 ⌊ ⌋ ⌊ ⌋ − 1 0 1 0 R1 = ⌈ ⌉ , R2 = ⌈ ⌉ 0 1 0 − 1

act as reflections with respect to the x and the y axes.

PIC

Figure 4.11: Reflection

When combined with a rotation, we can use reflections to flip bases. For instance, the transformation maps e1 to e2 and e2 to e1.

 ⌊ ⌋ ⌊ ⌋ ⌊ ⌋ R = ⌈0 − 1⌉ ⌈1 0⌉ = ⌈0 1⌉ 1 0 0 − 1 1 0 ◟--◝◜--◞ ◟---◝◜--◞ rotation with π∕2 =R2

PIC

Figure 4.12: Swapping e1 and e2 is a reflection and rotation

These types of transformations play an essential role in understanding determinants, as we will soon see in the next chapter.

In general, reflections can be easily defined in higher dimensional spaces. For instance,

 ⌊ ⌋ 1 0 0 R = ||0 1 0 || ⌈ ⌉ 0 0 − 1

is a reflection in ℝ3 that flips e3 to the opposite direction. It is just like looking in the mirror: it turns left to right and right to left.

Reflections can flip orientations multiple times. The transformation given by

 ⌊ ⌋ 1 0 0 R = || || ⌈0 − 1 0⌉ 0 0 − 1

flips e2 and e3, changing the orientation twice. Later, we’ll see that the “number of changes in orientation” of a given transformation is one of its essential descriptors.

One of the most important transformations (not only in two dimensions) is the orthogonal projection. We have seen this already when talking about inner products and their geometric representation in Section 2.2.3. By taking a closer look, it turns out that they are linear transformations.

PIC

Figure 4.13: Orthogonal projection

Recall from (3.2.3) that the orthogonal projection of x to some y can be written as

proj (x) = ⟨x,y⟩y. y ⟨y,y⟩

The bilinearity of ⟨⋅,⋅⟩ immediately implies that projy(x) is also linear. With a bit of algebra, we can rewrite this in terms of matrices. We have

projy(x) = ⟨x,y-⟩y ⟨y,y ⟩ ⌊ ⌋ = x1y1-+-x2y2⌈y1 ⌉ ∥y ∥2 y2 ⌊ ⌋ ⌊ ⌋ 1 y21 y1y2 x1 = ----2⌈ 2 ⌉ ⌈ ⌉ ∥y ∥ y1y2 y2 x2 1 = ----2yyT x, ∥y ∥

thus,

 ⌊ ⌋ 1 y2 y y projy = ----2⌈ 1 1 2⌉ ∥y ∥ y1y2 y22 1 = ----2yyT x ∥y ∥

Notice that

 y2 projy(e2) = y1 projy(e1),

so the images of the standard basis vectors are not linearly independent. As a consequence, the image of the plane under projy is span(y), which is a one-dimensional subspace. From this example, we can see that the image of a vector space under a linear transformation is not necessarily of the same dimension as the starting space.

With these examples and knowledge under our belt, we have a basic understanding of linear transformations, the most basic building blocks of neural networks. In the next section, we will study how linear transformations affect the geometric structure of the vector space.

day-mode Bookmark

4.4 Determinants, or how linear transformations affect volume

Section titled “4.4 Determinants, or how linear transformations affect volume”

In Section 4.3, we have seen that linear transformations (Definition 16) can be thought of as distorting the grid determined by the basis vectors.

Following our geometric intuition, we suspect that measuring how much a transformation distorts volume and distance can provide some valuable insight. As we will see in this chapter, this is exactly the case. Transformations that preserve distance or norm are special, giving rise to methods such as Principal Component Analysis.

4.4.1 How linear transformations scale the area

Section titled “4.4.1 How linear transformations scale the area”

Let’s go back to the Euclidean plane one more time. Consider any linear transformation A, mapping the unit square to a parallelogram.

PIC

Figure 4.14: Image of the unit square under a linear transformation

The area of this parallelogram describes how A scales the unit square. Let’s call it λ for now; that is,

area(A (C )) = λ ⋅area(C),

where C = [0,1] × [0,1] is the unit square, and A(C) is its image

A(C ) := {Ax : x ∈ C }.

Due to linearity, λ also matches the scaling ratio between the area of any rectangle (with parallel sides to the coordinate axes) and its image under A. As Figure 4.15 shows, we can approximate any planar object as the union of rectangles.

If all rectangles are scaled by λ, then unions of rectangles also scale by that factor. Thus, it follows that λ is also the scaling ratio between any planar object E and its image A(E) = {Ax : x ∈E}.

PIC

Figure 4.15: Approximating planar objects with a union of rectangles

This quantity λ reveals a lot about the transformation itself, but there is a question remaining: how can we calculate it?

Suppose that our linear transformation is given by

 ⌊ ⌋ x y A = ⌈ 1 1⌉ , x2 y2

thus its columns x = (x1,x2) and y = (y1,y2) describe the two sides of the parallelogram. This is the image of the unit square.

PIC

Figure 4.16: Image of the unit square under a linear transformation

Our area scaling factor λ equals the area of this parallelogram, so our goal is to calculate this.

The area of any parallelogram can be calculated by multiplying the length of the base (∥x∥ in this case) with the height h. (You can easily see this by cutting off a triangle at the right side of the parallelogram and putting it to the left side, rearranging it as a rectangle.) h is unknown, but with basic trigonometry, we can see that h = sinα∥y∥, where α is the angle between x and y.

Thus,

area = sin α∥y∥∥x ∥.

This is almost the dot product of x and y. (Recall that the dot product can be written as ⟨x,y⟩ = ∥x∥∥y∥cosα.) However, the sinα part is not a match.

Fortunately, there is a clever trick we can use to turn this into a dot product! Since sinα = cos(α −π 2), we have

 π- area = cos(α− 2)∥x∥∥y ∥.

The issue is the angle between x and y is not α −π 2. However, we can solve this easily by applying a rotation (Section 4.3.2). Applying the transformation

 ⌊ ⌋ 0 1 R = ⌈ ⌉, − 1 0

we obtain

y = Ry = (y,− y ). rot 2 1

Since

, we have

area = sin α∥y∥∥x ∥ π = cos(α − 2)∥x ∥∥y∥ π = cos(α − 2)∥x ∥∥yrot∥ = ⟨x,yrot⟩.

The quantity ⟨x,yrot⟩ can be calculated using only the elements of the matrix A:

⟨x, yrot⟩ = x1y2 − x2y1.

Notice that ⟨x,yrot⟩ can be negative! This happens when the angle between y = Ae2 and x = Ae1, measured from a counter-clockwise direction, is larger than π, as this implies cos(α −π 2)gt;0.

Hence, the quantity ⟨x,yrot⟩ is called the signed area of the parallelogram.

In two dimensions, we call this the determinant of the linear transformation. That is, for any given linear transformation/matrix A ∈ℝ2×2, its determinant is defined by

L(U,V ) = {f : U → V | f is linear}

(4.9)

The determinant is often written as jAj, but we’ll avoid this notation. We’ll deal with determinants for any matrix A ∈ℝn×n, but let’s stay with the 2 × 2 case just a bit to build intuition.

The determinant also reveals the orientation of the vectors: positive determinant means positive orientation, negative determinant means negative orientation. (Intuitively, positive orientation means that the angle measured from x to y in a counter-clockwise direction is between 0 and π; equivalently, the angle measured from x to y in a clockwise direction is between π and 2π.) This is demonstrated in Figure 4.17 below.

PIC

Figure 4.17: Orientation of two vectors in the plane

Overall,

area(A(E)) = |detA|area(E)

(4.10)

holds, where E ⊆ℝ2 is a planar object, and

A (E) = {Ax : x ∈ E }

is the image of E under the transformation A.

Even though we have only shown (5.4.1) in two dimensions, this holds in general. (Although we don’t know how to define the determinant there yet.)

So, if e1 and e2 is a basis on the plane, equations (5.4.1) and (5.4.1) tell us that the determinant in two dimensions equals to

det A = orientation(Ae ,Ae )× area(Ae ,Ae ) 1 2 1 2

Based on the example of the Euclidean plane, we have built enough geometric intuition on understanding how linear transformations distort volume and change the orientation of the space. These are described by the concept of determinants, which we have defined in the special case (5.4.1). We are going to move on to study the concept in its full generality.

To introduce the formal definition of the determinant, we will take a route that is different from the usual. Most commonly, the determinant of a linear transformation A is defined straight away with a complicated formula, then all of its geometric properties are shown.

Instead of this, we will deduce the determinant formula by generalizing the geometric notion we have learned in the previous section. Here, we are roughly going to follow the outline of Linear Algebra and Its Applications by Peter D. Lax.

We set the foundations by introducing some key notations. Let

A = (ai,j)ni,j=1 ∈ ℝn ×n

be a matrix with columns a1,…,an. When we introduced the notion of matrices as linear transformations in Section 4.1.1 , we saw that the i-th column is the image of the i-th basis vector. For simplicity, let’s assume that e1,e2,…,en is the standard orthonormal basis, that is, ei is the vector whose i-th coordinate is 1 and the rest is 0. Thus, Aei = ai.

During our explorations in the Euclidean plane Section 4.3, we have seen that the determinant is the orientation of the images of basis vectors, times the area of the parallelogram defined by them. Following this logic, we could define the determinant for n ×n matrices by

det A = orientation(Ae1,...,Aen )× volume(Ae1, ...,Aen )

Two questions surface immediately. First, how do we define the orientation of multiple vectors in the n-dimensional space? Second, how can we even calculate the area?

Instead of finding the answers for these questions, we are going to add a twist into the story: first, we’ll find a convenient formula for determinants, then use it to define orientation.

To make the relation between the determinant and the columns of the matrix ai = Aei more explicit, we’ll write

det A = det(a1,...,an ).

Thinking about determinants this way, det is just a function of multiple variables:

det : ℝn × ⋅⋅⋅× ℝn → ℝ. ◟-----◝◜----◞ n times

Good news: det(a1,…,an) is linear in each variable. That is,

det(a1,...,αai+ βbi,...an) = α det(a1,...,ai,...an )+β det(a1,...,bi,...an)

holds. We are not going to prove this, but as the determinant represents the signed volume, you can convince yourself by checking out Figure 4.18.

PIC

Figure 4.18: The multilinearity of det(a1,a2)

A consequence of linearity is that we can express the determinant as a linear combination of determinants for the standard basis vectors e1,…,en. For instance, consider the following. Since

 n Ae = a = ∑ a e, 1 1 i,1 i i=1

we have

 n ∑ det(a1,a2,...,an) = ai,1 det(ei,a2,...,an). i=1

Going one step further and using that

 ∑n a2 = aj,2ej, j=1

we start noticing a pattern. With the linearity, we have

det(a1, a2,…, an) = ∑ i=1n ∑ j=1n ai,1 aj,2 det(ei, ej, a3,…, an).

(4.11)

We can see that the row indices in the coefficients ai,1aj,2 match the indices of ek-s in det(ei,ej,a3,…,an). In the general case, this pattern can be formalized in terms of permutations; that is, orderings of the set {1,2,…,n}.

You can imagine a permutation as a function σ mapping {1,2,…,n} to itself in a way that for every j ∈{1,2,…,n}, there is exactly one i ∈{1,2,…,n} with σ(i) = j. In other words, you take every integer between 1 and n, and putting them in an order. The set of all possible permutations on {1,2,…,n} is denoted by Sn.

Continuing (5.4.2) and further expanding the determinant of A, we have

 ∑ ∏n det(a1,...,an) = [ aσ(i),i]det(eσ(1),...,eσ(n)). σ∈Sn i=1

This formula is not the easiest one to understand. You can think about each term ∏ i=1naσ(i),i as placing n chess rooks on an n×n board such that none of them can capture each other.

PIC Figure 4.19: The anatomy of the term aσ(1)1⋅⋅⋅aσ(n)n

The formula

∑ [∏n ] aσ(i),i det(eσ(1),...,e σ(n)) σ∈Sn i=1

combines all the possible ways we can do this.

There is only one thing left: calculating det(eσ(1),…,eσ(n)).

Remember when we discussed the combination of reflections and rotations in the Euclidean plane (Section 4.3.4)? The transformation determined by ei→eσ(i) is similar to that. When talking about permutations, it’s good to know that each one can be obtained by switching two elements at a time. The number of transpositions - that is, permutations affecting two elements - in a permutation is called the sign of σ. In the context of our linear transformation ei→eσ(i), the number of transpositions in σ is the number of reflections required and sign(σ) is the orientation of (eσ(1),…,eσ(n)).

Thus, with these, we can finally give a formal definition for determinants and the orientation.

Definition 20. (Determinants and orientation)

Let A ∈ℝn×n be an arbitrary matrix and let ai ∈ℝn be its i-th column. The determinant of A is defined by

detA = det( a1,…, an) = ∑ σ∈Sn sign(σ) [ ∏ i=1n a σ(i),i ],

(4.12)

and the orientation of the vectors a1,…,an is

orientation(a1,...,an ) := sign(detA ).

When the det notation is not convenient, we denote determinants by putting the elements of the matrix inside a big absolute value sign:

 || || ||a1,1 a1,2 ... a1,n|| |a2,1 a2,2 ... a2,n| detA = || . . . . ||. || .. .. .. .. || || || an,1 an,2 ... an,n

When I was a young math student, the determinant formula (4.12) was presented as-is in my first linear algebra class. Without explaining the connection to volume and orientation, it took me years to properly understand it. I still think that the determinant is one of the most complex concepts in linear algebra, especially when presented without a geometric motivation for the definition.

Now that you have a basic understanding of the determinant, you might ask: how can we calculate it in practice? Summing over the set of all permutations and calculating their sign is not an easy operation from a computational perspective.

Good news: there is a recursive formula for the determinant. Bad news: for an n×n matrix, it involves n pieces of (n − 1) × (n − 1) matrices. Still, it is a big step from the permutation formula. Let’s see it!

Theorem 21. (Recursive formula for determinants)

Let A ∈ℝn×n be an arbitrary square matrix. Then

detA = ∑ j=1n (−1)j+1 a 1,j detA1,j,

4.13

where Ai,j is the (n − 1) × (n − 1) matrix obtained from A by removing its i-th row and j-th column.

Instead of a proof, we are going to provide an example to demonstrate the formula. For 3 × 3 matrices, this is how it looks:

| | ||a b c|| || || || || || || || || ||e f|| ||d f|| ||d e|| ||d e f||= a ||h i||− b||g i||+ c||g h||. |g h i|

Now that we have both the geometric intuition and the recursive formula, let’s see the most important properties of the determinants!

4.4.3 Fundamental properties of the determinants

Section titled “4.4.3 Fundamental properties of the determinants”

When working with determinants, we prefer to create basic building blocks and rules for combining them. (As we have seen with this pattern so many times, even when deducing the (4.12).) These rules are manifested by the fundamental properties of determinants, which we will discuss now.

The first property is concerned with the relation of composition and the determinant.

Theorem 22. (The product of determinants)

∈ℝn×n be two matrices. Then

detAB = detAdetB.

(4.14)

The equation (4.14) is called the determinant product rule, and its proof involves some heavy computations based on the formulas (4.12) and (4.13). Instead of providing a fully fleshed-out proof, I’ll give an intuitive explanation. After all, we want to build algorithms using mathematics, not building mathematics.

So, the explanation of detAB = detAdetB is quite simple. If we think about the matrices A,B ∈ℝn×n as linear transformations, we have just seen that detA and detB determine how they scale the unit cube.

Since the composition of these linear transformations is the matrix product AB, the linear transformation AB scales the unit cube to a parallelepiped with signed volume detAdetB. (Because applying AB is the same as applying B first, then applying A on the result.)

Thus, by our understanding of the determinant, as the scaling factor of AB is also detAB, (4.14) holds.

We can do the actual proof of this, for example, by induction based on the recursive formula (4.13), leading to a long and involved calculation.

An immediate corollary of the product rule is a special relation between the determinants of a matrix and its inverse.

Theorem 23.

Let A ∈ℝn×n be an arbitrary invertible matrix. Then

detA −1 = (det A)−1.

Proof. Using the product rule, we have

1 = detI = detAA −1 = (det A)(detA −1),

from which the theorem follows.

Because of this, we can also conclude that the determinant is preserved by the similarity relation.

Theorem 24.

Let A,B ∈ ℝn×n be two similar matrices with B = T−1AT for some T ∈ℝn×n. Then

detA = detB.

Proof. This simply follows from

 −1 detB = det T AT = det T−1 detA detT = det A,

which is what we had to show.

Another important consequence is that the determinant is independent of the basis the matrix is in. If A : U →U is a linear transformation, and P = {p1,…,pn} and R = {r1,…,rn} are two bases of U, then we know that the matrices of the transformation are related (Section 4.2.1) by

AP = T−1ART,

where AS is the matrix of the transformation A in a basis S and T ∈ℝn×n is the change of basis matrix (Section 4.2.1). The previous theorem implies that detAP = detAR. Thus, the determinant is properly defined for linear transformations, not just matrices!

There is an essential duality relation regarding determinants: you can swap the rows and columns of a matrix, keeping all determinant-related identities true.

Theorem 25.

Let A ∈ℝn×n be an arbitrary matrix. Then

detA = detAT .

Proof. Suppose that A = (ai,j)i,j=1n. Let’s denote the elements of its transpose by ai,jt = aj,i. According to (4.12), we have

 T ∑ ∏n t detA = sign (σ ) aσ(i),i σ∈Sn i=1 ∑ ∏n = sign (σ ) ai,σ(i). σ∈Sn i=1

Now comes the trick. Since the product ∏ i=1nai,σ(i) iterates through all i-s, and the order of the terms doesn’t matter, we might as well order the terms as i = σ−1(1),…,σ−1(n). Since

sign(σ −1) = sign(σ),

by continuing the above calculation, we have

 n n ∑ sign(σ)∏ a = ∑ sign(σ−1)∏ a . i,σ(i) σ− 1(j),j σ∈Sn i=1 σ∈Sn j=1

Because every permutation is invertible and σ→σ−1 is a bijection, summing over σ ∈Sn is the same as summing over σ−1 ∈Sn.

Combining all of the above, we obtain that

 ∑ ∏n detA = sign(σ−1) aj,σ−1(j) σ∈Sn j=1 n = ∑ sign(σ)∏ a σ(j),j σ∈Sn j=1 = detAT .

which is what we had to show.

Theorem 26.

Let A ∈ℝn×n be an arbitrary matrix and let Ai,j denote the matrix which can be obtained by swapping the i-th and j-th column of A. Then

detAi,j = − detA,

or in other words, swapping any two columns of A will change the sign of the determinant. Similarly, swapping two rows also changes the sign of the determinant.

Proof. This follows from a clever application of (4.14), noticing that Ai,j = AIi,j, where Ii,j is obtained from the identity matrix by swapping its i-th and j-th column. detIi,j is a determinant of the form det(eσ(1),…,eσ(n)), where σ is a permutation simply swapping i and j. (That is, σ is a transposition.) Thus,

 i,j i,j detA = detA det I = − detA,

which is what we had to show.

Regarding swapping rows, we can apply the previous result because transposing a matrix preserves the determinant.

As a consequence, matrices with two matching rows have a zero determinant.

Theorem 27.

Let

be a matrix that has two identical rows or columns. Then

.

Proof. Suppose that the

-th and the

-th columns are matching. Since the two columns are equal,

. However, applying the previous theorem (which states that swapping two columns changes the sign of the determinant), we obtain

. This can only be true if

.

Again, transposing the matrix gives the statement for rows.

As yet another consequence, we obtain an essential connection between linearly dependent vector systems and determinants.

Theorem 28.

Let

be a matrix. Then its columns are linearly dependent if and only if

. Similarly, the rows of

are linearly dependent if and only if

.

Proof. (i) First, we are going to show that linearly dependent columns (or rows) imply detA = 0. As usual, let’s denote the columns of A as a1,…,an and for the sake of simplicity, assume that

 n ∑ a1 = αiai. i=2

Since the determinant is a linear function of the columns, we have

 n ∑ det(a1,a2,...,an) = αidet(ai,a2,...,an ). i=2

Because of the previous theorem, all terms det(ai,a2,…,an) are zero, implying detA = 0, which is what we had to show. If the rows are linearly dependent, we apply the above to obtain that detA = detAT = 0.

  1. Now, let’s show that detA = 0 means linearly dependent columns. Instead of the exact proof, which is rather involved, we should have an intuitive explanation instead.

Recall that the determinant is orientation times volume of the parallelepiped given by the columns. Since the orientation is ±1, detA implies that the volume of the parallelepiped is 0. This can only happen if the n columns lie in an n − 1-dimensional subspace, meaning that they are linearly dependent.

We can immediately apply this to get the following result.

Corollary 2.

Let A ∈ ℝn×n be a matrix with a constant zero column (or row). Then detA = 0.

As the determinant is the signed volume of the basis vectors’ image, it can be zero in certain cases. These transformations are rather special. When can it happen? Let’s go back to the Euclidean plane to build some intuition.

There, we have

|| || ||x1 y1|| ||x y || = x1y2 − x2y1 = 0, 2 2

or in other words, x1 y1- = x2 y2-. There is one more interpretation of this: the vector (y1,y2) is a scalar multiple of (x1,x2); that is, they are colinear, meaning that they lie on the same line through the origin. Thinking in terms of linear transformations, this means that the images of e1 and e2 lie on a subspace of ℝ2. As we shall see next, this is closely connected with the invertibility of the transformation.

Theorem 29. (Invertibility and the determinants) The linear transformation

is invertible if and only if

.

Proof. When we introduced the concept of invertibility (Definition 17), we saw that

is invertible if and only if its columns

form a basis. Thus, they are linearly independent.

Since linear independence (Definition 3) of columns is equivalent to a nonzero determinant, the result follows.

day-mode Bookmark

So, do your eyes hurt after finally using them for the first time? Mine sure did when I first learned about matrices as linear transformations. Here’s a part where the abstract viewpoint pays off for the first time, and trust me, it’ll pay even more dividends later.

Let’s recap this chapter quickly.

We’ve learned that besides a table of numbers, a matrix can represent linear transformations:

 ⌊ ⌋ ⌊ ⌋ ⌊ ∑m ⌋ a1,1 a1,2 ... a1,m x1 j=1a1,jxj || a a ... a || || x || || ∑m a x || Ax = || 2,.1 2.,2 2,m. || || .2|| = || j=1.2,j j|| , |⌈ .. .. ... .. |⌉ |⌈ .. |⌉ |⌈ .. |⌉ ∑m an,1 an,2 ... an,m, xm j=1an,jxj

where the columns of A describe the images of the basis vectors under the linear transformation x →Ax.

Why on Earth is this useful for us? Think of mathematics as a problem-solving tool. The crux of problem-solving is often finding the proper representation of our objects of interest. Looking at matrices as a way to transform data gives us the much-needed geometric perspective, opening up a whole new avenue of methods.

When looking at matrices this way, we quickly understand why matrix multiplication is defined as it is. The definition

 ∑l n,m AB = ( ai,kbk,j)i,j=1 k=1

is daunting at first, but from the perspective of linear transformations, it’s all revealed to be a simple composition: first, we apply the transformation B, then A.

Be careful, though: linear transformations and matrices are not exactly the same, as the matrix representation depends on the underlying basis of our vector space. (See, I told you that bases are going to be useful.)

Matrices also possess an important quantity called determinants, originally defined by the mind-boggingly complex formula

 ∑ ∏n det(a1,...,an) = [ aσ(i),i]det(eσ(1),...,eσ(n)), σ∈Sn i=1

but an investigation exploiting our newfound geometric perspective reveals that the determinant simply describes how much the linear transformation distorts the volume of the domain space, and how it changes the orientation of the basis vectors.

For us machine learning practitioners, making the conceptual jump from matrices to linear transformations is the more interesting one. (As opposed to the theory, where we often learn about linear transformations first, matrices second.) For instance, this allows us to see a layer in a neural network as stretching, rotating, shearing, and potentially reflecting the feature space.

In the next chapter, we’ll revisit matrices from a slightly different perspective: systems of equations. Of course, everything is connected, and we’ll end up where we started, looking at what we know from a higher perspective. This is because learning is a spiral, and we are ascending fast.

day-mode Bookmark

Problem 1. Show that if A ∈ℝn×n is an invertible matrix, then

 −1 T T −1 (A ) = (A ) .

Problem 2. Let Rα be ⌊ ⌋ ⌈cosα − sinα ⌉ R α = sinα cosα .the two-dimensional rotation matrix defined by

 ⌊ ⌋ ⌈cosα − sinα ⌉ R α = sinα cosα .

Show that RαRβ = Rα+β.

Problem 3. Let A = (ai,j)i,j=1n ∈ℝn×n be a matrix and let D ∈ℝn×n be a diagonal matrix defined by

 ⌊ ⌋ | d1 0 ... 0 | D = |⌈ 0 d2 ... 0 |⌉ , 0 0 ... dn

where all of its elements are zero outside the diagonal. Show that

 ⌊ ⌋ d1a1,1 d2a1,2 ... dna1,n || || DA = || d1a2,1 d2a2,2 ... dna2,n || |⌈ ... ... ... ... |⌉ d1an,1 d2an,2 ... dnan,n

and

 ⌊ ⌋ |d1a1,1 d1a1,2 ... d1a1,n| |d2a2,1 d2a2,2 ... d2a2,n| AD = || . . . . || . |⌈ .. .. .. .. |⌉ dnan,1 dnan,2 ... dnan,n

Problem 4. Let ∥⋅∥ be a norm on ℝn, and let A ∈ℝn×n be an arbitrary matrix.

Show that A is invertible if and only if the function

∥x∥∗ := ∥Ax ∥

is a norm on ℝn.

Problem 5. Let U be a normed space and f : U →U be a linear transformation.

If

∥x ∥∗ := ∥f(x)∥

is a norm, is f necessarily invertible?

Hint: Consider the vector space ℝ[x] with the norm

 n n ∑ 2 1∕2 ∑ i ∥p∥ = ( pi) , p(x) = pix i=0 i=0

and the linear transformation f : p(x)→xp(x).

Problem 6. Let ⟨⋅,⋅,⟩ be an inner product on ℝn. Show that there is a matrix A ∈ℝn×n such that

⟨x,y ⟩ = xT Ay, x,y ∈ ℝn.

(Recall that we treat vectors x,y ∈ℝn as column vectors.)

Problem 7. Let A ∈ℝn×n be a matrix. A is called positive definite if xT Ax>0 for every nonzero x ∈ℝn.

Show that A is positive definite if and only if

⟨x,y⟩ := xTAy

is an inner product.

Problem 8. Let A ∈ℝn×m be a matrix, and denote its columns by a1,…,an ∈ℝn.

(a) Show that for all x ∈ℝm, we have Ax ∈ span(a1,…,an).

(b) Let B ∈ℝm×k, and denote the columns of AB by v1,…,vk ∈ℝn. Show that

v1,...,vk ∈ span(a1,...,an).

Problem 9. Let A ∈ℝn×n be a matrix. Show that

⟨Ax, y⟩ = ⟨x,AT y⟩

holds for all x,y ∈ℝn, where ⟨⋅,⋅⟩ is the Euclidean inner product.

Problem 10. Calculate the determinant of

 ⌊1 2 3⌋ | | A = |⌈4 5 6|⌉ . 7 8 9

Problem 11. Let A ∈ℝn×n be a matrix and let c ∈ℝ be a constant.

(a) Show that

| | ||a1,1 ... ca1,i ... a1,n || ||a ... ca ... a || || 2.,1 .2,i 2.,n ||= cdetA || .. ... .. ... .. || || || an,1 ... can,i ... an,n

holds for all i = 1,…,n.

(b) Show that

| | ||a1,1 a1,2 ... a1,n || || . . . . || | .. .. .. .. | ||ca ca ... ca ||= cdet A || .i,1 i.,2 .i,n|| || .. .. ... .. || || || an,1 an,2 ... an,n

holds for all i = 1,…,n and

(c) Show that

det(cA ) = cndet A.

Problem 12. Let A ∈ℝn×n be an upper triangular matrix. (That is, all elements below the diagonal are zero.) Show that

 ∏n detA = ai,i. i=1

Show that the same holds for lower triangular matrices. (That is, matrices where elements above the diagonal are zero.)

Problem 13. Let M ∈ℝn×m be a matrix with the block structure

 ⌊ ⌋ ⌈A B ⌉ M = 0 C ,

where A ∈ℝk×k, B ∈ℝk×l, and C ∈ℝl×l.