Injective map from $\{0,1\}^{n}$ to $\mathbb{N}$

299 Views Asked by At

Please help me to construct an example of an injective map $F: \{0,1\}^{n} \to \mathbb{N}$ such that $$ |F(x_1,\ldots,x_n)-F(y_1,\ldots,y_n)| = \sum_{k=1}^{n} |x_k-y_k| $$ for all $x=(x_1,\ldots,x_n), \quad y=(y_1,\ldots,y_n) \quad (x_i, y_i =0 \,\,\text{or}\,\, 1)$.

Of course, there are $2^n$ such tuples and every such an $n$-tuple corresponds to a natural number.

1

There are 1 best solutions below

4
On

This is impossible. Consider $x$ to be a $n$-tuple with $n-1$ zeroes and a single $1$ in the $k$th position and $y = (0, \dots, 0)$.

Then:

$$|F(x_1, \dots, x_n) - F(0, \dots, 0)| = 1$$

This means that there are only two possible values for $F(x_1, \dots, x_n)$, namely $F(0, \dots, 0) \pm 1$.

But there are $n$ possible $x$ with the conditions above, meaning for $n > 2$ the mapping can't be injective.