 ## Number System:

A system of writing or denoting a number is called a number system. Number system is a Mathematical notation for portraying the numbers using several symbols and digits. In Mathematics, there are two types of number systems. They are positional number systems and non-positional number systems. A non positional system is a number system in which the value of a digit does not vary with its position. However, in the positional number system, the value of a digit depends on its position in the number. Hexadecimal number system is a positional number system.

The value of any digit in positional number system depends on the following:

• The digit whose value is to be determined

• Position of the digit in the number

• Base or radix of the number system

Hexadecimal number system has the base as 16 (hexa = 6 and deci = 10). So it is also called the base 16 number system. In this number system, there are 16 digits which are used in representing numbers in hexadecimal form. It is similar to the decimal number system because the first 10 digits remain the same in both the number systems. However, 10 in the decimal number system is represented as A in the hexadecimal system, 11 as B, 12 as C, 13 as D, 14 as E, 15 as F and 16 as 10. So the 16 digits of the hexadecimal number system are 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

### Place Value of Digits in Hexadecimal Number System:

A hexadecimal number has two parts namely integer part and the fraction part. Integer part includes the number to the left of the decimal point and the fraction part indicates the digits to the right of the decimal point. The digits of a number in hexadecimal form has a weightage in powers of 16. The power of 16 increases as the digit is towards the left of the decimal point whereas the power decreases as the digit is towards the right of the decimal point.

(image will be updated soon)

Example: (9AB.47)16 is a hexadecimal number

The number is written in expanded form as

9 x 162 x A x 161 + B x 160 + 4 x 16-1 + 7 x 16-2

Hexadecimal numbers can also be represented in binary, octal and decimal form. The table below denotes the representation of a hexadecimal digit in other forms.

 Hexadecimal Digit Decimal Equivalent Binary Equivalent 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 8 8 1000 9 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111

### Conversion of Numbers in other Positional Systems to Hexadecimal Form:

The decimal number is divided by 16 and the hexadecimal equivalent of the remainder is noted. The quotient obtained is again divided by 16 and the hexadecimal equivalent of the remainder is noted. The division is further continued till the quotient is equal to 0. The number in hexadecimal form is the remainders written from bottom to top.

Example:

Convert the base 10 number 242 into hexadecimal form.

Solution:

(242)10 = (F2)16

To convert a binary number into hexadecimal form, the digits are first separated into groups of 4 from the decimal point towards the right and the left. The left out digits are appended with the required number of zeroes to form a group of 4 binary digits. Each group of 4 binary digits is replaced with a single hexadecimal equivalent as depicted in the conversion table.

Example:

Solution:

The integer part is grouped as 0010 1000 1011. Its hexadecimal equivalent is (28B)16

The fraction part is grouped as 1010 1001 1110. Its hexadecimal equivalent is (A9E)16

So the number in hexadecimal form is (28B. A9E)16

Any octal number is first converted to decimal form. The decimal number obtained is converted into a hexadecimal number using the method explained above.

Example:

Solution:

(121)8 is converted into decimal form by multiplying each digit by its positional value of 8.

(121)8 = 1x 82 + 2 x 81 + 1 x 80 = 64 + 16 + 1 = (81)10

81 is then converted to hexadecimal form as follows:

So (121)8 = (51)16

Any number in hexadecimal form is converted into its decimal equivalent by multiplying each digit with its positional values of 16.

Example:

Convert (AB4)16 into decimal number.

Solution:

(AB4)16 = A x 162 + B x 161 + 4 x 160 = 10 x 64 + 11 x 16 + 4 x 1 = (820)10

A hexadecimal number is converted into a binary number by writing the 4 digit binary equivalent of each hexadecimal digit in the number by looking into the conversion table.

Example:

Convert (C7D)16 into base 2 number.

Solution:

Binary equivalent of

C => 1100

7 => 0111

D => 1101

So (C7D)16 = (110001111101)2

Hexadecimal digit can be converted into octal form by first converting it into a decimal number and then writing its octal equivalent.

Example:

Convert (AB4)16 into octal number.

Solution:

(AB4)16 is first converted into decimal form by multiplying each digit with the positional values.

(AB4)16 = A x 162 + B x 161 + 4 x 160 = 10 x 64 + 11 x 16 + 4 x 1 = (820)10

The number is then converted to octal form by dividing it by 8 and noting down the remainders. The remainder from bottom to top is the octal equivalent.

The number obtained by dividing 820 and noting down the remainders is 1464

So, (AB4)16 = (1464)8

### Fun Facts:

• An octal number can also be converted into hexadecimal form by first converting it into a binary equivalent. The binary equivalent can be divided into groups of 3 and their octal equivalent can be written using the binary to octal conversion table.

 Octal Digit 0 1 2 3 4 5 6 7 Binary Equivalent 000 001 010 011 100 101 110 111

• Similarly, a hexadecimal number can be converted into octal form by converting it into a binary number. The binary number is then divided into groups of three digits and their octal equivalent is written using the above conversion table.

1. Where are Hexadecimal Numbers Used by Programmers?

• Hexadecimal numbers are used to define locations in memory units of the system. Every byte can be defined as a two digit hexadecimal number instead of an eight digit binary number.

• Hexadecimal numbers are also used to represent the colors like red, green and blue on the webpages.

• MAC (Media Access Control) addresses are denoted by a 12 digit hexadecimal number. The first six digits is the ID of the adapter manufacturer and the last 6 digits is the adapter serial number.

• Programmers can easily debug the errors in their program using the hexadecimal error code indicating the memory location of the error.