Let A, B and C be sets and if f: A-> B and g: B-> C be functions.

a) Prove that if g ○ f is injective then f must be injective.

b) Prove that if g ○ f is surjective then g must be surjective.

For a) this is what I got..

Suppose that (g ○ f)(x) = (g ○ f)(y) for some x,yεA. By definition of composition, g(f(x)) = g(f(y)). Since g is assumed injective, f(x)=f(y) is also assumed injective, x=y. Therefore (g ○ f)(x)=(g ○ f)(y) implies x=y so (g ○ f) is injective and thus so is f.

Is that correct?

I need a bit of a hint at least to start b)