# Is there any function where $f \circ f = f$ but $f(0) = 1$

Other than the identity function, is there any function where $f \circ f = f$?
$f(0)$ also has to return 1.
It must has something to do with the exponent 0 to a some coefficient...

Anyone could give me a hint? I am feeling stupid that I can't find it..!

-
Did you mean a constant function instead? – copper.hat Nov 2 '12 at 1:13
@DouglasS.Stones One example is given by a function from $\{-1,0\}$ to $\{-1,1\}$, which seems pretty discrete. – Trevor Wilson Nov 2 '12 at 2:43

The identity function satisfies your first condition but not the second. If by "identity function" you meant instead a function that always returns 1, then consider the following. We know that $$f(1)=f(f(0))=f(0)=1,$$ so our function must satisfy $f(0)=f(1)=1$. Are there any other conditions on $f$? If not, how might we choose the values of $f(x)$ for $x \ne 0,1$? Can we set $f(99) \ne 1$?

-

How about $f(x)=\begin {cases} 1 & x=0,1 \\ x & \text {otherwise} \end {cases}$

For a continuous one, $f(x)=1$

-

$$\forall x\quad f(x) = 1 \implies (f\circ f)(0)=f(f(0))=f(1)=1$$

-

Yes. Let $f(x):=x$ if $x\ge 1$ and $f(x):=1$ if $x<1$.

-

Note that any solution must be the identity map on the range of the function, i.e. if $y = f(x)$ then $f(y) = f(f(x)) = f(x) = y$. But it can be anything you like outside the range of the function (as long as the range is still the range). So e.g. for a solution mapping $\mathbb R$ onto $[1,2]$ you define $f(x) = x$ for $1 \le x \le 2$, while for $x \notin [1,2]$ $f(x)$ all you need is $f(x) \in [1,2]$.

-

$$f(x)=1^x=1$$ $$f(0)=1^0=1$$ $$(f\circ f)(x)=f(f(x))=f(1)=1$$

$$f=1$$

-

Another non-identical, non-constant version is $$f(x) = 1 + \{x\}$$ where $\{ \cdot \}$ denotes the fractional part.
However, I'm actually not sure how to make this valid over the complex numbers...

[update] Uppss... this seems to equal Robert Israel's proposal... didn't see this in the beginning...

-