Proof needed for a function $x^2$ for irrationals and $x$ for rationals How can I prove that the function $f:[0,1] \rightarrow \mathbb{R}$, defined as
$$   f(x) = \left\{\begin{array}{l l}     x &\text{if }x \in \mathbb{Q} \\     x^2 & \text{if } x \notin \mathbb{Q}   
\end{array} \right. $$
is continuous on $0$ and $1$, but nowhere else?
I really don't know where to start.
I know the (equivalent) definitions of continuous functions (epsilon delta, $\lim f(x) = f(c)$, topological definition with epsilon and delta neighbourhoods, and the definition where as $x_n$ goes to $c$, it implies that $f(x_n)$ goes to $f(c)$).

Well I guess it should be something to do with the fact that $x = x^2$ has solutions $0$ and $1$.
Let $a>1$ be rational, then we can always find an irrational $a' > a$ very close to $a$ such that $|f(a)-f(a')| = |a-a'^2| > a(a-1)$.
You can do the same when $a$ is irrational, then you can do it when $a<0$ and also $0 < a < 1$.
Now we just want to prove continuous at $0$ and $1$. Ill show how for $1$:
We need to show the definition of continuity: $\forall \epsilon > 0,\,\, \exists \delta,\,\, \forall x,\,\, |x-1| < \delta \to |f(x) - f(1)| < \epsilon$
Note by cases that if $x < 1$ or $x > 1$ then $|x^2-1| > |x-1|$ so we can prove continuity by proving the stronger statementn $\forall \epsilon > 0,\,\, \exists \delta,\,\, \forall x,\,\, |x-1| < \delta \to |x^2 - 1| < \epsilon$ and this isn't difficult, just factor $|x^2 - 1^2| = |x-1||x+1|$ the first term is $\delta$ and the second is $2$, so (at least for $x$ relatively close to $1$, which is all that matters) use $\varepsilon = \delta/3$ and the proof goes through.
By the way, $x^2$ repels around 1 but it attracts around 0 so for the proof in the 0 case you can just use $\varepsilon = \delta$.
