DEV Community

Cover image for Binary Numbers
Levon Yedigaryan
Levon Yedigaryan

Posted on

Binary Numbers

By Levon Yedigaryan

What are binary numbers?

These are numbers which as every other number are used to represent an amount. These numbers are used in computers due to the peculiarities of the comupter's organisation.

How do Binary numbers work?

in everyday life people often use decimal system of representation of numbers because it is the method people got used to from the early life. Decimal system is a system where the basis is the number 10, which means that in decimal numbers every digit shows the amount of certain powers of 10 according to their position. If we look at a digit in a number, it shows the maximum amount of 10s in the power of n in the number where n is the position of the digit if we start counting from left to right starting with 0.
To better understand this here is an example with the number 35468991.

structure of a decimal number

The same principle is true with binary numbers. Here every digit shows the amount of 2s in the power of n in the number. In binary systems the only digits are 1s and 0s. For illustration here is an example of number 10110011 in binary system which is then represented in decimal system.

structure of a binary number

So the transmission from binary to decimals is clear. No lets talk about transmission from decimals to binary. To convert decimal numbers into binary we have to divide the number by 2 and write down the remainders until the quotient becomes 0 and then we have to rewrite the remainders in the reverse order. here is an example with the convertion of number 54 in decimals.

convertion of decimal numbers into binary

How to add binary numbers?

The principle of addition of binary numbers is exactly the same as the for the decimals. We start from the digit at the very right and then go to the left. In case when we get 1+1 in binary it is 10 but as be can not write 10 as one gidit we write only 0 and then carry 1 part to the left. For a better visualization here is an example of an addition of 2 binary numbers.

addition of binary numbers

How to multiply binary numbers?

The principle of multiplication is completely the same as with decimal numbers. We multiply one by one the digits from the lower factor each time writing the product one digit to the left and then summing all the product together. here is an example.

multiplication of binary numbers

These were the sum and the multiplication of binary numbers. With this information one can easily do subtraction and division as the principles are exactly the same as for decimal numbers.

Wish you luck with your further studies of binary numbers)
I hope this information was useful.

Top comments (2)

Collapse
 
yourmdsarfaraj profile image
MD Sarfaraj

Nice explanation, thanks for sharing!!

Collapse
 
levon_yedigaryan profile image
Levon Yedigaryan

Happy that I could help)