I just want to make sure i'm doing these correctly.

I need to find $\displaystyle |f(x)-f(x_0)|<\epsilon$ when $\displaystyle 0<|x-x_0|<\delta$.Prove that $\displaystyle f(x)=\begin{cases}x \ \ \ \ \ x \ \ rational\\ x^2 \ \ \ \ x \ irrational \end{cases}$ is continuous at 0.

Let $\displaystyle x_0=0$ (since i'm interested in continuity at the origin).

Therefore I need to find $\displaystyle |f(x)|<\epsilon$ when $\displaystyle 0<|x|<\delta$.

Let $\displaystyle 0<\delta<1$.

$\displaystyle |f(x)|<\epsilon \Leftrightarrow \ |x|<\epsilon$ for $\displaystyle x \in \mathbb{Q}$.

$\displaystyle |f(x)|<\epsilon \Leftrightarrow \ |x^2|<\epsilon \Leftrightarrow |x|< \epsilon$ (since $\displaystyle |x^2| \leq |x|$) for $\displaystyle x \in \mathbb{R}$\$\displaystyle \mathbb{Q}$.

Therefore pick $\displaystyle \delta$ such that $\displaystyle \delta=min\{\frac{1}{2}, \epsilon \}$.

That's the preliminary work done, so here's the proof.

Let $\displaystyle \epsilon>0$ and define $\displaystyle \delta:=min\{\frac{1}{2}, \epsilon \}.$ When $\displaystyle 0<|x|< \delta$:

$\displaystyle |f(x)|=|x|< \epsilon$ for $\displaystyle x \in \mathbb{Q}$

$\displaystyle |f(x)|=|x^2|<|x|<\epsilon$ for $\displaystyle x \in \mathbb{R}$\$\displaystyle \mathbb{Q}$

My one issue is that the method i've used is extremely similar to a method someone showed me how to use for another question. I also haven't used the properties of rational and irrational numbers as I would have liked.

Is this right?