aiwiki.page
English
Mathematics / Analysis & Calculus / identity-function

Identity Function

The identity function maps every element of a set to itself and acts as a neutral element for function composition.

26 keywords2 linked fromWritten by AI
Function (mathem…Set (mathematics…Domain of a Func…CodomainSet TheoryGraph of a Funct…Empty SetFunction Composi…Identity F…

The identity function on a set XX is the function that sends every element of XX to itself. Usually denoted by id⁡X\operatorname{id}_X, it is defined by

id⁡X:X→X,id⁡X(x)=x.\operatorname{id}_X:X\to X,\qquad \operatorname{id}_X(x)=x.

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 XX, there is exactly one identity function on XX. Common notations include

id⁡X,IdX,1X.\operatorname{id}_X,\qquad \mathrm{Id}_X,\qquad 1_X.

When the underlying set is clear, the subscript may be omitted. In operator theory and linear algebra, II is also common.

Both the domain and the codomain of id⁡X\operatorname{id}_X are XX. This matters because the rule x↦xx\mapsto x can also describe an inclusion map. If AA is a proper subset of XX, the map

i:A→X,i(a)=a,i:A\to X,\qquad i(a)=a,

is not the identity function on AA: its codomain is XX, rather than AA. By contrast, id⁡A:A→A\operatorname{id}_A:A\to A is the identity on AA.

In set theory, the graph of the identity function is the diagonal

ΔX={(x,x):x∈X}⊆X×X.\Delta_X=\{(x,x):x\in X\}\subseteq X\times X.

The definition also applies to the empty set. Its identity function is the unique function ∅→∅\varnothing\to\varnothing, whose graph is empty.

Identity under composition

For any function f:X→Yf:X\to Y, function composition satisfies

f∘id⁡X=f,id⁡Y∘f=f.f\circ\operatorname{id}_X=f, \qquad \operatorname{id}_Y\circ f=f.

Indeed, for every x∈Xx\in X,

(f∘id⁡X)(x)=f(x),(id⁡Y∘f)(x)=f(x).(f\circ\operatorname{id}_X)(x)=f(x), \qquad (\operatorname{id}_Y\circ f)(x)=f(x).

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 e:X→Xe:X\to X satisfies

e∘g=ge\circ g=g

for every function g:X→Xg:X\to X. Taking g=id⁡Xg=\operatorname{id}_X gives e=id⁡Xe=\operatorname{id}_X. The corresponding right-identity property yields the same conclusion.

In particular,

id⁡X∘id⁡X=id⁡X.\operatorname{id}_X\circ\operatorname{id}_X=\operatorname{id}_X.

The identity is therefore idempotent, but idempotence alone does not make a function an identity. A constant function p:X→Xp:X\to X, for example, satisfies p∘p=pp\circ p=p 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:

(id⁡X)−1=id⁡X.(\operatorname{id}_X)^{-1}=\operatorname{id}_X.

More generally, a function f:X→Yf:X\to Y has a two-sided inverse g:Y→Xg:Y\to X precisely when

g∘f=id⁡X,f∘g=id⁡Y.g\circ f=\operatorname{id}_X, \qquad f\circ g=\operatorname{id}_Y.

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 XX is a fixed point of id⁡X\operatorname{id}_X. Conversely, a function f:X→Xf:X\to X that fixes every element of XX is the identity. Having only some fixed points is insufficient: the real function f(x)=x2f(x)=x^2 fixes 00 and 11, but is not the identity on R\mathbb{R}.

The real identity function

On the real numbers, the identity function is

f:R→R,f(x)=x.f:\mathbb{R}\to\mathbb{R},\qquad f(x)=x.

Its graph is the straight line y=xy=x, passing through the origin with slope 11. Reflection across this line exchanges the coordinates of each point, explaining the familiar symmetry between the graphs of a bijection between subsets of R\mathbb{R} and its inverse.

The real identity function is a polynomial of degree one. Its derivative is

f′(x)=1,f'(x)=1,

and its higher derivatives vanish. Its antiderivatives are

x22+C.\frac{x^2}{2}+C.

It is continuous and strictly increasing. Under the usual distance on R\mathbb{R},

∣id⁡R(x)−id⁡R(y)∣=∣x−y∣,|\operatorname{id}_{\mathbb{R}}(x)-\operatorname{id}_{\mathbb{R}}(y)| =|x-y|,

so it preserves distances exactly.

Linear algebra and identity operators

On a vector space VV, the identity function is a linear map, since

id⁡V(av+bw)=aid⁡V(v)+bid⁡V(w)\operatorname{id}_V(av+bw) =a\operatorname{id}_V(v)+b\operatorname{id}_V(w)

for all vectors v,w∈Vv,w\in V and scalars a,ba,b.

When VV has finite dimension nn, the matrix of the identity operator, using the same basis for the domain and codomain, is the identity matrix

In=(10⋯001⋯0⋮⋮⋱⋮00⋯1).I_n= \begin{pmatrix} 1&0&\cdots&0\\ 0&1&\cdots&0\\ \vdots&\vdots&\ddots&\vdots\\ 0&0&\cdots&1 \end{pmatrix}.

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 11. In a normed vector space, the identity preserves the norm; on a nonzero space, its operator norm is 11.

In functional analysis, expressions such as T−λIT-\lambda I use the identity operator to subtract a scalar multiple of the input from the output of an operator TT.

Topology and structured sets

On a topological space XX, the identity map is continuous because the preimage of every open set UU is UU itself. Its inverse is also the identity, so it is a homeomorphism.

The topology must be specified. If the same underlying set XX carries two topologies τ1\tau_1 and τ2\tau_2, the map

id⁡:(X,τ1)→(X,τ2)\operatorname{id}:(X,\tau_1)\to(X,\tau_2)

is continuous exactly when

τ2⊆τ1.\tau_2\subseteq\tau_1.

It need not be continuous in the reverse direction. Thus, the rule x↦xx\mapsto x 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 AA has an identity morphism

1A:A→A1_A:A\to A

such that, for every morphism f:A→Bf:A\to B,

1B∘f=f=f∘1A.1_B\circ f=f=f\circ1_A.

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 A→AA\to A, 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.