Q:

Suppose that $f:[0,1]\to M$ is locally injective. Show that $f$ is piecewise injective.

Consider a metric space $M$ and $f: [0,1]\to M$ locally injective, i.e. for each $x\in M$ there is a neighborhood on which $f$ is injective. Show that $f$ is piecewise injective, i.e. there exists $0= t_0 < t_1 < \dots < t_N = 1$ such that $f$ is injective on $[t_{n-1},t_n]$ for each $n\in\{1,\dots, N\}$.

My attempt:
Given is that $\forall x\in M: \exists \delta_x>0: \forall y,z\in ]x-\delta_x,x+\delta_x[: f(y)=f(z)\Rightarrow y=z$. Then $$ [0,1]\subseteq\bigcup_{x\in [0,1]} ]x-\delta_x,x+\delta_x[ \quad \Rightarrow \quad [0,1]\subseteq\,\, ]x_1-\delta_{x_1},x_1+\delta_{x_1}[\,\, \cup\dots\cup \,\, ]x_N-\delta_{x_N},x_N+\delta_{x_N}[,$$ for some $x_1,\dots,x_N\in [0,1]$. Assuming w.l.o.g. that $x_1< \dots < x_N$, then $0\in \,\,]x_1-\delta_{x_1},x_1+\delta_{x_1}[\,\, =: B(x_1,\delta_{x_1})$ and $1\in B(x_N,\delta_{x_N})$ (I'm not too sure about this). I believe that all the open intervals that cover $[0,1]$ will have to overlap (otherwise, i.e. no overlapping intervals or at least two intervals that don't overlap, we won't cover whole $[0,1]$). By 'all' I mean that for each interval $B(x_i,\delta_{x_i})$ we can find $B(x_j,\delta_{x_j})$ such that $\exists t_{ij}\in B(x_i,\delta_{x_i})\cap B(x_j,\delta_{x_j})$. W.l.o.g. we can assume that $B(x_i, \delta_{x_i})$ intersects $B(x_{i+1}, \delta_{x_{i+1}})$ for $i=1,\dots, N-1$. Then we can select $t_{i-1}\in B(x_i,\delta_{x_i}), i=1,\dots, N$.
Is this somewhat correct?

A:

What you’ve done is basically correct; it just needs a bit more detail in the construction of the partition.
You have a finite set of intervals $(x_1,y_1),(x_2,y_2),\ldots,(x_n,y_n)$ that cover $[0,1]$ and are such that $0\in(x_1,y_1)$, and $1\in(x_n,y_n)$. You can further assume that none of these intervals is a subset of another: if one were, you could simply throw it away.
Let $(u_1,v_1)=(x_1,y_1)$. If $v_1>1$, then $[0,1]\subseteq(u_1,v_1)=(x_1,y_1)$, and $f$ in injective. Otherwise, there is an interval $(x_k,y_k)$ that contains $v_1$, and we let $(u_2,v_2)=(x_k,y_k)$. Proceeding in this fashion, in a finite number of steps we reduce the open cover to a family $\{(u_1,v_1),\ldots,(u_m,v_m)\}$ such that $0\in(u_1,v_1)$, $1\in (u_m,v_m)$, and $v_k\in(u_{k+1},v_{k+1})$ for $k=1,\ldots,m-1$.
Now you have a cover of $[0,1]$ by open intervals that overlap in a fairly predictable way, and you can define the desired partition: let $t_0=0$, $t_k\in(u_{k+1},v_k)$ for $k=1,\ldots,m-1$, and $t_m=1$. Then $[t_{k-1},t_k]\subseteq(u_k,v_k)$ for $k=1,\ldots,m$, so $f$ is injective on each segment of the partition.

