I am finding it hard to solve the following problem.
Let $A$ is a set and $f : A \rightarrow A$ and $g : A \rightarrow A$. If $f = g \circ f$, must $g$ be an identity function always?
Will there be any counterexamples to show that $g$ must not be a identity function?
2026-04-26 01:50:41.1777168241
Must $g$ be the identity if $f = g \circ f$?
488 Views Asked by user4536 https://math.techqa.club/user/user4536/detail At
2
Take $A=\{0,1,2\}$ and $f$ is the constant function $0$ while $g(0)=0$ and $g(1)=g(2)=1$.
Let us find exactly why the above works, and deduce a nice corollary: $\newcommand{rng}{\operatorname{rng}}\newcommand{id}{\operatorname{id}}$
Proof: Suppose that $g$ is the identity on $\rng f$ then for $x\in A$ we have $g(f(x))=f(x)$ since $f(x)\in\rng f$.
In the other direction, suppose that $f=g\circ f$, let $y\in\rng f$ then $y=f(x)$ for some $x\in A$. We have that $g(y)=g(f(x))=f(x)=y$, as wanted. $\square$
Proof: Assume that $f$ is surjective and apply the above theorem with $\rng f=A$. In the other direction, suppose that $f$ is not surjective, let $x\in\rng f$ and $y\in A\setminus\rng f$. Define $g$ as follows: $$g(a)=\begin{cases} x &a=y\\ a &\text{otherwise.}\end{cases}$$ By the above theorem we have that $g\circ f=f$ but clearly $g\neq\id_A$.