If $f \circ g = f$, prove that $f$ is a constant function. 
Suppose $A$ is a nonempty set and $f: A \rightarrow A$ and for all $g:A \rightarrow A,$ $f \circ g = f$. Prove that $f$ is a constant function.

This result seems obvious, but I can't seem to find a way to prove it. The book I got this problem from hinted that the reader should consider what would happen if $g$ were a constant function. I considered that case and it was easy to prove that $f$ was a constant function, but I can't find any way to prove it when $g$ is not a constant function. At this point I'm not really sure how to approach this problem anymore. Thanks in advance for any help! 

Suppose that $|A| = 1$. Then all functions $f:A \to A$ are constant.
Now suppose that $|A| > 1$ (or infinite). Let's suppose that $f$ is not constant. For my purposes, let's say that $f(0) = 0$ and $f(1) = 1$, and that we go from $\mathbb{R} \to \mathbb{R}$. But then suppose that $g(0) = g(1) = 0$.
Then we see that $f \circ g \neq f$.
Can you generalize this to your setting?
