a) If $f: E \to F$ and $g: F \to E \ $ are functions such that $g \circ f$ is injective, then $f$ is injective
b) If $f: E \to F$ and $g: F \to E \ $ are functions such that $g \circ f$ is surjective, then $g$ is surjective.
Proof:
a) Assume $g \circ f$ is injective but $f$ is not injective. Then there exist $x_1, x_2 \in E$ such that $x_1 \neq x_2$ but $f(x_1) = f(x_2)$. Then $g(f(x_1)) = g(f(x_2))$. Since $g\circ f$ is injective, $x_1 = x_2$, a contradiction! Therefore $f$ is injective.
b) Assume $g \circ f$ is surjective but $g$ is not surjective. Then there exists $e_1 \in E$ such that $e_1 \neq g(z)$ for all $z \in f$. Since $g\circ f$ is surjective, there exists $x_1 \in E$ such that $g(f(x_1)) = e_1$. But this is a contradiction to the hypothesis that $g$ is not surjective, since $f(x_1) = y_1 \in F$! Therefore $g$ is surjective.
Is everything here correct or did I make a mistake somewhere? If anyone has a cleaner proof I'd appreciate it as well, since I have still not convinced myself of the validity of the one I wrote above.