Consider $f(x) = x^2 + 2x + 5$ . Now find $g(x)$ such that $(f\circ g)(x) = x^2 - 4x + 5$ .
Note : I know that it will be easy if we suppose $g(x) = ax+b$ and then solve it but I'm curious about a general method . I mean solving $(g(x))^2 + 2g(x) + 5 = x^2 - 4x + 5$ . And also for all cases , is finding $g(x)$ possible if we have $(f\circ g)(x)$ and $f(x)$ ?
hint
Assume that $$f (g (x))=h (x) $$
for $x\in A .$
If $f $ is a bijection from $g (A) $ to $h (A) $ then
$$g (x)=f^{-1}(h (x)) $$
In your case,
$$f (x)=x^2+2x+5$$ $$f^{-1}(x)=-1\pm \sqrt{x-4} $$