[Elementary Discrete Maths] Functions

g∘f is not injective because the domain of g∘f is X.    g∘f(a) = g∘f(b)  but a != b.

It's a bit clearer if you rename g∘f to h.    h is a function from X to Z.   It is clearly not injective because h(a) = h(b) but a != b.
You say:

>g∘f is injective because g(f(a)) = g(f(b)), and f(a) = f(b).

But that doesn't at all mean that g∘f is injective. To know that g∘f is injective is to show that:

>g(f(x)) = g(f(y)) ONLY WHEN x = y.

In fact, you've clearly shown that your example has two distinct elements of X that map to the same elements of Z under g∘f and therefore that g∘f is not injective in your example.

As a hint, the claim is true. It's quite easy to prove by contradiction. Let's assume:

1. g∘f is injective.
2. f is not injective.

So... What's the definition of g∘f being injective (I state it above). What does it mean for f to be injective? If g is well defined and f(a) = f(b), what do we know about g(f(a)) and g(f(b))?