0% found this document useful (0 votes)
6 views12 pages

Understanding Number Systems Explained

The document explains various number systems including decimal, binary, octal, and hexadecimal, detailing their structures and conversion methods. It covers how to convert between these systems, including examples for decimal to binary, binary to decimal, and octal to hexadecimal conversions. Additionally, it discusses binary addition rules and provides solved examples for clarity.

Uploaded by

surajrana123r
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views12 pages

Understanding Number Systems Explained

The document explains various number systems including decimal, binary, octal, and hexadecimal, detailing their structures and conversion methods. It covers how to convert between these systems, including examples for decimal to binary, binary to decimal, and octal to hexadecimal conversions. Additionally, it discusses binary addition rules and provides solved examples for clarity.

Uploaded by

surajrana123r
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NUMBER SYSTEM

Decimal Number System


Humans express numbers in decimal format which is also called the base 10 number system.
Decimal numbers = {0,1,2,3,4,5,6,7,8,9}
In general, base N number system will consist of numbers from 0 to N-1.
Example
Base 2 number system has numbers from 0 to 1. i.e 0 to (2 - 1).
Base 8 number system has numbers from 0 to 7. i.e 0 to (8- 1).
Positional Decimal Numbers
To represent numbers above 9, we are using positional decimal numbers.
Example
(18)10 consist of two decimal numbers which are 1 and 8.
Here,
The position of 8 is 0.
The position of 1 is 1.
Position count starts from the right side of a number.
18
= 1*(101) + 8*(100)
= 1*10+8*1
= 10+8
= (18)10
Example
(145)10
The position of 5 is 0.
The position of 4 is 1.
The position of 1 is 2.
(145)10
= 1*(102) + 4*(101) + 5*(100)
= 100+40+5
= (145)10
Pictorial Explanation

Real Numbers
When it comes to the real numbers or numbers with fractional parts, the position after the dot(.) will be
counted as -1, -2 and so on.
Example
(125.67)10
The position of 6 is -1.
The position of 7 is -2.
The position of 5 is 0.
The position of 2 is 1.
The position of 1 is 2.
125.67
= 1*(102) + 2*(101) + 5*(100) + 6*(10-1) +7*(10-2)
= 100 + 20 + 5 + 0.6 + 0.07
= 125.67
Pictorial Explanation

Binary Number System


The computer can understand only binary number system which is also called the base 2 number system.
Binary number system = {0,1}.
Human express numbers in positional decimal format. But the computer can’t store decimal numbers
directly.
The computer automatically converts the decimal number to binary format before using it.
Whatever be the data, the computer always converts it into it's only known language which is binary.
Decimal Binary

0 0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

Octal Number System


It’s very hard to deal with binary numbers because everything will be in 0s and 1s.
To reduce the complexity, in the octal number system, we will group every 3 bits of binary in right to left
direction.
The maximum value that can be formed using 3 bit is 7 (111) 2.
Octal Numbers = {0,1,2,3,4,5,6,7}
It is also called as base 8 number system.
Possible three-bit group combination will be,
Binary Octal

000 0

001 1

010 2

011 3

100 4

101 5

110 6

111 7

Hexadecimal Number System


In the hexadecimal number system, we group every 4 binary bits. So that we can easily represent computer
memory addresses as on the computer, the memory allocation always happens in multiples of 4.
Possible values that can be formed using 4 bit is 15 (1111)2.
Hexadecimal Number System = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}.
It’s also called as base 16 number system.
Binary Decimal Hexadecimal

0000 0 0

0001 1 1

0010 2 2

0011 3 3

0100 4 4

0101 5 5

0110 6 6

0111 7 7

1000 8 8

1001 9 9

1010 10 A or a

1011 11 B or b

1100 12 C or c

1101 13 D or d

1110 14 E or e

1111 15 F or f

The hexadecimal number system will use letters A to F to represent numbers 10 to 15.
10-A,11-B,12-C,13-D,14-E,15-F

Conversion of decimal to binary


The general formula to convert decimal to any number system,
Divide the number by base. i.e. number / base
Write down the result (i.e. remainder)
Rewrite all remainders in reverse order.
Let's convert (22)10 into Binary format,
Here, base value = 2
Pictorial Explanation

Convert (15)10 to binary


Here base value = 2.
2|15
----
2|7 - 1
----
2|3 - 1
----
1 -1

(1111)2
Convert (20)10 to binary
Here base value = 2.
2|20
----
2|10 - 0
----
2|5 - 0
----
2|2 - 1
----
1 - 0
(10100)2
Binary to Decimal Conversion
∑( ni * ( base ^ position) )
∑ denotes the summation operation.
^ denotes the power operation.
* denotes the multiplication operation.
where, ni is each digit of a number
Number System Base Value

Binary 2

Decimal 10

Octal 8

Hexadecimal 16

Position
Position varies from 0 to (number of digits – 1).

Steps of conversion from Binary to Decimal


Step 1: Find the position of every binary digit. We should count the position from the right direction of the
number. And the position count starts from 0.
Example
0001 - position of 1 = 0, 0 = 1, 0 = 2, 0 = 3.
Step 2: Multiply every digit with 2 to the power of their corresponding position. (2 position)
Step 3: Finally, calculate the sum of all the multiples.
Convert (1111)2 to decimal
=1x23+1x22+1x21+1x20
=8+4+2+1
= (15)10
Convert (1001)2 to decimal
=1x23+0x22+0x21+1x20
=8+0+0+1
= (9)10

Example
For two digit numbers, the position varies from 0 to 1. For three digit numbers, the position varies from 0 to
2.
Position count starts from the right side of a number.
Example
Let's convert (10110)2 into the decimal number
where,
The position of 0 is 0.
The position of 1 is 1.
The position of 1 is 2.
The position of 0 is 3.
The Position of 1 is 4.
And the base value = 2.
(10110)2
=1*(24) + 0*(23) + 1*(22)+ 1*(21) + 0*(20)
=16+0+4+2+0
=(22)10
Pictorial Explanation

Binary to Octal
Group every 3 binary bits from right to left and construct the octal number system.
Let’s convert (101100)2 to the octal number system.
(101) (100)
(101) = 5
(100) = 4
(101) (100) => (54) 8
Pictorial Explanation

If the number of bits is not multiples of 3, add required zeros to the extreme left before the binary number to
make it perfect 3-bit group.
Example
(1010) 2
Here, the number of bits is 4. By adding two zeros before the binary number, we can make it multiples of 3.
Like,(001010)2 = (001)(010) = (12)8.

More examples:
(101010101)2 to octal
= (101010101)2
= (101)(010)(101)
= (525)8
(11111111)2 to octal
= (11111111)2
= (011)(111)(111)
= (377)8

Octal to Binary
To convert the octal number into binary, we need to represent every digit of octal number into 3 binary bits.
Example
(57) 8
5 = (101)
7 = (111)
(57)8 = (101111)2

Pictorial Explanation

Octal to Decimal
Octal Number System
Base 8 number system which consists numbers {0, 1, 2, 3, 4, 5, 6, 7}.
Decimal Number System
Base 10 number system which consists numbers {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.

Octal to Decimal Conversion Procedure


Step 1: Write down the octal numbers.
Step 2: Find the position of every digit. We should count the position from the right direction of the number.
And the position count starts from 0.
Example
134 - position of 4 = 0, 3 = 1, 1 = 2.
501 - position of 1 = 0, 0 = 1, 5 = 2.
position
Step 3: Multiply every digit with 8 to the power of their corresponding position. (8 )
Step 4: Finally, calculate the sum of all the multiples.

Example
(16)8 to decimal
position = {1-1, 6-0}
=1x81+6x80
=8+6
= (14)10

Example
(7777)8 to decimal
position = {7-3, 7-2, 7-1, 7-0}
f equivalent decimal = 15
= 7 x 8 3 + 7 x 8 2 + 7 x 8 1+ 7 x 8 0
= 7 x 512 + 7 x 64 + 7 x 8 + 7 x 1
= 3584 + 448 + 56 + 7
= (4095)10
Conversion of decimal to octal
Convert (34)10 to octal
Here base value = 8.
8|34
----
8|4 - 2
(42)8

Convert (456)10 to octal


8|456
----
8|57 - 0
----
8|7 - 1
(710)8
Binary to Hexadecimal
Let's convert (10001101) 2 into hexadecimal format.
Group every 4 binary bits from right to left.
Finally, combine the results.
(10001101) 2
(1000) (1101)
(1000) = (8)
(1101) = (13) ==> 13 -> D
(1000) (1101) = (8D)16
Pictorial Explanation

If the number of bits is not multiples of 4. Add zeros to the extreme left before the binary number to make it
perfect 4-bit group.
Example
(101010) 2
Here, the number of bits is 6. By adding two zeros before the binary number, we can make it multiples of 4.
Like, (00101010)2 = (0010)(1010) = (2A)16.

More Examples:
(101010101)2 to hexadecimal
= (101010101)2
= (1)(0101)(0101)
= (155)16
(11111111)2 to hexadecimal
= (11111111)2
= (1111)(1111)
= (15)(15)
= (ff)16
Note: 15 equivalent hexadecimal value is f.

Hexadecimal to Binary
To convert the hexadecimal number into binary, we need to represent every hexadecimal digit into 4 binary
bits.
Finally, combine the binary bits.

Example
Let's convert (FD) 16 into binary numbers
(FD) 16
F= (1111)
D= (1101)
(FD) 16 = (11111101) 2

Pictorial Explanation

Conversion from decimal to hexadecimal


Example: Convert (255)10 to hexadecimal
Here base value = 16.
16|255
----
16|15 - 15
(15)(15)
(ff)16
Octal to Hexadecimal
Using the below two methods, we can convert the octal number system into the hexadecimal number system.
1. Convert the octal number into binary and then convert the binary into hexadecimal.
2. Convert the octal number into decimal and then convert the decimal into hexadecimal.
Let's convert the octal number into the hexadecimal number system.

1. Octal  Binary  Hexadecimal


Let's convert (56)8 into hexadecimal
Step 1 : Convert (56)8 into Binary
In order to convert the octal number into binary, we need to express every octal value using 3 binary bits.
Binary equivalent of 5 is (101)2.
Binary equivalent of 6 is (110)2.
= (56)8
= (101)(110)
= (101110)2
Step 2 : Convert (101110)2 into Hexadecimal
In order to convert the binary number into hexadecimal, we need to group every 4 binary bits and calculate
the value [From left to right].
(101110)2 in hexadecimal
= (101110)2
= (10)(1110)
= (2)(14)
= (2e)16

2. Octal  Decimal  Hexadecimal


Step 1 : Convert (56)8 into Decimal
= 5*81+6*80
= 40+6
= (46)10
Step 2 : Convert (46)10 into hexadecimal
16|46
----
16|2 - 14
= (2e)16

Conversion of decimal numbers into binary numbers


Example 1:
(4.25)10
Where,
4 is an integral part.
0.25 is a fractional part.
Pictorial Explanation

Integral Part (4)


To convert an integral part into binary, just follow the previously discussed method.
Binary Number System
Using that method, we can represent 4 as (100)2.
Fractional part (0.25)
To convert the fractional part to binary, multiply fractional part with 2 and take the one bit which appears
before the decimal point.
Follow the same procedure with after the decimal point (.) part until it becomes 1.0.
Like,
0.25 * 2 =0.50 //take 0 and move 0.50 to next step
0.50 * 2 =1.00 //take 1 and stop the process
0.25 = (01)2
Combining both integral and fractional,
(4.25)10 = (100.01)2

Example 2:
10.75
Integral Part
10 = (1010) 2
Fractional Part
0.75 * 2 =>1.50 // take 1 and move .50 to next step
0.50 * 2 =>1.00 // take 1 and stop the process because no remainder
0.75 = (11) 2
Combining both integral and fractional,
(10.75)10 = (1010.11)2
Binary Addition
Rules of Binary Addition
Rule 1: 0+0=0; Carry =0 Rule 2: 0+1=1; Carry =0
Rule 3: 1+0=1; Carry =0 Rule 4: 1+1=0; Carry =1
Solved Examples
1. Add binary numbers (10)2 and (01)2
(10)2
+ (01)2
(11)2
2. Add binary numbers (1011)2 and (111)2
Carry over 1111
1011
+ 111
10010
Hence, (1011)2 + (111)2 = (10010)2
3. (11100)2+(10101)2

Therefore, (11100)2+(10101)2 = (110001)2


4. (110110)2+(1111)2.

Therefore, (110110)2+(1111)2 = (1000101)2


5. Add (110)2+(111)2+(101)2
At first, we add two binary numbers together and then add the resultant value with the third one.
Let’s add 110+111 first.

Now, let’s add the third binary number to the resultant value of addition of the first two.

Therefore, (110)2+(111)2+(101)2 = (10010)2.

Find the sum of 1101 and 1001. Ans: 10110


Find the sum of 110011 + 101100. Ans: 1011111
Binary Subtraction
Binary Subtraction is a mathematical operation and is one of the four fundamental operations of binary
numbers. Binary subtraction is similar to decimal subtraction but the rules used as somewhat different.
Binary Subtraction rules are,
Rule 1: 1 - 0 = 1 Rule 2: 1 - 1 = 0 Rule 3: 0 - 0 = 0
Rule 4: 0 - 1 = 1 (As, this is not possible directly, we borrow a 1 from the next higher order digit)
Example 1:
In binary, the number (8)10 is represented as (1000)2 and the number (25)10 is represented as (11001)2. Now
subtract (1000)2 from (11001)2.

Let us begin this subtraction by subtracting the integers on the right and working our way up to the next
higher order digit. To begin, subtract (1-0). This equals 1. Likewise, we proceed to the next higher order
digit and subtract (0-0), which is equals to 0. Again, subtract (0-0), which is equals to 0. Then, we subtract
(1-1), the outcome is 0. As a result, the difference is (10001)2 which is equivalent of (17)10.
Example 2:
In binary, the number (12)10 is represented as (1100)2 and the number (26)10 is represented as (11010)2. Now
subtract (1100)2 from (11010)2.

Let us begin this subtraction by subtracting the integers on the right and working our way up to the next
higher order digit. To begin, subtract (0-0). This equals 0. Likewise, we proceed to the next higher order
digit and subtract (1-0), which is equals to 1.
We must subtract (0 - 1) next, therefore we borrow a 1 from the next higher order digit. As a consequence
of subtracting (0 - 1), the outcome is 1. Then the next subtract (1-1) which is equal to 0 again subtract this
0 with 1 which is borrowed from the previous value (0-1) that is equal to 1. As a result, the difference is
(1110)2 which is equivalent of (14)10.

You might also like