$f$ differentiable, $f(x)$ rational if $x$ rational; $f(x)$ irrational if $x$ irrational. Is $f$ a linear function?
Let $f$ be an everywhere differentiable function whose domain consists of all real numbers. Assume that $f(x)$ is rational for rational $x$ and irrational for irrational $x$. Can we conclude that $f$ is a linear function?
Solution 1:
No. As mentioned in the posts linked in my comment above, the function $$ f(x)=\cases{ {1\over x-1}+1,& $x\le 0$ \cr {1\over x+1}-1, &$x\ge 0$ } $$ has the required properties and is not linear.