# Binary Numbers

**Keywords:** binary numbers

Today, we are going to talk about numbers, especially binary numbers. We had already had abilities to use numbers even when we were babies; for example, you must had asked your mother for ‘an’ apple , ‘a’ toy or ‘one’ dollar. These words are so normal for everyone that, for a long time, we have never recognize that there is an important and essential mathematic concept behind it. That is number. Sure enough, though we all have known $1,2,3,\dots$ very well, what is a number might never have been thought by us untill we were asked to do that. For we will learn to use binary numbers and decimal numbers simultaneously, during which the concept of number is a key point, we have to go closer to the defination of the number.

From now on, assuming that we know nothing about numbers is necessary to make everything clear, during which even $1,2,3,\dots$ are unknown until they are defined formally and precisely.

When we get something from others, no mater what they are, what we concern most is always how many they are. This question is about quantity, so the figure below can be an answer to our question :

Three rows represent three different things:

□. The row I contains $\{\text{apple}\}$

○. The row II contains $\{\text{apple},\text{apple}\}$

△. The row III contains $\{\text{apple},\text{apple},\text{apple}\}$

To answer the question of how many they are, I have drawn three symbles on the right-hand side of the equations, each of which represent the quantity of things at its row. (However here is a little bug that we have not defined what the equeling is ) So:

□. The quantity, how many the apples are, in row I is **rectangular**

○. The quantity, how many the apples are, in row II is **circle**

△. The quantity, how many the apples are, in row III row is **triangle**

Aha, till now, we have already have defined some numbers, and they are $\{□,○,△\}$ . Although we have only define △ numbers (the quantity of $\{□,○,△\}$ is △), but we can use this strategy to define as many numbers as you want. So the light might have already brought you that *the number is just a symbol which gives a certain and unique answer to the quesetion – how many things there are* . Even though we surely have abilities and times to define so many symbles that they can answer whatever the quantity question is, it’s too monotonous and inefficient. According this a new idea came to us, how about use just * a few symbols* , by whom we can create infinite different combinations. This simple idea gives us sufficient tools and materials to build the conceret and elegant number bulding. Then some great forefathers created $\{0,1,2,3,\dots\}$. However, I have to admit these symbols are more convenient than my ‘gurgles’(The name of baby play, whose heroes are rectangular, circle, and ect in ‘Good luck Charlie’).

How many symbols we are going to use decides what the number system is. If we use just 2 symbols we get a binary number system, and if we use ten symbols we get a decimal number system.

## Binary numbers

Just as most of human just know decimal numbers, computers only know binary ones( or $2^n$nary ones, like octonary and hexadecimal system) because of their hardware framwork. Binary numbers are expressed as

$\dots b_2b_1b_0.b_{-1}b_{-2}\dots \text{ where } b_i\in\{0,1\}$

This may be wired for you if you are not a computer science students. But our all computations on computers, smart phones and e.t.c. are based on binary. Each binary digit is called a bit.

Let’s look some examples, the decimal number 4 can be expressed as $(100.)_2$ in base 2, we can write this in the form:

$(4)_{10}=(100)_2$

Translating binary code to the decimal one for us to read is relatively easier than the contrary:

$n_{10}=\dots b_2 2^{2}+b_1 2^{1}+b_0 2^{0}+b_{-1} 2^{-1}+b_{-2} 2^{-2}+\dots \tag{1}$

The $2^{n}$ here must be calculated in the decimal system, where $2^2=4, 2^10=1024,\dots$

For example, convert $(10010)_2$ to the decimal number:

$1\times 2^4 + 0\times 2^3 + 0\times 2^2 + 1\times 2^1 + 0\times 2^0=16_{10}+0_{10}+0_{10}+2_{10}+0_{10}=18_{10}$

The algorithm we wish to discuss next is about how to convert decimal numbers to binary numbers.

## Decimal to Binary

We divid the decimal numbers into two parts, integer and fractional parts. For example,

$(50.7)_{10}=(50.)_{10}+(0.7)_{10}$

### Integer Part

We devide the integer part by $2$ successively until the result is 0 and recording the remainders which will always be $0$ or $1$, like $5\div 2 =2 \dots 1$ where the 2 is the result and 1 is the remainder. The successive recorded numbers are starting at the decimal point(radix may be more accurate)

$\begin{aligned} 53\div 2&=26 &\dots 1\\ 26\div 2&=13 &\dots 0\\ 13\div 2&=6 &\dots 1\\ 6\div 2&=3 &\dots 0\\ 3\div 2&=1 &\dots 1\\ 1\div 2&=0 &\dots 1\\ \end{aligned}$

Then the $53.$ in base 10 is equal to $110101.$ in base 2. To check this result, we can ues formular (1) easily:

$1\times 2^5+1\times 2^4+0\times 2^3+1\times 2^2+0\times 2^1+1\times 2^0=53$

### Fractional Part

Convert $(0.7)_{10}$ to binary by reversing the preceding steps. Multiply by 2 successively and record the integer parts, and move away the integer parts and then go on:

$\begin{aligned} 0.7\times 2&=0.4 &+ 1\\ 0.4\times 2&=0.8 &+ 0\\ 0.8\times 2&=0.6 &+ 1\\ 0.6\times 2&=0.2 &+ 1\\ 0.2\times 2&=0.4 &+ 0\\ 0.4\times 2&=0.8 &+ 0\\ 0.8\times 2&=0.6 &+ 1\\ 0.6\times 2&=0.2 &+ 1\\ 0.2\times 2&=0.4 &+ 0\\ &\vdots& \end{aligned}$

We can notice that the part which is start from $0.4\times 2$ to $0.2\times 2$ will repeat over and over, so the result must be repeat infinitely. So we write it as:

$(0.7)_{10}=(0.1\overline{0110})_{2}$

For this we conclude that

$53.7_{10}=(110101.1\overline{0110})_{2}$

## Binary to Decimal

Formular 1 has told us how to convert binary nunber into the number in base 10, then we use some little tricks to make the fractional part more concise.

$(.1011)_2=1\times(\frac{1}{2})^1+0\times(\frac{1}{2})^2+1\times(\frac{1}{2})^3+1\times(\frac{1}{2})^4=(\frac{11}{16})_{10}$

There is no doubt in this proccess, but how should the infinite ones be calculated? Suppose $x=(0.\overline{1011})_2$ let’s convert it to decimal:

$\begin{aligned} x&=0.\overline{1011}\\ 2^4x &=1011. \overline{1011}\\ 2^4x -x&=1011. \overline{1011}-0.\overline{1011}\\ (16-1)_{10}x&=1011_{2}=11_{10}\\ x&=(\frac{11}{15})_{10} \end{aligned}$

Another more complicated example, what is $x=(0.10\overline{101})_2$ in decimal form:

first

$z=2^2x=(10.\overline{101})_2$

for

$(10)_2=2_{10}$

then we set:

$y_{10}=(z-2)_{10}=(.\overline{101})_2$

use the same method as last example we can get :

$(2^3-1)y_{10}=101_2=5_{10}\\ y_{10}=(\frac{5}{7})_{10}$

then we can get z from the third formular :

$z=y_{10}+2=\frac{19}{7}$

then we can get x from the first formular :

$x=z_{10}\div 4=\frac{19}{28}$

## Conclusion

This post we have learned something about binary numbers, how to convert between decimal and binary is the central topic.

## Reference

- Sauer, T., Columbus, B., New, I., San, Y., Upper, F., River, S., … Tokyo, T. (n.d.). Numerical Analysis. Retrieved from http://www.pearsoned.com/legal/permissions.htm.