Verify if 2 functions are inverse to each other

1.4k Views Asked by At

According this site, 2 functions $f$ and $g$ are the inverse function of each other, only if both $(f \circ g) (x) = x$ and $(g \circ f) (x) = x$ are true.

Is it really necessary to prove both of them? Can someone please provide an counter example where one is satisfied and the other is not?

Edit: what if given $f$ and $g$ have the same domain?

Edit2: what if $f$ and $g$ are both monotonic?

4

There are 4 best solutions below

1
On BEST ANSWER

Try $f(x) = x^2$ and $g(x) = \sqrt{x}$. Then $(f \circ g)(x) = x$, but $(g \circ f)(-1) \neq -1$.

EDIT: If you want $f$ and $g$ to have the same domain, let $$f(x) = \left\lbrace \begin{array}{rcl}(x + 1)^3 & : & x \le -1 \\ (x - 1)^3 & : & x \ge 1 \\ 0 & : & -1 < x < 1 \end{array} \right.$$ Notice that $f$ definitely is not invertible, since it isn't one-to-one. Also let $$g(x) = \left\lbrace \begin{array}{rcl}\sqrt[3]{x}-1 & : & x < 0 \\ \sqrt[3]{x}+1 & : & x \ge 0 \end{array} \right.$$ Both functions have a domain of $\mathbb{R}$. Now, I claim that $(f \circ g)(x) = x$ for any $x$. We have two possibilities: $x \ge 0$ and $x < 0$. If $x \ge 0$, then $g(x) = \sqrt[3]{x} + 1 \ge 1$, so $$(f \circ g)(x) = f(\sqrt[3]{x} + 1) = (\sqrt[3]{x} + 1 - 1)^3 = x.$$ On the other hand, if $x < 0$, then $g(x) = \sqrt[3]{x} - 1 < -1$, so $$(f \circ g)(x) = f(\sqrt[3]{x} - 1) = (\sqrt[3]{x} - 1 + 1)^3 = x.$$ On the other hand, we cannot have $(g \circ f)(x) = x$, otherwise $f$ would be invertible and hence injective. Specifically, we can compute $$(g \circ f)(1/2) = g(0) = 1 \neq 1/2.$$

EDIT2: Free bonus! Both $f$ and $g$ are monotonic!

0
On

Consider the functions $f(x)=\sqrt{x}$ and $g(x)=x^2$.

$$g(f(x))=(\sqrt{x})^2=x$$

$$f(g(x))=\sqrt{x^2}=|x|$$

1
On

As a more exciting counterexample which uses the same domain, consider the space $l_2$, the space of all square-summable sequences. This is essentially an infinite-dimensional analog of our usual euclidean space.

Take our two functions to be $R$ and $L$, the "right shift" and "left shift" operators respectively.

That is to say: $R~:~l_2\to l_2$, given by $(x_1,x_2,x_3,x_4,\dots)\mapsto (0,x_1,x_2,x_3,\dots)$

and $L~:~l_2\to l_2$, given by $(x_1,x_2,x_3,x_4,\dots)\mapsto (x_2,x_3,x_4,x_5,\dots)$.

You have then: $(L\circ R) (x_1,x_2,x_3,x_4,\dots)=L(0,x_1,x_2,x_3,\dots) = (x_1,x_2,x_3,x_4,\dots)$ and so $L\circ R$ is the identity and $L$ is the "left inverse" of $R$.

On the other hand, $(R\circ L)(x_1,x_2,x_3,x_4,\dots)=R(x_2,x_3,x_4,x_5,\dots)=(0,x_2,x_3,x_4,\dots)$ which is not the identity in the case $x_1\neq 0$, showing that $L$ is not the right inverse of $R$.

1
On

The only problem occurs (as you can see from the other answers) is when the ranges and domains of $f$ and $g$ conflict when you switch the order. Otherwise everything wirks fine.

Suppose $f \circ g (x) =x$. Since $f$ has an inverse it must be bijecctive. Now consider $g \circ f (x)=y$. Then $f(g \circ f)(x)) =f(y)$. By associativity $(f\circ g)(f(x)) =f(y)$. Therefore $f(x)=f(y)$. Since f is bijective $x=y$. Hence we have proved that $g \circ f (x)=x$