Show $f$ is not differentiable at $x = 0$. 
Define $f(x) =  \begin{cases} 
      x & x\in \mathbb{Q} \\
      0 & x \in \mathbb{R}\setminus\mathbb{Q}
   \end{cases}$
Is $f$ differentiable at $0$? Is $g(x) = xf(x)$ differentiable at $0$?

Is my reasoning correct? Is there a simpler way to prove $f'(0)$ does not exist? I was typing this up because I was stuck on it but I ended up figuring it out so I thought why not answer my own question.
 A: For $h \neq 0$ you have 
$$\frac{f(h)-f(0)}{h-0}=\begin{cases}
1 & \text{for } h \in \mathbb Q\\
0 & \text{for } h \in \mathbb{R}\setminus\mathbb{Q}
\end {cases}$$
So $\lim\limits_{h \to 0} \frac{f(h)-f(0)}{h-0}$ can’t exist as a limit is unique. Hence $f$ is not differentiable at $0$.
$g$ is differentiable at $0$ and $g^\prime(0)=0$ as for all $x \neq 0$
$$\left\vert \frac{g(x)}{x} \right\vert \le \vert x \vert.$$
A: First I was hoping to show that $f$ is not continuous at $0$ but turns out that it is.
Let $\epsilon > 0$ be given. Let $\delta = \epsilon$ and let $x\in \mathbb{R}: 0 < |x - 0| < \delta$.
Then $|f(x)-f(0)| = |f(x)|\leq|x|<\delta =\epsilon.$ So $f$ is continuous at $0$.
Then aiming for a contradiction I assume that $f$ is differentiable at $0$. So there is an $L\in\mathbb{R}$ such that given $\epsilon >0:\exists \delta > 0 : \forall x\in\mathbb{R}:0<|x-0|<\delta$ we have $$\bigg|\frac{f(x)-f(0)}{x-0}-L\bigg|\leq\bigg|\frac{f(x)}{x}\bigg|+|L| \leq1+|L| < \epsilon$$
Since the above holds for every $\epsilon >0$ we must have $f'(0) = -1$.
But then there is an irrational $x$ such that $0<|x|<\delta$ for all $\delta>0$.
So $|\frac{f(x)}{x}| + L = L < \epsilon$. So $L = 0$.
This is a contradiction.
Let $\epsilon >0$ be given, set $\delta = \epsilon$. Let $x\in \mathbb{R}: 0 < |x| < \delta$. Then $$\bigg|\frac{xf(x) - 0f(0)}{x-0}\bigg| = |f(x)| \leq |x| < \delta = \epsilon.$$
This shows $g'(0) = 0$
Edit: For anyone looking this answer is incorrect from when I start the contradiction as pointed out in the comments
A: Suppose $s(h) = (f(h)-f(0))/h$. That is, $s(h)$ is the slope of the secant between $x$ and $x+h$. By definition, $f'(0)$ is the limit as $h$ goes to zero of $s(h)$. If we take a sequence of numbers $a_n$ that go to zero, then the limit of $s(a_n)$ must go to $f'(0)$. If we take $a_n$ to be a sequence of rational numbers, then $s(a_n) = 0$, so $f'(0)$ must be zero. But if we take $a_n$ to be a sequence of irrational numbers, then $s(a_n) = 1$. Since $f'(0)$ can't be both $0$ and $1$, it must not exist.
In general, if there are subsets $A$ and $B$ such that $0$ is a limit point of both $A$ and $B$, and the definition of $f$ over $A$ has a derivative at $0$ that's different from the derivative of $f$ over $B$ at $0$, then $f$ has no derivative.
