In mathematics, an identity element (or neutral element) is a special type of element of a set with respect to a binary operation on that set.

The term identity element is often shortened to identity when there is no possibility of confusion, and we will do so in this article.

Let S be a set with a binary operation * on it. Then an element e of S is called a left identity if e * a = a for all a in S, and a right identity if a * e = a for all a in S. If e is both a left identity and a right identity, then it is called a two-sided identity, or simply an identity.

For example, if (S,*) denotes the real numbers with addition, then 0 is an identity. If (S,*) denotes the real numbers with multiplication, then 1 is an identity. If (S,*) denotes the n-by-n square matrices with addition, then the zero matrix is an identity. If (S,*) denotes the n-by-n matrices with multiplication, then the identity matrix is an identity. If (S,*) denotes the set of all functions from a set M to itself, with function composition as operation, then the identity map is an identity. If S has only two elements, e and f, and the operation * is defined by e * e = f * e = e and f * f = e * f = f, then both e and f are left identities, but there is no right or two-sided identity.

As the last example shows, it is possible for (S,*) to have several left identities. In fact, every element can be a left identity. Similarly, there can be several right identities. But if there is both a right identity and a left identity, then they are equal and there is just a single two-sided identity. To see this, note that if l is a left identity and r is a right identity then l = l * r = r. In particular, there can never be more than one two-sided identity.

If e is an identity of (S,*) and a * b = e, then a is called a left inverse of b and b is called a right inverse of a. If an element x is both a left inverse and a right inverse of y, then x is called a two-sided inverse, or simply an inverse, of y.

As with identities, it is possible for an element y to have several left inverses or several right inverses. y can even have several left inverses and several right inverses. However if the operation * is associative, then if y has both a left inverse and a right inverse, then they are equal.

See also: Additive inverse, Group, Monoid, Quasigroup.