Mark M. answered 09/10/20
Retired Math prof with teaching and tutoring experience in trig.
f(x) = 3/x and g(x) = x2 - 1
f(g(x)) = f(x2 - 1) = 3 / (x2 - 1)
domain of f(g(x)) is { x l x is in dom g and g(x) is in dom f} = {x l x is real and x2 - 1 is not zero} = {x l x ≠ ±1}
g(f(x)) = g(3/x) = (9 / x2 ) - 1
domain of g(f(x)) = {x l x is in dom f and f(x) is in dom g} = {x l x ≠ 0 and 3 / x is real } = {x l x ≠ 0}