Claim this function is contin and diff

Suppose that $\displaystyle f(x)=\left\{\begin{array}{cc}x^2,&\mbox{ if }

x \ is \ irrational \\0, & \mbox{ if } x \in \mathbb {Q} \end{array}\right. $

Is f continuous at 0 and is f differentiable at 0?

Claim: f is continuous at 0.

Given $\displaystyle \epsilon > 0 $, pick $\displaystyle \delta = \sqrt { \epsilon } $, then whenever $\displaystyle |x-0|=|x|< \delta $

Now, $\displaystyle |f(x)-f(0)|=|f(x)| = \left\{\begin{array}{cc}|x^2|,&\mbox{ if }

x \ is \ irrational \\0, & \mbox{ if } x \in \mathbb {Q} \end{array}\right. < x^2 = \delta ^2 = \epsilon $

Q.E.D.

Claim: f is differentiable.

Proof.

Now, if $\displaystyle x_0 \in \mathbb {Q} $, then $\displaystyle \lim _{h \rightarrow 0 } \frac { f(x_0+h)-f(0)}{h}= \lim _{h \rightarrow 0 } \frac {f(h)}{h}=0 $

If $\displaystyle x_0$ is irrational, then $\displaystyle \lim _{h \rightarrow 0 } \frac { f(x_0+h)-f(0)}{h}= \lim _{h \rightarrow 0 } \frac { (x_0+h)^2-0}{h}= \lim _{h \rightarrow 0 } \frac {2x_0^2+2x_0h+h^2}{h} = 0 $

So f is diff.

Q.E.D.

Is this right? Thanks.