Proposition:
Suppose $A ≠ \emptyset$ and $f: A \rightarrow A$. Suppose that for all $g: A \rightarrow A$, $f \circ g = f$. Prove that $f$ is a constant function.
My attempt:
Definitions:
- If $f$ is a constant function, then exists some $a \in A$ such that
$$\forall x \in A (f(x) = a)$$
- Composition of functions $$f \circ g = \{(a,b) \in A \times A \mid \exists c \in A \bigl((a,c) \in g \land (c,b) \in f\bigr)\}$$
By contrapositive.
Suppose $f$ is not a constant function.
Suppose $g$ is a constant function.
Then exists some $a \in A$, such that for arbitrary $x \in A$, $(x,a) \in g$.
Since $a \in A$, exists some $y \in A$ such that $(a,y) \in f$.
Since $f$ is not a constant function, there exist some $k_1,k_2 \in A$ such that $(k_1,k_2) \in f$ and $y ≠ k_2$.
Since $k_1 \in A$, we know that $(k_1,a) \in g$ and therefore $(k_1,y) \in f \circ g $.
$f \circ g$ is a function, thus we can conclude that $(k_1,k_2) \notin f \circ g$
Hence $f ≠ f \circ g$. $\Box$
Is it correct?
My initial plan was to prove it directly, but after struggling for hours, I failed to find any way to do it. Can someone show me how to prove the proposition directly?