Linear Transformations
7.1 Introduction to linear maps
Recall that a function is a rule which assigns exactly one element of the codomain to each element of the domain . The element is called an argument of the function, and is called the image of under .
Linear maps are a special class of functions where both the domain and the codomain are vector spaces, and where the function "preserves" the two fundamental vector space operations; adding two vectors then applying the map gives the same result as applying the map first and then adding, and the same goes for scalar multiplication.
Note
Definition 1
Let and be two vector spaces over the same field . A function is called a linear map or linear transformation if the following two conditions are satisfied.
- Addition Condition. for all , and
- Scalar Multiplication Condition. for all and .
Basically, a linear map is a function where the order of operations does not matter; you can "add then map" or "map then add", "scale then map" or "map then scale", and you always land in the same place. The vector space operations pass straight through the function untouched. Geometric operations like rotating, reflecting and projecting behave exactly like this, and so do calculus operations like differentiating and integrating, which is why linear maps show up everywhere.
Example. Show that the function defined by , where are constants, is a linear map if and only if .
The domain and codomain are both , which is a vector space, so we check the two conditions. For ,
whereas
The two expressions are equal if and only if , that is, if and only if . In that case we check the scalar multiplication condition:
Therefore, is a linear map if and only if .
Notice how is the equation of a line in ; the equation of a line defines a linear map if and only if the line passes through the origin. It is important to remember that a "linear polynomial" like is NOT a linear map; the constant term must be zero.
Example. Show that the function defined by
is a linear map.
Both and are vector spaces, so we just check the two conditions.
Addition condition. For ,
Scalar multiplication condition. For and ,
Both conditions hold, and therefore is a linear map.
Quick ways to show a map is NOT linear
Every linear map is forced to behave nicely on the zero vector and on negatives.
Note
Proposition 1
If is a linear map, then
- , and
- for all .
Proof. Since in any vector space, the scalar multiplication condition gives
Similarly, since ,
Basically, a linear map must send the zero vector of the domain to the zero vector of the codomain. This gives you the fastest possible "not linear" test: plug in first, and if you do not get out, you are done. If does hold, hunt for a specific numerical counterexample to one of the two conditions instead (same idea as disproving closure in subspace questions).
Example. Show that the function defined by is not linear.
We have
Since , is not a linear map.
Example. Show that the function defined by is not linear.
Here , so the quick test tells us nothing; we look for a numerical counterexample to the scalar multiplication condition:
Since , is not a linear map.
The converse of Proposition 1 is NOT true; a function can pass both the and tests and still fail to be linear.
Example. The function satisfies and , but
so is not a linear map. Passing the quick tests is necessary but never sufficient.
The one-condition test and linear combinations
The two conditions in the definition can be merged into a single condition, which halves the amount of algebra you have to do in a "show that is linear" question.
Note
Theorem 2
A function is a linear map if and only if for all and ,
Proof. If is linear, then by the addition condition followed by the scalar multiplication condition (used twice),
Conversely, if the combined condition holds, then choosing recovers the addition condition, and choosing recovers the scalar multiplication condition.
Example. Show that the function defined by
is a linear map.
For and , we have , and hence
Therefore, by Theorem 2, is a linear map.
An induction argument extends the one-condition test from two vectors to any finite linear combination.
Note
Theorem 3
If is a linear map with domain and is a set of vectors in , then for all scalars ,
In other words, linear maps preserve linear combinations. This has a very useful consequence: if you know what does to a basis, you know what does to everything, because every vector is a unique linear combination of the basis vectors.
Note
Theorem 4
For a linear map , the function values for every vector in the domain are known if and only if the function values for a basis of the domain are known. Further, if is a basis for , then for all ,
where are the scalars in the unique linear combination .
Example. Let be a linear map with
Find the function value at .
Since , Theorem 3 gives
Therefore, three function values were enough to pin down the whole map.
Example. Show that the function with the same three values as above, but which also satisfies , is not a linear map.
If were linear, then since , Theorem 3 would force
But we are told , and hence is not a linear map.
Common exam traps
The strategy for "is linear?" questions: first check the domain and codomain are actually vector spaces, then check , then try small specific vectors (especially ), and only commit to the general algebra of Theorem 2 once nothing has broken.
Example (trap: translation). Is defined by a linear map?
No;
Therefore a translation is never a linear map (unless you translate by ), even though sliding the plane around feels like the most "linear" thing imaginable.
Example (trap: absolute value). Is defined by a linear map?
Here , so the quick test passes. Try :
Since , the scalar multiplication condition fails and is not linear. Whenever a formula folds negatives back onto positives, is the counterexample to reach for.
Example (trap: determinant). Is defined by a linear map?
The domain and codomain are vector spaces and , so we test the conditions on the identity matrix :
Since , is not linear. In fact for matrices, so the determinant scales quadratically, not linearly.
Example (trap: the domain matters). Is defined by a linear map?
No, and not because of the formula; the domain is not a vector space (it is not closed under addition or scalar multiplication), so is disqualified before we even check the conditions. The function with the same rule is linear. Always check that the domain and codomain are vector spaces before checking the two conditions.
7.2 Linear maps from to and matrices
If you look back at the examples in the previous section, every linear map from to we wrote down could have been written as for some matrix . This is no accident; in this section we show that every matrix defines a linear map and, conversely, every linear map from to is a matrix map.
Note
Theorem 1
For each matrix , the function defined by
is a linear map.
Proof. This follows straight from the matrix arithmetic rules of 1131. For all and ,
and
Example. Describe the linear map such that for the matrix
Since has rows and columns, the domain is and the codomain is (an matrix eats vectors of length and spits out vectors of length ), and
Therefore every matrix defines a linear map just by multiplication.
The converse direction is the important one.
Note
Matrix Representation Theorem
Let be a linear map and let for be the standard basis vectors of . Then the matrix whose columns are given by
has the property that for all .
Proof. Every can be written uniquely as . By Theorem 3 of Section 7.1,
where the last step uses the fact (Proposition 3 of Section 6.4) that a linear combination of the columns of is exactly the matrix product .
The take-away formula is
i.e. the th column of the matrix is the image of the th standard basis vector. This is worth internalising; it is how you will construct every geometric matrix in Section 7.3.
Example. Find a matrix such that for the linear map defined by
We compute the images of the standard basis vectors:
Therefore, placing these as columns,
An alternative (often faster) method is to notice that the components of look like the left-hand side of a system of linear equations, and simply read off the coefficient matrix.
Example. Find a matrix such that for the linear map defined by
Reading off the coefficients row by row (remembering to put a wherever a variable is missing),
Therefore for all ; both methods must always give the same matrix.
Example (images of non-standard vectors). A linear map satisfies
Find the matrix of with respect to the standard basis.
The trap here is that we were not given and ; we have to build them, using the fact that preserves linear combinations. Since ,
Similarly, , and hence
Therefore
and a quick sanity check confirms as required. This works because is a basis of ; by Theorem 4, values on a basis determine the map completely.
7.3 Geometric examples of linear transformations
Many of the standard geometric operations on and are linear maps: stretching, compressing, reflecting, rotating and projecting. For each of them, the Matrix Representation Theorem gives a mechanical recipe for the matrix: work out where and land, and make those the columns.
A useful general fact first: linear maps send lines to lines (or squash them to points).
Note
Proposition 1
Suppose that is a linear map. Then maps a line in to either a line or a point in .
Proof. A line is the set with . By Theorem 2 of Section 7.1, , so the image is ; this is a line when and the single point otherwise.
The same argument shows a line segment maps to the segment between the images of the endpoints, which is why it is enough to transform the vertices of a shape and then reconnect them.
Stretching and dilation
A diagonal matrix with positive entries,
multiplies the first component by and the second by ; each axis direction is stretched (if ) or compressed (if ) independently. When the whole plane is scaled uniformly by (a dilation).
Example. Apply to the point .
Therefore the point is pushed out to twice the horizontal distance and squashed to half the vertical distance.
Reflections
Example. Reflection in the -axis sends to , and is represented by
since . Note that finding a matrix which performs the transformation is itself the proof that the transformation is linear. Similarly, reflection in the -axis has matrix .
Example (matrix from a geometric description). Find the matrix of the reflection in the line in .
We only need the images of the standard basis vectors. Reflecting in the line swaps the two coordinate axes, so
Therefore
and as a check, , which is exactly the mirror image of in that line. This "track and , then check on one extra point" routine handles basically every geometric matrix question.
Rotations
Example. Let rotate every point anticlockwise about the origin by an angle . Rotation is linear; rotating gives the same result as rotating and separately and then adding (the whole parallelogram rotates rigidly), and the same for scaling. To find the matrix, rotate the standard basis vectors: sits at angle on the unit circle and moves to angle , while sits at angle and moves to angle , so
Therefore the rotation matrix for angle is
Example. Find the matrix for rotation by anticlockwise, and rotate the point .
Then
Therefore rotates to , which still has length , as a rotation should preserve.
Projections and the dot product
Example. Recall from 1131 that the projection of onto a fixed non-zero vector is
Show that is a linear map.
Rather than arguing geometrically, we use the algebraic properties of the dot product. For all ,
and for all ,
Therefore is a linear map.
Example. Find the matrix of the projection onto in .
Here . The columns of the matrix are the projections of and :
Therefore
and as a check, for we have , so , and indeed
Therefore the matrix reproduces the projection formula exactly.
Example. For a fixed , the function defined by is a linear map; the proof is the same dot-product algebra as for the projection. Taking gives the map which picks out the th component of , so "read off a coordinate" is itself a linear map.
7.4 Subspaces associated with linear maps
There are two important subspaces attached to every linear map: the kernel (the set of vectors squashed to zero, living in the domain) and the image (the set of all function values, living in the codomain). Informally, the kernel measures what the map destroys and the image measures what the map can actually reach.
7.4.1 The kernel of a map
Note
Definition 1
Let be a linear map. Then the kernel of (written ) is the set of all zeroes of , that is, the subset of the domain defined by
For matrix maps the definition specialises to something very familiar.
Note
Definition 2
For an matrix , the kernel of is the subset of defined by
that is, the set of all solutions of the homogeneous equation .
Basically, finding the kernel of a matrix is nothing new; it is just solving by Gaussian elimination like in 1131. Showing a specific vector lies in the kernel is even easier: multiply and see if you get .
Example. Let and . Then
and hence . Also, for every linear map , since ; the kernel is never empty.
Example. Find the kernel of
We solve . Row reducing,
Columns and are non-leading, so set and . Back substitution into row gives
and then row gives
Hence
and therefore
Geometrically, the kernel is a plane through the origin in .
The word "subspace" in the section title is justified by the following theorem.
Note
Theorem 1
If is a linear map, then is a subspace of the domain .
Proof. We use the Subspace Theorem. The kernel contains , since . Suppose and . Then
and
so is closed under addition and scalar multiplication, and is therefore a subspace of .
Since the kernel is a subspace, it has a dimension, and that dimension gets a special name.
Note
Definition 3
The nullity of a linear map is the dimension of . The nullity of a matrix is the dimension of .
For a matrix map we have (the conditions and are literally the same equation), and the nullity can be read off from the row-echelon form.
Note
Proposition 3
For a matrix ,
Example (continued). For the matrix above, the two vectors
span , and they are linearly independent (look at the third and fourth entries; the only combination giving there is ). Therefore they form a basis for , and , matching the two non-leading columns of .
Note
Proposition 4
The columns of a matrix are linearly independent if and only if .
This follows because the columns are independent exactly when has only the zero solution, i.e. when .
7.4.2 Image
Note
Definition 4
Let be a linear map. Then the image of is the set of all function values of , that is, the subset of the codomain defined by
Note
Definition 5
The image of an matrix is the subset of defined by
We have met this set several times before in disguise. Since is a linear combination of the columns of , the image is exactly the span of the columns, and it is also the set of right-hand sides for which is solvable:
Basically, every question about the image of a matrix is secretly a linear equations question you already know how to solve.
Example (continued). Find conditions on for , where is the same matrix as before.
We ask when has a solution for . Reducing the augmented matrix with a general right-hand side,
The system has a solution if and only if the last row is consistent, that is, if and only if
Therefore is the plane through the origin in with normal ; a two-dimensional subspace of .
Note
Theorem 5
Let be a linear map. Then is a subspace of the codomain .
Proof. We have . If and are in the image and , then
which is a function value of the vector , and
which is a function value of . Hence the image is closed under both operations, and by the Subspace Theorem it is a subspace of .
Note
Definition 6
The rank of a linear map is the dimension of . The rank of a matrix is the dimension of .
Note
Proposition 7
For a matrix ,
Example (continued). Find and a basis for .
The row-echelon form has leading entries in columns and , so , and a basis for is given by columns and of the original matrix :
When writing down a basis for the image, you must take the leading columns of the original matrix , not the columns of the row-echelon form ; row operations change the column space. As a sanity check, both basis vectors satisfy from before.
7.4.3 Rank, nullity and solutions of
In the running example, , the number of columns of . This is no coincidence; every column of a row-echelon form is either leading (counted by the rank) or non-leading (counted by the nullity).
Note
Rank-Nullity Theorem for Matrices
For any matrix ,
Note
Rank-Nullity Theorem
Suppose and are finite dimensional vector spaces and is linear. Then
A proof of the general version is given in Section 7.9 below. The rough idea: the domain has dimensions to spend; every dimension is either flattened to zero (nullity) or survives into the image (rank), and nothing is created or lost. This one line answers a surprising number of exam questions instantly, as we will see below.
Rank and nullity together classify the solutions of any linear system.
Note
Theorem 10
The equation has:
- no solution if , and
- at least one solution if . Further,
i) if the solution is unique, whereas,
ii) if , then the general solution is of the form
where is any particular solution of and is a basis for .
Basically, the full solution set is one particular solution plus the entire kernel; the same "particular solution plus homogeneous solution" structure you will meet again with linear ODEs in the calculus half, and for the same underlying reason (both problems are linear).
Example. Find the general solution of , where
and identify and the kernel part.
Row reducing the augmented matrix,
The right-hand column is non-leading, so a solution exists; and , so we expect one parameter. Setting , back substitution gives
Hence
Therefore is a particular solution and is a basis for , exactly matching Theorem 10 with .
Example. Show that has no solution for and .
Here but , so by Theorem 10 there is no solution; geometrically, lies outside the line .
Example (instant answers with rank-nullity). These come up constantly in exams and need almost no working.
a) Can a linear map be onto (i.e. have )?
Therefore no; the image is at most -dimensional and can never fill , no matter how the map is defined.
b) is a matrix. Can the columns of be linearly independent?
Therefore no; by Proposition 4 the columns are dependent, since the nullity cannot be zero.
c) A linear map is known to be onto. Find .
Therefore the nullity is exactly ; onto forces , and rank-nullity does the rest.
7.5 Further applications and examples of linear maps
So far most of our examples have had domain and codomain , but the theory applies to any vector spaces; polynomials, matrices and functions included.
Example. The identity map , defined by for all , is linear. This one is self explanatory so I'm not gonna write much; and by definition.
Example. Let be an ordered basis of a real vector space . The map which sends each to its coordinate vector is a linear map, because adding vectors adds their (unique) coordinates and scaling a vector scales its coordinates. This innocent-looking fact is what makes Section 7.6 below work: it lets us translate any finite-dimensional problem into a column-vector problem.
Example. Show that the function defined by , where
is a linear map.
First, to get a feel for the map: is the polynomial , and is the zero polynomial, as required. Now let and , and let , , . Then
Thus , and by Theorem 2 of Section 7.1, is a linear map.
Differentiation and integration as linear maps
Calculus supplies the most important non- examples: both differentiation and integration preserve sums and scalar multiples.
Example (differentiation). Show that the function , defined by , is a linear map.
First, really is a function into ; differentiating a polynomial of degree at most gives a polynomial of degree at most . From the properties of derivatives, for all and ,
so and . Therefore is a linear map. All the standard derivative rules you memorised for 1131 ("derivative of a sum is the sum of the derivatives") were secretly the statement that is linear.
Example (integration). Show that the function defined by , where
is a linear map.
For a concrete function value first: if , then
a polynomial of degree , as expected. For linearity, let and , and let . From the properties of integration,
Hence , and is a linear map.
Example (kernel and image of the derivative on ). Find , , and for , and verify the Rank-Nullity Theorem.
Write , so that
Kernel. requires
with free. Hence , and ; the derivative destroys exactly the constant information.
Image. Given any target , choose
(and anything); then . Hence , so is onto and .
Check. , exactly as the Rank-Nullity Theorem demands. Therefore antidifferentiation being "unique up to " is precisely the statement .
Example (evaluation map). Let be defined by . Show that is linear, and find its rank and a basis for its kernel.
Linearity. For and ,
so is linear by Theorem 2 of Section 7.1.
Rank. , so the image contains a non-zero number, and since is a subspace of the one-dimensional space , we must have and ; is onto.
Kernel. By rank-nullity,
so we need two linearly independent polynomials vanishing at . Both and evaluate to at , and they are independent (different degrees). Therefore is a basis for . Notice how rank-nullity told us in advance exactly how many kernel vectors to hunt for; that is the standard trick for kernel questions on polynomial spaces.
[X] For interest: the Laplace transform , where , is a linear map on a suitable space of functions, by the same integration argument as above; its linearity is the whole reason it is useful for solving linear ODEs (transform each term separately, solve algebraically, transform back).
7.6 [X] Representation of linear maps by matrices
This section is 1241/extension content.
Section 7.2 showed that linear maps are matrix maps. The generalisation: every linear map between finite-dimensional vector spaces can be represented by a matrix, once you fix a basis at each end and work with coordinate vectors.
Note
General Matrix Representation Theorem
Let be a linear map from an -dimensional vector space to an -dimensional vector space , and let and be ordered bases for and . Then there is a unique matrix such that
where is the matrix whose columns are for .
The matrix depends on and the two chosen bases, but not on the particular vector being mapped. The recipe:
- Choose a basis for the domain and for the codomain.
- Compute the function values of the domain basis vectors.
- Write each as a coordinate vector with respect to .
- Assemble those coordinate vectors as the columns of .
Example. Construct the matrix of the derivative map with respect to the standard bases and , and use it to differentiate .
The images of the domain basis vectors are
whose coordinate vectors with respect to are
respectively. Hence
The coordinate vector of is , and
so , which is indeed the derivative of . Therefore differentiating polynomials is literally a matrix multiplication once you pass to coordinates.
It is often possible to simplify a problem enormously by choosing non-standard bases; with the right basis in domain and codomain, the representing matrix can come out diagonal or triangular, from which the behaviour of the map can be read off instantly. This idea is developed properly in Chapter 8.
7.7 [X] Matrix arithmetic and linear maps
This section is 1241/extension content.
Since matrices and linear maps are two views of the same objects, matrix arithmetic must correspond to operations on maps. Indeed, for matrices () and of matching sizes:
- Addition. ; adding maps adds their matrices.
- Scalar multiplication. .
- Composition. The interesting one:
Note
Proposition 3 (Multiplication and Composition)
Let be a real matrix and be a real matrix. Then the composite is the linear map defined by
So composition of linear maps is matrix multiplication; this is arguably the real reason matrix multiplication is defined the weird way it is. Note the order carefully: in , the map acts first, i.e. the matrix nearest the vector acts first.
Example. Show that rotating the plane by and then by is the same as rotating by , i.e. .
using the trig addition formulas. Therefore the matrix identity is just the geometric fact that consecutive rotations add their angles; as a bonus, the trig addition formulas fall out of matrix multiplication for free.
Example (order matters). Let (rotation by ) and (reflection in the -axis). Compare "rotate then reflect" with "reflect then rotate".
Rotate first, then reflect (rotation acts first, so it sits on the right):
Reflect first, then rotate:
The results differ; testing on , the first sends while the second sends . Therefore composition of linear maps (like matrix multiplication) is not commutative, and when you translate a worded geometric sequence into matrices you must write the transformations from right to left.
7.8 [X] One-to-one, onto and invertible linear maps and matrices
This section is 1241/extension content; the general function versions of these definitions are in Section 7.10.
Note
Definition 1
A linear map is said to be:
a) one-to-one if for all , only if ;
b) onto if for all there exists such that , that is, if .
For linear maps (and only for linear maps) being one-to-one collapses to a single check at zero.
Note
Proposition 1
A linear map is one-to-one if and only if , that is, if and only if
Proof. If is one-to-one, then since , no other vector can also map to , so . Conversely, if and , then by linearity
so , forcing .
This shortcut is only valid for linear maps; has only at , yet it is not one-to-one.
Note
Proposition 2
If the codomain of a linear map is finite dimensional, then is onto if and only if .
Combining these with rank-nullity gives the dimension facts you can quote instantly:
- If is one-to-one and onto, then .
- If , then is one-to-one is onto (each forces the other).
- If (e.g. ), can never be one-to-one; if (e.g. ), can never be onto.
Note
Theorem 5
If and are finite-dimensional vector spaces and is a linear map, then the following statements are equivalent:
- is invertible, i.e. there exists a linear map with and ;
- is one-to-one and onto;
- and there exists with ;
- and there exists with .
Further, if a linear map has an inverse, the inverse is unique and is itself a linear map.
Example. Determine whether the maps and are one-to-one, onto and invertible, where
For : row reducing,
so and . Since , is not one-to-one (indeed , so the whole line gets crushed to ), and since , is not onto. Hence is not invertible.
For : row reducing,
so and . Hence is one-to-one and onto, and therefore invertible; its inverse is the matrix map given by the usual inverse formula from 1131,
and a quick check gives . Therefore invertibility of the map and invertibility of the matrix are the same thing.
7.9 [X] Proof of the Rank-Nullity Theorem
This section is 1241/extension content; a sketch of the proof is enough here.
We want to show that if is finite dimensional and is linear, then . The idea is to build one basis of out of a kernel part and an image part, and count.
Proof (sketch). Let be a basis for , where , and pick preimages with . Let be a basis for , where . We claim is a basis for ; then and we are done.
Linear independence. Suppose . Applying kills the kernel vectors and turns the rest into the , leaving
so by independence of the . The original relation then collapses to a combination of the kernel basis alone, forcing the remaining too.
Spanning. Take any . Then , so for some scalars. Set ; by construction , and hence
so the "remainder" lies in and is a combination of the kernel basis vectors. Adding the two pieces back together expresses as a linear combination of .
Therefore is a linearly independent spanning set for , and .
Basically, every vector in the domain splits into a part the map remembers (spanned by the preimage vectors) and a part the map forgets (the kernel), and the two parts share no overlap.
7.10 One-to-one, onto and inverses for functions
This appendix collects the general function definitions used in Section 7.8; they apply to all functions, not just linear maps. For a point in the codomain of a function there are three possibilities: it is hit by no point of the domain, by exactly one, or by more than one.
Note
Definition 1
The range or image of a function is the set of all function values,
Note
Definition 2
A function is said to be onto (or surjective) if the codomain is equal to the image, that is, if for all there exists an such that .
Note
Definition 3
A function is said to be one-to-one (or injective) if no point of the codomain is the value of more than one point of the domain, that is, if implies .
Basically, onto means "everything in the codomain gets hit" and one-to-one means "nothing gets hit twice". A function which is both hits everything exactly once. Notice how the same formula can be both, either or neither depending on the choice of domain and codomain, as the next three examples show.
Example. The function , , is neither one-to-one nor onto. It is not one-to-one since with , and it is not onto since no satisfies .
Example. The function , , is one-to-one but not onto. Restricting the domain removed the negative twin of each square root, but the negative half of the codomain is still never reached.
Example. The function , , is both one-to-one and onto; every is and of nothing else in the domain. Therefore "is one-to-one/onto?" is a question about the whole package , not just the formula.
Note
Definition 4
Let be a function. Then a function is called an inverse of if it satisfies the two conditions:
a) , i.e. for all , and
b) , i.e. for all .
Note
Theorem 1
A function has an inverse if and only if the function is both one-to-one and onto.
The idea of the proof: if is one-to-one and onto, then every is hit by exactly one , so "send back to that unique " is a well-defined function, and it undoes in both directions; conversely, an inverse forces every point to be hit (onto) and forbids two points sharing a value (one-to-one, since could not undo it). For the third example above, the inverse is , and indeed on and ; for the first two examples no inverse exists. Combined with Section 7.8, this is exactly why a linear map is invertible if and only if and ; those two conditions are one-to-one and onto in linear-algebra clothing.