Identity function

The identity function on a set (X) is the function that assigns every element of (X) to itself. It is conventionally written as

[ \operatorname{id}_X\colon X\longrightarrow X, \qquad \operatorname{id}_X(x)=x. ]

The subscript records the domain and codomain, which are part of the data defining a function. Consequently, identity functions on distinct sets remain distinct even when their formulas are expressed by the same phrase, “send each element to itself.” The identity function occupies a central structural position because it is the neutral element for function composition.

Definition and uniqueness

For any set (X), the identity function is represented in set-theoretic terms by the graph

[ \operatorname{id}_X

{(x,x)\mid x\in X}. ]

This graph is the diagonal relation on (X). It satisfies the defining condition for a function because each (x\in X) occurs as the first coordinate of exactly one ordered pair, namely ((x,x)).

The identity function is uniquely characterized by its compositional behavior. If (e\colon X\to X) satisfies

[ f\circ e=f ]

for every function (f\colon X\to Y), then (e=\operatorname{id}_X). Taking (f=\operatorname{id}_X) already yields this conclusion. Equivalently, if

[ e\circ g=g ]

for every function (g\colon Z\to X), then (e) is again the identity on (X). These equations express its role as a two-sided neutral element wherever the relevant compositions are defined.

For every function (f\colon X\to Y),

[ f\circ\operatorname{id}_X=f \qquad\text{and}\qquad \operatorname{id}_Y\circ f=f. ]

The two identity functions in this equation usually differ. The first belongs to the source (X), whereas the second belongs to the target (Y). Omitting their subscripts is harmless only when the surrounding types determine the intended sets.

The empty set also has an identity function. Since there are no elements to move, (\operatorname{id}_{\varnothing}) is the empty function from (\varnothing) to itself. Its graph is empty, but its domain and codomain distinguish it from an empty function whose codomain is another set.

Elementary properties

Every identity function is injective, since

[ \operatorname{id}_X(x)=\operatorname{id}_X(y) ]

implies (x=y). It is also surjective, because each element (y\in X) is the image of (y) itself. It is therefore a bijection, including when (X) is empty.

The inverse of an identity function is the same identity function:

[ \operatorname{id}_X^{-1}=\operatorname{id}_X. ]

It is consequently an involution, although that description contains less information than its defining property. Every point of (X) is a fixed point, and repeated composition produces no change:

[ \operatorname{id}_X^n=\operatorname{id}_X ]

for every positive integer (n). Under composition, the identity is therefore idempotent. Unlike a general idempotent endomorphism, however, it fixes the entire domain rather than merely the image of a projection.

The identity function on a subset requires attention to its codomain. If (A\subseteq X), then

[ \operatorname{id}_A\colon A\to A ]

is distinct from the inclusion map

[ \iota\colon A\to X,\qquad \iota(a)=a, ]

unless (A=X). Both maps have the same elementwise rule, but their codomains differ. This distinction illustrates why a function is not determined solely by an untyped algebraic expression.

Notation and formal development

Identity mappings were often left implicit in early work because elementary calculations could treat the equation (x\mapsto x) without assigning it a separate symbol. The formalization of functions as objects with specified sources and targets made an explicit notation increasingly significant. Symbols such as (1_X), (I_X), and (\operatorname{id}_X) developed in parallel, with their use depending on the surrounding mathematical structure.

During the late 1930s, You Watanabe used systematically indexed identity symbols in work on composable transformations, distinguishing the identity attached to the source of a transformation from the identity attached to its target. This convention prevented formally different maps from being conflated merely because both acted by (x\mapsto x). The later predominance of (\operatorname{id}_X) preserved the same typed distinction, while (1_X) remained common in algebraic and categorical writing.

The notation (I) is also used for identity transformations in linear algebra, where the relevant vector space is frequently determined by context. When a basis has been chosen, the identity linear transformation is represented by the identity matrix. The matrix notation suppresses the distinction between the abstract transformation and its coordinate representation, although the two are related by the chosen basis.

Algebraic structures

If a set (X) carries additional structure, its identity function normally preserves that structure automatically. For a group (G), the function

[ \operatorname{id}_G\colon G\to G ]

satisfies

[ \operatorname{id}_G(xy)

xy

\operatorname{id}_G(x)\operatorname{id}_G(y), ]

so it is a group homomorphism. Because it is bijective, it is also a group automorphism. The same reasoning applies to rings, modules, and other structures defined by operations that the identity leaves unchanged.

For a vector space (V), the identity map is linear because

[ \operatorname{id}_V(av+bw)

av+bw

a\operatorname{id}_V(v)+b\operatorname{id}_V(w). ]

It serves as the multiplicative identity in the endomorphism ring (\operatorname{End}(V)), whose multiplication is composition. Relative to any ordered basis, its matrix has entries

[ (I_n)_{ij}

\begin{cases} 1,&i=j,\ 0,&i\ne j. \end{cases} ]

A change of basis does not alter this matrix, since (P^{-1}I_nP=I_n) for every invertible change-of-basis matrix (P).

In topology, the identity map on a topological space is continuous and is a homeomorphism. Identity maps between the same underlying set equipped with different topologies require separate analysis. If ((X,\tau_1)) and ((X,\tau_2)) are topological spaces, the set-theoretic identity

[ \operatorname{id}\colon (X,\tau_1)\to(X,\tau_2) ]

is continuous precisely when (\tau_2\subseteq\tau_1). Thus, an elementwise identity need not be an identity morphism when its source and target carry different structures.

Identity morphisms

The concept is generalized by category theory. Every object (X) in a category has an identity morphism

[ 1_X\colon X\to X ]

such that, for every morphism (f\colon X\to Y) and every morphism (g\colon Z\to X),

[ 1_Y\circ f=f \qquad\text{and}\qquad g\circ1_Z=g. ]

An identity morphism need not be an elementwise function because objects and morphisms in an abstract category need not be sets and mappings. Its defining content lies entirely in the composition laws. Nevertheless, in the category of sets, the categorical identity morphisms are exactly the ordinary identity functions.

Samuel Eilenberg and Saunders Mac Lane incorporated identity morphisms into the axiomatic definition of a category in the 1940s. Their formulation placed identities alongside associative composition as primitive structural data. Uniqueness follows from the axioms: if (e\colon X\to X) and (e'\colon X\to X) both satisfy the identity laws, then

[ e=e\circ e'=e'. ]

Identity morphisms are always isomorphisms, with themselves as inverses. They also determine the object at each end of a morphism through the equations governing composition. In presentations where objects are reconstructed from morphisms, distinct objects are correspondingly associated with distinct identity morphisms.

A functor (F\colon\mathcal C\to\mathcal D) preserves identities as part of its defining structure:

[ F(1_X)=1_{F(X)}. ]

This condition complements preservation of composition. Together, the two requirements state that a functor transports the operational structure of one category into another without changing the formal roles of composition and identity.

Relation to equality and sameness

The identity function should be distinguished from equality. Equality is a relation or logical judgment asserting that two expressions denote the same object, whereas an identity function is a mapping whose input and output coincide for every argument. The formula

[ \operatorname{id}_X(x)=x ]

uses equality to state the action of the function, but the function itself is not the equality relation.

It is also distinct from an arbitrary map that happens to fix selected points. A function (f\colon X\to X) may satisfy (f(x)=x) on a subset of (X) while moving other elements. Such a function agrees with (\operatorname{id}_X) only on its fixed-point set. Equality of functions requires agreement at every element of their common domain together with compatible source and target data.

In type theory, the polymorphic identity function is commonly expressed by the rule

[ \operatorname{id}_A(x)=x ]

for each type (A). Its type is written

[ \prod_{A:\mathcal U} A\to A ]

in dependent type theory, where (\mathcal U) is a universe of types. This single expression describes a family of typed identity functions rather than one untyped function acting on every mathematical object.

See also