Given an operation $*\colon X \times Y \to Y$, an element $e$ of $X$ is called a left identity for $*$ if $e * a = a$ for every element $a$ of $Y$. That is, the map $Y \to Y$ given by $e * -$ is the identity function on $Y$.

If $*\colon Y \times X \to Y$, then there is a similar concept of right identity.

If $*\colon X \times X \to X$, then $e$ is a two-sided identity, or simply identity, if it is both a left and right identity.

Related notions

Historically, identity elements (as above) came first, then identity functions, and then identity morphisms. These are all the same basic idea, however: an identity morphism is an identity element for the operation of composition.

An identity is sometimes called a unit (although that term also has a broader meaning, and an operation that has an identity element is called unital or unitary. In particular, a magma whose underlying operation $*\colon X \times X \to X$ has an identity is called a unital magma or a unitary magma.

Similarly, a unit law is the statement that a given operation has an identity element. In higher category theory, we generalise from the property of uniticity/unitality to the structure of a unitor.