I'd just like to know for my own experimentation a list of known functions in algebra that satisfy $$ f(f(x))=f(x), $$ like how there's a list of known involution functions on wikipedia. But somehow, I can't find a single example anywhere on the internet of even one idempotent function.
What are some examples of Idempotent functions?
5.5k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 5 best solutions below
On
Any idempotent function $P: \mathbb{R} \rightarrow \mathbb{R}$ can be constructed by
1) Choosing your favorite set $S$.
2) Find a mapping $P:\mathbb{R} \backslash S$ into $S$.
3) Expand the domain of $P$ by letting let $P(x) = x$ for $x \in S$.
This is, for example, how $P(x) = |x|$ works. It just maps the negative part of the real line onto the positive part, and acts as the identity on the positive part.
But if you want this to be a function with a nice formula it's not quite as obvious. One way is to use any non one-to-one function that $f(x)$ that has a right inverse $g(x)$, so that $f(g(x)) = x$. Then if $P(x) = g(f(x))$ then $P\circ P = g \circ f \circ g \circ f = g \circ f = P$.
Intuitively, $g$ works by mapping an input $y$ to an $x$ in a select domain $A$ of $\mathbb{R}$ so that $f(x) = y$. Then on this particular set $A$, we have $g(f(x)) = g(y) = x$.
For example, think about $P(x) = \arcsin(\sin(x))$ where $arcsin$ is the usual branch taking $x$ into $[-\pi/2, \pi/2]$.
Note that this only really works for certain inverse functions we decided are okay to write in formulas, like $\sqrt{x}$ or $\arcsin(x)$. Most of these examples are going to be a little bit artificial, because if $P$ is the identity on on a set $S$ that contains an interval than it 'really ought' to be the identity everywhere. That is, it must be the identity if it is analytic.
On
Expanding on the comment:
Note that if $f$ is idempotent and differentiable, then $f′(f(x))⋅f′(x)=f′(x)$ so $f′(x)=0$ on its domain, or $f′(y)=1$ on its range, or some combination thereof.
Take any partition of the reals $\mathbb{R} = \bigcup R_k\,$, and for each $R_k$ define a function $f_k : R_k \to R_k$ which is either linear $f_k(x)=x$ or constant $f_k(x)=c_k \in R_k$. Then "combine" all those functions into one function $f(x) = f_k(x) \;\;\text{iff}\;\; x \in R_k\,$, and that function $f(x)$ is idempotent. This construction covers several of the posted functions, for example $R_k = [k, k+1)$ and $f_k(x) = k$ gives $f(x)= \lfloor x \rfloor$.
For a more offbeat (and nowhere continuous) idempotent function, consider for example:
$$ f(x) = \begin{cases} \begin{align} 0 &\quad\quad \text{if}\; x \in \mathbb{R} \setminus \mathbb{Q} \\ p\,q &\quad\quad \text{if}\; x =p/q \in \mathbb{Q} \;\;\text{with}\; p, q \in \mathbb{Z}\;\;\text{and}\;\; \gcd(p,q)=1 \end{align} \end{cases} $$
Proof of 1.: If $f$ is continuous and idempotent, then $I=f(\mathbb R)$ is an interval by continuity alone along with the IVT. If $A=\{x\in \mathbb R: f(x)=x\}$, then $A$ is a closed set by continuity, $A\subseteq I$ because each $x\in A$ equals $f(x)\in I$, and $I\subseteq A$ by idempotency. Thus $I=A$, confirming that $I$ is a closed interval on which $f$ is the identity function.
Proof of 2.: Suppose that $f$ is continuous and idempotent, but not constant and not the identity function. Then $I$ is not $\mathbb R$, not a singleton, so by 1. $I$ is a nontrivial closed interval that is either bounded above or below (or both). Suppose $I$ is bounded above, and let $b=\sup(I)=\max(I)$, the last equality holding by closedness of $I$. Because $I$ is a nontrivial interval, $I$ contains $(a,b]$ for some $a<b$. It follows that $f$ is not differentiable at $x=b$, because $\lim\limits_{h\to 0-}\dfrac{f(b+h)-f(b)}{h}=1$, but for all $h>0$, $\dfrac{f(b+h)-f(b)}{h}\leq 0$. If $f$ is bounded below a similar argument applies to show that $f$ is not differentiable at $\inf(I)=\min(I)$. By contraposition, this confirms that if $f$ is idempotent, differentiable and nonconstant, then $I=\mathbb R$, i.e., $f(x)=x$ for all $x\in\mathbb R$.
In the case where $f$ is continuous and not constant or the identity function, the graph of $f$ consists of a closed line segment or ray on the line $y=x$, having the form $\{(x,x):x\in f(\mathbb R)\}$, then extends continuously in a way that is arbitrary as long as the $y$ values stay in $I=f(\mathbb R)=f(I)$. This is a special case of Jair Taylor's more general description, where $S$ must be a interval and the pieced together map must be continuous.
For a given bounded interval $[a,b]$, $a<b$, a formula for a continuous idempotent function $f$ having $[a,b]=f(\mathbb R)$ is $$f(x)=\frac{b-a}{\pi}\arcsin\left(\sin\left(\frac{\pi(x-\frac12(a+b))}{b-a}\right)\right)+\frac{a+b}{2},$$
a triangle wave function obtained by dilating and shifting the example $\arcsin(\sin(x))$ given in Jair Taylor's answer. To get arbitrary closed rays instead, you can shift and reflect $y=|x|$ to get $y=\pm|x-h|+h$.