# Prove that if $A ≠ \emptyset$ and $f: A \rightarrow A$ and for all $g: A \rightarrow A$, $f \circ g = f$, then $f$ is a constant function.

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:

1. If $$f$$ is a constant function, then exists some $$a \in A$$ such that

$$\forall x \in A (f(x) = a)$$

1. 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?

## 3 Answers

We may assume that $$A$$ has at least two elements (if $$|A|=1$$, then we have only the identity map, that it's constant in this case).

Suppose $$f$$ is not a constant function. We want to prove there exists a $$g:A \rightarrow A$$ such that $$f \circ g \neq f$$.

Since $$f$$ is not constant, there exist some $$a,b \in A$$, $$a \neq b$$ such that $$f(a) \neq f(b)$$. Take $$g$$ to be $$g(x):=b$$ for every $$x \in A$$. Now $$(f \circ g) (a)=f(b)$$. Hence we have $$(f \circ g) (a)=f(b) \neq f(a)$$, so $$f \circ g \neq f$$.

A direct proof: Since $$A$$ is non-empty, we can pick an element $$a \in A$$. Take a constant function $$g:A\to A$$ such that $$g(x) = a$$ for all $$x\in A$$. Then $$f(g(x)) = f(a)$$ for any $$x \in A$$, so that $$f \circ g$$ is a constant function, thus $$f$$ is also a constant function.

You only need to prove that for any $$x,y \in A$$, $$f(x) = f(y)$$ holds. Let $$x,y \in A$$. Choose $$g$$ such that $$g(x) = g(y)$$, e.g. $$g(z) = g(x)$$ for all $$z \in A$$. Then $$f(x) = f(g(x)) = f(g(y)) = f(y)$$.