Is this function continuous everywhere or at 1 point only? Problem:
let $f:[0,1]\longrightarrow\mathbb R$ be defined by 
$f(x) = \left\{
     \begin{array}{lr}
       2x-1 & \text{ if } x \notin \mathbb{Q}\\
       x^2 & \text{ if } x \in \mathbb{Q}
     \end{array}
   \right.$
Determine the points where $f$ is continuous
Solution:
I think this is continuous either everywhere or only at $x=1$.
Any ball of radius $\delta$ around any point $x$ contains both irrational and rational numbers. 
thus there are only 3 cases: 


*

*$|f(x)-f(y)|$ S.T. $x\in Q, y\notin Q$

*$|f(x)-f(y)|$ S.T. $x\in Q, y\in Q$

*$|f(x)-f(y)|$ S.T. $x\notin Q, y\notin Q$
In each of these cases we have : 
$|2x-1-x^2|=|(-x+1)(x-1)|\\
|x^2-x^2|=|0|\\
|2x-1-(2x-1)|=|0|$
Since any ball around any $x$ contains both rationals and irrationals, we have to look at case $1$. In this case, $\forall x,y \in B_\delta(x)$, if $x=1$ then this is continuous, because $\forall \epsilon >0$, $|f(x)-f(y)|\rightarrow |0|=0 < \epsilon$
But is it continuous everywhere? Because this function, $|-x^2+2x-1|$ will grow monotonically as a function of $x$. Therefore, for whatever $\epsilon$, cant one find a $\delta$ where $|-x^2+2x-1|<\epsilon$ if $|x-y|<\delta$
Choose $x^2<\epsilon$, so am I right that it is continuous everywhere?
 A: No. That function is continuous at $1$ and only there. If $a\neq 1$, $f$ is discontinuous at $a$ because:


*

*if $a\in\mathbb Q$ you take a sequence $(a_n)_{n\in\mathbb N}$ of irrational numbers converging to $a$, and then $\lim_{n\to\infty}f(a_n)=2a-1\neq a^2=f(a)$;

*if $a\notin\mathbb Q$ you take a sequence $(a_n)_{n\in\mathbb N}$ of rational numbers converging to $a$, and then $\lim_{n\to\infty}f(a_n)=a^2\neq 2a-1=f(a)$.

A: In addition to the correct answer by José Carlos Santos, let me tell you where you went wrong, so you don't make the same mistake(s) next time.
Considering the cases is OK, but you are missing case 4: $x \not \in Q, y \in Q$.
First mistake is that suddenly when you discuss those cases, all traces of $y$ are gone. In case 3, the inequality should have been $|x^2-y^2|<\epsilon$, for the other cases that applies similiarly.
Then, because of your incorrect handling above, cases 2) and 3) become (incorrectly) trivially 'continuous'. But case 1 only is 'small' for $x=1$. 
Then you make the next, bigger mistake: You think you can choose $x$ as you want. That's not true, you started the whole argument with "Any ball of radius $\delta$ around any point $x\ldots$". If you now 'choose $x$', whatever you wrote will only be true for that $x$ you chose, and not for any $x$.
The third mistake is that your choice of $x^2 < \epsilon$ is not even correct, as that implies $|x|$ is small, which implies that $|-x^2+2x|$ is small, which implies that $|-x^2+2x-1|$ is very near to $1$, which makes it 'not small'.
