# Preservation of surjectivity when composing functions

Let's say that $f: A \rightarrow B$ and $g: B \rightarrow C$ and then $g \circ f : A \rightarrow C$. He said that given $g \circ f$ surjective this only says that $g$ is surjective, but not f (as in does not guarantee). But if $f$ is not surjective, than that means that there is a value for which $f(x)$ is undefined and subsequently $g \circ f$ doesn't make sense. So would I be right in asserting that if $g \circ f$ guarantees both $f$ and $g$ as surjective?

-

Incorrect. $g \circ f$ is a function from $A \to C$. It is possible that there is a $b \in B$ so that $f(a) \neq b$ for any $a \in A$, but $g \circ f$ is still perfectly defined because its domain is $A$ and not $B$. To put it a bit more explicitly, let's let $A = \{a, a'\}$, $B = \{b, b', b''\}$, and $C = \{c, c'\}$. Define $f(a) = b$, and $f(a') = b'$ Define $g(b) = c$, $g(b') = c'$, and $g(b'') = c$.
Now $f$ is not surjective, but $g \circ f$ is, and it's perfectly well-defined on $A$.