Local Injectivity Given Rank of Jacobian 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!
 A: Let $f$, $p$, and $\tilde{f}$ be continuous maps such that $\tilde{f}=p\circ f$, and let $U$ be the common domain of $f$ and $\tilde{f}$. ($p$ corresponds to the projection $\mathbb{R}^M\to\mathbb{R}^N$ used above to define $\tilde{f}$.) For each open $V\subseteq U$, let $\left.\tilde{f}\right\rvert_V$ and $\left.f\right\rvert_V$ be denote the restrictions of $\tilde{f}$ and $f$ to $V$.
Then $\left.f\right\rvert_V$ is injective whenever $\left.\tilde{f}\right\rvert_V$ is. To see this, let $f(x)=f(y)$ for $x$ and $y$ in $V$. Then $p\circ f(x)=p\circ f(y)$, i.e., $\tilde{f}(x)=\tilde{f}(y)$. But $\tilde{f}$ is injective on $V$, so $x=y$.
Now, suppose $\tilde{f}$ is locally injective. By definition, for each $x\in U$ there is a neighborhood $V\subseteq U$ of $x$ such $\left.\tilde{f}\right\rvert_V$ is injective. On this $V$, $\left.f\right\rvert_V$ is injective by the previous paragraph. Consequently, $f$ is locally injective. 
A: If the Jacobian is full rank the transformation, locally expressed by an affine transformation, is invertible. Note that the Jacobian is evaluated in a point.
In your example for $x=\pi/2$ Jacobian is $[-1 \quad0]$ thus $f(x,y)$ is locally approximated by $$f(\pi/2+h)\approx(0,1)+h\cdot[-1 \quad0]$$
which is injective.
A: Concerning the function $f$ defined by $f(x)=\bigl(\cos(x),\sin(x)\bigr)$, the statement “$f$ is clearly the unit circle” makes no sense, because $f$ is a function from $\mathbb R$ to $\mathbb{R}^2$ and the unit circle is a subset of $\mathbb{R}^2$. And, yes, $f$ is locally injective. Take for instance, $x=\frac\pi2$. Then near $x$ the function $f$ because the first component of $f$ (the cosine function) is injective near $x$.
Also, talking about a “neighborhood $U$ of $(0,1)$, such that $f$ is injective on $U\cap\mathbb R$” makes no sense, because $U$ is a subset of $\mathbb{R}^2$.
