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 
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.
 A: Basically, the thing to show is that, for a sequence $x_n$ of distinct rationals in $[-1,1]$ with $\lim_{n \to \infty} x_n =x$, we have $\lim_{n \to \infty} f(x_n) = |x|$.  To see this, represent them in lowest terms as $x_n =\frac{p_n}{q_n}$. Since there are only finitely many rationals in $[-1,1]$ with any given denominator, it follows that $q_n \to \infty$, and so $f(x_n) = \sqrt{\frac{1 + p_n^2}{1+q_n^2}} = \sqrt{\frac{\frac{1}{q_n^2} + r_n^2}{\frac{1}{q_n^2}+1}} \to \sqrt{\frac{0 + x^2}{0+1}} = |x|$. Thus, in order for $f$ to be continuous at $x$, it is necessary to have $f(x)=|x|$, which only happens at $x=0$, $x=1$ and at every irrational number $x \in (0,1)$.
There are still details to write out, but hopefully this helps. 
A: 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$. 

