Let $f(x)=x^2$ for $x$ rational and $f(x) = 0$ for $x$ irrational. Prove that $f$ is discontinuous at all $x$ not equal $0$ I understand that I have to use the discontinuity criterion:
Theorem: Let $S⊂ℝ$, let $f:S→ℝ$ and let $c∈S$.
Then f is discontinuous at c if and only if there exists a sequence $\{x_n\}$ in S such that $\lim(x_n)=c$, but the sequence $\{f(x_n)\}$ does not converge to $f(c)$.
I tried splitting up the function as $f(x)=x^2$ when $x=\frac{p}{q}$, for $p,q\in \mathbb{Z}$ but I do not know how to define for irrational numbers
I also don't know how to think of a sequence show the limit exists but it does not converge...
 A: If $x\ne 0$ is rational, then take $x_n\to x$ with $x_n$ irrational for all $n$. Then:
$$0 = f(x_n)\to 0\ne x^2=f(x)$$
If $x\ne 0$ is irrational, then take $x_n\to x$ with $x_n$ rational for all $n$. Then:
$$x_n^2 = f(x_n)\to x^2\ne 0=f(x)$$
In both cases, $f$ is discontinuous at $x$.
A: For a fixed $c$, you need to find a sequence converging to $c$. It doesn't help to write your rational number as $\frac{p}{q}$. You'd need to choose a specific sequence of values for $p$ and $q$, depending on $c$.
Try thinking of any sequence of rational numbers converging to 0. Let's call it $\epsilon_1,\epsilon_2,\epsilon_3,\ldots$. You can choose specific values for each $\epsilon_i$, depending on $i$. (For example, you might choose $\epsilon_i:=\frac{1}{2^i}$, or $\epsilon_i:=\frac{1}{i}$, or whatever you like - the point is you just have to choose some specific expression depending on $i$). Then to get a sequence of irrational numbers converging to 0, you can choose a new sequence $\xi_1:=\sqrt{2}\epsilon_1,\xi_2:=\sqrt{2}\epsilon_2,\xi_3:=\sqrt{2}\epsilon_3,\ldots$. Then if $c$ is rational, the sequence $x_1:=c+\xi_1,x_2:=c+\xi_2,x_3:=c+\xi_3,\ldots$ converges to $c$. Notice that the terms $x_i:=c+\xi_i$ depend on both $c$ and $i$, and they are specific numbers that you've chosen.
To get a sequence of rational numbers converging to an irrational number $c$ is slightly harder. You need to construct a sequence of rational approximations to $c$, i.e. a sequence of numbers $x_i$ which are the closest rational number to $x_i$ within some set, or at least a sequence which is getting closer. For example, you could take $x_1:=\lfloor c \rfloor$, then for $i \ge 2$, define $x_i:=x_{i-1}+\frac{1}{2^i}$ if $c\ge x_{i-1}+\frac{1}{2^i}$, and $x_i:=x_{i-1}$ otherwise. Clearly, this sequence converges to $c$. Alternatively, you can take $x_i$ for $i \ge 1$ as the closest decimal number to $c$ to $i$ decimal places. Here, I've still defined $x_i$ in terms of both $c$ and $i$, and it clearly is a specific sequence converging to $c$.
If you want a more high-level proof, you can use the fact that rational numbers are dense in $\mathbb{R}$, which means precisely that for any $c \in \mathbb{R}$ there is a sequence of points $x_1,x_2,x_3,\ldots \in \mathbb{R}$ converging to $c$. But you can only use this fact directly if your teacher says you can, otherwise you have to find an explicit sequence like the ones above.
