Link Search Menu Expand Document

Binary numbers

Table of contents

  1. Introduction
  2. Binary counting
  3. Binary to decimal demonstration
  4. Signed and unsigned numbers

Introduction

Binary number system was invented by Gottfried Leibniz. As the word is prefixed with ‘Bi’ which is a Latin word and means ‘two’ in English. This brings us to the first two digits i.e., 0 and 1 which means that while counting in binary you cannot exceed 1. Infact all the numbers which you represent are made up of only two digits i.e., 0 and 1 which is quite interesting. Check out the binary representation of a decimal number (the numbers used for counting i.e., from 0-9) in binary.

Example:
Decimal Number :: 25 
Binary Number :: 11001 

Note: There is no 2, 3, 4, 5, 6, 7, 8 or 9 in Binary!


Binary counting

How do we count using binary?

It is just like counting in decimal except we reach 10 much sooner.

Binary Explanation
0 Start at 0
1 Then 1
??? But then there is no symbol for 2 … what to do?

Well how do we count in Decimal?

Decimal Explanation
0 Start at 0
1 Then 1
2-8 Count 1,2,3,4,5,6,7,8
9 This is the last digit in Decimal
10 Start from back at 0 again, but carry 1 on the left

The same thing is done in Binary …

Binary Explanation
0 Start at 0
1 Then 1
10 Now start back at 0 again, but carry 1 on the left
11 1 more
??? But NOW what … ?

What happens in Decimal?

Decimal Explanation
99 When you run out of digits, …
100 … start from back at 0 again, but carry 1 on the left

And that is what is done in Binary …

Binary Explanation
0 Start at 0
1 Then 1
10 Now start back at 0 again, but carry 1 on the left
11 1 more
100 start back at 0 again, and carry one to the number on the left but that number is already at 1 so it also goes back to 0 and 1 is carried to the next position on the left
101  
110  
111  
1000 Start back at 0 again (for all 3 digits), add 1 on the left

Binary to decimal demonstration


Let’s tell you something more about conversion. Conversion from Binary to Decimal is quite a simple task. All you need to do is begin from the right. Follow the steps below:

  • STEP 1 :: Write the decimal value of each digit on top of them respectively. The value which you seek to write is 2^(place value from right) beginning from 0 i.e., 2^0, 2^1, 2^2 …. continuing up to 2^7.
  • STEP 2 :: Now, multiply each digit of binary number with its value.
  • STEP 3 :: Add ‘em all.
  • STEP 4 :: Result is ready :)

Note: If the number is large, increase bits of the binary number on the left. Keep in mind that it’s value will increase subsequently.

Example ::
Decimal number :: 25
You can convert the 1st, 4th, and the 5th digit from the right by tapping on it to convert from 0 to 1.
Further, the respective binary digit is multiplied with the value present on top of each digit. Now add.
In this Case ::
1x16 + 1x8 + 0x4 + 0x2 + 1x1 = 25 which is the decimal equivalent of the binary number 11001

Signed and unsigned numbers

Currently, we have just looked at unsigned numbers - they can only be positive, as there is no sign. However, sometimes we need to work with negative numbers too. To do this, we add a sign bit on the far left of the binary number, which indicates whether the number is positive (0) or negative(1).

For example, the number 10000011 would be 131 if the number is unsigned, but if the number is signed, the actual representation would be -3

  • The first bit 1 represents that the number is negative
  • The remaining bits 0000011 represent the actual number, 3

The downside to using a signed number is that it removes one bit from the actual number representation, halving the maximum value.

  • The minimum and maximum values for an unsigned 8-bit number would be 0 to 2^8-1 (0 to 255)
  • The minimum and maximum values for a signed 8-bit number would be -2^7-1 to 2^7-1 (-127 to 127)

Use the Simulator below to get the decimal equivalent of a binary number

Click on the '0' to change it to '1' and vice-versa

Binary
128
0
64
0
32
0
16
0
8
0
4
0
2
0
1
0
Decimal
0
  1. Is 0110103 a binary number?
    1. No
      • Yes
  2. What is 10101 as a decimal number?
    1. 21
      • 10101
      • 25
      • 1000