I want to find out if there are any function $f$ which takes, lets say two numbers $a$, $b$ and outputs $x$, such that $f^{-1}(x)$ returns $a$ and $b$.

$$f(a,b) = x$$ $$f^{-1}(x) = a,b $$

I think this is not possible as there is information loss, but I want to know whether there are any methods that will approximate this.

  • $\begingroup$ What are $a,b$? Integers? Real numbers? And can $f$ be totally arbitrary? $\endgroup$ – Ben Blum-Smith Dec 21 '17 at 13:08
  • 1
    $\begingroup$ What sort of "numbers"? If just natural numbers, then pick your favorite two primes (like $2,3$) and write $f(a,b)=2^a\times 3^b$ or something like that. $\endgroup$ – lulu Dec 21 '17 at 13:09
  • 1
    $\begingroup$ It strongly depends what kind of number we are talking about. If $a$ and $b$ are real and $x$ is complex, you can have $x=a+\mathrm ib$... $\endgroup$ – Tom-Tom Dec 21 '17 at 13:09
  • 3
    $\begingroup$ If $a,b$ and $x$ are from the same domain, then the answer is "yes", as long as the domain is infinite (but it won't be pretty) You could even take this as a definition of "infinite set". $\endgroup$ – Arthur Dec 21 '17 at 13:12
  • 2
    $\begingroup$ @Perseus14 You can pack triples together as $f(f(x,y),z)$, which is uniquely extracted to $f(x,y), z$, which is itself uniquely extracted to $x,y,z$. Keep going to pack more numbers into the tuple. $\endgroup$ – Patrick Stevens Dec 21 '17 at 13:17

Let me assume you want $a,b,x$ to be (nonnegative) real numbers. One solution is to:

Write decimal expansions of $a,b$, and then let $x$ be the number whose decimal expansion has $a$'s digits in the even powers of 10 and $b$'s digits in the odd powers of 10. (With $b$'s 1's place in the 10's place.) For example:

$a = 2.002\overline{4}$

$b = 337.99575$

$x = 303072.909052745\overline{40}$


Per Arthur's comment, what you want is an injective function from the set of pairs $\mathbb{R}\times\mathbb{R}$ to $\mathbb{R}$ (the set of real numbers). This exists because $\mathbb{R}$ is infinite. In general, if $A$ is an infinite set, there is an injective function from $A\times A$ to $A$.

When Arthur said, "it won't be pretty," he was referring to the fact that it's often not possible to make such a function "well-behaved" in ways we are used to.

For example, the function I just described is highly disconinuous. It fails to be continuous at values of the inputs that have 2 different decimal expansions like $0.399999... = 0.40000...$. It is not possible to give a continuous injective function from $\mathbb{R}\times\mathbb{R}$ to $\mathbb{R}$. (Proof, for those who know some point-set topology: Suppose $f$ were such an injection. Restrict $f$ to the unit disc. As the disc is compact and connected, its image is a compact connected subset of $\mathbb{R}$, i.e. a closed interval. Thus $f$ induces a continuous bijection from a disc to a closed interval. This is impossible because a continuous bijection between compact hausdorff spaces is a homeomorphism, but a disc is not homeomorphic to a line segment.)

Second addendum: This is getting a little afield of the OP, but, since I engaged with Arthur's comments in the first addendum, I should mention that I just looked for a reference to the claim that if $A$ is infinite, there is an injection from $A\times A$ to $A$ (equivalently, that $A\times A$ and $A$ have the same cardinality), and discovered to my surprise that the general statement of this fact requires the axiom of choice, and is actually equivalent to the axiom of choice in ZF! See here and here. (However, in the situation of $A=\mathbb{R}$, there is no need for it, as shown in the totally explicit map $\mathbb{R}^{\geq 0}\times\mathbb{R}^{\geq 0}\rightarrow\mathbb{R}^{\geq 0}$ described above.)

  • $\begingroup$ Woah that's a smart idea. So I assume if I have other numbers like c & d, then I would take the 100's place and 1000's place for c's and d's 1's place? $\endgroup$ – Perseus14 Dec 21 '17 at 13:18
  • $\begingroup$ Yes, as long as you know how many numbers you are starting with, that will work. $\endgroup$ – Ben Blum-Smith Dec 21 '17 at 13:19

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.