Formally, if *S* is a set with a binary operation * on it, then an element *s* of *S* is said to be idempotent if

*s***s*=*s*.

A function *f* from a set *M* to itself is called idempotent if *f* o *f* = *f*, that is, *f*(*f*(*x*)) = *f*(*x*) for all *x* in *M*. This is equivalent to saying that *f*(*x*) = *x* for all *x* in *f*(*M*). Trivial examples of idempotent functions on *S* are the identity map and the constant maps. Less trivial examples are the absolute value function of a real or complex argument, and the closure operator for a topological space *X*, which is an idempotent function on the power set of *X*.

In linear algebra, projections are idempotent. That is, any matrix that projects all vectors onto a subspace V (not necessarily orthogonally) is idempotent, if V itself is pointwise fixed.

A ring in which multiplication is idempotent (*x***x*=*x*) is called a boolean ring.
It can be shown that in every such ring, multiplication is commutative, and every element is its own additive inverse.

In computing, idempotence is the quality of something that has the same effect if used multiple times as it does if used only once. This is but a special case of the mathematical concept defined above. In particular, C header files are often designed to be idempotent, that is, if the header file is included more than once (as can easily happen with nested `#include`s), then nothing untoward happens - the effect is the same as if it had been included only once. In HTTP, some methods (such as GET) are idempotent, while other methods (such as POST) are not.

In user interface design, a button can be called "idempotent" if pressing it more than once will have the same effect as pressing it once. For example, a "Pause" button is not idempotent if it toggles the paused state. On the other hand, if pressing it multiple times keeps the system paused and pressing "Play" resumes, then "Pause" is idempotent. This is useful in interfaces such as infrared remote controls and touch screens where the user may not be sure of having pressed the button successfully and may press it again. Elevator call buttons are idempotent, though many people think they are not.