I am having a little bit of misunderstanding of the highlighted proof and would appreciate any help if possible. Below is some background/information I use in the highlighted proof.
Let $\varnothing \neq D\subset \mathbb{R}^N$, and $f:D\mapsto \mathbb{R}^M$. We say $f$ is locally injective at $x_0\in D$, if there exists a neighborhood $U$ of $x_0$, such that $f$ is injective on $D\cap U$.
$\mathbf{Lemma \ 1:}$ Let $\varnothing \neq U\subset \mathbb{R}^N$ be open and $f\in C^1(U,\mathbb{R}^N)$, such that for some $x_0\in U$, $\text{det}[J_f(x_0)]\neq0$. Then $f$ is locally injective at $x_0$
$\mathbf{Theorem:}$
Let $\varnothing \neq U\subset \mathbb{R}^N$ be open, and $f\in C^1(U,\mathbb{R}^M)$ with $M\geq N$. Then if $\text{rank}(J_f(x))=N$ for all $x\in U$, then $f$ is locally injective for all $x\in U$.
$\mathbf{Proof:}$ Let $f:=(f_1,...,f_N,...,f_M)$, then
rank $J_f(x)=$ rank$\begin{bmatrix} \frac {\partial f_1}{\partial x_1} & \cdots & \frac {\partial f_1}{\partial x_N} \\ \vdots & & \vdots \\ \frac {\partial f_M}{\partial x_1} & \cdots & \frac {\partial f_M}{\partial x_N} \end{bmatrix} $= rank$\begin{bmatrix} \frac {\partial f_1}{\partial x_1} & \cdots & \frac {\partial f_1}{\partial x_N} \\ \vdots & & \vdots \\ \frac {\partial f_N}{\partial x_1} & \cdots & \frac {\partial f_N}{\partial x_N} \end{bmatrix}=N$
Let $\tilde{f}:=(f_1,...,f_N)$, then rank $J_{\tilde{f}}(x)=N$ for all $x\in U$.
By $\mathbf{lemma \ 1}$, clearly $\tilde{f}$ is locally injective for all $x\in U\implies f$ is locally injective for all $x\in U$.
My question is, why does $\tilde{f}$ being locally injective imply $f$ is locally injective for all $x\in U$?
Secondly, the textbook gives an example of the application of this theorem.
Consider $f:\mathbb{R}\rightarrow \mathbb{R}^2, \ \ \ x\mapsto (cos(x),sin(x))$.
Clearly $J_f(x)=\begin{bmatrix} -sin(x) \\ cos(x) \end{bmatrix}\implies \text{rank} \ J_f(x)=1 \ \forall x\in \mathbb{R}$. Thus $f$ is locally injective for all $x\in \mathbb{R}$. (by the above theorem).
However, I don't agree with the above statement. $f$ is clearly the unit circle, and if I choose the point $x=\frac {\pi}{2}$, there doesn't exist any neighborhood $U$ of $(0,1)$, such that $f$ is injective on $U\cap \mathbb{R}$.
Could someone please explain? My apologies if this seems a bit elementary. Thanks for the help in advance!