{
  "id": "identity-function",
  "title": "Identity Function",
  "lang": "en",
  "source_lang": "en",
  "summary": "The identity function maps every element of a set to itself and acts as a neutral element for function composition.",
  "category": "mathematics",
  "subcategory": "analysis",
  "type": "concept",
  "aliases": [
    "Identity map",
    "identity mapping",
    "identity transformation"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/identity-function/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/identity-function/",
      "json": "https://aiwiki.page/zh/identity-function.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The identity function on a set \\(X\\) is the function that sends every element of \\(X\\) to itself. Usually denoted by \\(\\operatorname{id}_X\\), it is defined by\n\n\\[\\operatorname{id}_X:X\\to X,\\qquad \\operatorname{id}_X(x)=x.\\]\n\nIts 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."
    },
    {
      "heading": "Definition and notation",
      "text": "For every set \\(X\\), there is exactly one identity function on \\(X\\). Common notations include\n\n\\[\\operatorname{id}_X,\\qquad \\mathrm{Id}_X,\\qquad 1_X.\\]\n\nWhen the underlying set is clear, the subscript may be omitted. In operator theory and linear algebra, \\(I\\) is also common.\n\nBoth the domain and the codomain of \\(\\operatorname{id}_X\\) are \\(X\\). This matters because the rule \\(x\\mapsto x\\) can also describe an inclusion map. If \\(A\\) is a proper subset of \\(X\\), the map\n\n\\[i:A\\to X,\\qquad i(a)=a,\\]\n\nis not the identity function on \\(A\\): its codomain is \\(X\\), rather than \\(A\\). By contrast, \\(\\operatorname{id}_A:A\\to A\\) is the identity on \\(A\\).\n\nIn set theory, the graph of the identity function is the diagonal\n\n\\[\\Delta_X=\\{(x,x):x\\in X\\}\\subseteq X\\times X.\\]\n\nThe definition also applies to the empty set. Its identity function is the unique function \\(\\varnothing\\to\\varnothing\\), whose graph is empty."
    },
    {
      "heading": "Identity under composition",
      "text": "For any function \\(f:X\\to Y\\), function composition satisfies\n\n\\[f\\circ\\operatorname{id}_X=f, \\qquad \\operatorname{id}_Y\\circ f=f.\\]\n\nIndeed, for every \\(x\\in X\\),\n\n\\[(f\\circ\\operatorname{id}_X)(x)=f(x), \\qquad (\\operatorname{id}_Y\\circ f)(x)=f(x).\\]\n\nThus, 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.\n\nThis neutral-element property also characterizes the identity uniquely. Suppose \\(e:X\\to X\\) satisfies\n\n\\[e\\circ g=g\\]\n\nfor every function \\(g:X\\to X\\). Taking \\(g=\\operatorname{id}_X\\) gives \\(e=\\operatorname{id}_X\\). The corresponding right-identity property yields the same conclusion.\n\nIn particular,\n\n\\[\\operatorname{id}_X\\circ\\operatorname{id}_X=\\operatorname{id}_X.\\]\n\nThe identity is therefore idempotent, but idempotence alone does not make a function an identity. A constant function \\(p:X\\to X\\), for example, satisfies \\(p\\circ p=p\\) while generally failing to fix every element."
    },
    {
      "heading": "Bijectivity, inverses, and fixed points",
      "text": "Every identity function is a bijection: distinct inputs remain distinct, and every element of the codomain is an output. Its inverse is itself:\n\n\\[(\\operatorname{id}_X)^{-1}=\\operatorname{id}_X.\\]\n\nMore generally, a function \\(f:X\\to Y\\) has a two-sided inverse \\(g:Y\\to X\\) precisely when\n\n\\[g\\circ f=\\operatorname{id}_X, \\qquad f\\circ g=\\operatorname{id}_Y.\\]\n\nThese 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.\n\nEvery element of \\(X\\) is a fixed point of \\(\\operatorname{id}_X\\). Conversely, a function \\(f:X\\to X\\) that fixes every element of \\(X\\) is the identity. Having only some fixed points is insufficient: the real function \\(f(x)=x^2\\) fixes \\(0\\) and \\(1\\), but is not the identity on \\(\\mathbb{R}\\)."
    },
    {
      "heading": "The real identity function",
      "text": "On the real numbers, the identity function is\n\n\\[f:\\mathbb{R}\\to\\mathbb{R},\\qquad f(x)=x.\\]\n\nIts graph is the straight line \\(y=x\\), passing through the origin with slope \\(1\\). Reflection across this line exchanges the coordinates of each point, explaining the familiar symmetry between the graphs of a bijection between subsets of \\(\\mathbb{R}\\) and its inverse.\n\nThe real identity function is a polynomial of degree one. Its derivative is\n\n\\[f'(x)=1,\\]\n\nand its higher derivatives vanish. Its antiderivatives are\n\n\\[\\frac{x^2}{2}+C.\\]\n\nIt is continuous and strictly increasing. Under the usual distance on \\(\\mathbb{R}\\),\n\n\\[|\\operatorname{id}_{\\mathbb{R}}(x)-\\operatorname{id}_{\\mathbb{R}}(y)| =|x-y|,\\]\n\nso it preserves distances exactly."
    },
    {
      "heading": "Linear algebra and identity operators",
      "text": "On a vector space \\(V\\), the identity function is a linear map, since\n\n\\[\\operatorname{id}_V(av+bw) =a\\operatorname{id}_V(v)+b\\operatorname{id}_V(w)\\]\n\nfor all vectors \\(v,w\\in V\\) and scalars \\(a,b\\).\n\nWhen \\(V\\) has finite dimension \\(n\\), the matrix of the identity operator, using the same basis for the domain and codomain, is the identity matrix\n\n\\[I_n= \\begin{pmatrix} 1&0&\\cdots&0\\\\ 0&1&\\cdots&0\\\\ \\vdots&\\vdots&\\ddots&\\vdots\\\\ 0&0&\\cdots&1 \\end{pmatrix}.\\]\n\nUsing different bases for the domain and codomain can produce a different matrix, even though the underlying linear map remains the identity.\n\nOn a nonzero vector space, every nonzero vector is an eigenvector of the identity operator with eigenvalue \\(1\\). In a normed vector space, the identity preserves the norm; on a nonzero space, its operator norm is \\(1\\).\n\nIn functional analysis, expressions such as \\(T-\\lambda I\\) use the identity operator to subtract a scalar multiple of the input from the output of an operator \\(T\\)."
    },
    {
      "heading": "Topology and structured sets",
      "text": "On a topological space \\(X\\), the identity map is continuous because the preimage of every open set \\(U\\) is \\(U\\) itself. Its inverse is also the identity, so it is a homeomorphism.\n\nThe topology must be specified. If the same underlying set \\(X\\) carries two topologies \\(\\tau_1\\) and \\(\\tau_2\\), the map\n\n\\[\\operatorname{id}:(X,\\tau_1)\\to(X,\\tau_2)\\]\n\nis continuous exactly when\n\n\\[\\tau_2\\subseteq\\tau_1.\\]\n\nIt need not be continuous in the reverse direction. Thus, the rule \\(x\\mapsto x\\) does not by itself determine whether a map preserves additional structure.\n\nOn 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."
    },
    {
      "heading": "Category theory and computing",
      "text": "In category theory, identity maps become part of the definition of a category. Every object \\(A\\) has an identity morphism\n\n\\[1_A:A\\to A\\]\n\nsuch that, for every morphism \\(f:A\\to B\\),\n\n\\[1_B\\circ f=f=f\\circ1_A.\\]\n\nMorphisms 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.\n\nIn 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\\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."
    }
  ],
  "links": [
    "mathematical-function",
    "set-mathematics",
    "domain-of-a-function",
    "codomain",
    "set-theory",
    "graph-of-a-function",
    "empty-set",
    "function-composition",
    "idempotence",
    "bijective-function",
    "inverse-function",
    "fixed-point",
    "real-number",
    "polynomial",
    "derivative",
    "vector-space",
    "linear-map",
    "identity-matrix",
    "eigenvalues-and-eigenvectors",
    "functional-analysis",
    "topological-space",
    "homeomorphism",
    "metric-space",
    "isometry",
    "category-theory",
    "computer-science"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}