[Math] Can the composition of two non-invertible functions be invertible

function-and-relation-composition

(Context: I came across this exercise in the textbook "Coding the Matrix" when reading it to supplement my studies in the Coursera class "Coding the Matrix".)

After proving that the composition of invertible functions is itself invertible (by showing that a function is invertible iff it is both one-to-one and onto), the author left as an exercise the proof that the statement "Suppose that $f$ and $g$ are functions and $f \circ g$ is invertible. Then $f$ and $g$ are invertible." is false.

I haven't been able to come up with a solution. Initially, I thought that the image of $g$ would be but a subset of the co-domain of $f$, with the rest of the co-domain of $f$ (say, two elements) mapping to the same element in its domain. This would suffice to make $f$ non-invertible, but $f \circ g$ would still be invertible.

I'm not sure if this is correct, however, because in order for it to be, I'd have to redefine the co-domain of $f \circ g$ to not be the co-domain of $f$.

Is my approach correct? If not, how can the statement be shown to be false?

Best Answer

Your idea is right.

For $f\circ g$ to be invertible, $f$ only needs to be invertible when restricted the range of $g$. It may not actually be invertible on its whole domain. For example, let $g(x)=e^{x}$ and $f(x)=x^{2}$.

Related Question