Let $X=\Bbb N\times\{0,1\}$, and let $\preceq$ be the lexicographic order on $X$: $\langle m,i\rangle\preceq\langle n,j\rangle$ iff $m<n$, or $m=n$ and $i\le j$. Thus, $\langle 0,0\rangle$ is the $\preceq$-least element of $X$, and the next few in increasing order are $\langle 0,1\rangle,\langle 1,0\rangle,\langle 1,1\rangle$, and $\langle 2,0\rangle$. It’s a straightforward exercise to verify that this is a well-order and that
$$f:X\to\Bbb N:\langle n,i\rangle\mapsto 2n+i$$
is an order-isomorphism whose inverse is
$$f^{-1}:\Bbb N\to X:n\mapsto\left\langle\left\lfloor\frac{n}2\right\rfloor,n-2\left\lfloor\frac{n}2\right\rfloor\right\rangle\;.$$
I saw this answer in s.e and im having trouble understanding why this function is an order isomorphism since the inverse function does not work for example.
$(2,1)$ is mapped to $5$ but $5$ is mapped to $(2,6)$ meaning it is not an inverse function and hence the function cannot be an isomorphism am I just not understanding the function or is it indeed not an inverse?.
Thanks in advance.