Can the inverse of a function be the same as the original function?

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.


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.