TITLE: Continuity points of the function $f$ defined by $f(p/q)=\sqrt{(1+p^2)/(1+q^2)}$ and $f(x)=x$ if $x$ is irrational or zero
QUESTION [6 upvotes]: Let $f:[-1,1]\rightarrow\mathbb{R}$ defined by $f(x)=x$ for every $x\in[-1,1]\cap \mathbb{Q}^{c})\cup\{0\}$ and $f(x)=\sqrt{\frac{1+p^{2}}{1+q^{2}}}$ for every $x=\frac{p}{q} \in[-1,1]$. Then, $f$ is continuous on $((0,1)\cap\mathbb{Q}^{c})\cup\{0,1\}$. 

How to find the continuity and discontinuity points? Is there any theorem to check the continuity and continuous point for this type of function. Proving the continuity using $\epsilon-\delta$ definition like the proof of Thomae function is lengthy. Please help me to deduce the conclusion with less time.

REPLY [2 votes]: This one comes straight from Hardy's A Course of Pure Mathematics. The function is clearly discontinuous for negative values of the argument (because irrational points lead to a negative value and rational points lead to a positive value). So any points of continuity must lie in $[0,1]$.If $x\in(0,1)$ is irrational then we can ensure that rationals near $x$ have a large denominator (therefore a large numerator, see the theorem at the end). If $p/q$ is one such rational number near $x $ then because $p, q$ are large $f(p/q) =\sqrt{(1+p^{2})/(1+q^{2})}$ is near $p/q$ and hence near $x=f(x) $. So $f$ is continuous at $x$. If $x=p/q\in(0,1)$ then we can see that $f(p/q) \neq p/q$ and hence for irrational $y$ close to $x$ the value $|f(y)-f(x) |=|y-f(p/q) |$ is near $|p/q-f(p/q) |$ and hence cannot be made arbitrarily small. Thus $f$ is discontinuous at $x$ if $x$ is rational and $x\in(0,1)$. This problem does not occur if $x=0,x=1$ because then $f(x) =x$.
To sum up the function $f$ is continuous at $0,1$ and at all irrational points in $[0,1]$.

Note: If you need more formalism then prove the following theorem (and this is not a difficult job)

Theorem: If $x$ is irrational and $N$ is a positive integer then there is a positive real number $\delta$ such that all rationals in interval $(x-\delta, x+\delta) $ have a denominator greater than $N$.