Could you please help me the following question from Adam's Calculus?
Let $$ f(x) = \begin{cases} x, & \text{if } x=1, 1/2, 1/3, \ldots \\ x^2, & \text{otherwise.} \end{cases} $$ Is it continuous at $x=0$?
According to the definition of continuity, it's not continuous at $x=1/2, 1/3, 1/4, \ldots$ At $x=0$ it is continuous, but I cannot understand how it is continuous at $x=0$ when the values of $f$ are approaching $0$ at two different rates. I mean, in any interval containing $x=0$ there are points at which the function is discontinuous. Is it enough to rely on the definition of continuity?
Let $\epsilon>0$ be arbitrary. By the Archimedean property there exists a $n\in\mathbb N$ such that $\epsilon>1/n$. Let $\delta=1/n$.
Now, let $|x|<\delta$ be arbitrary. If $x=1/m$ for some $m\in\mathbb N$, then $|f(x)-f(0)|=1/m<1/n<\epsilon$.
Otherwise, $|f(x)-f(0)|=x^2\le |x|<\delta=1/n<\epsilon$.
Thus, $f$ is continuous at $x=0$.