This question is from the GRE sample exam found at https://www.ets.org/s/gre/pdf/practice_book_math.pdf It is from page 44 of the pdf, problem 47. The problem reads,
The function $f:\mathbb{R}\rightarrow \mathbb{R}$ is defined as follows:
$f(x)=\left\{\begin{matrix}3x^2 \textrm{ if } x \in \mathbb{Q} \\ -5x^2 \textrm{ if } x \notin \mathbb{Q} \end{matrix}\right.$
Which of the following is true?
(A) $f$ is discontinuous at all $x \in \mathbb{R}$
(B) $f$ is continuous only at $x=0$ and differentiable only at $x=0$.
(C)$f$ is continuous only at $x=0$ and nondifferentiable at all $x \in \mathbb{R}$.
(D)$f$ is continuous at all $x \in \mathbb{Q}$ and nondifferentiable at all $x \in \mathbb{R}$.
(E)$f$ is continuous at all $x \notin \mathbb{Q}$ and nondifferentiable at all $x \in \mathbb{R}$.
I do not know what the correct answer is, but I have done some thinking and would appreciate input from the community. First, Both $\mathbb{Q}$ and $\mathbb{R}\setminus\mathbb{Q}$ are dense in $\mathbb{R}$, which I think makes it impossible to say that the function is continuous anywhere save the point of intersection, $x=0$. This thinking still seems wrong to me because discontinuities exist in the neighborhood about $x=0$. If this thinking is still (somehow) correct, then since a function is only differentiable where it is continuous, the answer could be (B)?
I'm not understanding the critical definitions here. Can somebody quickly fill-me in on what I need to understand for this problem? Thank you.
You're correct in this case, but as Arthur says in the comments you haven't really justified why it is B and not C.
The function is not continuous (and hence not differentiable) anywhere that $3x^2\neq-5x^2$, since for any $x$ you can get sequence of rationals $x_i\to x$ and a sequence of irrationals $y_i\to x$, so $\lim f(x_i)=3x^2$ but $\lim f(y_i)=-5x^2$.
It is continuous at $0$, because for any sequence $z_i\to 0$ the subsequence of rational $z_j$ has $f(z_j)\to 0$, the same is true for the irrational subsequence, and between them, these cover the whole sequence.
It is also differentiable at $0$, but that only works because not only do $3x^2$ and $-5x^2$ coincide at $0$, but also their derivatives coincide at $0$. (If your functions were $3x$ and $-5x$, it would be nowhere-differentiable, but still continuous at $0$.)