I'm thinking of $f$ as a function either from the reals to the reals or from the naturals to the naturals.
Edit: Okay, what if $f$ is from the naturals to the naturals?
I'm thinking of $f$ as a function either from the reals to the reals or from the naturals to the naturals.
Edit: Okay, what if $f$ is from the naturals to the naturals?
On
If you want one from the naturals to the naturals, take $f(x)$ to be the function $f(1)=2,f(2)=1$, and $f(n)=n$ for $n\geq 3.$
On
As for $\Bbb N$, let $f(n)=n+1$ for odd and $=n-1$ for even $n$. One can twist this to fancier constructions by fancier partitions of $\Bbb N$.
On
This doesn't directly answer the question, but if $f$ is continuous from $\mathbb{R}\to\mathbb{R}$, it still can be nonlinear. For a concrete example, see the comments on this answer to one of my previous questions in a similar vein to this one; essentially, one can rotate the graph of
$$y=\epsilon \cos(x)$$
for small enough $\epsilon$ exactly $45^{\circ}$ counterclockwise, and it satisfies the property.
No. For example,$$ f(x) = \begin{cases} \displaystyle \frac{1}{x}; & x \neq 0\\ 0; & x = 0 \end{cases}. $$