Does there exist a function $f:\mathbb R \to (0,\infty)$ such that $f(x)f(y)\le|x-y|, \forall x\in \mathbb Q , \forall y \in \mathbb R \setminus \mathbb Q$ ?

  • 1
    $\begingroup$ It's simple to prove that such a function cannot be continuous. $\endgroup$ Mar 12, 2016 at 16:27
  • $\begingroup$ I mean such function is nowhere continuous (if you pick a rational $x$, there is a sequence $y_n$ of irrationals such that $y_n\to x$ and $f(y_n)\to 0\neq f(x)$). The same reasoning applies if $x$ is irrational. $\endgroup$ Mar 12, 2016 at 16:37
  • $\begingroup$ @Alessandro I don't think so, $f(0)f(\sqrt{2}/5)=1/2>\sqrt{2}/5$ $\endgroup$ Mar 12, 2016 at 16:43
  • $\begingroup$ @Alessandro no. As LeGrandDODOM has pointed out each for each sequence $y_n$ of irrational number converging to some rational number, $f(y_)\rightarrow 0$, and vice versa. $\endgroup$
    – Thomas
    Mar 12, 2016 at 16:44
  • 1
    $\begingroup$ Yep, indeed, I confused $x$ and $f(x)$ $\endgroup$ Mar 12, 2016 at 16:45

2 Answers 2


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$.

  • $\begingroup$ If $h(y)>0$ for all $y \in Y$ , how does it follow that there is an open set $U \subseteq Y$ and $\epsilon >0$ such that $h(y)\ge \epsilon $ for all $y \in Y$ ? Why is $Y$ a Baire space ? How does that help ? Can we instead use that $\mathbb R$ is a Baire space ? thanks in advance $\endgroup$
    – user228169
    Mar 13, 2016 at 6:13
  • $\begingroup$ I've elaborated on the existence of $U$ and $\varepsilon$. There are various ways of proving that $Y$ is a Baire space. One can say that it's the complement of a meagre set ($\mathbb{Q}$) in a Baire space ($\mathbb{R}$). Or one can say that it's a Polish space (because it's a $G_{\delta}$ set in the Polish space $\mathbb{R}$), and completely metrisable spaces are Baire spaces. Since the condition on $f$ only says something about pairs of points where one is rational and the other irrational, I think it's natural to split $\mathbb{R}$ into $\mathbb{Q}$ and $\mathbb{R}\setminus \mathbb{Q}$ and $\endgroup$ Mar 13, 2016 at 12:05
  • $\begingroup$ look at each part separately. One could also look at the functions $h_q$ defined on $\mathbb{R}$, but then one needs an additional argument that $h = \inf h_q$ has irrational zeros - and that argument would most likely effectively reintroduce the splitting into $\mathbb{Q}$ and $\mathbb{R}\setminus \mathbb{Q}$. $\endgroup$ Mar 13, 2016 at 12:05

Let $(M,d)$ be a metric space , let $X \subseteq M$ and $Y:=M \setminus X$ . If there exist a function $f:M \to (0,\infty)$ such that $f(x)f(y)\le d(x,y) , \forall x\in X , y\in Y$ , then $X,Y$ are $F_{\sigma}$ sets in $M$ .

Proof : For every $n \in \mathbb N$ , let $X_n:=\{x \in X | f(x) \ge 1/n\}$ .

We first claim that $\overline X_n \subseteq X , \forall n \in \mathbb N$ . If not , then $\exists m\in \mathbb N$ and some $y \in \overline X_m \setminus X$ ; as $y \notin X$ , so $y \in Y$ . Also , as $y \in \overline X_m$ , there is a sequence $\{x_k\}_{k \ge 1}$ in $X_m$ such that $x_k \to y$ ; whence $x_k \in X$ and $f(x_k) \ge 1/m , \forall k \ge 1 $ . Thus $0< f(y)/m \le f(x_k)f(y) \le d(x_k,y) , \forall k \ge 1$ , where $x_k \to y$ as $k \to \infty $ , hence by Squeeze Principle , $f(y)/m=0$ i.e. $f(y)=0$ , contradicting $f(M) \subseteq (0, \infty)$ .

Thus $\overline X_n \subseteq X , \forall n \in \mathbb N$ .

Now as $f(M) \subseteq (0, \infty)$ , so for every $x \in M , \exists n\in \mathbb N$ such that $1/n \le f(x)$ ; hence

$M=\cup_{n \in \mathbb N} \{x \in M | f(x) \ge 1/n\}$ ; so $X=\cup_{n \in \mathbb N} X_n \subseteq \cup_{n \in \mathbb N} \overline X_n =X$ , thus

$X=\cup_{n \in \mathbb N} \overline X_n$ is a countable union of closed sets in $M$ i.e. a $F_{\sigma}$ set in $M$ .

Since the existence of the function ( the inequality ) is symmetric in the sets $X$ and $Y$ , the same proof works for $Y$ , showing that $Y$ is a $F_{\sigma}$ set in $M$ .


Now if $M$ is a complete metric space without any isolated point and with a countable dense subset $X$ , then by Baire Category theorem , $M \setminus X$ cannot be a $F_{\sigma}$ set ; hence for such $M$ and $X$ , a function satisfying the above properties cannot exist ; so in particular for $M=\mathbb R$ with usual Euclidean metric and $X=\mathbb Q$ , such a function cannot exist .


You must log in to answer this question.