# Linear map

In mathematics, a linear map (also called a linear mapping, linear transformation or, in some contexts, linear function) is a mapping VW between two modules (for example, two vector spaces) that preserves (in the sense defined below) the operations of addition and scalar multiplication. If a linear map is a bijection then it is called a linear isomorphism.

An important special case is when V = W, in which case a linear map is called a (linear) endomorphism of V. Sometimes the term linear operator refers to this case. In another convention, linear operator allows V and W to differ, while requiring them to be real vector spaces. Sometimes the term linear function has the same meaning as linear map, while in analytic geometry it does not.

A linear map always maps linear subspaces onto linear subspaces (possibly of a lower dimension); for instance it maps a plane through the origin to a plane, straight line or point. Linear maps can often be represented as matrices, and simple examples include rotation and reflection linear transformations.

In the language of abstract algebra, a linear map is a module homomorphism. In the language of category theory, it is a morphism in the category of modules over a given ring.

## Definition and first consequences

Let V and W be vector spaces over the same field K. A function f : VW is said to be a linear map if for any two vectors ${\textstyle \mathbf {u} ,\mathbf {v} \in V}$  and any scalar cK the following two conditions are satisfied:

 $f(\mathbf {u} +\mathbf {v} )=f(\mathbf {u} )+f(\mathbf {v} )$ additivity / operation of addition $f(c\mathbf {u} )=cf(\mathbf {u} )$ homogeneity of degree 1 / operation of scalar multiplication

Thus, a linear map is said to be operation preserving. In other words, it does not matter whether the linear map is applied before (the right hand sides of the above examples) or after (the left hand sides of the examples) the operations of addition and scalar multiplication.

By the associativity of the addition operation denoted as +, for any vectors ${\textstyle \mathbf {u} _{1},\ldots ,\mathbf {u} _{n}\in V}$  and scalars ${\textstyle c_{1},\ldots ,c_{n}\in K,}$  the following equality holds:

$f(c_{1}\mathbf {u} _{1}+\cdots +c_{n}\mathbf {u} _{n})=c_{1}f(\mathbf {u} _{1})+\cdots +c_{n}f(\mathbf {u} _{n}).$

Denoting the zero elements of the vector spaces V and W by ${\textstyle \mathbf {0} _{V}}$  and ${\textstyle \mathbf {0} _{W}}$  respectively, it follows that ${\textstyle f(\mathbf {0} _{V})=\mathbf {0} _{W}.}$  Let c = 0 and ${\textstyle \mathbf {v} \in V}$  in the equation for homogeneity of degree 1:

$f(\mathbf {0} _{V})=f(0\mathbf {v} )=0f(\mathbf {v} )=\mathbf {0} _{W}.$

Occasionally, V and W can be vector spaces over different fields. It is then necessary to specify which of these ground fields is being used in the definition of "linear". If V and W are spaces over the same field K as above, then we talk about K-linear maps. For example, the conjugation of complex numbers is an -linear map ℂ → ℂ, but it is not -linear, where and are symbols representing the sets of real numbers and complex numbers, respectively.

A linear map VK with K viewed as a one-dimensional vector space over itself is called a linear functional.

These statements generalize to any left-module ${\textstyle {}_{R}M}$  over a ring R without modification, and to any right-module upon reversing of the scalar multiplication.

## Examples

• The prototypical example that gives linear maps their name is the function f : ℝ → ℝ : xcx, of which the graph is a line through the origin.
• More generally, any homothety centered in the origin of a vector space, ${\textstyle \mathbf {v} \mapsto c\mathbf {v} }$  where c is a scalar, is a linear operator. This does not hold in general for modules, where such a map might only be semilinear.
• The zero map x ↦ 0 between two left-modules (or two right-modules) over the same ring is always linear.
• The identity map on any module is a linear operator.
• For real numbers, the map xx2 is not linear.
• For real numbers, the map xx + 1 is not linear (but is an affine transformation; y = x + 1 is a linear equation, as the term is used in analytic geometry.)
• If A is a real m × n matrix, then A defines a linear map from ℝn to Rm by sending the column vector x ∈ ℝn to the column vector Ax ∈ ℝm. Conversely, any linear map between finite-dimensional vector spaces can be represented in this manner; see the following section.
• If F : XY is an isometry between real normed spaces such that F(0) = 0 then F is a linear map. This result is not necessarily true for complex normed space.
• Differentiation defines a linear map from the space of all differentiable functions to the space of all functions. It also defines a linear operator on the space of all smooth functions (a linear operator is a linear endomorphism, that is a linear map where the domain and codomain of it is the same). An example is ${\frac {d}{dx}}\left({{c}_{1}}{{f}_{1}}\left(x\right)+{{c}_{2}}{{f}_{2}}\left(x\right)+\cdots +{{c}_{n}}{{f}_{n}}\left(x\right)\right)={{c}_{1}}{\frac {d{{f}_{1}}\left(x\right)}{dx}}+{{c}_{2}}{\frac {d{{f}_{2}}\left(x\right)}{dx}}+\cdots +{{c}_{n}}{\frac {d{{f}_{n}}\left(x\right)}{dx}}$ .
• A definite integral over some interval I is a linear map from the space of all real-valued integrable functions on I to ℝ. For example,$\int _{a}^{b}{[{{c}_{1}}{{f}_{1}}(x)+{{c}_{2}}{{f}_{2}}(x)+\ldots +{{c}_{n}}{{f}_{n}}(x)]dx}={{c}_{1}}\int _{a}^{b}{{{f}_{1}}(x)dx}+{{c}_{2}}\int _{a}^{b}{{{f}_{2}}(x)dx}+\ldots +{{c}_{n}}\int _{a}^{b}{{{f}_{n}}(x)dx}$ .
• An indefinite integral (or antiderivative) with a fixed integration starting point defines a linear map from the space of all real-valued integrable functions on to the space of all real-valued, differentiable functions on . Without a fixed starting point, an exercise in group theory will show that the antiderivative maps to the quotient space of the differentiables over the equivalence relation "differ by a constant", which yields an identity class of the constant valued functions ${\textstyle \left(\,\int \!:\ I(\Re )\ \to \ D(\Re )/\Re \,\right)}$ .
• If V and W are finite-dimensional vector spaces over a field F, then functions that send linear maps f : VW to dimF(W) × dimF(V) matrices in the way described in the sequel are themselves linear maps (indeed linear isomorphisms).
• The expected value of a random variable (which is in fact a function, and as such a member of a vector space) is linear, as for random variables X and Y we have E[X + Y] = E[X] + E[Y] and E[aX] = aE[X], but the variance of a random variable is not linear.

## Matrices

If V and W are finite-dimensional vector spaces and a basis is defined for each vector space, then every linear map from V to W can be represented by a matrix. This is useful because it allows concrete calculations. Matrices yield examples of linear maps: if A is a real m × n matrix, then f(x) = Ax describes a linear map RnRm (see Euclidean space).

Let {v1, …, vn} be a basis for V. Then every vector v in V is uniquely determined by the coefficients c1, …, cn in the field R:

$c_{1}\mathbf {v} _{1}+\cdots +c_{n}\mathbf {v} _{n}.$

If f : VW is a linear map,

$f\left(c_{1}\mathbf {v} _{1}+\cdots +c_{n}\mathbf {v} _{n}\right)=c_{1}f\left(\mathbf {v} _{1}\right)+\cdots +c_{n}f\left(\mathbf {v} _{n}\right),$

which implies that the function f is entirely determined by the vectors f(v1), …, f(vn). Now let {w1, …, wm} be a basis for W. Then we can represent each vector f(vj) as

$f\left(\mathbf {v} _{j}\right)=a_{1j}\mathbf {w} _{1}+\cdots +a_{mj}\mathbf {w} _{m}.$

Thus, the function f is entirely determined by the values of aij. If we put these values into an m × n matrix M, then we can conveniently use it to compute the vector output of f for any vector in V. To get M, every column j of M is a vector

${\begin{pmatrix}a_{1j}&\cdots &a_{mj}\end{pmatrix}}^{\textsf {T}}$

corresponding to f(vj) as defined above. To define it more clearly, for some column j that corresponds to the mapping f(vj),

$\mathbf {M} ={\begin{pmatrix}\ \cdots &a_{1j}&\cdots \ \\&\vdots &\\&a_{mj}&\end{pmatrix}}$

where M is the matrix of f. In other words, every column j = 1, …, n has a corresponding vector f(vj) whose coordinates a1j, …, amj are the elements of column j. A single linear map may be represented by many matrices. This is because the values of the elements of a matrix depend on the bases chosen.

The matrices of a linear transformation can be represented visually:

1. Matrix for ${\textstyle T}$  relative to ${\textstyle B}$ : ${\textstyle A}$
2. Matrix for ${\textstyle T}$  relative to ${\textstyle B'}$ : ${\textstyle A'}$
3. Transition matrix from ${\textstyle B'}$  to ${\textstyle B}$ : ${\textstyle P}$
4. Transition matrix from ${\textstyle B}$  to ${\textstyle B'}$ : ${\textstyle P^{-1}}$

Such that starting in the bottom left corner ${\textstyle \left[{\vec {v}}\right]_{B'}}$  and looking for the bottom right corner ${\textstyle \left[T\left({\vec {v}}\right)\right]_{B'}}$ , one would left-multiply—that is, ${\textstyle A'\left[{\vec {v}}\right]_{B'}=\left[T\left({\vec {v}}\right)\right]_{B'}}$ . The equivalent method would be the "longer" method going clockwise from the same point such that ${\textstyle \left[{\vec {v}}\right]_{B'}}$  is left-multiplied with ${\textstyle P^{-1}AP}$ , or ${\textstyle P^{-1}AP\left[{\vec {v}}\right]_{B'}=\left[T\left({\vec {v}}\right)\right]_{B'}}$ .

## Examples of linear transformation matrices

In two-dimensional space R2 linear maps are described by 2 × 2 real matrices. These are some examples:

• rotation
• by 90 degrees counterclockwise:
$\mathbf {A} ={\begin{pmatrix}0&-1\\1&0\end{pmatrix}}$
• by an angle θ counterclockwise:
$\mathbf {A} ={\begin{pmatrix}\cos \theta &-\sin \theta \\\sin \theta &\cos \theta \end{pmatrix}}$
• reflection
$\mathbf {A} ={\begin{pmatrix}1&0\\0&-1\end{pmatrix}}$
$\mathbf {A} ={\begin{pmatrix}-1&0\\0&1\end{pmatrix}}$
• about the axis with angle θ:
$\mathbf {A} ={\begin{pmatrix}{\frac {1-\tan ^{2}\theta }{\tan ^{2}\theta +1}}&{\frac {2\tan \theta }{\tan ^{2}\theta +1}}\\{\frac {2\tan \theta }{\tan ^{2}\theta +1}}&{\frac {1-\tan ^{2}\theta }{\tan ^{2}\theta +1}}\end{pmatrix}}$
• Note that $\tan \theta$  is the slope of the line passing through the origin
• scaling by 2 in all directions:
$\mathbf {A} ={\begin{pmatrix}2&0\\0&2\end{pmatrix}}=2\mathbf {I}$
• horizontal shear mapping:
$\mathbf {A} ={\begin{pmatrix}1&m\\0&1\end{pmatrix}}$
• squeeze mapping:
$\mathbf {A} ={\begin{pmatrix}k&0\\0&{\frac {1}{k}}\end{pmatrix}}$
• projection onto the y axis:
$\mathbf {A} ={\begin{pmatrix}0&0\\0&1\end{pmatrix}}.$

## Forming new linear maps from given ones

The composition of linear maps is linear: if f : VW and g : WZ are linear, then so is their composition gf : VZ. It follows from this that the class of all vector spaces over a given field K, together with K-linear maps as morphisms, forms a category.

The inverse of a linear map, when defined, is again a linear map.

If f1 : VW and f2 : VW are linear, then so is their pointwise sum f1 + f2 (which is defined by (f1 + f2)(x) = (f1(x) + f2(x)).

If f : VW is linear and a is an element of the ground field K, then the map af, defined by (af)(x) = a(f(x)), is also linear.

Thus the set L(V, W) of linear maps from V to W itself forms a vector space over K, sometimes denoted Hom(V, W). Furthermore, in the case that V = W, this vector space (denoted End(V)) is an associative algebra under composition of maps, since the composition of two linear maps is again a linear map, and the composition of maps is always associative. This case is discussed in more detail below.

Given again the finite-dimensional case, if bases have been chosen, then the composition of linear maps corresponds to the matrix multiplication, the addition of linear maps corresponds to the matrix addition, and the multiplication of linear maps with scalars corresponds to the multiplication of matrices with scalars.

## Endomorphisms and automorphisms

A linear transformation f: VV is an endomorphism of V; the set of all such endomorphisms End(V) together with addition, composition and scalar multiplication as defined above forms an associative algebra with identity element over the field K (and in particular a ring). The multiplicative identity element of this algebra is the identity map id: VV.

An endomorphism of V that is also an isomorphism is called an automorphism of V. The composition of two automorphisms is again an automorphism, and the set of all automorphisms of V forms a group, the automorphism group of V which is denoted by Aut(V) or GL(V). Since the automorphisms are precisely those endomorphisms which possess inverses under composition, Aut(V) is the group of units in the ring End(V).

If V has finite dimension n, then End(V) is isomorphic to the associative algebra of all n × n matrices with entries in K. The automorphism group of V is isomorphic to the general linear group GL(n, K) of all n × n invertible matrices with entries in K.

## Kernel, image and the rank–nullity theorem

If f : VW is linear, we define the kernel and the image or range of f by

{\begin{aligned}\ker(f)&=\{\,x\in V:f(x)=0\,\}\\\operatorname {im} (f)&=\{\,w\in W:w=f(x),x\in V\,\}\end{aligned}}

ker(f) is a subspace of V and im(f) is a subspace of W. The following dimension formula is known as the rank–nullity theorem:

$\dim(\ker(f))+\dim(\operatorname {im} (f))=\dim(V).$ 

The number dim(im(f)) is also called the rank of f and written as rank(f), or sometimes, ρ(f); the number dim(ker(f)) is called the nullity of f and written as null(f) or ν(f). If V and W are finite-dimensional, bases have been chosen and f is represented by the matrix A, then the rank and nullity of f are equal to the rank and nullity of the matrix A, respectively.

## Cokernel

A subtler invariant of a linear transformation ${\textstyle f:V\to W}$  is the cokernel, which is defined as

$\operatorname {coker} (f):=W/f(V)=W/\operatorname {im} (f).$

This is the dual notion to the kernel: just as the kernel is a subspace of the domain, the co-kernel is a quotient space of the target. Formally, one has the exact sequence

$0\to \ker(f)\to V\to W\to \operatorname {coker} (f)\to 0.$

These can be interpreted thus: given a linear equation f(v) = w to solve,

• the kernel is the space of solutions to the homogeneous equation f(v) = 0, and its dimension is the number of degrees of freedom in a solution, if it exists;
• the co-kernel is the space of constraints that must be satisfied if the equation is to have a solution, and its dimension is the number of constraints that must be satisfied for the equation to have a solution.

The dimension of the co-kernel and the dimension of the image (the rank) add up to the dimension of the target space. For finite dimensions, this means that the dimension of the quotient space W/f(V) is the dimension of the target space minus the dimension of the image.

As a simple example, consider the map f: R2R2, given by f(x, y) = (0, y). Then for an equation f(x, y) = (a, b) to have a solution, we must have a = 0 (one constraint), and in that case the solution space is (x, b) or equivalently stated, (0, b) + (x, 0), (one degree of freedom). The kernel may be expressed as the subspace (x, 0) < V: the value of x is the freedom in a solution – while the cokernel may be expressed via the map WR, ${\textstyle (a,b)\mapsto (a):}$  given a vector (a, b), the value of a is the obstruction to there being a solution.

An example illustrating the infinite-dimensional case is afforded by the map f: RR, ${\textstyle \left\{a_{n}\right\}\mapsto \left\{b_{n}\right\}}$  with b1 = 0 and bn + 1 = an for n > 0. Its image consists of all sequences with first element 0, and thus its cokernel consists of the classes of sequences with identical first element. Thus, whereas its kernel has dimension 0 (it maps only the zero sequence to the zero sequence), its co-kernel has dimension 1. Since the domain and the target space are the same, the rank and the dimension of the kernel add up to the same sum as the rank and the dimension of the co-kernel ( ${\textstyle \aleph _{0}+0=\aleph _{0}+1}$  ), but in the infinite-dimensional case it cannot be inferred that the kernel and the co-kernel of an endomorphism have the same dimension (0 ≠ 1). The reverse situation obtains for the map h: RR, ${\textstyle \left\{a_{n}\right\}\mapsto \left\{c_{n}\right\}}$  with cn = an + 1. Its image is the entire target space, and hence its co-kernel has dimension 0, but since it maps all sequences in which only the first element is non-zero to the zero sequence, its kernel has dimension 1.

### Index

For a linear operator with finite-dimensional kernel and co-kernel, one may define index as:

$\operatorname {ind} (f):=\dim(\ker(f))-\dim(\operatorname {coker} (f)),$

namely the degrees of freedom minus the number of constraints.

For a transformation between finite-dimensional vector spaces, this is just the difference dim(V) − dim(W), by rank–nullity. This gives an indication of how many solutions or how many constraints one has: if mapping from a larger space to a smaller one, the map may be onto, and thus will have degrees of freedom even without constraints. Conversely, if mapping from a smaller space to a larger one, the map cannot be onto, and thus one will have constraints even without degrees of freedom.

The index of an operator is precisely the Euler characteristic of the 2-term complex 0 → VW → 0. In operator theory, the index of Fredholm operators is an object of study, with a major result being the Atiyah–Singer index theorem.

## Algebraic classifications of linear transformations

No classification of linear maps could hope to be exhaustive. The following incomplete list enumerates some important classifications that do not require any additional structure on the vector space.

Let V and W denote vector spaces over a field F and let T: VW be a linear map.

Definition: T is said to be injective or a monomorphism if any of the following equivalent conditions are true:

1. T is one-to-one as a map of sets.
2. ker T = {0V}
3. dim(kerT) = 0
4. T is monic or left-cancellable, which is to say, for any vector space U and any pair of linear maps R: UV and S: UV, the equation TR = TS implies R = S.
5. T is left-invertible, which is to say there exists a linear map S: WV such that ST is the identity map on V.

Definition: T is said to be surjective or an epimorphism if any of the following equivalent conditions are true:

1. T is onto as a map of sets.
2. coker T = {0W}
3. T is epic or right-cancellable, which is to say, for any vector space U and any pair of linear maps R: WU and S: WU, the equation RT = ST implies R = S.
4. T is right-invertible, which is to say there exists a linear map S: WV such that TS is the identity map on W.

Definition: T is said to be an isomorphism if it is both left- and right-invertible. This is equivalent to T being both one-to-one and onto (a bijection of sets) or also to T being both epic and monic, and so being a bimorphism.

If T: VV is an endomorphism, then:

• If, for some positive integer n, the n-th iterate of T, Tn, is identically zero, then T is said to be nilpotent.
• If T2 = T, then T is said to be idempotent
• If T = kI, where k is some scalar, then T is said to be a scaling transformation or scalar multiplication map; see scalar matrix.

## Change of basis

Given a linear map which is an endomorphism whose matrix is A, in the basis B of the space it transforms vector coordinates [u] as [v] = A[u]. As vectors change with the inverse of B (vectors are contravariant) its inverse transformation is [v] = B[v'].

Substituting this in the first expression

$B\left[v'\right]=AB\left[u'\right]$

hence

$\left[v'\right]=B^{-1}AB\left[u'\right]=A'\left[u'\right].$

Therefore, the matrix in the new basis is A′ = B−1AB, being B the matrix of the given basis.

Therefore, linear maps are said to be 1-co- 1-contra-variant objects, or type (1, 1) tensors.

## Continuity

A linear transformation between topological vector spaces, for example normed spaces, may be continuous. If its domain and codomain are the same, it will then be a continuous linear operator. A linear operator on a normed linear space is continuous if and only if it is bounded, for example, when the domain is finite-dimensional. An infinite-dimensional domain may have discontinuous linear operators.

An example of an unbounded, hence discontinuous, linear transformation is differentiation on the space of smooth functions equipped with the supremum norm (a function with small values can have a derivative with large values, while the derivative of 0 is 0). For a specific example, sin(nx)/n converges to 0, but its derivative cos(nx) does not, so differentiation is not continuous at 0 (and by a variation of this argument, it is not continuous anywhere).

## Applications

A specific application of linear maps is for geometric transformations, such as those performed in computer graphics, where the translation, rotation and scaling of 2D or 3D objects is performed by the use of a transformation matrix. Linear mappings also are used as a mechanism for describing change: for example in calculus correspond to derivatives; or in relativity, used as a device to keep track of the local transformations of reference frames.

Another application of these transformations is in compiler optimizations of nested-loop code, and in parallelizing compiler techniques.