Is there a "non-trivial" function $f(x,y)$ such that

$$f(x,y) \in \mathbb{Q} \iff x,y\in \mathbb{Q}?$$

An example of a "trivial" function would be

$$f(x,y) = \begin{cases} 0 & x,y\in \mathbb{Q}\\ \pi & \text{otherwise} \end{cases}$$ or any other $f$ which effectively uses a cases function.

The motivation is just my curiosity. Obviously, operations which preserve one direction of the $\iff$ are plentiful and well-studied. I was wondering how onerous the condition of the additional direction is on the choice of $f$. This question on mathoverflow seems related.

  • 4
    $\begingroup$ Well, you definitely can't have a continuous function satisfy this. If any two values of $f$ differ, you can come up with uncountably many paths between them (e.g. $(x,Cx(1-x))$ parameterizes in $C$ such a family of paths from $(0,0)$ to $(1,0)$) and then choose some rational $r$ between their values, and the intermediate value theorem says that $f(x,y)=r$ has uncountably many solutions - but $\mathbb Q\times\mathbb Q$ is countable, so that's not good. More strongly, $f$ may not be continuous on any open set. $\endgroup$ – Milo Brandt Jun 1 '15 at 2:53

Perhaps a slightly less trivial example would be the function $f$ that interleaves the decimal digits of $x$ and $y$: that is, if \begin{align} x&=0.x_1x_2x_3\dots \\ y&=0.y_1y_2y_3\dots \end{align} are decimal expansions of $x$ and $y$, then $$ f(x,y)=0.x_1y_1x_2y_2x_3y_3\dots $$

You can make this definition unambiguous by deciding to always (or never) take finite decimal expansions when they are available.

Then $f(x,y)$ has a repeating decimal expansion if and only if both $x$ and $y$ do, and so it satisfies your condition.

  • $\begingroup$ This is a really good answer. One might be tempted to use arithmetic operations for this but the irrationals are not closed under the standard arithmetic operations so that approach isn't very fruitful. Very nice insight! $\endgroup$ – Cameron Williams Jun 1 '15 at 2:30
  • 6
    $\begingroup$ Similarly, interleaving the continued fraction expansions of $x$ and $y$ preserves rationality, since a real number is rational if and only if its continued fraction terminates. $\endgroup$ – Greg Martin Jun 1 '15 at 2:51
  • 1
    $\begingroup$ This is even continuous at points where neither $x$ nor $y$ has a terminating decimal! $\endgroup$ – Milo Brandt Jun 1 '15 at 2:57
  • 1
    $\begingroup$ @Hugh: Yes, this follows from Meelo's comment. The set of discontinuities is a subset of $(\mathbb Q \times \mathbb R) \cup (\mathbb R \times \mathbb Q)$, which has measure zero. $\endgroup$ – TonyK Jun 1 '15 at 15:05
  • 1
    $\begingroup$ The usual problem with this interlace scheme (that it is not onto) is not a problem here, because that is not required in the problem. $\endgroup$ – GEdgar Jun 1 '15 at 15:54

This is an interesting question.

The answer would depend on how the functions are defined. My inclination is to say that the answer is "no", because irrationals can be made to cancel out to give a rational.

However, if limiting processes can be used, perhaps a function that uses the fact that rationals can not be well-approximated by rationals (error in approximation by $a/b$ at best $\Omega(1/b)$) and irrationals can (error in approximation by $a/b$ at worst $O(1/b^2)$) could be constructed.

  • $\begingroup$ Of course, limiting processes can result in cases functions like that in the OP's example. $\endgroup$ – Greg Martin Jun 1 '15 at 2:32

I think the function f must be understood to be from $\mathbb{R}^2$ to $\mathbb{R}$ so I choose

enter image description here

  • 1
    $\begingroup$ This is "trivial". $\endgroup$ – Hugh Jun 3 '15 at 2:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.