DEV Community

Cover image for What are binary number? Why we need them? How to convert Binary to decimal? How to add and multiple binary number?
Edgar Minasyan
Edgar Minasyan

Posted on

What are binary number? Why we need them? How to convert Binary to decimal? How to add and multiple binary number?

What are binary numbers?

Binary numbers are numbers which are expressed in base-2 numerical system or binary numerical system. It’s a method of mathematical expression which uses only two symbols: 0 and 1. So to represent numbers starting from zero in base-2 numerical system we just start from 0(0 in base-10), 1(1 in base-10), 10(2in base-10), 11(3 in base-10), 100(4in base-10) and so on. Every digit in our base-2 numbers is referred to as a bit or a binary digit.

So why do we need this base-2 numerical system?

The main reason the binary number system is used in computing and it is simpler for computers to understand the language or numbers in the same way that we do. All that computers really have available to work with are switches and electrical signals, which are either on or off. So, to say it much simpler if we have 1 it means there is an electricity if we have 0 it means that there is no electricity.

How to convert binary to decimal?

If you are given a binary number and you need to understand which decimal number that could be you jut need to do the following to get decimal value of that number. Since binary numbers are type of positional number system. That means Weight of the positions from right to left are as 2^0, 2^1, 2^2,2^3 … and so on. So, starting from the right side you just multiple your binary digit into 2^(digit’s position) and add all numbers that you got from multiplying.
For example: 1101 = 1*2^3 + 1*2^2 + 0*2^1 + 1*2^0 = 8+4+0+1 = 13

How to add and multiply binary numbers?

                        Adding
Enter fullscreen mode Exit fullscreen mode

The binary addition operation works similarly to the base 10 decimal system, except that it is base 2 system and it consist of only two digits. In binary addition we again start from the right. Binary addition is much easier than the decimal addition if you remember just this four rules of binary addition:
• 0 + 0 = 0
• 0 + 1 = 1
• 1 + 0 = 1
• 1 + 1 = 10
Now, look at the example of binary addition: 101 + 101
Step 1: First consider 1’s column from the right, and add the digits of that column (1+1) and it gives the result 10
Step 2: Now, leave the 0 in the one’s column and carry the value 1 to the 10’ column
Step 3: Now add 10’s place, 1+(0+0) = 1. So, nothing carries to the 100’s place and leave the value 1 in the 10’s place
Step 4: Now add the 100’s place (1+1)=10. Leave the value 0 in the 100’s place and carries 1 to the 1000’s place
Result: So in the end by adding 101 to 101 we get 1010.

                      Multiplying 
Enter fullscreen mode Exit fullscreen mode

Binary multiplication is similar to the multiplication of decimal numbers. We have a multiplier and a multiplicand. The result of multiplication result in a product. Since only binary digits are involved in binary multiplication, we get to multiply only 0s and 1s. The rules for binary multiplication are as follows.
• 0 * 0 = 0
• 0 * 1 = 0
• 1 * 0 = 0
• 1 * 1 = 1
And you just multiply binary numbers as you multiply decimals by using this rules.

Top comments (0)