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$?
Here's a simpler statement along the same lines:
We could look at any $x$ we wanted to, but it just happens to be convenient to notice that $x=0$ causes us to conclude $0=y$. This suffices to show us "if such a $y$ exists, it is $0$". Then, all that's left to do is to check whether $y=0$ actually has the desired property for all other $x$.
You're in a similar situation: You've proven, by looking at only constant functions, that if such an $f$ exists, it is constant. Then, your only remaining task is to show all constant $f$ satisfy the given property. So, we're not discounting the other cases - we should still check them, but that's easy after we've leveraged the case of constant $g$ to show that $f$ must be constant.