can every real number be represented by binary floating point number?

668 Views Asked by At

I've got to prove that every real x, greater than 0, can be represented as $$x = n*2^c$$ where $$n\in <0,5;1)$$ $$n=\frac12\sum_{i=2}^\infty d_{i}2^{-i}$$ $$c \in \Bbb Z,\ \ d_{-2,-3,...}=\{0,1\}$$ What I got is that if we take (1) and divide it by 2^(n+1) we will get (2). It is now clear that I have to show that n can be every real number between <0,5; 1). Well, it is logical, that if we divide by 2 multiple times we have greater "resolution" every time so that sum (up to infinity) can be every real number in assumed interval. But I have no clue how to write it in mathematical way. Any help would be appreciated. $$2^c\le x<2^{c+1}\ (1)$$ $$\frac12\le \frac{x}{2^{c+1}} < 1(2)$$

2

There are 2 best solutions below

0
On

For a real postive $x > 0$ there is $-\infty < c < +\infty$ such that $2^{c-1} \lt x \le 2^{c}$
Why is this true ? Because the sequence of half open intervals $ ((2^{c-1}, 2^{c}])_{c = -\infty, \infty}$ partitions the postitve real line $x > 0$. (To be more precise, the sequences $ ((2^{c-1}, 2^{c}])_{c = 1, \infty}$ and $ ((2^{-c}, 2^{1-c}])_{c = 1, \infty}$)

Then $x = 2^c * (x/2^c)$. Put $y = (x/2^c)$ so $x = 2^c * y$ and $1/2 \lt y \le 1$, i.e. $2^{-1}\lt y \le 2^0$

Now we just need to show that any $1/2 \lt y \le 1$ has a binary representation. Do this by recursively constructing a sequence of binary representations that converges to $y$.....
Put $r_1 = y$ then $2^{-1}\lt r_1 \le 2^0$
If $r_n \gt 2^{-n} $ put $b_n = 1$ else $b_n = 0$ and put $r_{n+1} = r_{n} - 2^{-n}b_n$
And (by induction) $y = (\Sigma _{i = 1, n} 2^{-i} b_i) + r_{n+1}$

Claim that for all $n$, $ 0 \le r_{n} \le 2^{1-n}$
Certainly true for n = 1.
If true for n,
then $r_n > 2^{-n} $ (and $r_{n} \le 2^{1-n}) \implies 0 \le r_{n+1} \le 2^{-n}$
while $r_n \le 2^{-n} \implies r_{n+1} = r_n \le 2^{-n}$.
So, by induction the claim is true for all n.

Then the sequence $((s_n = \Sigma _{i = 1, n} 2^{-i} b_i))_{n = 1, \infty}$ converges to $y$ (since for any $\epsilon > 0$ there is N with $r_N \le 2^{1-N} \lt \epsilon$)
I.e. $y = \Sigma _{i = 1, \infty} 2^{-i} b_i$ and then $0.b_1b_2....$ is a binary representation for y.

Note: this construction always generates an infinite sequence. If $y= 0$ then an infinite sequence of zeroes, but otherwise any remainder which is exactly $2^{-n}$ will be represented as $\Sigma _{i = n+ 1, \infty}2^{-n}$. This is the same as saying $1 = 0.9999999...$.
I think a better binary representation is achieved by changing the starting inequalities so that for $x > 0$ there is $-\infty < c < +\infty$ such that $2^{c-1} \le x \lt 2^{c}$ .
Or is this what you neant by $n\in <0,5;1)$ ? If so you can make the necessary adjustments.

0
On

Let $\frac12 \leq n < 1$ and let $c$ be any integer. Then since $2^c > 0,$

$$ \tfrac12 \times 2^c \leq n \times 2^c < 1 \times 2^c,$$ that is, $$ 2^{c-1} \leq n \times 2^c < 2^c.$$

(This is also true for any real number $c,$ but since you want $c$ to be an integer, I've added the assumption that it is an integer.)

So if you want to set $x = n\times 2^c,$ where $c$ is an integer (therefore also a real number!) and $\frac12 \leq n < 1,$ then you want

$$ 2^{c-1} \leq x < 2^c.$$

The mathematical statement you want is, "For any positive real number $x,$ there exists an integer $c$ such that $ 2^{c-1} \leq x < 2^c.$"


If you need a proof of that fact, you could proceed like this, provided that you are allowed to use the fact that every set of integers bounded above by a real number has a greatest member.

For the case $x \geq 1,$ let $A = \{k \in \mathbb N \mid 2^k \leq x\}$ (that is, $A$ is the set of integers $k$ such that $2^k \leq x$). The set $A$ is a set of integers, and it is non-empty because $0$ is a member (because $2^0=1\leq x$), therefore it has a greatest member.

Let $m$ be the greatest member of $A.$ Then $m+1 \not\in A,$ so $x < 2^{m+1},$ but since $m\in A,$ $2^m \leq x.$ That is, $2^m \leq x < 2^{m+1}.$ Now let $c = m +1.$ then $$ 2^{c-1} \leq x < 2^c,$$ proving the fact for the case $x \geq 1.$

For $x < 1,$ then $\frac1x \geq 1,$ and therefore (by the case we have just proved) there exists an integer $d$ such that $ 2^{d-1} \leq \frac1x < 2^d.$ Therefore $$ 2^{-d} < x \leq 2^{1-d} .$$ If $x =2^{1-d}$ exactly, then set $c = 2 - d$ (hence $2^{c-1} = 2^{1-d} = x$); otherwise set $c = 1 - d.$ Then $$ 2^{c-1} \leq x < 2^c,$$ proving the fact for the case $x < 1.$