1

If there exists functions $f, g$ such that $$f(g(x))=x$$ can we say that $g(f(x))=x$ as well? I don't know but it apparently appears to hold true.

Just to clarify, my doubt lies in the fact whether it ALWAYS HOLDS or not.

Assume that $x\in \mathbb{R}$.

I am not specifying the domain and codomain of the Functions anymore as that may lead to some case wise discussion of the particular matter.

Mathejunior
  • 3,344

3 Answers3

4

Let $g:\Bbb R \to \Bbb R^2$ be the inclusion map and $f : \Bbb R^2 \to \Bbb R$ be the projection map. Then, $f(g(x)) = f(x,0) = x$, while $g(f(x,y)) = g(x) = (x,0) \ne (x,y)$.

Kenny Lau
  • 25,049
2

That is not true in general. Choose $g(x)$ some function that is injective but not surjective. Choose some $f(x)$ such that $f(g(x))=x$; this is possible since $g$ is injective.

So the image of $g$ is not the entire domain, thus it is impossible that $g(f(x))=x$ for all $x$ in the domain.

However, your claim does hold if the domain is finite; This is because $f(g(x))=x$ implies $f$ surjective, $g$ injective. But over a finite domain this implies that $f$,$g$ are bijections, and from $f\circ{}g=id$ we have

$g\circ{}f\circ{}g=g\circ{}id=g$

taking inverse from the right, we get $g\circ{}f=id$.

A concrete example: choose $g:\mathbb{R}\to\mathbb{R}$ as $g(x)=e^x$.
choose $f:\mathbb{R}\to\mathbb{R}$ as $f(x)=\ln(x)$ for all $x>0$, and $f(x)=42$ for all $x\le{}0$.

Then $g(x)>0$ for all $x\in\mathbb{R}$. So $f(g(x))=\ln(e^x)=x$ for all $x\in\mathbb{R}$.

On the other hand, $g(f(-1))=g(42)=e^{42}\ne{}-1$

idok
  • 1,701
  • @Mathbg $y=e^x\implies x=\ln y\implies f(x)=\ln x$ – ℋolo Jan 02 '18 at 05:32
  • @Holo I think you've answered in someone else's answer. And please check, your answer isn't valid I believe. – Mathejunior Jan 02 '18 at 05:39
  • @Mathbg I was answer your comment on this answer("how to find $f(x)$), idk why my answer got downvote, but read about inverse functions, this is exactly what you are looking for – ℋolo Jan 02 '18 at 05:44
  • @Holo I didn't give the downvote, though I understand there's a misconception between us. I know it holds for inverse functions but my point was: "DOES IT ALWAYS HOLD FOR ANY FUNCTION?" – Mathejunior Jan 02 '18 at 05:46
  • @idok, can you please choose some possible $f,g$ as an example? – Mathejunior Jan 02 '18 at 05:49
  • @Mathbg Yes, I added an example. – idok Jan 02 '18 at 06:11
0

Not all functions are like this, only invertible function:

$f(x)=\ln x,g(x)=e^x$

$f(x)=x^3, g(x)=\sqrt[3]x$

$f(x)=\tan(x), g(x)=\arctan(x)$(this one is only over the domain $(-\pi/2,\pi/2)$)

And much more. An easy counter example is $f(x)=x^2$, to this function every(almost every) value of $f(x)$ has 2 $x$ that give it, for example $x^2=4\implies x=\pm2$, because a function can by definition had only one value it means that there is no $g(x)$ that will have $f(g(x))=g(f(x))=x$ but $\sqrt{x}^2=x$(and $\sqrt{x^2}=|x|\ne x$). Another counter example is $f(x)=\tan(x), g(x)=\arctan(x)$ over larger domain: $\tan(\arctan(x))=x$ while $\arctan(\tan(x))$ is not equal to $x$ if $x$ is outside of $(-\pi/2,\pi/2)$

ℋolo
  • 10,006
  • Can you please explain something more? Take the first example, $g(f(x))=e^{\ln x}$ – Mathejunior Jan 02 '18 at 05:35
  • @Mathbg $e^x$ and $\ln x$ are inverse functions, means that $e^x=y\implies \ln y=x$, now if so we have $e^{\ln(y)}=e^x=y$ now we take the opposite direction: $\ln(e^x)=\ln y=x$, because $x$ and $y$ are arbitrary this implies that $\ln(e^x)=e^{\ln(x)}=x$ – ℋolo Jan 02 '18 at 05:42
  • I think there's some miscommunication between us. I've edited my doubt for clarity – Mathejunior Jan 02 '18 at 05:45
  • @Mathbg I edit my answer to fit the question, sorry I misunderstood the question – ℋolo Jan 02 '18 at 05:52
  • Great, I can upvote and neutralize the points. (I can't communicate with whoever has downvoted anyway) – Mathejunior Jan 02 '18 at 05:58
  • @Mathbg I added another example that doesn't involve looking at $\sqrt•$ of negative numbers – ℋolo Jan 02 '18 at 06:04