Representing a number in the binary number system follows the same steps that we had earlier followed to represent a decimal number, except for the fact that the weights used in binary number system are powers of 2 and the values that are assigned to the weights can take only two values either zero's (0) or one's (1).
Let us take a simple example 13 in decimal number system and (1101) its binary equivalent, we will not worry much about how we got the binary equivalent at this moment and concentrate on how we represent in binary number system.
Step 1: (1101)2
Here subscript 2 indicates binary number system
We will now write down the weights in the form of table without assigning the values as shown below
23 22 21 2 0 ← Weights in binary number system
↑ ↑
MSB LSB
= 8 + 4 + 0 + 1
= ( 13 )10
Let us take a simple example 13 in decimal number system and (1101) its binary equivalent, we will not worry much about how we got the binary equivalent at this moment and concentrate on how we represent in binary number system.
Step 1: (1101)2
Here subscript 2 indicates binary number system
We will now write down the weights in the form of table without assigning the values as shown below
23 22 21 2 0 ← Weights in binary number system
MSB LSB
Step 2 : The values are assigned starting from LSB to MSB, the right most bit in the given example is LSB and the left most bit is MSB as done below :
23 22 21 2 0 ← Weights in binary number system
↑ ↑
MSB LSB
1 | 1 | 0 | 1 |
MSB LSB
Step 3: Multiply the values and the associated binary weights shown below
Beginning from LSB to MSB
1 x 2 0 ← LSB ← (1)
1 x 2 1 ← (2)
1 x 2 2 ← (3)
1 x 2 3 ← MSB ← (4)
Step 4: Add the products (1), (2), (3), (4) from step 3 as illustrated below
1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0
= 1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0
↑ ↑
MSB LSB
MSB LSB
= 1 x 8 + 1 x 4 + 0 x 2 1 + 1 x 1
= 8 + 4 + 0 + 1
= ( 13 )10