Find, if possible, two functions f and g with:
f(x) ≠ g(x)
g(x) = 1/f(x)
g(f(x)) = 1/f(g(x))
for all x in the respective domains.
A less trivial offering is
f(x) = x
g(x) = 1/x
Note that
g(x) = 1/f(x) = 1/x
g(f(x)) = f(g(x)) = 1/x
This works as a problem solution if we limit the domain of both to x not in (-1,0,1)
Or, if you prefer, we could transform g(x) into
g(x) = (x^2 - 1)/(x^3 - x). Arguably, this equals 1/x except for x in (-1,0,1), where it is undefined.
Similarly, f(x) = (x^4 - x^2)/(x^3 - x).
Arguably, this equals x except for x in (-1,0,1), where it is undefined.
So, one answer is
f(x) = (x^4 - x^2)/(x^3 - x)
g(x) = (x^2 - 1)/(x^3 - x)
and this seems to meet all puzzle conditions.
It also works if they are reversed:
g(x) = (x^4 - x^2)/(x^3 - x)
f(x) = (x^2 - 1)/(x^3 - x)