Let $f$: $[0,1] \to [0,1]$ be defined by
$$f(t):=\begin{cases} t& \text{if}\; x \in \Bbb{Q}\\1-t &\text{otherwise}\end{cases}$$ I have to show that $f$ is only continuous at $t=$$\frac12$
I know the Def: $f$ is said to be continuou at $x$ if for every $\epsilon>0$, exists a $\delta$ such that $|f(x)-f(y)|<\epsilon$ for every $y$ belonging to $(x-\delta, x+\delta)$
and Def: $f$ is said to be continuous at $x$ if $\lim_{n \to\infty}f(a_n)=f(x)$ for every $\lim_{n \to\infty}a_n=x$
How can I show this?
Verify that for every $t\in[0,1]$ you have $$ \frac12 - \left|t-\frac12\right| \leq f(t) \leq \frac12 + \left|t-\frac12\right| . $$ The LHS and RHS are both continuous at $\frac12$ and have the same limit.
Alternatively, from the given inequality you deduce also $$ \left|f(t)-\frac12\right| \leq \left|t-\frac12\right|, $$ which implies that $\lim_{t\to1/2} f(t)=1/2$.