1

How to show that every number between 0 and 1 has a unique binary representation, with infinite digits after the dot?

I can use induction to prove that for any integer $m \geq 1$, there exists $n \in \mathbb N \cup\{0\}$, such that, $$m = \sum_{k=0}^n a_k2^k$$ where $a_k \in\{0,1\}$

This will define which bits in my binary representation are '0' and which are '1'. For example, $9 = 2^3 + 2^0$ so its binary representation is: $1001$.

But, what to do with fractions like: $x=0.635$. How do I calculate the binary representation of this and how do I show it is unique (when using infinite-after-the-dot representationa)?

Thanks

edit: Thank you for your corrections and comments. I corrected: $m \geq 1$, and every fraction $x \in (0,1]$ has a unique binary representation with infinite digits after the dot. So, for example, using basis 10, $1=0.9999999.....$. Also note that my original claim is for every integer $m \geq 1$ So this one is correct I think

Alex
  • 411
user135172
  • 1,139
  • 2
    Same way, greedy algorithm. If the number is $≥\frac 12$, it gets a $1$ in the first "decimal" place. Otherwise a $0$. Then, subtracting that value from your number, you ask if what's left is $≥\frac 14$ and so on. – lulu Dec 18 '24 at 13:25
  • 1
    The statement "for any $m$ there exists an $n$ such that $m = \sum_{k=0}^n 2^k $" is incorrect... – van der Wolf Dec 18 '24 at 13:38
  • 6
    It is also not correct that every number in that range has a unique expression. Just as in base $10$ you have the problem with "decimals" that end with an infinite string of $1's$ or $0's$, for instance $.1\bar 0 = .0\bar 1$ in binary. – lulu Dec 18 '24 at 13:42
  • @lulu is right. The example given compares expressions for $\frac12$. Another notation for repeating digits is common enough to be worth mentioning. In decimal, $\frac{1}{14}=0.0\dot{7}1428\dot{5}$. – J.G. Dec 18 '24 at 13:49
  • Your sum is obviously incorrect. You don't allow for $0's $ in the binary expansion. For instance, $5=2^2+2^0$ can't be written as $\sum_{k=0}^n2^k$ for any $k$. – lulu Dec 18 '24 at 14:19
  • 1
    Please look at https://math.stackexchange.com/questions/409658/can-every-real-number-be-represented-by-a-possibly-infinite-decimal and https://math.stackexchange.com/questions/1424905/uniqueness-of-binary-representation?noredirect=1 and https://math.stackexchange.com/questions/99506/binary-expansion-unique and see if they answer your question. Whether the base is $2$ or $10$ doesn't matter. – Ross Millikan Dec 18 '24 at 14:58
  • You seem to still be missing the point about why the representation is not always unique. The representation $1 = 0.\bar 1_2$ can be considered "unique" because the alternative, $1.\bar 0_2,$ has a non-zero digit to the left of the decimal point. But $0.1\bar 0_2$ and $0.0\bar 1_2,$ previously mentioned, represent the same number and both have zero to the left of the decimal point. So we have to be more careful about what we mean when we say "unique." We might say, for example, that the representation is unique except for a specific set of numbers that have exactly two representations. – David K Dec 18 '24 at 17:20
  • Or we could simply say that the representation must not end with an infinite string of zeros, so $0.\bar1_2$ is an acceptable representation for $1$ and $0.0\bar1_2$ is acceptable for $1/2$ but we do not accept $0.1\bar0_2$ as a representation of $1/2.$ – David K Dec 18 '24 at 17:21
  • In any case, I don't see much use for your sum that adds up to an integer. Most real numbers in $(0,1]$ don't have terminating binary fractions; most don't even have repeating binary fractions, so you really need to look at an infinite number of terms $a_k.$ – David K Dec 18 '24 at 17:23
  • @DavidK I think it would be more intuitive to disallow infinite string of ones rather than zeros. – QuantumWiz Dec 18 '24 at 18:23
  • @QuantumWiz I think that would be more usual, but then we should look at the interval $[0,1)$ rather than $(0,1].$ – David K Dec 19 '24 at 02:02
  • 0 could just be ruled out separately. 1 doesn't look like a problem since the question didn't seem to stipulate that there couldn't be a 1 left of the decimal point (or I guess rather binary point). If that's disallowed, then I guess there's no choice but to go with what you said. – QuantumWiz Dec 19 '24 at 07:25

1 Answers1

2

So to find the binary representation of a number we typically start by finding the highest power of $2$ that is less than the number and subtracting it off. So say, for $9_{10}$ ($9$ in base $10$) we see that $2^3=8$ is the highest power that is less than $9$ so we put a $1$ in the $8$ position. From here we take the remainder when we subtract off the power of two, which is $1$ and the highest power of $2$ to that is less than $1$ is $2^0$ so we add another $1$ in the last position to get $9=1 \cdot 2^3 + 0 \cdot 2^2 + 0 \cdot 2^1 + 1 \cdot 2^0=1001_2$ as the binary representation.

For a fractional number this is exactly the same. So say we're looking at $0.635_{10}$. The highest power of $2$ that is less than this is $2^{-1} = 0.5_{10}$. So this start of the fractional part will begin $0.1_2$ which allows us to write $0.635_{10} = 0.1_2 + 0.135_{10}$. Note the use of mixed radix in this equation. From here we continue to repeat by reducing the size of the decimal part to increase the size of the binary part in the same way that we have been. So $2^{-3} < 0.135_{10}$ which we subtract off to get $0.01_{10} + 0.101_2$, then since $2^{-7}=0.0078125$ we have $0.0021875_{10} + 0.1010001_2$

So you keep doing that and one of two possibilities happens, it terminates when you reach some power of $2$ that perfectly subtracts off the last bit or the pattern begins to repeat, just like it would in base $10$ for a rational number. There was no meaningful difference between the process for a positive integer and a rational number other than to use negative powers of $2$.

CyclotomicField
  • 11,925
  • 1
  • 14
  • 32
  • I assumed that "every number" included irrational numbers. But it is admittedly not clear from the question. – David K Dec 19 '24 at 02:04