# inverse functions in real analysis

Can anyone help me with this?

Spose $I$ is a closed interval from $0$ to $1$ and let $f$ go from $I$ to $R$ be defined by $f(x) = x$ for $x$ rational, and $f(x) = 1-x$ for $x$ irrational. Show that $f$ is injective on $I$ and that $f(f(x)) = x$ for all $x \in I$. Show that $f$ is cont. only at the point $x = 1/2$

-
It's strange how "Show that $f$ is injective on $I$" is before "$f(f(x))=x$", considering the former follows from the latter. – wj32 Nov 2 '12 at 2:56

First note that $x$ and $f(x)$ are either both simultaneously rational or simultaneously irrational.

To prove that it is injective, let $f(x_1) = f(x_2)$. Then $f(x_1)$ and $f(x_2)$ are both rational or both irrational. Hence, either $x_1 = x_2$ or $1-x_1 = 1-x_2$. Both imply that $x_1 = x_2$.

Hence, $f(x)$ is injective.

If $x$ is rational, then $f(f(x)) = f(x) = x$.

If $x$ is irrational, then $f(f(x)) = f(\underbrace{1-x}_{\text{irrational}}) = 1-(1-x) = x$.

To show that $f$ is not continuous for all $x \neq \dfrac12$, approach $x$ by a sequence of rationals to get a limit of $x$ and a sequence of irrationals to get a limit of $1-x$.

For instance, if $x \neq \dfrac12$ is rational, consider the sequence $x_n = x-\dfrac{x}{n\sqrt{2}}$, to get $$\lim_{n \to \infty} f(x_n) = 1-x \neq x = f(x)$$

For instance, if $x \neq \dfrac12$ is irrational, consider the sequence $x_n = \dfrac{\lfloor 10^n x\rfloor}{10^n}$, to get $$\lim_{n \to \infty} f(x_n) = x \neq 1-x = f(x)$$

To show that $f$ is continuous at $x = \dfrac12$. Note that $\vert f(1/2+h) - f(1/2) \vert = h$, irrespective of $h$ being rational or irrational.

-