Function composition where two functions are not equal

929 Views Asked by At

Can you find two functions $f$ and $g$ such that they are not equal and $$f \circ g= f,\qquad\text{and}\qquad g \circ f= f$$ where $\circ$ denotes composition of the two functions.

1

There are 1 best solutions below

0
On

Yes, you can. To satisfy these conditions, $g$ has to be the identity map on the range of $f$, but you can play with other elements (in the complement of the range of $f$) to define $g$ that is different from both $f$ and the identity map.

Here's an example. Let $X=\{1,2,3\}$ and define the two maps $f,g : X\to X$ as follows: $$f(1)=1,f(2)=1,f(3)=1 \quad \text{and} \quad g(1)=1,g(2)=3,g(3)=2.$$ (It looks much better as a diagram, but I don't know how to create one quickly.)