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.

g(x) = -x

f(x) = -1/x

now g(x) = 1/f(x) = -1/x

g(f(x)) = f(g(x)) = 1/x

also

/*********************************/

f(x) = |1/x| (absolute value function)

g(x) = |x|

now g(x) = 1/f(x) =

g(f(x)) = f(g(x)) = |1/x|

/*********************************/

f(x) = 1/x if x is rational

x if x is irrational

g(x) = x if x is rational

1/x if x is irrational

/************************************/

All the above, of course, are defined for x not in (0, 1, -1). Or we can do "transformations" as in the previous post to reform these.

Here, however, is one that works for all x:

f(x) = 2 if x in (0,1,-1)

= x otherwise

g(x) = 1/2 if x in (0, 1 -1)

= 1/x otherwise

Obviously, lots of other piecewise functions are available