Binary expansion of rational numbers

1.8k Views Asked by At

It is well known that the decimal representation of a rational number is either finite or it has a pattern of repetition. I wonder if this property is still true when you "pass" to the binary representation, i.e., is this a property of the representation?

2

There are 2 best solutions below

0
On BEST ANSWER

It's true in every base. This is essentially due to a theorem of Euler, the relevant consequence of which is that for any integer $n$ and any $a$ relatively prime to $n$, there exists an $m$ so that the remainder of $a^m$ divided by $n$ is $1$. That means that, for a given base $b$ and a rational number $c/n$ with $n$ relatively prime to $b$, we can always rewrite it as $\frac{d}{b^m - 1}$ for some $m$.

For a given $b$ and $m$, consider the number $r = (0.\overline{00\ldots 01})_b$, where the repetition has length $m$. Then $b^mr = (1.\overline{00\ldots 01})_b = 1 + r$, so $(b^m - 1)r = 1$, so $r = \frac{1}{b^m-1}$. In particular, $\frac{1}{b^m - 1}$ has a repeating representation in base $b$, and so every multiple of it does. As a consequence of this and the above, $c/n$ has a repeating base-$b$ representation whenever $b$ and $n$ are relatively prime.

The case when $n$ is a divisor of $b$ is simple; if $b = kn$, then $\frac{1}{n} = \frac{k}{b} = (0.k)_b$. If $n$ is not a divisor of $b$ but is not relatively prime to $b$ (so $n = km$ where $k$ divides $b$ but $m$ is relatively prime to $b$) then we can expand $\frac{1}{n}$ as a sum of multiples of $\frac{1}{k}$ and $\frac{1}{m}$.

To summarize: $\frac{c}{n}$ has a repeating base-$b$ expansion given any choice of integers $c$, $n$, and $b$.

4
On

In a given base $b$ a rational number has a finite representation if and only if the prime factors of the reduced denominator each divide the base $b$. So, in binary, the only rational numbers with finite representations are those of the form $\frac{a}{2^n}$ for $a,n\in\mathbb{Z}$. Any other numbers have infinite binary representations. For example, $$(0.1)_{10}=(0.0\overline{0011})_2$$