Is $f(x)=\begin{cases}x \ \text{if } x\in [0,1),\\3-x \ \text {if} \ x \in [1,2]\end{cases}$ continuous from $[0,2]$ to $[0,2]$? Yes/No Consider the  map

$f : [0,2] \rightarrow  [0,2] $ defined by  $ f(x)  = \begin{cases} x \ \text{if 
 x} \in [0,1),\\3-x \ \text   {if} \ x \in [1,2]\end{cases}$.

Is $f$  is continuous?
My attempt: Yes
Only one - sided limits can be taken   at  $x=0,x=2$  and for the other points, the double sided limit can be argued.
By this  we can say  that $f$ is continuous
Is it true?

Notice that:
$$\lim_{x \to 1^-} f(x) = \lim_{x \to 1^-} x = 1,$$
and
$$\lim_{x \to 1^+} f(x) = \lim_{x \to 1^+} 3-x = 2.$$
Since
$$\lim_{x \to 1^-} f(x) \neq \lim_{x \to 1^+} f(x),$$
we can conclude that this function is not continuous $[0, 2]$.
