top of page
  • Writer's picturePhysics Core

Binary numeral system


The binary system is often treated like an alien from a different world. To some extent, it's true, as it never was a part of our lives. We count in 10s, and many don't even realise we can do it differently. But artificial intelligence counts in 2s. And if the sci-fi prediction comes true and machines rise against humans, knowledge of their language might come in handy. Whatever we think of the doomsday scenario, computers are here to stay. So, it makes sense to learn more about their way of thinking. We'll start with our decimal numeral system. If you understand how it works, the transition to binary will be easy. These two systems have much more in common than it looks.




Decimal numeral system

Our decimal is a base-10, positional system. Base-10 means it uses ten digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9), and positional means it arranges them into groups with increasing values. Take number 8547. The rightmost position contains the 1s, its value is 7x1=7. The following position contains the 10s, its value is 4x10=40. The third position contains the 100s, its value is 5x100=500. The leftmost position contains the 1000s, its value is 8x10000=8000. In the base-10 positional system, the value of each position increases by a factor of 10 from right to left.


The number 8547 is already split into positions. But suppose we have a big pile of peas that we must count and write the result for future reference. How do we do it? We label small bags "10" and put ten peas in each. We're left with seven peas, 7<10, and we write the remainder 7 in the rightmost position of the 1s (Fig 1). Next, we label bigger bags "10x10=100" and put ten bags labelled "10" in each. We're left with four bags labelled "10", 40<100, and we write the remainder 4 in the position of the 10s. We continue increasing the value of the bags 10 times until we're left with the final eight bags labelled "10x10x10=1000". There is nothing to pass on to the higher position of the "10x10x10x10=10,000". We write the remainder 8 in the leftmost position of the 1000s. The count is over.


So what we did was we kept dividing the number of peas by 10 until we were left with the number of bags 8<10:



We write the resulting remainders right to left, starting with the top 7 and finishing with the bottom 8. The number of peas in the pile expressed in the decimal system is 8547.


Using base 10, we can express the value of the number 8547 as:


8547 = 7×10^0 + 4×10^1 + 5×10^2 + 8×10^3 = 7×1 + 4×10 + 5×100 + 8 ×1000




Fig 1 Dividing the number 8547 into the decimal positions




Binary numeral system

The binary is a base-2, positional system. It uses only two digits, 0 and 1, but follows the same positional principle.  Let's assume we have 17 peas. We must count them and write the result using only two digits. We label small bags "2" and put two peas in each. We're left with one pea and write the remainder 1 in the rightmost position (Fig 2). Next, we take bigger bags, label them "2x2", and put two bags labelled "2" in each. We're left with zero peas and write the remainder 0 in the following position. In the base-2 system, the value of each position increases by a factor of 2 from right to left. Continuing to divide 17 by 2, we get:



We write the result the same way we did in the decimal system. The top remainder (in blue) goes into the lowest rightmost position, and the bottom remainder 1 into the highest leftmost position. The number 17 in binary is 10001. Note the way of displaying the base, also called the radix, in Fig 2.




Fig 2 Dividing the number 17 into the binary positions



Using base-2, we can express the value of number 17 in binary as:

10001 = 1×2^0 + 0×2^1 + 0×2^2 + 0×2^3 + 1×2^4 = 1x1 + 0x2 + 0x4 + 0x8 + 1x16 =17


The binary notation doesn't change the value of a number. A pile of 17 peas remains the pile of 17 peas, whichever system we use to count them. The higher the base, the shorter the notation. We chose the base-10 because it offers the most compact and user-friendly format. We only need to add 0s to identify a position value. In the case of number 8547, we add one 0 to digit 4 to determine the value of 40, two 0s to digit 5 to determine the value of 500, and three 0s to digit 8 to determine the value of 8000. What could be easier?


Computers chose the binary because they prioritise the minimum number of digits in use. And the minimum number of digits any counting system can have is two.



Converting number 8547 to binary



Writing the resulting remainders from right to left, starting with the top one (in blue) and finishing with the bottom one, we get the number 8547 in binary as 10000101100011.


Using base-2, we can express the value of number 8547 in binary as:

10000101100011= 1×2^0 + 1×2^1 + 0×2^2 + 0×2^3 + 0×2^4 + 1×2^5 + 1×2^6 + 0×2^7 + 1×2^8 + 0×2^9 + 0×2^10 + 0×2^11 + 0×2^12 + 1×2^13 = 1x1 + 1x2 + 0x4 + 0x8 + 0x16 + 1x32 + 1x64 + 0x128 + 1X256 + 0X512 + 0X1024 + 0X2048 + 0X4096 + 1X8192 =8547


You can use the graph in Fig 3 to convert any binary number back to the decimal. Here, it was done for number 8547. Multiply the value of each position (in grey) by the digit it contains (0 or 1). And sum up the results, as it was done above.


Fig 3 Binary graph for the number 8547




Converting number 147 to binary



The number 147 in binary is 10010011. The graphical representation of the number 147 in binary is shown in Fig 4.


Fig 4 Binary graph for the number 147




Converting number 118 to binary



The number 118 in binary is 1110110. The graphical representation of the number 118 in binary is shown in Fig 5.


Fig 5 Binary graph for the number 118



 


86 views

Related Posts

See All

Comments


bottom of page