# Result of topological definition of continuity of a function

i have a question about a result i came across while studying point-set topology in Munkres book about continuity of functions. It says :

$$f : X \rightarrow Y$$ Let $\{A_{\alpha}\}_{\alpha}$ be a collection of subsets of $X$ such that $X=\cup_{\alpha} A_{\alpha}$. Suppose that the restrictions $f|A_{\alpha}$ are continuous for each $\alpha$.

If the collection $\{A_{\alpha}\}_{\alpha}$ is finite and each set $A_{\alpha}$ is closed then $f$ is continuous.

I proved this result and the proof was correct but my problem is i found a counterexample (or at least what i think it is) :

Let $n,m \in \mathbb{Z}$ such that $n>m$ and let $X = [m,n] \subset \mathbb{R}$ and we define the collection $\{A_{k}\}_{k \in \{m,...,n-1\}}$ such that $A_{k} = [k,k+1]$ so $X = \cup_{k=m}^{n-1} A_{k}$.

We define $f : X \rightarrow \mathbb{R}$ by $\forall x \in X$ $f(x) = [x]$. So for each $k \in \{m,...,n-1\}$ $f|A_{k}$ is defined by $\forall x \in A_{k}$ $f|A_{k}(x) = f(x) = [x] = k$.

It's clear that for each $k$ $f|A_{k}$ is continuous, and the collection $\{A_{k}\}_{k \in \{m,...,n-1\}}$ is finite and each $A_{k}$ is closed in $X$ but the function $f$ is not continuous.

I know something is wrong but i don't seem to know what it is.

Thanks :)

$f|_{A_k}$ is not continuous. For example, the map $x \mapsto [x]$ defined on $[0,1]$ is explicitly written as
$$x \mapsto \begin{cases} 0 & x \in [0,1) \\ 1 & x=1 \end{cases}$$ which is not continuous.
• Thank your for your answer. You're right so i have to consider the collection of $[k,k+1)$ :) – M.Azzeddine Jul 2 '17 at 14:18
• so my example is uncorrect because $[k,k+1)$ is not closed in $\mathbb{R}$ – M.Azzeddine Jul 2 '17 at 14:24
There're 5 types of open sets: the empty set, [1,x), (x,y), (y,2] and [1,2] where 1 < x < y < 2. However, $f^{-1}((1.5,2.5))=\{2\}$ which is not an open set, so f is not continuous.