Idempotence (UK: , US: ) is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application. The concept of idempotence arises in a number of places in abstract algebra (in particular, in the theory of projectors and closure operators) and functional programming (in which it is connected to the property of referential transparency). The term was introduced by American mathematician Benjamin Peirce in 1870 in the context of elements of algebras that remain invariant when raised to a positive integer power, and literally means "(the quality of having) the same power", from idem + potence (same + power).
Definition An element x of a set S equipped with a binary operator ⋅ is said to be idempotent under ⋅ if x⋅x=x The binary operation ⋅ is said to be idempotent if x⋅x=x for all x∈S
Examples In the monoid (ℕ,×) of the natural numbers with multiplication, only 0 and 1 are idempotent. Indeed, 0×0=0 and 1×1=1. In the monoid (ℕ,+) of the natural numbers with addition, only 0 is idempotent. Indeed, 0 + 0 = 0. In a magma (M,⋅), an identity element e or an absorbing element a, if it exists, is idempotent. Indeed, e⋅e=e and a⋅a=a. In a group (G,⋅), the identity element e is the only idempotent element. Indeed, if x is an element of G such that x⋅x=x, then x⋅x=x⋅e and finally x=e by multiplying on the left by the inverse element of x. In the monoids (𝒫(E),∪) and (𝒫(E),∩) of the power set 𝒫(E) of the set E with set union ∪ and set intersection ∩ respectively, ∪ and ∩ are idempotent. Indeed, x∪x=x for all x∈𝒫(E), and x∩x=x for all x∈𝒫(E). In the monoids ({0,1},∨) and ({0,1},∧) of the Boolean domain with logical disjunction ∨ and logical conjunction ∧ respectively, ∨ and ∧ are idempotent. Indeed, x∨x=x for all x∈{0,1}, and x∧x=x for all x∈{0,1}. In a GCD domain (for instance in ℤ), the operations of GCD and LCM are idempotent. In a Boolean ring, multiplication is idempotent. In a tropical semiring, addition is idempotent. In a ring of quadratic matrices, the determinant of an idempotent matrix is either 0 or 1. If the determinant is 1, the matrix necessarily is the identity matrix.
Idempotent functions In the monoid (EE,∘) of the functions from a set E to itself (see set exponentiation) with function composition ∘, idempotent elements are the functions f:E→E such that f∘f=f, that is such that f(f(x))=f(x) for all x∈E (in other words, the image f(x) of each element x∈E is a fixed point of f). For example:
the absolute value is idempotent. Indeed, abs∘abs=abs, that is abs(abs(x))=abs(x) for all x; constant functions are idempotent; the identity function is idempotent; the floor, ceiling and fractional part functions are idempotent; the real part function Re(z) of a complex number, is idempotent. for most kinds of average, taking the average of a set and putting it in a singleton set is idempotent: {avg{avg{x1,…,xn}}}={avg{x1,…,xn}} the subgroup generated function from the power set of a group to itself is idempotent; the convex hull function from the power set of an affine space over the reals to itself is idempotent; the closure and interior functions of the power set of a topological space to itself are idempotent; the Kleene star and Kleene plus functions of the power set of a monoid to itself are idempotent; the idempotent endomorphisms of a vector space are its projections. If the set E has n elements, we can partition it into k chosen fixed points and n−k non-fixed points under f, and then kn−k is the number of different idempotent functions. Hence, taking into account all possible partitions, ∑k=0n(nk)kn−k is the total number of possible idempotent functions on the set. The integer sequence of the number of idempotent functions as given by the sum above for n = 0, 1, 2, 3, 4, 5, 6, 7, 8, ... starts with 1, 1, 3, 10, 41, 196, 1057, 6322, 41393, ... (sequence A000248 in the OEIS). Neither idempotence nor non-idempotence is preserved under function composition. As an example for the former, f(x)=x mod 3 and g(x)=max(x,5) are both idempotent, but f∘g is not, although g∘f happens to be. As an example for the latter, the negation function ¬ on the Boolean domain is not idempotent, but ¬∘¬ is. Similarly, unary negation −(⋅) of real numbers is not idempotent, but −(⋅)∘−(⋅) is. In both cases, the composition is simply the identity function, which is idempotent.
Idempotent morphisms A morphism f:x→x in a category is called idempotent if f∘f=f. An idempotent is said to split if it can be written as f=h∘g for some g:x→y,h:y→x with g∘h=id. A category is said to be idempotent complete if every idempotent splits. For example, 𝖲𝖾𝗍 is idempotent complete.
Computer science meaning
In computer science, the term idempotence may have a different meaning depending on the context in which it is applied:
in imperative programming, a subroutine with side effects is idempotent if multiple calls to the subroutine have the same effect on the system state as a single call, in other words if the function from the system state space to itself associated with the subroutine is idempotent in the mathematical sense given in the definition; in functional programming, a pure function is idempotent if it is idempotent in the mathematical sense given in the definition. This is a very useful property in many situations, as it means that an operation can be repeated or retried as often as necessary without causing unintended effects. With non-idempotent operations, the algorithm may have to keep track of whether the operation was already performed or not.
… excerpt ends here. Continue reading the full article.

