Mathematical function, in linear algebra
In mathematics, and more specifically in linear algebra, a linear map (also called a linear mapping, linear transformation, vector space homomorphism, or in some contexts linear function) is a mapping formula_1 between two vector spaces that preserves the operations of vector addition and scalar multiplication. The same names and the same definition are also used for the more general case of modules over a ring; see Module homomorphism.
If a linear map is a bijection then it is called a ;templatestyles src="Template:Visible anchor/styles.css" / ;linear isomorphism. In the case where formula_2, a linear map is called a linear endomorphism. Sometimes the term ;templatestyles src="Template:Visible anchor/styles.css" / ;linear operator refers to this case, but the term "linear operator" can have different meanings for different conventions: for example, it can be used to emphasize that formula_3 and formula_4 are real vector spaces (not necessarily with formula_2), or it can be used to emphasize that formula_3 is a function space, which is a common convention in functional analysis. Sometimes the term "linear function" has the same meaning as "linear map", while in analysis it does not.
A linear map from formula_3 to formula_4 always maps the origin of formula_3 to the origin of formula_4. Moreover, it maps linear subspaces in formula_3 onto linear subspaces in formula_4 (possibly of a lower dimension); for example, it maps a plane through the origin in formula_3 to either a plane through the origin in formula_4, a line through the origin in formula_4, or just the origin in formula_4. Linear maps can often be represented as matrices, and simple examples include rotation and reflection linear transformations.
In the language of category theory, linear maps are the morphisms of vector spaces, and they form a category equivalent to the one of matrices.
Definition and first consequences.
Let formula_3 and formula_4 be vector spaces over the same field formula_19. 
A function formula_20 is said to be a "linear map" if for any two vectors formula_21 and any scalar formula_22 the following two conditions are satisfied:
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 formula_25 and scalars formula_26 the following equality holds:
formula_27 Thus a linear map is one which preserves linear combinations.
Denoting the zero elements of the vector spaces formula_3 and formula_4 by formula_30 and formula_31 respectively, it follows that formula_32 Let formula_33 and formula_34 in the equation for homogeneity of degree 1:
formula_35
A linear map formula_36 with formula_19 viewed as a one-dimensional vector space over itself is called a linear functional.
These statements generalize to any left-module formula_38 over a ring formula_39 without modification, and to any right-module upon reversing of the scalar multiplication.
Examples.
Linear extensions.
Often, a linear map is constructed by defining it on a subset of a vector space and then to the linear span of the domain. 
Suppose formula_63 and formula_64 are vector spaces and formula_69 is a function defined on some subset formula_70 
Then a " ;templatestyles src="Template:Visible anchor/styles.css" / ;linear extension of formula_54 to formula_72" if it exists, is a linear map formula_73 defined on formula_63 that extends formula_54 (meaning that formula_76 for all formula_77) and takes its values from the codomain of formula_78 
When the subset formula_79 is a vector subspace of formula_63 then a (formula_64-valued) linear extension of formula_54 to all of formula_63 is guaranteed to exist if (and only if) formula_69 is a linear map. In particular, if formula_54 has a linear extension to formula_86 then it has a linear extension to all of formula_87
The map formula_69 can be extended to a linear map formula_89 if and only if whenever formula_90 is an integer, formula_91 are scalars, and formula_92 are vectors such that formula_93 then necessarily formula_94 
If a linear extension of formula_69 exists then the linear extension formula_89 is unique and
formula_97
holds for all formula_98 and formula_99 as above. 
If formula_79 is linearly independent then every function formula_69 into any vector space has a linear extension to a (linear) map formula_102 (the converse is also true).
For example, if formula_103 and formula_104 then the assignment formula_105 and formula_106 can be linearly extended from the linearly independent set of vectors formula_107 to a linear map on formula_108 The unique linear extension formula_109 is the map that sends formula_110 to
formula_111
Every (scalar-valued) linear functional formula_54 defined on a vector subspace of a real or complex vector space formula_63 has a linear extension to all of formula_87 
Indeed, the Hahn–Banach dominated extension theorem even guarantees that when this linear functional formula_54 is dominated by some given seminorm formula_116 (meaning that formula_117 holds for all formula_118 in the domain of formula_54) then there exists a linear extension to formula_63 that is also dominated by formula_121
Matrices.
If formula_3 and formula_4 are finite-dimensional vector spaces and a basis is defined for each vector space, then every linear map from formula_3 to formula_4 can be represented by a matrix. This is useful because it allows concrete calculations. Matrices yield examples of linear maps: if formula_45 is a real formula_46 matrix, then formula_128 describes a linear map formula_129 (see Euclidean space).
Let formula_130 be a basis for formula_3. Then every vector formula_132 is uniquely determined by the coefficients formula_133 in the field formula_56:
formula_135
If formula_52 is a linear map,
formula_137
which implies that the function "f" is entirely determined by the vectors formula_138. Now let formula_139 be a basis for formula_4. Then we can represent each vector formula_141 as
formula_142
Thus, the function formula_54 is entirely determined by the values of formula_144. If we put these values into an formula_46 matrix formula_146, then we can conveniently use it to compute the vector output of formula_54 for any vector in formula_3. To get formula_146, every column formula_150 of formula_146 is a vector
formula_152
corresponding to formula_141 as defined above. To define it more clearly, for some column formula_150 that corresponds to the mapping formula_141,
formula_156
where formula_146 is the matrix of formula_54. In other words, every column formula_159 has a corresponding vector formula_141 whose coordinates formula_161 are the elements of column formula_150. 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:
Such that starting in the bottom left corner formula_175 and looking for the bottom right corner formula_176, one would left-multiply—that is, formula_177. The equivalent method would be the "longer" method going clockwise from the same point such that formula_175 is left-multiplied with formula_179, or formula_180.
Examples in two dimensions.
In two-dimensional space R2 linear maps are described by 2 × 2 matrices. These are some examples:
If a linear map is only composed of rotation, reflection, and/or uniform scaling, then the linear map is a conformal linear transformation.
Vector space of linear maps.
The composition of linear maps is linear: if formula_20 and formula_192 are linear, then so is their composition formula_193. 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 formula_194 and formula_195 are linear, then so is their pointwise sum formula_196, which is defined by formula_197.
If formula_52 is linear and formula_199 is an element of the ground field formula_200, then the map formula_201, defined by formula_202, is also linear.
Thus the set formula_203 of linear maps from formula_204 to formula_205 itself forms a vector space over formula_200, sometimes denoted formula_207. Furthermore, in the case that formula_208, this vector space, denoted formula_209, 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 formula_210 is an endomorphism of formula_204; the set of all such endomorphisms formula_212 together with addition, composition and scalar multiplication as defined above forms an associative algebra with identity element over the field formula_200 (and in particular a ring). The multiplicative identity element of this algebra is the identity map formula_214.
An endomorphism of formula_204 that is also an isomorphism is called an automorphism of formula_204. The composition of two automorphisms is again an automorphism, and the set of all automorphisms of formula_204 forms a group, the automorphism group of formula_204 which is denoted by formula_219 or formula_220. Since the automorphisms are precisely those endomorphisms which possess inverses under composition, formula_219 is the group of units in the ring formula_212.
If formula_204 has finite dimension formula_224, then formula_209 is isomorphic to the associative algebra of all formula_226 matrices with entries in formula_200. The automorphism group of formula_204 is isomorphic to the general linear group formula_229 of all formula_226 invertible matrices with entries in formula_200.
Kernel, image and the rank–nullity theorem.
If formula_52 is linear, we define the kernel and the image or range of formula_233 by
formula_234
formula_235 is a subspace of formula_204 and formula_237 is a subspace of formula_205. The following dimension formula is known as the rank–nullity theorem:
formula_239
The number formula_240 is also called the rank of formula_233 and written as formula_242, or sometimes, formula_243; the number formula_244 is called the nullity of formula_233 and written as formula_246 or formula_247. If formula_204 and formula_205 are finite-dimensional, bases have been chosen and formula_233 is represented by the matrix formula_165, then the rank and nullity of formula_233 are equal to the rank and nullity of the matrix formula_165, respectively.
Cokernel.
A subtler invariant of a linear transformation formula_52 is the "co"kernel, which is defined as
formula_255
This is the "dual" notion to the kernel: just as the kernel is a "sub"space of the "domain," the co-kernel is a "quotient" space of the "target." Formally, one has the exact sequence
formula_256
These can be interpreted thus: given a linear equation "f"(v) = w to solve,
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": R2 → R2, 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 "W" → R, formula_257: 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": R∞ → R∞, formula_258 with "b"1 = 0 and "b""n" + 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 (formula_259), 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": R∞ → R∞, formula_260 with "cn" = "a""n" + 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