In mathematics an idempotent element, or an idempotent for short, is anything that, when multiplied by itself, gives itself as result. For example, the only two real numbers which are idempotent are 0 and 1.
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 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 #includes), 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.