Operator that returns unique number of binary matrix

Click For Summary
SUMMARY

This discussion centers on the challenge of generating a unique identifier for arbitrary square binary matrices populated with 1s and 0s. Participants propose various methods, including mapping matrix entries to a 9-digit number and utilizing different numeral bases, such as Base-33, to achieve uniqueness. The conversation also touches on the use of Linear Feedback Shift Registers (LFBSR) for compressing binary strings, emphasizing the importance of avoiding collisions in unique number generation. Ultimately, the consensus is that while several methods exist, the choice of representation significantly impacts reliability and efficiency.

PREREQUISITES
  • Understanding of binary matrices and their properties
  • Familiarity with numeral systems, particularly Base-2 and Base-33
  • Knowledge of Linear Feedback Shift Registers (LFBSR) and their applications
  • Concept of Gödel numbering for unique identification
NEXT STEPS
  • Research the implementation of Linear Feedback Shift Registers (LFBSR) for data compression
  • Explore Base-33 numeral system and its applications in encoding
  • Study Gödel numbering and its use in unique matrix representation
  • Investigate methods to prevent collisions in unique number generation for binary matrices
USEFUL FOR

Mathematicians, computer scientists, and software developers interested in unique data representation, binary matrix manipulation, and efficient encoding techniques.

Mayhem
Messages
425
Reaction score
317
If we have an arbitrary square matrix populated randomly with 1s and 0s, is there an operator which will return a unique number for each configuration of 1s and 0s in the matrix?
i.e. an operation on
$$ \begin{pmatrix}
1 &0 &0 \\
1 & 0 & 1\\
0 & 1 & 0
\end{pmatrix} $$

would return something different than

$$ \begin{pmatrix}
1 &0 &0 \\
0 & 1 & 1\\
0 & 0 & 0
\end{pmatrix} $$
or any configuration, an ideally for an arbitrary square matrix.
 
Mathematics news on Phys.org
What do you mean by operator? The set of matrices do not form a vector space, so you can't define a linear operator on them.

You could just map the entries to the digits of a 9-digit number (including leading zeroes).
 
PeroK said:
What do you mean by operator? The set of matrices do not form a vector space, so you can't define a linear operator on them.

You could just map the entries to the digits of a 9-digit number (including leading zeroes).
Function was maybe a better word (the real word, really). So if me get ##M_{B,i}## denote an arbitrary binary matrix of dimensions n x n, then ##f(M_{B,i}) = k## where ##k## is unique for all ##i##.
 
Mayhem said:
Function was maybe a better word (the real word, really). So if me get ##M_{B,i}## denote an arbitrary binary matrix of dimensions n x n, then ##f(M_{B,i}) = k## where ##k## is unique for all ##i##.
Just write the digits out in a given order.
$$ f: \begin{pmatrix}
1 &0 &0 \\
1 & 0 & 1\\
0 & 1 & 0
\end{pmatrix} \rightarrow 100101010$$
 
  • Like
Likes   Reactions: Mayhem
PeroK said:
Just write the digits out in a given order.
$$ f: \begin{pmatrix}
1 &0 &0 \\
1 & 0 & 1\\
0 & 1 & 0
\end{pmatrix} \rightarrow 100101010$$
Yes, I thought of that. and it's good for small matrices, but becomes very tricky when you are dealing with large matrices (think, you'll need n² digits to represent one matrix) and that's not to mention leading zeroes.

So thank you, there is a way. But is there a more elegant way?
 
Actually, I'm stupid. We can just represent the output in a different base than base 2, which would generate a unique number and can be easily converted to give information about the matrix.
My bad, thanks!
 
  • Like
Likes   Reactions: berkeman
Mayhem said:
So thank you, there is a way. But is there a more elegant way?
Mayhem said:
We can just represent the output in a different base than base 2, which would generate a unique number and can be easily converted to give information about the matrix.
That sounds like it should work. We do something similar to compress medium-length binary strings into Base-33 notation, for example.

One other technique I was going to suggest is to use a Linear Feedback Shift Register (LFBSR) to compress the long binary string into a shorter binary string (say 16b or 32b long). This technique is used in communications encoding to generate a Cyclic Redundancy Check (CRC) word that is appended to the communication string and used for error detection purposes. With the CRC technique, though, there is a very small chance that the CRC could be generated by two different communication strings. So if you don't need to limit the length of your "compressed" version of the binary matrix, your idea would be more reliable.

https://en.wikipedia.org/wiki/Linear-feedback_shift_register

https://en.wikipedia.org/wiki/Cyclic_redundancy_check

Base-33 info here: https://en.wikipedia.org/wiki/List_of_numeral_systems#By_type_of_notation
 
berkeman said:
That sounds like it should work. We do something similar to compress medium-length binary strings into Base-33 notation, for example.

One other technique I was going to suggest is to use a Linear Feedback Shift Register (LFBSR) to compress the long binary string into a shorter binary string (say 16b or 32b long). This technique is used in communications encoding to generate a Cyclic Redundancy Check (CRC) word that is appended to the communication string and used for error detection purposes. With the CRC technique, though, there is a very small chance that the CRC could be generated by two different communication strings. So if you don't need to limit the length of your "compressed" version of the binary matrix, your idea would be more reliable.

https://en.wikipedia.org/wiki/Linear-feedback_shift_register

https://en.wikipedia.org/wiki/Cyclic_redundancy_check

Base-33 info here: https://en.wikipedia.org/wiki/List_of_numeral_systems#By_type_of_notation
To be honest, I was just looking for inspiration on cool mathematical ways to program a snake game lol
 
  • Haha
Likes   Reactions: berkeman
PeroK said:
The set of matrices do not form a vector space, so you can't define a linear operator on them.
Unless there's something I'm forgetting, the matrices in this thread do form a vector space, provided that the field is the set {0, 1}, element-wise addition is done modulo 2, and scalar multiplication is also done modulo 2.
 
Last edited:
  • Like
Likes   Reactions: Office_Shredder
  • #10
There are ##2^{n^2}## distinct choices of matrix. So you need to use at least the numbers 1 through ##2^{n^2}## which the binary representation does. Any smaller representation will have collisions
 
  • Like
Likes   Reactions: Mayhem
  • #11
Office_Shredder said:
There are ##2^{n^2}## distinct choices of matrix. So you need to use at least the numbers 1 through ##2^{n^2}## which the binary representation does. Any smaller representation will have collisions
I'll take your word on that. That said, the fact that mapping it to digits and converting to decimal gives a unique number is quite cool!
 
  • #12
Or you could use Gödel numbering: Number the elements in the matrice in a unique way, then form the product \prod_{j=1}^{N}p_{j}^{aj}where pj is the j'th prime and aj is the j'th number in the matrix.
 
  • Wow
Likes   Reactions: PeroK
  • #13
Mayhem said:
I'll take your word on that. That said, the fact that mapping it to digits and converting to decimal gives a unique number is quite cool!
It is a unique number even before mapping it to decimal. The conversion to decimal makes it a numeral.
 
  • #14
jbriggs444 said:
The conversion to decimal makes it a numeral.
I don't believe that a number has to be in decimal form to be a numeral. E.g., 0x12, 18, 100102, and XVIII are all numerals that are different representations of decimal 18.
 
  • #15
Mark44 said:
I don't believe that a number has to be in decimal form to be a numeral. E.g., 0x12, 18, 100102, and XVIII are all numerals that are different representations of decimal 18.
Right. But the value that results from taking the set of bits in the 3 x 3 matrix as a sequence and interpreting them in place value notation is a number. The result of converting that result to a decimal string is a numeral.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
9
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
31
Views
3K