# 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.

• Your example for (i) almost works (sometimes $\sqrt{n}$ is rational), but it only applies for $c=0$. – vadim123 Apr 5 '15 at 3:24
• The key insight is that if $\lim_{x\to c, x\in \mathbb R} g(x) = \ell$ for $g: \mathbb R \to \mathbb R$ continuous, then $\lim_{x\to c, x\in \mathbb Q} g(x) = \ell = \lim_{x\to c, x\in \mathbb Q^c} g(x)$. – William Stagner Apr 5 '15 at 3:28

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.

• Hi @DanZimm, for part i), could i just use $x_n=c+\frac{1}{n}$ and $y_n=c+\frac{\sqrt{2}}{n}$? I've never really though about c being irrational or rational as i've only done questions where c is a whole number e.g 0,1,2 etc. Also for ii) could i use the $\varepsilon, \delta$ definition? – Helpisneeded Apr 5 '15 at 3:54
• @Helpisneeded for $x_n$ defined as you put it, suppose $c = \pi$. Then is $\pi + \frac{1}{n}$ a rational number for every $n$? Similarly for your $y_n$ consider $c = - \frac{\sqrt{2}}{2}$, then it isn't true that $y_2$ is irrational (and thus not all of $y_n$ are irrational). As for the last part, since the sequence is made up of a combination of rationals and irrationals you can consider subsequences of rationals and irrationals, then show that any subsequence of $f(c_n) \to f(c)$ and thus $f(c_n) \to f(c)$. This may seem vague but working out the details yourself really helps you understand. – DanZimm Apr 5 '15 at 4:16
• @Helpisneeded further, you can ditch the sequential formulation of continuity and just go from the definition - that is let $\epsilon > 0$ and show that there's a $\delta > 0$ so that $\lvert x - 2 \rvert < \delta \implies \lvert f(x) \rvert < \epsilon$. – DanZimm Apr 5 '15 at 4:17
• Hi @DanZimm, sorry if this is taking up too much of your time, really appreciate the help. I see the problem with me trying to define $x_n$ and $y_n$. Do i then just let $x_n$ be a rational sequence where $x_n \rightarrow c$ and let $y_n$ be an irrational sequence where $y_n \rightarrow c$ and just say that $\lim_{n \to \infty} f(x_n) = (c - 2)^3$ and $\lim_{n \to \infty} f(y_n) = (2-c)$ and conclude that $c$ needs to be 2 for the limit to exist? – Helpisneeded Apr 5 '15 at 4:34
• Also for the second part, could i just follow what @reluctant mathematician did below? – Helpisneeded Apr 5 '15 at 4:36

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$