0

TL;DR Can a bijective function $f : {\Bbb R}^n \to {\Bbb R} : \vec{x} \mapsto f(\vec{x})$ be constructed in such a way that I can always find the vector $\vec{x}$ if I know $f(\vec{x})$?


I am trying to find a way to store (sparse) matrices on my computer very efficiently. Which is why I am looking for such a function. This function has to be bijective, of course. If such a function exists and can be constructed, then that would mean that any matrix could be stored in a single number.

Let me visualize for everyone. Let $A$ be a $2\times 2$ matrix :

$$ A = \begin{pmatrix} a_1 & a_2 \\ b_1 & b_2 \end{pmatrix} $$

and let $A_i$ denote the $i$th row of $A$. Using the function I am looking for on the rows of $A$, I would get : $$ \left(\begin{matrix} f(A_1) \\ f(A_2) \end{matrix}\right) =\left(\begin{matrix} f(a_1,a_2) \\ f(b_1,b_2) \end{matrix}\right)$$

and applying $f$ once again to the remaining column, I would get the real number

$$ r = f(f(a_1,a_2),f(b_1,b_2))$$

So that would be the gist of how the function works. But to make it usable in my use case, I would need to be able to find the matrix $A$ back from $r$ which is why $f$ must be bijective.

I have not found litterature that talks about this so I was wondering if this community could enlighten me. Does such a function exist? If so, can it be constructed? And if so, how?

Michael
  • 19
  • $f$ cannot be bijective if $n \neq 1$ (because it would imply $n=1$ same dimension) – EDX Dec 30 '20 at 01:53
  • 4
    Such functions exist, but they can't be continuous at the same time. Keep in mind that you still need the same amount of memory, either way, unless you're willing to only save the matrix entries up to fewer decimal places. But then you could also just make a matrix with entries of some smaller data type instead of encoding it with such an ugly function. – Vercassivelaunos Dec 30 '20 at 02:27
  • 5
    @EDX That is incorrect as OP never said $f$ was linear. $\mathbb R^n$ has the same cardinality as $\mathbb R$, though I'm not sure of any particularly tractable bijections. For instance, they cannot be continuous. – paul blart math cop Dec 30 '20 at 02:47
  • Ok thanks to have precise it. – EDX Dec 30 '20 at 08:59
  • 1
    The way to store sparse matrices more efficiently is to minimize the space wasted on $0$ entries. see here for example. Otherwise, no magic exists in the general case to compress $n^2$ numbers to a single smaller number. The distinguishing difference for sparse matrices is that they contain many $0$s, and that's what you need to take advantage of. – dxiv Jul 15 '21 at 02:53
  • 3
    I don't know how Michael intends to store even one real number on a computer. – Gerry Myerson May 21 '25 at 01:52
  • 1
    The whole Library of Congress can be "compressed" into a real number. From the viewpoint of information theory, real numbers are pathological and bits are preferred. – Rodrigo de Azevedo May 21 '25 at 07:50
  • 1
    @GerryMyerson Indeed I had not thought of that when I asked the question back in 2020... – Michael May 22 '25 at 02:15

0 Answers0