Determine if the following function is differentiable at 0 For
$$
f(x) = \begin{cases}
x^2 & \text{if $x\in\mathbb{Q}$,} \\[4px]
x^3 & \text{if $x\notin\mathbb{Q}$}
\end{cases}
$$
What I did was examine each of the limits at $0$ of 
$\displaystyle\lim_{x\to0} \frac{f(x)-f(a)}{x-a}$ for each case but I am not sure 
 A: You need to compute
$$
\lim_{x\to0}\frac{f(x)-f(0)}{x-0}=\lim_{x\to0}\frac{f(x)}{x}
$$
But you can write, for $x\ne0$,
$$
\frac{f(x)}{x}=\begin{cases}
x & \text{if $x\in\mathbb{Q}$}\\[4px]
x^2 & \text{if $x\notin\mathbb{Q}$}
\end{cases}
$$
For $0<|x|<1$, you have $\left|\dfrac{f(x)}{x}\right|\le |x|$. Then…
A: Yes
Consider the rationale sequences $\delta_{k} = \pm 2^{-k}$. The limit on the left equals the limit on the right.
$$
  \lim_{k\to\infty} \frac{f(\pm\delta_{k}) - f(0)}{\mp\delta_{k}} = 0.
$$
Next consider the irrational sequences $\epsilon_{k} = \pm e^{-k}$. Again, the right and left limits converge to the same number as above:
$$
  \lim_{k\to\infty} \frac{f(\pm\epsilon_{k}) - f(0)}{\mp\epsilon_{k}} = 0.
$$
A: By the Sequential Criterion for Limits, we know that $$\lim_{x\to c}f(x)=L$$ if and only if for every sequence $(x_n)$ in the domain of $f$ that converges to $c$ such that $x_n\ne c$ for all $n$, then the sequence $(f(x_n))$ converges to $L$.
Let $(x_n)\in\mathbb{Q}$ such that $x_n\ne0$ for all $n$ and $\lim_{n\to\infty}(x_n)=0$. Then, $$\lim_{n\to\infty}(f(x_n))=f(0)=0^2=0$$
Let $(y_n)\notin\mathbb{Q}$ such that $y_n\ne0$ for all $n$ and $\lim_{n\to\infty}(y_n)=0$. Then, $$\lim_{n\to\infty}(f(y_n))=f(0)=0^2=0$$
Thus, by the Sequential Criterion, $$\lim_{x\to 0}f(x)=0$$
A: Maybe you prefer definition. You must prove that: 
$(\forall \epsilon\gt0)(\exists\delta\gt0) (|x-0|\lt\delta \Rightarrow \frac{|f(x)-f(0)|}{|x-0|}\lt\epsilon$) , that is: 
$(\forall \epsilon\gt0)(\exists\delta\gt0) (|x|\lt\delta \Rightarrow \frac{|f(x)|}{|x|}\lt\epsilon$)
Since we are interested only in small $\epsilon$, let us take  $\epsilon\in\langle0,1\rangle$ arbitrarily. 
$\qquad$ Now define $\delta:= \epsilon^\frac{1}{2} $, obviously $\delta\gt0$ 
$\qquad$ Let us assume $|x|\lt\delta$ , we have two cases:
case 1: $x\in\mathbb Q$
$\qquad$ $\frac{|f(x)|}{|x|}=\frac{|x^2|}{|x|}=|x|\lt\delta=\epsilon^\frac{1}{2}<\epsilon$
case 2: $x\notin\mathbb Q$
$\qquad$ $\frac{|f(x)|}{|x|}=\frac{|x^3|}{|x|}=|x|^2\lt\delta^2=\epsilon^\frac{2}{2}=\epsilon$
In both cases we have shown that:
$|x|\lt\delta \Rightarrow \frac{|f(x)|}{|x|}\lt\epsilon$
$\qquad$ Which was need to be prove.
