I am trying to solve part $(c)$ of the following problem:
For $i = 1,2,$ let $G_i$ be a group and $H_i$ be a normal subgroup of $G_i.$ Let $\pi_i: G_i \to G_i/H_i$ be given by $\pi_i(a) = a H_i$ for all $a \in G_i.$ Let $f: G_1 \to G_2$ be a group homomorphism such that $f(H_1) \subset H_2.$ Let $f': H_1 \to H_2$ be the restriction of $f.$
$(a)$ Prove: there exist a unique group homomorphism $\bar{f}: G_1/H_1 \to G_2/H_2$ such that $\bar{f} \circ \pi_1 = \pi_2 \circ f.$
$(b)$ Prove that if $f'$ and $\bar{f}$ are both one-one then $f$ is one-one.
$(c)$ Prove that if $f'$ and $\bar{f}$ are both onto then $f$ is onto.
This is a trial for solving $(c):$
Let $y \in G_2,$ then $y + H_2 = \pi_2(y) = \bar{f}(x + H_1)$ for some $x \in G_1.$ but then since $\bar{f}(x + H_1) = f(x) + H_2$ (I do not understand why this is correct, is not this using the idea that $f$ is onto which is what ae are trying to prove) we have $ y - f(x) \in H_2$ i.e., $y - f(x) = f(h)$ for some $h \in H_1$ as $f'$ is onto and $f'$ is the restriction of $f$ i.e., $f = f'$ on $H_1.$ So, $y = f(x) + f(h) = f(x + h)$ and the required is proved.
My question is about the bold part I am mentioning above, how to correct this trial, or is it correct? if so, what about the bold line I am remarking above. Could anyone help me please?