The identity function on a set is the function that sends every element of to itself. Usually denoted by , it is defined by
Its defining role is to leave other functions unchanged when composed with them on the appropriate side. Identity functions occur throughout mathematics, from elementary algebra and calculus to linear algebra, topology, and category theory.
Definition and notation
For every set , there is exactly one identity function on . Common notations include
When the underlying set is clear, the subscript may be omitted. In operator theory and linear algebra, is also common.
Both the domain and the codomain of are . This matters because the rule can also describe an inclusion map. If is a proper subset of , the map
is not the identity function on : its codomain is , rather than . By contrast, is the identity on .
In set theory, the graph of the identity function is the diagonal
The definition also applies to the empty set. Its identity function is the unique function , whose graph is empty.
Identity under composition
For any function , function composition satisfies
Indeed, for every ,
Thus, identity functions are neutral elements for composition. Their role is analogous to that of zero for addition and one for multiplication, although composition requires compatible domains and codomains.
This neutral-element property also characterizes the identity uniquely. Suppose satisfies
for every function . Taking gives . The corresponding right-identity property yields the same conclusion.
In particular,
The identity is therefore idempotent, but idempotence alone does not make a function an identity. A constant function , for example, satisfies while generally failing to fix every element.
Bijectivity, inverses, and fixed points
Every identity function is a bijection: distinct inputs remain distinct, and every element of the codomain is an output. Its inverse is itself:
More generally, a function has a two-sided inverse precisely when
These equations express that applying one function and then the other restores the original input. A function has such an inverse exactly when it is bijective.
Every element of is a fixed point of . Conversely, a function that fixes every element of is the identity. Having only some fixed points is insufficient: the real function fixes and , but is not the identity on .
The real identity function
On the real numbers, the identity function is
Its graph is the straight line , passing through the origin with slope . Reflection across this line exchanges the coordinates of each point, explaining the familiar symmetry between the graphs of a bijection between subsets of and its inverse.
The real identity function is a polynomial of degree one. Its derivative is
and its higher derivatives vanish. Its antiderivatives are
It is continuous and strictly increasing. Under the usual distance on ,
so it preserves distances exactly.
Linear algebra and identity operators
On a vector space , the identity function is a linear map, since
for all vectors and scalars .
When has finite dimension , the matrix of the identity operator, using the same basis for the domain and codomain, is the identity matrix
Using different bases for the domain and codomain can produce a different matrix, even though the underlying linear map remains the identity.
On a nonzero vector space, every nonzero vector is an eigenvector of the identity operator with eigenvalue . In a normed vector space, the identity preserves the norm; on a nonzero space, its operator norm is .
In functional analysis, expressions such as use the identity operator to subtract a scalar multiple of the input from the output of an operator .
Topology and structured sets
On a topological space , the identity map is continuous because the preimage of every open set is itself. Its inverse is also the identity, so it is a homeomorphism.
The topology must be specified. If the same underlying set carries two topologies and , the map
is continuous exactly when
It need not be continuous in the reverse direction. Thus, the rule does not by itself determine whether a map preserves additional structure.
On a metric space with the same metric on both sides, the identity is an isometry. On a group or ring, the identity map preserves the algebraic operations and is an isomorphism from the structure to itself.
Category theory and computing
In category theory, identity maps become part of the definition of a category. Every object has an identity morphism
such that, for every morphism ,
Morphisms need not be ordinary functions, so the concept extends beyond element-by-element mappings. In each case, the composition laws determine the identity morphism uniquely.
In computer science, an identity function returns its argument unchanged. In functional programming, it can be passed to another function when no transformation is required. In typed settings, a generic identity function has the type , returning a value of the same type as its input. It is distinct from a no-argument operation that merely performs no action: an identity function specifically accepts and returns a value.