First problem statement, as written:

Let $f\colon B\rightarrow C$ be a function. Prove that $f$ is injective if and only if, for every pair of functions $g,h\colon A\rightarrow B$, if $f\circ g = f\circ h$, then $g=h$.

This one seems easy to spot. Clearly $A$ must be non-empty, as otherwise a contradiction may easily be reached (not to mention the proof is impossible otherwise).

[If $A$ is empty, then $g,h$ are empty. If we’re working in the direction to “prove” $f$ is injective, then (vacuously) if $f\circ g = f\circ h$ then $g=h$. But if $f$ is any constant function with a domain of at least two elements (which remains possible because even though $A$ being empty forces $g,h$ to be empty, their codomain, $B$, need not be empty to satisfy the definition of function), then f is not injective, even though all premises hold.] No?

Second problem statement, as written:

Let $f\colon A\rightarrow B$ be a function. Prove that $f$ is surjective if and only if, for every pair of functions $g,h\colon B\rightarrow C$, if $g\circ f = h\circ f$, then $g=h$.

For this problem, there seem to be two issues on restrictions on the sets the functions act on: 1) either $A,B$ are both empty, or both non-empty, and 2) $C$ must contain at least two elements.

I concluded 1) since, if $B$ is empty, $A$ must be empty to satisfy the definition of function. If $A$ alone is empty, then $f$ cannot be surjective (either by hypothesis, or as a conclusion).

I concluded 2) since I got to a junction in my proof in which I was unable to proceed without additional premises. After considering some possibilities, the contention that $C$ contain at least two elements seemed a plausible way out of this. [for the record, in “proving” $f$ to be surjective, I supposed the antecedent if the conditional (in that direction). Next, I proceeded by contradiction, supposing (to the contrary) $g\ne h$. If $C$ is unspecified (but non-empty, as otherwise $A,B,C$ are all forced to be empty, and the theorem becomes vacuous), it seems impossible to define $g,h$ by which to arrive at a contradiction.] Am I correct?

  • 1
    $\begingroup$ Needs more focus: This question currently includes multiple questions in one. It should focus on one problem only. $\endgroup$ Commented May 6, 2020 at 3:12

1 Answer 1


The only if direction says, this has to hold for every such pair of functions, not just one example. So you just showed that sure, for $A$ being the empty set, this gives you no extra information about $f$. But let's assume like you said that $f$ is a constant function with a domain with e.g. two elements, so $f : \lbrace b_1, b_2 \rbrace \to \lbrace c_1, c_2 \rbrace$ and $f(b_1) = f(b_2) = c_1$. Now let's test the assumption with the two functions $g,h : \lbrace a \rbrace \to \lbrace b_1, b_2 \rbrace$ defined as $g(a) = b_1$ and $h(a) = b_2$, so clearly $g \neq h$. But $f \circ g(a) = f(b_1) = c_1$ and $f \circ h(a) = f(b_2) = c_1$, which means $f \circ g = f \circ h$, so these two "test functions" show that $f$ is not injective.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .