Prove this function is pointwise continuous Prove that the function $f\colon(0,1)\cup(1,2)\mapsto\mathbb{R}$ is continuous at all points in its domain.
$$f(x)=
\begin{cases}
x : 0<x<1\\
0 : 1<x<2
\end{cases}$$
The graph of $f$:

 A: Proof 1 (using the $\varepsilon$-$\delta$ definition)
Definition: A function $f\colon A\mapsto\mathbb{R}$ is continuous at a point $c\in A$ iff for all $\varepsilon > 0$, there exists a $\delta > 0$ such that when $x\in A$, $\left|x-c\right|<\delta \implies \left|f(x)-f(c)\right| < \varepsilon$.
Case 1: If $0<c<1$, then $f(c)=c$. Choose $\delta = \min(\varepsilon,1-c)$.
That is, $\delta \le \varepsilon$ and $\delta \le 1-c$.
Now if $|x-c| < \delta \le 1-c$,
\begin{align}
-(1-c) <\:&x-c < 1-c \\
-1 < 2c-1 <\:&x < 1 \\
0 <\:&x < 1 \qquad \text{(since $x>0$)}
\end{align}
Thus $f(x)=x$.
Then $|f(x)-f(c)|=|x-c|<\delta\le\varepsilon$, as desired.
Case 2: If $1<c<2$, then $f(c)=0$. Choose $\delta = c-1$.
Notice $\delta$ does not depend on $\varepsilon$ in this case.
If $|x-c| < \delta = c-1$,
\begin{align}
-(c-1) <\:&x-c < c-1 \\
1 <\:&x < 2c-1 < 3 \\
1 <\:&x < 2 \qquad \text{(since $x<2$)}
\end{align}
Thus $f(x)=0$.
Then $|f(x)-f(c)|=|0-0|=0<\epsilon$, as desired.
q.e.d.
In conclusion, despite the apparent "jump" in the graph, the function is continuous at every point in the domain. (It is everywhere-continuous.) However, this is because the point $1$ is not part of the domain. If the domain of $f$ were $(0,2)$ and $f$ were defined at $x=1$, then it would indeed be discontinuous at $1$.
A: Consider a linear function $ax+b$ in the open interval $(A,B)$.
At $x_0$ in $(A,B)$, for every $\epsilon>0$, take $$\delta=\frac\epsilon{|a|} \min (x_0-A) \min (B-x_0)>0^*.$$
Then if $|x-x_0|<\delta$, $x$ is in the domain and $|(ax+b)-(ax_0+b)|=|a|\ |x-x_0|<\epsilon$.
This settles the continuity question for all $x_0$ in the domain.
$^*$ In case $a=0$, take $\delta=(x_0-A) \min (B-x_0)$.
A: Proof 2 (using the sequences definition)
Definition: A function $f\colon A\mapsto\mathbb{R}$ is continuous at a point $c\in A$ iff for any sequence $\left(x_n\right)$ (satisfying $x_n\in A$ for all $n\in\mathbb{N}$), if $\left(x_n\right)\to c$, then the image sequence $f(x_n)\to f(c)$.
Choose $c\in (0,1)\cup(1,2)$ and any sequence $(x_n)$, where $x_n\in (0,1)\cup(1,2)$.
Assume $\left(x_n\right)\to c$. That is, for all $\delta>0$, there exists an $N\in\mathbb{N}$ such that $n>N \implies |x_n-c|<\delta$. We must show that $f(x_n)\to f(c)$. That is, for all $\varepsilon>0$, there exists an $N\in\mathbb{N}$ such that $n>N \implies |f(x_n)-f(c)|<\varepsilon$.
It is important to understand that we are assuming the sequence $(x_n)$ already has $c$ as its limit. What we need to show is that the image sequence $f(x_n)$ has $f(c)$ as its limit.
Take any $\varepsilon > 0$.
Case 1: If $0<c<1$, then $f(c)=c$. If $(x_n)\to c$, then there exists some $N$ such that if $n>N$ then $|x_n-c|<\min(\varepsilon,1-c)$, or said another way, $|x_n-c|<\varepsilon$ and $|x_n-c|<1-c$. In either case, we have $0<x_n<1$, which means $f(x_n)=x_n$. Now $|f(x_n)-f(c)|=|x_n-c|<\varepsilon$, and we have $f(x_n)\to f(c)$ as desired.
Case 2: If $1<c<2$, then $f(c)=0$. If $(x_n)\to c$, then there exists some $N$ such that $n>N \implies |x_n-c|<c-1$. So we have $1<x_n<2$, which means $f(x_n)=0$. Now $|f(x_n)-f(c)| = |0-0| = 0 < \epsilon$ and we have $f(x_n)\to f(c)$ as desired.
q.e.d.
