# Why does $g \circ f$ being injective imply that $f$ is injective too?

Algebraically I do understand the usual proof of the proposition, like the on in the accepted answer: If $g \circ f$ is injective, so is $g$

But I still am missing something. When I draw the composition of $g$ and $f$, I can draw $g \circ f$ as injective while $f$ is merely surjective. What am I doing wrong here? According to the proposition this should not be possible.

In the figure, $f$ is blue $g$ is red and thus $g \circ f$ is violet. Notice how $g \circ f$ is injective (while $g$ alone is not), but $f$ is not injective.

• how is $g\circ f$ injective on your picture ? the top $2$ left-most points have the same image under $g\circ f$. – Gabriel Romon Oct 31 '17 at 8:58
• $g\circ f$ has same domain as $f$, so I don't think you really mean that $g\circ f$ is violet. The combination of a blue arrow and a violet arrow is $g\circ f$. – Gabriel Romon Oct 31 '17 at 9:03
• But $g \circ f$ is the violet arrows. How is that not injective? – user3578468 Oct 31 '17 at 9:03
• $g \circ f$ goes from the blue arrow to the violet arrow. – Siong Thye Goh Oct 31 '17 at 9:05
• Oh, ok, now I see. That was my error. Thanks. – user3578468 Oct 31 '17 at 9:08

In your picture, $f$ is not surjective.
The beginning of the red arrow has no preimage, hence $f$ is not surjective but your result require $f$ to be a surjective function.
Edit: Also, as mentioned in the comment, $g\circ f$ is not injective as well.
btw, to make sure your function has a chance to be injective, make sure your codomain is at least as large as your domain. Notice that domain of $g\circ f$ is equal to the domain of $f$.
Strictly speaking, the second part is just the function $g$ and the whole picture is $g \circ f$.
• Hm, right, I got that wrong, but then simply imagine the red arrow wasn't there. The issue remains, does it not? $f$ is still not injective then. (I did not downvote your answer btw.) – user3578468 Oct 31 '17 at 9:02
• OP believes the violet arrows are $g\circ f$, which leads him to believe that $g\circ f$ is injective. – Gabriel Romon Oct 31 '17 at 9:05