$f(x) = \begin{cases} x & x \in \mathbb{Q} \\ -x & x \in \mathbb{I} \end{cases}$
I wish to show that $f(x)$ is continuous at only $0$. Thus, if it is differentiable, it would only be differentiable at $0$.
$\textbf{My attempt (Continuity)}$
$f(x)$ only continuous at $0$
Choose $\delta = \epsilon$
Then, if $|x-0| = |x| < \delta$
$|f(x) - f(0)| = |f(x)| \leq |x| < \delta = \epsilon$
$f(x)$ discontinuous anywhere else ($c \neq 0)$
Choose $\delta =$ (need help)
Then, if $|x-c| < \delta$
$|f(x) - f(c)| \leq |x+c|$
Unsure of where to go from here.
$\textbf{Differentiable}$
$f(x)$ could only possibly be differentiable at $0$ since it was continuous at $0$
$$\lim_{x\to c} \frac{f(x) - f(c)}{x - c}$$
Set $c = 0$
$$\lim_{x\to 0} \frac{f(x) - f(0)}{x - 0} = \lim_{x\to 0} \frac{f(x)}{x}$$
$$ = f(x) = \begin{cases} 1 & x \in \mathbb{Q} \\ -1 & x \in \mathbb{I} \end{cases}$$
Some how?
Any help would be appreciated.
$f(x)$ is continuous at $0.$
Choose $\delta = \epsilon$
$|x|<\delta \implies |f(x)|<\epsilon$
$f(x)$ is not continuous away from $0.$
for any $a\ne 0$ Choose $\epsilon < a$
$\forall \delta>0, \exists x$ such that $|x-a|<\delta$ and $|f(x)-f(a)|>\epsilon$
Your proof for the non-differentaiability of $f(x)$ at $0$ is on the mark.
Since $\frac {f(x) - f(0)}{x-0}$ can equal $1$ or $-1$ in a neighborhood of 0, the limit does not exist.
If you want to be more formal.
Proof by contradiction: Suppose $\lim_\limits{x\to 0} \frac {f(x)}{x} = L$
Let $\epsilon < 1$
$\forall \epsilon>0,\exists \delta>0$ such that $|x|<\delta \implies|\frac {f(x)}{x}-L|<\epsilon$
$x\in \mathbb Q \implies \frac {f(x)}{x} = 1\\ x\in \mathbb I \implies \frac {f(x)}{x} = -1$
$|1-L|<1$ and $|-1-L|<1?$
$|1-L|<1 \implies L\in (0,2)\\ |-1-L|<1\implies L\in (-2,0)$
The intervals are disjoint, giving us a contradiction.