Is there a positive function $f$ on real line such that $f(x)f(y)\le|x-y|, \forall x\in \mathbb Q , \forall y \in \mathbb R \setminus \mathbb Q$?
Solution 1:
There is no such function. Consider any function $g\colon \mathbb{Q} \to (0,+\infty)$. Let $Y := \mathbb{R}\setminus \mathbb{Q}$. For each $q\in \mathbb{Q}$, consider the function $h_q \colon Y \to (0,+\infty)$ given by
$$h_q(y) = \frac{1}{g(q)}\lvert y- q\rvert$$
and then
$$h(y) = \inf \{ h_q(y) : q \in \mathbb{Q}\}.$$
Since $Y$ is a Baire space (it's a Polish space), if we had $h(y) > 0$ for all $y\in Y$, then there would be a nonempty open set $U \subset Y$ and an $\varepsilon > 0$ with $h(y) \geqslant \varepsilon$ for all $y\in U$: each $h_q$ is continuous, hence for every $\delta > 0$ the set
$$F(\delta) := \bigcap_{q\in \mathbb{Q}} h_q^{-1}([\delta,+\infty))$$
is closed. $h(y) > 0$ for all $y\in Y$ means
$$Y = \bigcup_{n = 1}^{\infty} F\bigl(\tfrac{1}{n}\bigr),$$
so $Y$ is written as a countable union of closed sets, and in a Baire space, one of these sets must have nonempty interior, say $\varnothing \neq U = \operatorname{int} F\bigl(\frac{1}{k}\bigr)$, then $h(y) \geqslant \frac{1}{k}$ on $U$.
But a nonempty open $U \subset Y$ contains a set $(a,b) \cap Y$ with $a < b$, and for $q \in (a,b) \cap \mathbb{Q}$ we have $h_q(y) < \varepsilon$ on the nonempty open subset
$$(q - g(q)\varepsilon, q + g(q)\varepsilon)\cap (a,b) \cap Y$$
of $(a,b) \cap Y$, and a fortiori $h(y) < \varepsilon$ there, in contradiction to $h(y) \geqslant \varepsilon$ on $(a,b) \cap Y$.
It follows that we have $h(y) = 0$ for some $y\in Y$ (in fact, every nonempty open subset of $Y$ contains zeros of $h$), and hence $g$ is not the restriction of an $f\colon \mathbb{R} \to (0,+\infty)$ with the property
$$f(x)f(y)\leqslant \lvert x-y\rvert$$
for all $x\in \mathbb{Q}, y \in Y$. For if it were, the construction above applied to $g = f\lvert_{\mathbb{Q}}$ would yield $0 < f(y) \leqslant h(y) = \inf \{h_q(y) : q \in \mathbb{Q}\}$ for all $y \in Y$.