I was wondering if the inverse of a function can be the same function.

For example when I try to invert

$g(x) = 2 - x$

The inverse seems to be the same function. Am I doing something wrong here?

  • 18
    $\begingroup$ No, you're not doing anything wrong. You can certainly have functions such that $f(f(x))=x$. Such functions are called involutions. $\endgroup$
    – mjqxxxx
    Oct 27, 2013 at 20:54
  • 12
    $\begingroup$ Consider $f(x) = x$. $\endgroup$
    – Thomas
    Oct 28, 2013 at 1:35
  • 7
    $\begingroup$ There is also a simple graphical interpretation: any function that when graphed is symmetrical over $y=x$ (that is, a diagonal line at 45° angle splits the graph in two mirror images of each other) will have this property. It's easy to see that you can draw boatloads of functions like that. $\endgroup$ Oct 28, 2013 at 1:40
  • $\begingroup$ In general, given an invertible function $g$, $f(x)=g^{-1}(-g(x))$ is an involution. $\endgroup$
    – Workaholic
    Sep 23, 2016 at 17:23

6 Answers 6


You're correct. A function that's its own inverse is called an involution.

Edit: Oh let's have some fun. :) What are some other functions that are easy to check are involutions? I've cherry picked some of my favorites in what follows, both from memory and also the references I provide below.

  • First, note that there's an easy test to determine whether or not $f$ is an involution. Namely, since $f^{-1} = f$, you just need to double check that $f(f(x)) = x$ for all $x$ in the domain of $f$. This can be used to verify all three of the following examples are actually involutions.

  • Your function $g(x)$ generalizes to a whole class of involutions! Namely, $$ f(x) = a-x $$ is an involution for any real number $a$. In particular, $f(x) = 0 - x = -x$ is an involution (as is $f(x) = x$, of course).

  • As someone already pointed out, $f(x) = 1/x$ (defined for all real $x \neq 0$) is also an involution. More generally, for any real $a$ and $b$ the function $$ f(x) = a + \frac{b}{x-a} = \frac{ax + (b-a^2)}{x-a} $$ satisfies $$ f(f(x)) = a + \frac{b}{a + \frac{b}{x-a} - a} = a + (x-a) = x $$ for all real $x \neq a$, and as such is also an involution on this domain.

  • Here's a less obvious (but cool) example. Consider the function $f(x) = (a - x^3)^{1/3}$. You can check this directly that $f(f(x)) = (a - ((a-x^3)^{1/3})^3)^{1/3} = x$. This is an example of a large class of involutions generated by a special type of symmetric function $F(x,y)$ (as explained here).

  • Fun Fact: The only continuous, odd ($f(-x) = -f(x)$ for all $x$) involutions with domain $(-\infty,\infty)$ are $f(x) = \pm x$. (A short proof of this fact is given here.)

  • There are many, many, more of these functions, and they occur naturally/are useful tools in many branches of mathematics.

  • $\begingroup$ For "fun fact", that is the only non-trivial involution, but the trivial involution is also odd and continuous. $\endgroup$ Oct 28, 2013 at 3:25
  • $\begingroup$ @DietrichEpp: Good catch! I've edited the post. Thanks! $\endgroup$
    – Dan
    Oct 28, 2013 at 5:26

That's perfectly fine, and your answer is correct. For another function that is its own inverse, see: $$f(x) = \frac{1}{x} = f^{-1}(x)$$


$g(x): y=2-x$

$g^{-1}(x): x=2-y\implies x-2=-y\implies y=2-x$

So you're correct. It is possible that a function can be an inverse of itself.


Coming from theory of coding (LDPC codes decoding), you have another involution: $x\mapsto-\log(\tanh(x/2))$.


Yes, you are correct, a function can be it's own inverse. However, I noticed no one gave a graphical explanation for this.

The inverse for a function of $x$ is just the same function flipped over the diagonal line $x=y$ (where $y=f(x)$). So, if you graph a function, and it looks like it mirrors itself across the $x=y$ line, that function is an inverse of itself.

This graphical representation can be used to understand a lot of really cool ideas about inverse functions.

For example, any straight line that's perpendicular to the line $x=y$ will of course be the exact same on both sides of the line $x=y$. Any function that is a straight line perpendicular to $x=y$ can be written in the form $f(x)=a−x$, which as Dan mentioned is an entire class of functions that your function just happens to be one of. Note that the $a$ just determines how high up on the $y$ axis the function starts, but it will always mirror itself across $x=y$.

You can also see some interesting facts about functions that are their own inverse that might be fun to take some time to prove. For example, since it needs to mirror itself over the line $x=y$, any function that is its own inverse that has any points where $f(x) = x$ must have a slope of either 1 or -1 at that point (or have an undefined slope).

Edit: I must have skipped over Euro Micelli's comment, which explained the graphical aspect of this literally years before I did.


There are many examples for such types of function's Y=1/x X^2+Y^2=1,2,3,4,5,6,7.....(any other positive number) Simply the fact behind this is that the graph of the function should be symmetric about line Y=X While calculating inverse what we actually calculate is image of that function with respect to line Y=X

  • 1
    $\begingroup$ $x^2 + y^2 = 1$ is not a function. $\endgroup$
    – mlc
    Aug 2, 2017 at 6:01
  • $\begingroup$ Welcome to the math.stachexchange. Try using mathjax for formulas to make your answers/questions more readable. Extensive how-to found on site. $\endgroup$
    – Thanassis
    Aug 2, 2017 at 6:04

You must log in to answer this question.

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