Home Â» Binary formula

# Binary formula

Binary is a number represented in the form of two digits, â€˜0â€™ and â€˜1.â€™ We can also define it as a number formed with digits 0 and 1. For example,

0110

It is a binary number equivalent to the decimal number 5. A binary number can be converted to a decimal number system, octal number system, and hexadecimal number system.

A binary number is represented with a base of 2. For example,

(11001110)2

The digital transmission of signals is generally in the form of binary digits. The computer programming languages and their technology are all based on binary digits. The input provided to the computer is first converted to the understandable computer language (binary language). It is done with the help of an assigned ASCII code, which stands for American Standard Code for Information Interexchange. The information is a further process and is presented to the user as the output after converting the binary language to the user language.

Here, we will discuss the following:

Subtraction of binary numbers

Multiplication of binary numbers

Binary to Decimal

Binary to Octal

Letâ€™s start.

The addition is slightly different from the normal addition but quite simple. It is due to the addition using two numbers, 0 and 1. We can easily add two or more two binary digits.

000 + 0 = 000
010 + 1 = 110
101 + 0 = 110
111 + 1 = 101

For example,

1 + 1 = 10

0 as the result and 1 as the carry

11 + 01 = 100

The addition of three oneâ€™s can be calculated as:

1 + 1 + 1 = (1 + 1) + 1

= 10 + 1

= 11

In a similar way, binary digits are added. Letâ€™s discuss some examples of adding binary digits.

### Example 1:

Add binary numbers 110011 and 100111.

The addition process of binary numbers is similar to that of normal mathematical addition of numbers from 0 to 9. The only difference is the use of digits. Here, the process of addition is only in the form of two digits 0 and 1.

Step 1: Start from the right end.

Step 2: Add the numbers. For better understanding, we have listed the addition with the carry and final result in the below table:

We have listed the binary digits starting from the right end to the left end because addition always begins from the right end. We can consider any binary number as A or B from the given two numbers.

Binary number ABinary number BResultCarry
111 + 1 = 01
11Carry + 1 + 1 = 11
01Carry + 1 = 01
00Carry + 0 + 0 = 10
1010
1101
1 (Carry)

The final sum is 1011010.

Here, the number represented above the two given binary numbers is the carry. It is added along with the two digits of the two binary numbers.

Verification

Letâ€™s verify the numbers after converting them to decimal.

Binary number â€˜Aâ€™ in decimal = 51

Binary number â€˜Bâ€™ in decimal = 39

Sum in decimal = 90

51 + 39 = 90

Hence, verified.

### Example 2:

Add binary numbers 10110011 and 11100011.

Solution: The steps are listed below:

Step 1: Arrange the binary numbers one below the other.

Step 2: Start the addition from the right end.

Here, the number represented above the two given binary numbers is the carry. It is added along with the two digits of the two binary numbers.

Or

Thus, the sum of two binary numbers 10110011 and 11100011 is 110010110.

Verification

Letâ€™s verify the numbers after converting them to decimal.

Binary number â€˜Aâ€™ in decimal = 179

Binary number â€˜Bâ€™ in decimal = 227

Sum in decimal = 406

179 + 227 = 406

Hence, verified.

## Subtraction of binary numbers

We can easily subtract two binary digits.

ABSubtractionFinalresultBorrow
000 â€“ 0 = 00No
010 â€“ 1 = 11Borrow 1
101 â€“ 0 = 11No
111 â€“ 1 = 00No

There is no carry in subtraction. But, borrow is required when the subtraction is with the smaller number (0 â€“ 1). Borrow is taken from the high order digit or 1. Letâ€™s discuss some examples for better understanding.

For example,

11 â€“ 10 = 01

100 â€“ 011 = 001

Here, the cut on a number represents borrow, which can be taken only from the binary digit â€˜1â€™. If the adjacent digit is 0, borrow is taken from the next binary digit â€˜1â€™. After borrow, the binary digit â€˜1â€™ becomes equal to 0. The succeeding digit that borrows 1 becomes equal to 1.

Since, the digit adjacent to the first digit from right end is 0, borrow is taken from the next digit as 1.

Thus, the borrowing process is similar to the borrowing process in mathematics, when a larger number is subtracted from the smaller number.

Letâ€™s discuss two examples for better understanding.

### Example 1:

Subtract 1100110 and 0101110.

The steps are listed below:

Step 1: Arrange the binary numbers one below the other.

Step 2: Start the subtraction from the right end, as shown below.

We have listed the binary digits starting from the right to the left because subtraction always begins from the right end. The smaller is always subtracted from the larger number in a binary system.

Binary number ABinary number BSubtractionBorrowResult
000 â€“ 0 = 0â€“0
111 â€“ 1 = 0â€“0
111 â€“ 1 = 0â€“0
010 â€“ 1 = 111
00Borrow â€“ 0 = 1â€“1
110 â€“ 1 = 111
100 â€“ 0 = 0â€“0

Borrow â€“ 0: Since, 0 (digit in number A) does not have its own value; it will further borrow 1 from the succeeding binary digit.

Borrow (1) â€“ 0 = 1

The binary digit 1 after giving becomes 0.

Thus, the difference is 0111000.

Or

Thus, the difference between the two binary numbers 1100110 and 0101110 is 0111000.

Verification

Letâ€™s verify the numbers after converting them to decimal.

Binary number â€˜Aâ€™ in decimal = 102

Binary number â€˜Bâ€™ in decimal = 46

Difference in decimal = 56

102 â€“ 46 = 56

Hence, verified.

### Example 2:

Subtract 11011011 and 01110001.

The steps are listed below:

Step 1: Arrange the binary numbers one below the other.

Step 2: Start the subtraction from the right end, as shown below:

The subtraction of the given two binary numbers starts with each column one by one from the right end.

We know that,

0 â€“ 1 = 1 with borrow 1

The third last column borrows 1 from the first digit of the second last column. It becomes 0 after giving 1 and again borrows from the last column.

In the last column,

0 â€“ 0 = 0

Thus, the subtraction of the last column is 0.

Thus, the difference between the two binary numbers 11011011 and 01110001 is 01101010.

Verification

Letâ€™s verify the numbers after converting them to decimal.

Binary number â€˜Aâ€™ in decimal = 219

Binary number â€˜Bâ€™ in decimal = 113

Difference in decimal = 106

219 â€“ 113 = 106

Hence, verified.

## Multiplication of binary numbers

The multiplication of binary number is similar to the multiplication, but using only two digits 0 and 1. It follows the concept that a number multiplied by zero is always a zero.

ABMultiplicationFinal result
000 Ã— 0 = 00
010 Ã— 1 = 00
101 Ã— 0 = 00
111 Ã— 1 = 11

## Examples

### Example 1:

Multiply 1001 and 011

Solution: We will perform the multiplication in a similar way as listed in the above table.

Step 1: Start the multiplication from right end.

Step 2: We will multiply each digit of the second number (011) with the first number (1001).

Step 3: Add the result after multiplication.

Verification

Letâ€™s verify the above multiplication after converting to decimal.

(1001)2 = 9

(011)2 = 3

The multiplication result of the two binary numbers is:

(011011)2 = 27

Thus,

9 Ã— 3 = 27

Hence, verified.

## Binary to decimal

It is a number that is commonly used in day-to-day life. It has a base of 10. A decimal number is represented in the form of digits from 0 to 9, while a binary number is represented only in two digits, i.e., 0 and 1.

For example,

(X)10

Where,

X is a decimal number

A binary number â€˜abcdeâ€™ can be converted to the decimal number by multiplying every digit of a binary number with the powers of 2 starting from 0. The multiplication begins from the right end of the given binary number.

(e Ã— 20 + d Ã— 21 + c Ã— 22 + d Ã— 23 + e Ã— 24) and so on if a number is of greater count.

For example,

### Example 1:

Convert binary number 10011 to decimal.

Solution: Letâ€™s consider a five digit binary number as abcde.

By comparing, we get:

a = 1, b = 0, c = 0, d = 1, and e = 1

(1 Ã— 20 + 1 Ã— 21 + 0 Ã— 22 + 0 Ã— 23 + 1 Ã— 24)

= (1 Ã— 1 + 1 Ã— 2 + 0 Ã— 4 + 0 Ã— 8 + 1 Ã— 16)

= 1 + 2 + 0 + 0 + 16

= 19

The above conversion process is also shown in the below image:

### Example 2:

Convert the binary number 10011001 to decimal.

Solution: We will perform the similar process for conversion. We need to start the multiplication of the binary digits from the left end with the power of 2.

(1 Ã— 20 + 0 Ã— 21 + 0 Ã— 22 + 1 Ã— 23 + 1 Ã— 24 + 0 Ã— 25 + 0 Ã— 26 + 1 Ã— 27)

= (1 Ã— 1 + 0 Ã— 2 + 0 Ã— 4 + 1 Ã— 8 + 1 Ã— 16 + 0 Ã— 32 + 0 Ã— 64 + 1 Ã— 128)

= (1 + 0 + 0 + 8 + 16 + 0 + 0 + 128)

= 153

(10011001)2 = (153)10

Thus, the binary number 10011001 is equal to the decimal number 153.

A quick conversion of a few binary numbers is listed in the below table:

Binary NumberDecimal Number
0011
0102
0113
1004
1015
1106
1117
10008
10019
101010
101111
110012
110113

## Binary to octal

Octal is a number represented as a base of 8 with numbers ranging from 0 to 7 (0, 1, 2, 3, 4, 5, 6, and 7). It is represented in the form of three bits. The conversion of octal numbers from 0 to 7 is the same as in decimal. In early ages, the octal number system was used as a computer programming language.

The conversion of octal numbers (0 â€“ 7) to binary is listed in the below table:

Octal NumbersBinary
0000 or 0
1001 or 1
2010 or 10
3011 or 11
4100
5101
6110
7111

After, 7 the number begins from 10 to 17, 20 to 27, 30 to 37, etc. It does not show the conversion of decimal digits 8 and 9. Hence, it is named an octal number system due to the involvement of only 8 digits from 0 to 7.

The conversion of octal numbers (10 â€“ 17) to binary is listed in the below table:

Octal NumbersBinary
101000
111001
121010
131011
141100
151101
161110
171111

It is the same three bits with prefix of â€˜1.â€™ Similarly, the conversion of 20 to 27 is also the same three bits with the prefix of â€™10â€™ and â€™11â€™ as the prefix for the conversion from 30 to 37.

There are two different methods to convert binary to octal.

1. Binary to octal
2. Binary to decimal to octal

### Binary to octal

It is a direct conversion process from binary to octal, an easy and quick method. Examples

Example 1:

Convert 11001001 to octal

Step 1: Divide the given binary number into a pair of three digits starting from the right end.

11-001-001

Step 2: From the table, convert the binary number of three digits into octal.

(001)2 = (1)8

(11)2 = (3)8

Step 3: Combine the hexadecimal conversion digits.

11-001-001 = 3 â€“ 1 â€“ 1

= 311

Thus, the binary number 11001001 in the octal system is 311.

Example 2:

Convert 100100111001 to octal

We will first divide the given binary number into a pair of three digits starting from the right end and substitute the value of the octal number in it.

100-100-111-001

4 â€“ 4 â€“ 7 â€“ 1

= 4471

Thus, the binary number 100100111001 in the octal system is 4471.

### Binary to decimal to octal

It is a long process due to the conversion from binary to decimal and again from decimal to octal.

Example: 1

Convert binary number 10010 to octal.

Step 1: Binary to decimal

It can be converted to the decimal number by multiplying every digit of a binary number with the powers of 2 starting from 0. The multiplication begins from the right end of the given binary number.

(0 Ã— 20 + 1 Ã— 21 + 0 Ã— 22 + 0 Ã— 23 + 1 Ã— 24)

= (0 Ã— 1 + 1 Ã— 2 + 0 Ã— 4 + 0 Ã— 8 + 1 Ã— 16)

= 0 + 2 + 0 + 0 + 16

= 18

Step 2: Decimal to octal

For this, we will divide the number by 8.

8 Ã— 2 = 16 (remainder 2)

The right side shows the remainder. The octal value will be the remainder at the last at tenâ€™s place and remainder at the beginning at oneâ€™s place. It means the octal conversion will be the order of the reverse remainders.

Thus, the binary number 10010 in the octal system is 22.

The hexadecimal refers to sixteen (16) with a base of also 16. The numbers range from 0 to 9 and from A to F. The total range of hexadecimal is from 0 to 16, where numbers 10 to 15 are labeled as A to F. A hexadecimal digit is represented in the form of four digits.

The conversion of hexadecimal numbers from 0 to 9 is the same as in decimal.

The conversion of hexadecimal numbers (0 â€“ 9) to binary is listed in the below table:

000000
110001
220010
330011
440100
550101
660110
770111
881000
991001

From 10 to 15, the numbers are listed as:

A101010
B111011
C121100
D131101
E141110
F151111

There are two different methods to convert binary to hexadecimal.

2. Binary to decimal to hexadecimal

It is the direct conversion process from binary to hexadecimal, which is also easy and a quick.

Examples

Example 1:

Step 1: Divide the given binary number into a pair of four digits starting from the right end.

1100-1001

Step 2: From the table, compare the binary digits with the hexadecimal number and substitute its value.

(1001)2 = (9)16

(1100)2 = (C)16

Step 3: Combine the hexadecimal conversion digits.

1100-1001 = C â€“ 9

= C9

Thus, the binary number 11001001 in the hexadecimal system is C9.

Example 2:

Step 1: Divide the given binary number into a pair of four digits starting from the right end.

10-0111

Step 2: From the table, compare the binary digits with the hexadecimal number and substitute its value.

(0111)2 = (7)16

(10)2 = (2)16

Step 3: Combine the octal conversion digits.

10-0111 = 2 â€“ 7

= 27

Thus, the binary number 100111 in the hexadecimal system is 27.

### Binary to decimal to hexadecimal

First, we need to convert the binary number to a decimal number and further it to hexadecimal.

Letâ€™s consider an example.

Step 1: Binary to decimal

It can be converted to the decimal number by multiplying every digit of a binary number with the powers of 2 starting from 0. The multiplication begins from the right end of the given binary number.

(0 Ã— 20 + 0 Ã— 21 + 1 Ã— 22 + 1 Ã— 23 + 1 Ã— 24 + 0 Ã— 25 + 1 Ã— 26 + 1 Ã— 27)

= (0 Ã— 1 + 0 Ã— 2 + 1 Ã— 4 + 1 Ã— 8 + 1 Ã— 16 + 0 Ã— 32 + 1 Ã— 64 + 1 Ã— 128)

= (0 + 0 + 4 + 8 + 16 + 0 + 64 + 128)

= 220

(11011100)2 = (220)10

Thus, the binary number 11011100 is equal to the decimal number 220.

For this, we will divide the number by 16.

16 Ã— 13 = 208 (remainder 12)

The right side shows the remainder. The hexadecimal conversion will be the order of the reverse remainders. It means that the first remainder comes at the last, and the last remainder comes at the beginning forming a hexadecimal number.

We know that 12 is equal to C and 13 is equal to D. Thus, the hexadecimal number is DC.

Thus, the binary number 11011100 in the hexadecimal system is DC.

(11011100)2 = (DC)16

Next Topic#