1
$\begingroup$

I'm working on a hash function and I was wondering if there is a function which can tansform a matrix into a natural being bijective. For example:

$A=\begin{bmatrix} 0&0&1\\ 2&0&1\\ 0&1&2 \end{bmatrix}$

I'm trying to find a way to tranform that matrix into $\Bbb N$ with a bijective function. This function has its domain in all the combinations that can be done with the numbers in $A$ (four $0$'s, three $1$'s and two $2$'s) and the image has to be $\{0,\dots, \#\text{Combinations}\}$.

Thanks in advance.

$\endgroup$
  • $\begingroup$ Let $n$ the FINITE number of possibilities $A_i$ of variations of $A$ according to the specified rules.You can correspond to each $A_i$ an arbitrary natural integer keeping the injectivity so you have $n$ distinct integers. What kind of "Combinations" do you want to choose? $\endgroup$ – Piquito Jun 5 '16 at 15:31
1
$\begingroup$

Note: reading the question carefully, it seems to differ from the title. I have answer the title.


An injective function from $3\times 3$ matrices to $\mathbb{N}$ is $$f(M)=2^{m_{1,1}}3^{m_{1,2}}5^{m_{1,3}}7^{m_{2,1}}11^{m_{2,2}}13^{m_{2,3}}17^{m_{3,1}}19^{m_{3,2}}23^{m_{3,3}}$$ where $m_{i,j}$ denotes the $(i,j)$ entry of $M$.

An explicit bijective function would be rather messy, but it must exist due to the Cantor-Schroder-Bernstein theorem, and the fact that there are plenty of injective funtions going the other way. For example, $$g(a)=\left(\begin{matrix}a&0&0\\0&0&0\\0&0&0\end{matrix}\right)$$

If you really want an explicit bijection, you can try to generalize the construction in this answer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.