Sorry if this seems trivial, I'm having some difficulty understanding a proof.
I'm doing exercise 5.1.14 of Velleman's How to Prove It and a solution posted in this question, including the comments, does not make sense to me. I'll restate the problem here:
Suppose $A$ is a nonempty set and $f:A\longrightarrow A$. Also suppose that for all $g:A\longrightarrow A, f\circ g=f$. Prove that f is a constant function. Hint: What happens if $g$ is constant?
Proving $f$ is constant, if $g$ is constant was easy, but I don't understand how that helps solve the problem. The way I read the question, $g$ has to be an arbitrary function from $A$ to $A$, and restricting it to a constant one no longer makes it arbitrary. As an example, if $g=\text{id}_A$, then $g$ is not constant, but still satisfies the conditions and $f\circ g=f$.
My question boils down to: why can we discount all non-constant functions $g$?