4
$\begingroup$

The question is

$h:\mathbb{R}\backslash\mathbb{Q}\rightarrow\ \mathbb{Q}$ so that the image of $h$ is the same as the codomain of $h$.

I couldn't really think of a function that maps irrational numbers to rational numbers. Can anyone give me some hints?

$\endgroup$
1
  • 3
    $\begingroup$ One method would be to think of an invertible function $g: \mathbb{Q} \to \mathbb{R} \setminus \mathbb{Q}$; and then map all the un-mapped-to irrationals to, say, zero. $\endgroup$
    – whoisit
    Oct 1, 2022 at 6:24

2 Answers 2

13
$\begingroup$

$h(x)=r$ if $x=\sqrt2+r$ for some $r\in\mathbb Q$, and $h(x)=0$ else.

$\endgroup$
1
  • $\begingroup$ Clever! :) :) :) $\endgroup$ Jan 4, 2023 at 22:18
7
$\begingroup$

Use the floor of the absolute value, $$x\mapsto⌊|x|⌋\ :\ {\mathbb R}\setminus{\mathbb Q}\,\to\,{\mathbb N}$$ which is surjective, and further use that ${\mathbb Q}$ is countable.

$\endgroup$
2
  • 1
    $\begingroup$ The floor function would only produce $\mathbb{N}$ right? The question is actually asking me to find a function whose range is $\mathbb{Q}$. $\endgroup$
    – d0nut
    Oct 1, 2022 at 6:41
  • 3
    $\begingroup$ @d0nut Yeah for brievity the answer takes for granted that ${\mathbb Q}$ and ${\mathbb N}$ have the same cardinality. Here's a pointer to the relevant Wikipedia section and you'll find counting functions on this site too. $\endgroup$
    – Nikolaj-K
    Oct 1, 2022 at 6:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .