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

Solution 1:

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.

Solution 2:

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)$$

Solution 3:

$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.

Solution 4:

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

Solution 5:

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.