Let $f$ and $g$ be functions such that $f\colon A\to B$ and $g\colon B\to C$. Prove or disprove the following
a) If $g\circ f$ is injective, then $g$ is injective
Here's my proof that this is true. Let $A = \{4,5\}$, $B = \{3,9\}$, $C = \{1,2\}$ $f(4) = 3$; $f(5) = 9$ $g\circ f(4) = 1$ and $g\circ f(5) = 2$ Since no 2 elements map to the same element in the range $g\circ f$ and $g$ are both injective.
b) If $f$ and $g$ are surjective, then $g\circ f$ is surjective.
Here's my proof that this is true. Let $A = \{1,2\}$, $B = \{4\}$, $C = \{5\}$, $f(1) = 4$; $f(2) = 4$ $g\circ f(1) = 5$ and $g\circ f(2) = 5$. Since no elements are left unmapped then $g\circ f$ and $f$ and $g$ are surjective
Are these proofs valid?
**Edit: Ok so I revised my proof for a. I will disprove it using a counterexample. Let A = {4}, B = {3,9}, C={1}. g∘f(4) = 1 and g(3) = 1 and g(9) = 1 g∘f is injective but g is not injective because 3 and 9 both map to 1. Is that a valid disproof?
Now I'm just having some trouble disproving or proving b. If anyone could lend some tips. Also this is not homework. Just reviewing for an exam.