$\begingroup$

Study continuity of the following function: $$ f(x) = \begin{cases} |x|,\ \text{if $x$ is irrational}\\ \frac{qx}{q+1},\ \text{if}\ x = {p\over q}, q\in\Bbb N, p\in\Bbb Z, p\perp q \end{cases} $$

I've been recently studying some similar functions. The usual trick was to consider different sequences $x_n$ and then study the behavior of $f(x)$ as $x_n$ approaches some point $x_0$.

I wasn't able to apply the same trick for this function but here some intuition though, which I want to formalize somehow. If we take any sequence $\{x_n\}_{n\in\Bbb N}$ of irrational numbers such that: $$ \lim_{n\to\infty}x_n = x_0 $$ Then: $$ \forall x_n \in\Bbb R\setminus \Bbb Q:f(x_n) = |x_n| $$ In such case: $$ \lim_{n\to\infty} f(x_n) = |x_0| $$

So it looks like the function is continuous at every irrational point.

For the rational ones, I was trying to use a similar approach. Let $\{y_n\}$ be a sequence of rational numbers such that for $y_n \in\Bbb Q$ and $y_0\in\Bbb R\setminus\Bbb Q$: $$ \lim_{n\to\infty}y_n = y_0 $$ But: $$ \lim_{n\to\infty}f(y_n)

e f(y_0) = |y_0| $$

Now every neighborhood of a given point in $\Bbb R$ contains infinitely many rationals and irrationals. So we might approximate $y_0$ with points from $y_n$ closer and closer to $y_0$ so if we introduce a $\{q_n\}$ denoting consequent denominators from $p\over q$ then it is going to grow and eventually: $$ \lim_{n\to\infty}{q_n\over q_n + 1} = 1 $$

So looks like every rational point is a point of removable discontinuity at least for $x \ge 0$. My problem is with putting down a rigorous proof behind that intuition.

Could you please help me with that?