limits involving a piecewise function, Prove that if $c \ne 2$, then f does not have a limit at $x = c$. $$f(x) = \begin{cases} (x-2)^3 & \text{if $x$ is rational }  \\
(2-x) & \text{if $x$ is irrational }
\end{cases}$$
(i) Prove that if $c \ne 2$, then f does not have a limit at $x = c$.
(ii) Prove that $\lim_{x\to2} f (x)$ exists.
Hi all, i'm not very sure how to approach this question. For part i), i think i'm suppose to find a rational sequence $x_n$ and an irrational sequence $y_n$ such that $x_n \rightarrow c$ & $y_n\rightarrow c$. But $\lim_{n\to \infty}f(x_n) \ne \lim_{n\to \infty}f(y_n)$. Would letting $x_n = \frac{1}{n}$ and $y_n=\frac{1}{\sqrt{n}}$ suffice?
I'm clueless as to how to answer part ii). Would appreciate any hints or advice. Thanks in advance.
 A: For part $(i)$ you're on the right track, but note that we are concerned with $x_n, y_n$ converging to any arbitrary $c$. Note that your $x_n, y_n$ both converge to $0$ (also that $y_n$ is necessarily even a sequence of irrationals - consider $n = 4$). I'm guessing you are to come up with the sequences yourself, and I leave but a hint for you here:


*

*If $c$ is rational consider adding to $c$ some rational sequence that converges to $0$ i.e. find an $a_n$ such that $\{a_n\} \subset \mathbb{Q}$ and $a_n \to 0$.

*If $c$ is irrational consider first a sequence of decimal approximations for $x_n$ (that is the $n^{th}$ term of $x_n$ has $n$ decimal places expanded out) and for $y_n$ simply consider adding on the same sequence $a_n$ as above, will $c + a_n$ be irrational always?


Once you have done this then note that you will have $\lim_{n \to \infty} f(x_n) = (c - 2)^3$ and $\lim_{n \to \infty} = (2 - c)$. Now note $f$ is continuous at $c$ iff the limit is the same no matter how you approach it (meaning, no matter what sequence you use to approach $c$). If $c \neq 2$ what do you get above?
As for $(ii)$, we can use the sequential characterization of continuity. That is, $f : \mathbb{R} \to \mathbb{R}$ is continuous at $c$ iff for any $c_n \to c$ we have
$$
\lim_{n \to \infty} f(c_n) = f(c)
$$
Now theres three possible types of sequences when talking about rational and irrational sequences:


*

*Completely rational sequence (all elements of the sequence are themselves rational)

*Completely irrational sequence (all elements of the sequence are themselves irrational)

*Mixed: Some elements are rational, some are irrational


Now when considering the case of $c = 2$ what is the limit of a completely rational sequence? What about a completely irrational sequence? As for this third category of sequences, the proof really depends on the level of rigor your professor/teacher wants. If you clue me in on how precise you want this to be I can help you out.
A: Since the rationals are dense in $\mathbb{R}$, for every $c\in\mathbb{R}$ there is a sequence $\{x_n\}$ of rationals which converges to $c$. Then the sequence $\{f(x_n)\}$ converges to $(c-2)^3$. Furthermore, since the irrationals are dense in $\mathbb{R}$, for every $c\in\mathbb{R}$ there is a sequence $\{y_n\}$ of irrationals which converges to $c$. Then the sequence $\{f(y_n)\}$ converges to $2-c$. Thus, the function can have a limit only where $(c-2)^3=2-c$, that is, at $c=2$.
To determine whether $f(x)$ has a limit at $x=2$, let $\epsilon>0$ and put $\delta=min\{\epsilon,\epsilon^{1/3}\}$. Let $x\in\mathbb{R}$  such that $|x-2|<\delta$. If x is rational, then $|f(x) - f(2)|=|(x-2)^3|<\delta^3$. If x is irrational, then $|f(x) - f(2)|=|2-x|<\delta$. In either case, $|f(x) - f(2)|<\epsilon$. $\ \ \ \ \Box$
