A number system is a series of symbols that are used, according to certain rules , to construct those numbers that are considered valid. Among the different number systems, we find the binary system .
Before moving forward with the definition, we can analyze what the notion refers to. A system is specifically a set of components that interact and are interrelated with each other. Binary , on the other hand, is that which is made up of two components or units.
Use of two digits
The binary system, in this way, uses only two digits or figures : zero ( 0 ) and one ( 1 ). The case is different, for example, with the decimal system , which uses ten digits (from zero to nine), or the hexadecimal system, with its sixteen elements (from zero to nine, and then from "A" to "F"). . Although the decimal system is the best known to everyone, given that it is the first one we are taught in school and the one we use for basic calculations in everyday life, the other two have great importance in different fields, such as computing.
Currently, the popularity of the binary system lies in the fact that it is the one used by computers ( computers or computers, depending on the region). As these devices, internally, operate with two different degrees of voltage, they use the binary system to indicate off , de-energized, "zero volts" or inhibited (represented with 0 ) or on , energized, +5 or +12 volts ( 1 ).
Equivalences between the binary and decimal systems
Although it may seem strange, any number in the decimal system (the most used in everyday life) can be expressed through the binary system. You just have to follow one of the established methods to find the equivalence. There are some special cases for which it is not necessary to resort to any procedure; for example, 0 and 1, which remain the same in both systems.
The most common method is to divide the decimal system quantity by 2 : the resulting integer is divided again by 2 , successively until the dividend is less than the divisor. Once this is done, the remains of each division are ordered from the last remainder to the first.
Thus, if we want to express the number 34 in the binary system, we will do the following:
34 / 2 = 17 (remainder = 0 )
17 / 2 = 8 (remainder = 1 )
8 / 2 = 4 (remainder = 0 )
4 / 2 = 2 (remainder = 0 )
2 / 2 = 1 (remainder = 0 )
1/2 = 0 (remainder = 1 )
another example
In this way, we can determine that the decimal number 34 is equivalent to the binary number 100010 . Another method for converting a decimal number to binary is similar to that used to factor prime numbers , and also consists of performing successive divisions. In this case, the idea is to divide the initial number by 2 and place a 0 if it is even or a 1 if it is odd; Before continuing, if the result of the division is odd, we must subtract 1. And this must be applied to each step, until we reach 1, which always corresponds to a 1 as a binary digit. Finally, you must take all the ones and zeros and arrange them from bottom to top, to form the binary number corresponding to the given decimal.
This method is demonstrated below, also with the decimal number 34:
34/2 = 17 (binary digit: 0, since 34 is even)
* we subtract 1 from 17, since it is odd
16/2 = 8 (binary digit: 1, since 17 is odd)
8/2 = 4 (binary digit: 0)
4/2 = 2 (binary digit: 0)
2/2 = 1 (binary digit: 0)
1/1 = 1 (binary digit: 1)
Finally, we sort from bottom to top, and we obtain the binary number 100010, just like with the previous method.
From binary to decimal system
If, however, we want to convert a number from the binary system to decimal, the possible procedures are somewhat different. The most used method consists of taking each of the digits of the binary number, starting from the right, and multiplying it by 2 raised to the corresponding power, with 0 being the first exponent. Once this is done, all the results must be added to obtain the equivalent decimal number. Let's look at the conversion of 100010 into 34:
0 x 2 0 + 1 x 2 1 + 0 x 2 2 + 0 x 2 3 + 0 x 2 4 + 1 x 2 5 = 34