What are the functions that are their own inverse?

(thus functions where $ f(f(x)) = x $ for a large domain)

I always thought there were only 4:

$f(x) = x , f(x) = -x , f(x) = \frac {1}{x} $ and $ f(x) = \frac {-1}{x} $

Later I heard about a fifth one

$$f(x) = \ln\left(\frac {e^x+1}{e^x-1}\right) $$ (for $x > 0$)

This made me wonder are there more? What are conditions that apply to all these functions to get more, etc.


7 Answers 7


These are called involutions.

If you don't require continuity, then the set of involutions $\Bbb R\to\Bbb R$ corresponds to the set of ways to partition $\Bbb R$ into at most $2$-element subsets. This train of thought follows from thinking about the cycle decomposition of an involution, considered as a permutation of an infinite set.

This is massively infinite, with $2^{\frak c}$-many elements, where ${\frak c}=|\Bbb R|$. Indeed, if we take for granted the fact that every infinite set has a decomposition into $2$-sets, or equivalently every infinite set has a fixed-point-free involution (which I am sure follows from some level of choice), then a lower bound for the number of involutions would be the number of coinfinite subsets of $\Bbb R$ chosen to be the fixed-point sets, and a lower bound for the number of coinfinite subsets is the number of subsets of say $\Bbb R\setminus[0,1]$ of which there are $2^{\frak c}$. An upper bound is given by the number of functions $\Bbb R\to\Bbb R$, which is also $2^{\frak c}$ - see here.

If you do require continuity there are ${\frak c}=|\Bbb R|$-many continuous involutions. As an upper bound, there are $\frak c$ continuous real-valued functions - see here. As a lower bound, $\log_a\left(\frac{a^x+1}{a^x-1}\right)$ is a distinct continuous involution for every $a>0$, of which there are $\frak c$-many.

To see where these ideas are coming from, we employ two ideas: conjugation from group theory and linear fractional transformations from complex analysis. Given any involution $\sigma$ and any homeomorphism $f:\Bbb R\to\Bbb R$ (continuous function with continuous inverse) there is a conjugate function $f\circ\sigma\circ f^{-1}$ which is also an involution. Of course, this can still equal $\sigma$ in general.

A linear fractional transformation is a map $[\begin{smallmatrix} a & b \\ c & d\end{smallmatrix}]z:=\frac{az+b}{cz+d}$. This creates a group action of the group of invertible matrices. That is, if $A$ and $B$ are matrices, then $A(Bz)=(AB)z$ in this notation, where $AB$ is the product of $A$ and $B$. Usually we have them acting on the complex plane or the Riemann sphere (or the upper half plane in hyperbolic geometry), but we can certainly consider matrices with real coefficients acting on the real number line $\Bbb R$. Note that scalar multiples of the identity matrix act as the identity function.

Note $[\begin{smallmatrix}1&1\\1&-1\end{smallmatrix}]^2$ is proportional to the identity matrix, and conjugating the corresponding linear fractional transformation $\frac{u+1}{u-1}$ by $a^x$ yields the aforementioned family of examples. Technically $a^x$ is a homeomorphism $\Bbb R\to(0,\infty)$, but this is fine since $\frac{u+1}{u-1}$ is well-defined on $(0,\infty)$.

  • 2
    $\begingroup$ What a great answer. $\endgroup$ Jul 10, 2015 at 14:59
  • $\begingroup$ Came looking for the name of these types of functions. Thank you! $\endgroup$ Oct 28, 2022 at 23:32

There are in fact many involutions. But if you want an involution that is rational function and is involutory on a dense subset of $\mathbb R$, then you end up with Möbius transforms $f(x)=\frac{ax+b}{cx+d}$ where $\begin{pmatrix}a&b\\c&d\end{pmatrix}^2=1$ (and the domain of $f$ is $\mathbb R\setminus\{-\frac dc\}$). Your first four examples correspond to the matrices $$\begin{pmatrix}1&0\\0&1\end{pmatrix},\quad \begin{pmatrix}-1&0\\0&-1\end{pmatrix},\quad \begin{pmatrix}0&1\\1&0\end{pmatrix},\quad \begin{pmatrix}0&-1\\1&0\end{pmatrix}.$$ Your fifth example is really a transformation of the Möbius transform $f(x)=\frac{x+1}{x-1}$ obtained from the matrix $-\frac12\begin{pmatrix}1&1\\1&-1\end{pmatrix}$. Of course, whenever $f\colon D\to D$ is an involution and $g\colon D'\to D$ a bijection, then $g'^{-1}\circ f\circ g\colon D'\to D'$ is also an involution. (In this special case we need to verify that $x\mapsto \frac{x+1}{x-1}$ maps $(1,\infty)\to(1,\infty)$)

  • 2
    $\begingroup$ Interesting! Does this really encompass all possible examples of rational functions (in one argument) that are involutory at all but finitely many points? $\endgroup$ Jul 10, 2015 at 22:45
  • $\begingroup$ @goblin: Probably, but I didn't check. The proof might need some Galois theory. $\endgroup$
    – user21820
    Jul 11, 2015 at 7:08

Why would you think those are the only functions possible? If we consider discrete functions rather than only explicit, algebraically defined, functions, then it's easy to come up with examples (obviously we need to ensure that our functions are bijective--but this has more to do with defining proper domain and range sets). The simplest example is a function which maps from a singleton set to the same singleton set (which means $f(x) = x$ is the only possible function anyway). It's trivial to come up with examples of functions which are their own inverse with sets of size two (and they no longer have to have the form $f(x) = x$--which certainly always satisfies this property). For example:

$$ \{a_1, a_2\}\mapsto \{a_1, a_2\}: f(x) = \begin{cases} a_2 & x = a_1 \\ a_1 & x = a_2 \end{cases} $$

Or we can do a set with three items:

$$ \{a_1, a_2, a_3\}\mapsto \{a_1, a_2, a_3\}: f(x) = \begin{cases} a_2 & x = a_1 \\ a_1 & x = a_2 \\ a_3 & x = a_3 \end{cases} $$

...or four:

$$ \{a_1, a_2, a_3, a_4\}\mapsto \{a_1, a_2, a_3, a_4\}: f(x) = \begin{cases} a_3 & x = a_1 \\ a_4 & x = a_2 \\ a_1 & x = a_3 \\ a_2 & x = a_4 \end{cases} $$

...etc. Now it may be "difficult" to come up with functions defined through algebraic operations that satisfy this condition over a continuous domain (like $\mathbb{R}$) but I don't see why one would assume there are a finite number of them a priori.

And David Quinn and Maciek raise a good point--which is that any function which is symmetric about the line $y = x$ is an inverse of itself. Just because you may not be able to "write down", algebraically, such a function doesn't mean one doesn't exist. Here's an example graph from a function which is its own inverse:

enter image description here

And you can create all sorts of different looking such functions by just drawing some curve (it must pass the horizontal line test) and reflecting it by the line $y = x$ (which is how I generated the above example).

  • 17
    $\begingroup$ "Why would you think...", "It's easy", "It's not hard", "It might be "difficult" to...". Why would you think those phrases were appropriate? It's easy to notice the disdain. It's not hard to see the condescension. It might be "difficult" to choose different verbiage. $\endgroup$
    – user121330
    Jul 10, 2015 at 14:52
  • 14
    $\begingroup$ @user121330 Phrases like "it's easy" and "it's trivial" are common mathematical parlance. Like a lot of mathematical language, they have a slightly different meaning to their common English meaning. In particular, when someone describes something as "easy" or "trivial" they often mean that it can be done without introducing significant new ideas, or without requiring a sudden flash of insight. In particular, a calculation or derivation taking many pages of routine algebraic manipulation can be described as "trivial" even though most non-math people would say it is hard. $\endgroup$ Jul 10, 2015 at 16:50
  • 6
    $\begingroup$ @user121330 I think you are reading way too much into my writing style. I certainly never intended to be condescending. In fact the phrase "...it may be "difficult" to come up with functions defined through algebraic operations..." served as an acknowledgement that the apparent scope presented by the OP is a little trickier to come up with examples for (although not impossible as has been demonstrated elsewhere). The reason I said things like "It's easy..." and "It's not hard..." is because I didn't perform any great feat by writing down those three discrete functions. $\endgroup$
    – Jared
    Jul 10, 2015 at 19:18
  • 9
    $\begingroup$ Wowww, some people are ridiculously sensitive. $\endgroup$ Jul 10, 2015 at 20:12
  • 8
    $\begingroup$ @Jared, please leave your answer be. Hypersensitivity is not a reasonable ground to push somebody around. $\endgroup$ Jul 10, 2015 at 21:24

Any rectangular hyperbolas of the form $$f(x)=\frac{ax+b}{x-a}$$ are self-inverse since they are reflections of themselves in the line $y=x$.

  • $\begingroup$ These are quite intuitive, $x\mapsto\frac{k}{x\pm a}\mp a$ is just shifting and vertical dilatation for $k$. $\endgroup$
    – PinkyWay
    Jan 10, 2021 at 10:32

For algebraic solutions, take $f(x,y) = 0$ for any nonconstant symmetric polynomial (on an appropriate domain). Of course, if the degree in $x$ or $y$ is greater than $5$, this may not be solvable by radicals.

For example, $f(x,y) = x^3 + x y + y^3 - 1$. This one can be solved by radicals: $$ y = \dfrac{\sqrt [3]{108-108\,{x}^{3}+12\,\sqrt {81\,{x}^{6}-150\,{x}^{3}+81 }}}{6}-{\frac {2x}{\sqrt [3]{108-108\,{x}^{3}+12\,\sqrt {81\,{x}^{6}-150 \,{x}^{3}+81}}}} $$


I'll give you an example of a nonlinear involution, that is a transcendental function, and a composition of $e^x$ and $\frac{1}{\log(x)}.$ Composing one way gives $1/x$ (an involution) and composing the other way gives a different involution, whose reciprocal is an involution, and whose fixed points are reciprocals of one another: $f(x)=\exp(\frac{1}{\log(x)}).$


Technically Any functions satisfying $$f(x)=-x+a$$ for real numbers $a$ are their own inverses


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .