Existence of injective and non surjective functions Let $X = [0,1] \times [0,1]$ and $Y = [0,1]$. Is there  an injective and non-surjective $f : X \longrightarrow Y$ function?
 A: Okay, consider the decimal expansion for each coordinate of some $x = (x_1, x_2) \in X$:
$$
x_1 = \sum_{n = 0}^\infty 10^{-n}b_n,\;\;x_2 = \sum_{n = 0}^\infty 10^{-n}d_n.
$$
Let $c_n = \begin{cases}
b_{n/2}\;\;\text{for}\;\;n\;\;\text{even}, \\
c_{(n-1)/2}\;\;\text{for}\;\;n\;\;\text{odd}.
\end{cases}$
Now, we can define $f(x) = \sum_{n = 0}^\infty 10^{-n}c_n$. By interleaving the decimal expansions, you guarantee that if $x \neq z$ for some $z \in X$, then $f(x) \neq f(z)$ since the decimal expansions differ in at least one place. So this function is injective. This function is not surjective because decimal expansions are not unique; e.g. $0.\bar{9} = 1$. In our definition of the function, we can arbitrarily choose to always use the "simpler" decimal expansion, i.e. $0.5$ rather than $0.4\bar{9}$. But this means that nothing will map to, say $0.4\overline{09}$.
A: For $x\in[0, 1]$, let
$$
x_1.x_2x_3\dots\tag1
$$
denote its unique$^1$ binary representation which is not all $1$s beyond a certain point. For $x,y\in[0, 1]$ define $f(x, y)$ as the number whose ternary representation is
$$
0.x_1y_1x_2y_2x_3y_3\dots.\tag2
$$
Now, if $x\ne x'$ then there exists $k\in\mathbb{N}$ such that $x_k\ne x'_k$. The ternary representations
$$
0.x_1y_1x_2y_2x_3y_3\dots
$$
and
$$
0.x'_1y_1x'_2y_2x'_3y_3\dots
$$
do not contain a $2$ and therefore are not different representations of the same number. Thus, $f(x, y)\ne f(x', y)$. Similarly, if $y\ne y'$ then $f(x, y)\ne f(x, y')$. Also, if $x\ne x'$ and $y\ne y'$ then $f(x, y)\ne f(x', y')$. Hence, $f$ is injective.
Now, $x_k, y_k\in\{0, 1\}$ for every $k\in\mathbb{N}$. Therefore
$$
f(x, y)< 0.11111\dots = \frac13+\frac19+\frac{1}{27}+\dots = \frac12
$$
where $0.11111\dots$ is to be interpreted in ternary.
Therefore, $f$ maps $[0, 1]\times[0, 1]$ to $[0, \frac12)$. We conclude that as a map $f:[0, 1]\times[0, 1]\to[0, 1]$, it is injective and not surjective.


$^1$ Not all numbers have a unique binary representation. However, if a number has multiple binary representations then it has two such representations and one of them consists of all $0$s beyond a certain point and the other consists of all $1$s beyond a certain point. In this case, we choose the representation that consists of all $0$s beyond a certain point.

A: In this post: Examples of bijective map from $\mathbb{R}^3\rightarrow \mathbb{R}$ MJD constructs an injection from $[0,1)^2$ to $[0,1)$ that is not a surjection (in the part evoking Cantor-Schröder-Bernstein mappings). I think you could extend it to your case.
