There are many easy examples for differentiable $f$ st $f'(x) \ne 0$ and for $a \in \mathbb{Q}, \ f(a) \not \in \mathbb{Q}$ for example $\pi x , e^x,$ etc, but the question is: Is the converse true ? i.e Is there a differentiable $f$ st $f'\ne 0$ on $\mathbb{R}$ st for $a\not \in \mathbb{Q}, \ f(a) \in \mathbb{Q}$?
Of course $f$ couldn't be 1-1 function but can this $f$ exist ? I was not able to find any example.
I think the answer is to this question is such function couldn't exist because the cardinality of irrationals is bigger than rations but I couldn't prove that.
Claim. If $f: \mathbb R\to \mathbb R$ is continuous and sends every irrational number to a rational number, then $f$ is constant.
Proof. Suppose not. Then there exist $x\ne y$ such that $a=f(x)\ne b=f(y)$. After relabelling, we can assue that $a<b$. The interval $[a,b]$ has cardinality of continuum. Since $\mathbb Q$ is countable, so is $f(\mathbb Q)$. Thus, $f(\mathbb Q)\cup f(\mathbb R \setminus \mathbb Q)$ is countable (since $f(\mathbb R \setminus \mathbb Q)\subset \mathbb Q$). Hence, $f(\mathbb R)$ cannot contain $[a,b]$. Thus, there exists $c\in [a,b]$ such that $c\notin f(\mathbb R)$. This contradicts the intermediate value theorem. qed