Sales Toll Free No: 1-855-666-7446

# Binary Data

Top
 Sub Topics Number system is the type of numerals used to define different quantities in a unique way. In general, we do use the decimal system where all the numbers are represented in base of 10. It does use numbers from 0 to 9. When it comes to digital computers there are different ways of representing a number, the primary one being the binary system. It has a base of 2 as there are only two digits, 0 and 1, to represent any quantity.

## Definition

Binary data is the one which represents any quantity in two digits only, that is, 0 and 1. A combination of binary digits is used to represent any decimal number. The value of a digit at any position is twice of the value of the digit at its right. So, the digit value will increase in powers of two rather than in powers of 10 as it is in the case of decimal number system.

Let us take an example of a binary data. We have a binary number 101.

The value of the rightmost digit is 1, for the digit next to it the value is 2 times the data entered there, for the next one it is 4 times the data entered there.

101 = 1.22 + 0.21 + 1.20 = 1.4 + 0.2 + 1.1 = 4 + 0 + 1 = 5.

Let us take a decimal number and understand how this works. We have a number 3102.

3102 = 3.103 + 1.102 + 0.101 + 2.100 = 3000 + 100 + 0 + 2 = 3102.

Here, value at each position is 10 times the value at its right. Hence, the digit values increase in powers of 10.
Binary data has only two outcomes. It can be used in statistics and probability to show two outcomes, that is, True and False, or Yes and No.

## Binary Encoding

In computers a one bit can have two values, 0 or 1. Eight bits make one byte and the binary encoding of computers are mostly done in bytes. For n bits the number of possible codes can be 2n as for each bit the value can be 0 or 1, that is, two possible values. So, for n bits the values can be 2.2.2... up to n times = 2n .
In digital systems we have two more important number systems called hexadecimal and octal systems. In hexadecimal system, the base is of 16, and the values 10, 11, 12, 13, 14, 15 are taken as A, B, C, D, E, F respectively. Values 0 to 9 are taken as such only.

If a value has to be changed from binary to hexadecimal, following steps are taken:

1) Take four bits at a time.

2) Change them to decimal.

3)  If the values come more than 9 and up to 15, give them the hexadecimal values.

Let us see by an example. Take 11001111. Divide 4 bits in one part.

1111 = 15 = F

1100 = 12 = C

Hence, (11001111)2 = (CF)16

There is one more number system used in digital world which is known as octal system.  It has a base of 8. To change binary to octal following steps are taken.

1. Take three bits at a time.

2. Change them to decimal.

3. Write the decimal values together.

Take an example of 111011001 and change it to octal.

111 = 7

011 = 3

001 = 1

Hence, (111011001)2 = (731)8 .

To change octal and hexadecimal numbers into binary, take each digit and change it to binary data of 3 bits and 4 bits respectively. Take an example of (15)16 and change it to binary. Binary value of 5 = 101. Changing it to 4 bits we get, 0101 as adding a zero to left will make no difference in the value. Similarly, 1 = 0001.
Hence, binary value will become (0001 0101)2 .

## Steps

We need to convert binary data to decimal and decimal to binary. For converting decimal to binary we need to follow the given steps:

Step 1: Divide the number by 2 and note the remainder.

Step  2:  Divide the quotient by 2 again and note the remainder.

Step 3:  Keep repeating step 2 till the quotient becomes zero.

Step 4: Starting with the bottom remainder, write the sequence of remainders to get the binary value.
As an example, change 23 into binary.

1. 23 ÷ 2 = 11, remainder = 1

2. 11 ÷ 2 = 5, remainder = 1

3. 5 ÷ 2 = 2, remainder = 1

4. 2 ÷ 2 = 1, remainder = 0

5. 0 ÷ 2 = 0, remainder = 1

Hence, binary form is 10111.

Now, we will see the conversion of binary to decimal. We take 10111 and change it to its decimal value.

10111 = 1.24 + 0.23 + 1.22 + 1.21 + 1.20 = 1.16 + 0.8 + 1.4 + 1.2 + 1.1 = 16 + 0 + 4 + 2  + 1 = 23.

## Examples

Example 1: Change 35 into binary data.

Solution: Divide 35 by 2 and keep dividing the quotients by 2 till the quotients become zero.

35 ÷ 2 = 17, remainder = 1

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

Hence, binary = 100011.

Example 2: Change 11001 to decimal form.

Solution: Each digit's value will increase in powers of 2.

11001 = 1.24 + 1.23 + 0.22 + 0.21 + 1.20 = 1.16 + 1.8 + 0.4 + 0.2 + 1.1 = 16 + 8 + 0 + 0 + 1 = 25.

Example 3: Change the octal number (215)8 into binary.

Solution: To change into binary we will take each digit and find its binary counterpart.

2 = 10 = 010

1 = 1 = 001

5 = 101

Hence, (215)8 = (010001101)2 .

Example 4: Change (11100100111)2 into hexadecimal.

Solution: Take 4 bits each, 111 0010 0111

0111 = 7

0010 = 2

111 = 0111 = 7

Hence, hexadecimal value is (727)16 .