# Continuity and differentiability of a piecewise function

1. Dec 10, 2013

### Zaculus

1. The problem statement, all variables and given/known data
Discuss the continuity and differentiability of
$$f(x) = \begin{cases} x^2 & \text{if } x\in \mathbb{Q} \\ x^4 & \text{if } x\in \mathbb{R}\setminus \mathbb{Q} \end{cases}$$

2. Relevant equations

3. The attempt at a solution
From the graph of $f$, I can see that it will be differentiable at $x=0$, and I think just continuous at $x= \pm 1$. That is, discontinuous everywhere else. What would be the strategy in showing that points not equal to $0\text{, } \pm 1$ are discontinuous? I know I would take a sequence of rationals and a sequence of irrationals, but would I say consider $x_n \in \mathbb{Q}$ and $y_n \in \mathbb{R} \setminus \mathbb{Q}$ such that as $n \rightarrow \infty$, $x_n \rightarrow x$ and $y_n \rightarrow x$? I'm only guessing considering the function, since we'll have $x^2 \ne x^4$ for $x \not\in \{0, \pm1\}$

2. Dec 10, 2013

### jbunniii

Yes, this is the right idea. In order for $f$ to be continuous at $x$, one must have
$$\lim_{y \rightarrow x} f(y) = f(x)$$
In particular, the limit must exist. But if the limit exists, then we must get the same answer no matter how we approach $x$. Therefore if $x_n$ and $y_n$ are two sequences converging to $x$, and the limits $\lim_{n\rightarrow \infty} f(x_n)$ and $\lim_{n\rightarrow \infty} f(y_n)$ disagree, then $\lim_{y \rightarrow x} f(y)$ does not exist, so $f$ cannot be continuous at $x$.

3. Dec 10, 2013

### Zaculus

Thank you jbunniii. Now to make the proof more rigorous, would I need to find explicit $x_n$ and $y_n$ that converge to $x$, or just "consider $x_n$ and $y_n$ which both go to $x$ as $n \rightarrow \infty$ ?

4. Dec 10, 2013

### jbunniii

Good question. It depends on what knowledge is assumed in this problem set. If you can justify (based on what you have already covered in the course) writing something like "every $x \in \mathbb{R}$ is a limit point of both $\mathbb{Q}$ and $\mathbb{R}\setminus\mathbb{Q}$, so there exist sequences $x_n \in \mathbb{Q}$ and $y_n \in \mathbb{R}\setminus\mathbb{Q}$ such that $x_n \rightarrow x$ and $y_n \rightarrow x$" then that should suffice. Otherwise you might want to explicitly construct such sequences.