If composition of homomorphisms is an isomorphism, then the constituent homomorphisms are also isomorphisms

This is not for a homework, but rather a group theory question I saw in review material. I tried looking it up online, and could not find any solution.

The questions statement is as follows:

Suppose $$f_1 : A \mapsto B$$ and $$f_2 : B \mapsto C$$ are group homomorphisms. Then, if $$f_2 \circ f_1$$ is an isomorphism, is it true that $$f_1, f_2$$ are isomorphisms?

My thinking:

Intuitively, this must be true. If we don't have injectivity/surjectivity for one of the constituent maps, then there is something that is either not being mapped to in between, or something that is mapped to the identity when it shouldn't be. I am having trouble making this notion rigorous.

My attempt:

Aiming for contradiction, suppose WLOG that $$f_1$$ is not an isomorphism. Then, it is non-injective or non-surjective. If it is non-injective, then $$ker(f_1) \neq 1_A$$ and there exists non-identity $$x \in A$$ such that $$f_1(x) = 1_B$$. Then, we get that $$f_2(f_1(x)) = 1_C$$ and $$f_2(f_1(1_A)) = 1_C$$ which would mean $$f_2 \circ f_1$$ is not injective, which is the desired contradiction.

On the other hand, if $$f_1$$ is not surjective, there exists $$y \in B$$ that is not mapped to by any $$x \in A$$, and therefore $$f_2 \circ f_1$$ is not surjective. We know $$f_2$$ maps $$y$$ to a unique $$f(y)$$, and so we have that as $$y$$ is never mapped to, $$f(y)$$ is never mapped to. Therefore, $$f_2 \circ f_1$$ is not surjective and this is the desired contradiction.

Does this proof work?

No, take $$A, C$$ be the trivial group and $$B$$ non trivial.
Just to add something to Tsemo's answer. You proved correctly that $$f_1$$ must be injective (and you can also prove that $$f_2$$ must be surjective), but your proof that $$f_1$$ must be surjective is wrong. If $$f_2$$ is still surjective when restricted to the image of $$f_1$$, then $$f_2\circ f_1$$ is going to be surjective even when $$f_1$$ is not.
Intuitively, for $$f_1\circ f_2$$ to be injective you need $$f_1$$ injective and that anything that could hit $$1_C$$ in $$B$$ other than $$1_B$$ must lie outside the image of $$f_1$$. And for $$f_1\circ f_2$$ to be surjective, you need that $$f_2$$ restricted to the image of $$f_1$$ be surjective.
• Hmmm I see. So I suppose another mistake was saying "without loss of generality" and just focussing on $f_1$. Thank you, that helped! Dec 16 '19 at 0:04