Concept:
For a composite function \( gof: A \rightarrow C \), the function takes elements from domain \( A \) and maps them to codomain \( C \).
By definition, a function is onto (surjective) if every element in the codomain is mapped to by at least one element from the domain.
Therefore, for \( gof \) to be onto, for every \( c \in C \), there must exist some \( a \in A \) such that:
\[
(gof)(a) = g(f(a)) = c
\]
Step 1: Analyzing the codomain mapping of the outer function \( g \).
Since \( g(f(a)) = c \) for every \( c \in C \), let us substitute \( b = f(a) \). Since \( f: A \rightarrow B \), it is clear that \( b \in B \).
Thus, for every \( c \in C \), there exists an element \( b \in B \) (specifically, \( b = f(a) \)) such that:
\[
g(b) = c
\]
This perfectly satisfies the mathematical definition for \( g: B \rightarrow C \) to be an onto function.
Step 2: Checking if \( f \) needs to be onto via a counter-example.
Consider the sets:
\[
A = \{1\}, \quad B = \{2, 3\}, \quad C = \{4\}
\]
Let \( f(1) = 2 \). Let \( g(2) = 4 \) and \( g(3) = 4 \).
Here, the codomain of \( gof \) is \( C = \{4\} \), and since \( (gof)(1) = g(f(1)) = g(2) = 4 \), the composition \( gof \) is onto.
However, the element \( 3 \in B \) has no pre-image in \( A \), meaning \( f \) is not onto. Thus, \( f \) being onto is not necessary.