Prove that the function : $f(x) = x$ when $x$ is rational and $f(x) = 1 - x$ when $x$ is irrational is continuous at $x = \frac{1}{2}$.
To prove the continuity it is necessary to prove that for every $\epsilon$ there exists a $\delta$ such that $|f(x) - f(\frac{1}{2})| < \epsilon$ whenever $|x -c| < \delta$ $- (1).$
Now if we choose $a \in (\frac{1}{2} - \delta, \frac{1}{2} + \delta)$ and also $a$ is rational and choose $\epsilon < |a - \frac{1}{2}|$ then condition in $(1)$ is not satisfied. How to move from here?
You can show this by using the $\varepsilon-\delta$ definition of continuity, by first noticing that $f(\frac{1}{2}) = \frac{1}{2}$ and then looking at $x \in \mathbb{\mathbb{Q}}$ and $x \in \mathbb{\mathbb{R} \backslash \mathbb{Q}}$ seperately.