You are on page 1of 6

# 1.

In the previous section we looked at the decimal (base 10) and binary (base
2) number systems. In this section we look at the hexadecimal (base 16)
number system.

## Both binary and hexadecimal numbers are used in

computing.
The decimal (base 10) number system uses 10 digits:
0, 1, 2, 3, ..., 9
The binary (base 2) number system uses 2 digits: 0, 1
The hexadecimal (base 16) number system uses 16
digits: 0, 1, 2, 3, ..., 9, A, B, C, D, E and F.
The first 10 whole numbers in the hexadecimal system
are:
0,
1,
2,
3,
4, 5,
6,
7,
8,
9.
Once we reach 9, we run out of ordinary digits, since
there are only ten digits available.
The number 1010 = A16 , 1110 = B16 ,
1510 = F16.
1310 = D16 , 1410 = E16 ,

1210 = C16,

## So the first sixteen whole numbers in the hexadecimal

number system are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
After we reach the number F there are no more digits
left to use for the units digit. The next number is 10.
Continuing to count we have:
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D,
1E, 1F, 20, ...., 2F, 30, ..., 3F

Problems 1.2.1

## Can you count in hexadecimal? Give the next five

numbers in each of these sequences:
a) 45, 46, 47, 48, ...
b) 116, 117, 118, ..
c) 3A7, 3A8, 3A9, ...
e) A997, A998, A999,....

Positional Weights of Digits in the Hexadecimal System Conversions Hex to Decimal and Decimal to Hex
164
163
162
161 160

Example 1.2.1

## The hexadecimal number 13A716 written using

positional notation is:
13A716 = 1 x 163 + 3 x 162 + A x 161 + 7 x
160
To convert a hexadecimal number to a decimal number,
we evaluate the expression for the number using
positional notation.

Example 1.2.2

## The decimal value of 13A716 can be determined by

evaluating the positional notation expression.
13A716 = 1 x 163 + 3 x 162 + A x 161 + 7 x 160
= 1 x 4096 + 3 x 256 + 10 x 16 +
7x1
= 503110

Problem 1.2.2

Problems 1.2.3

numbers:
a) 8C516
b) AEF116

## Converting Decimal Numbers to Hexadecimal Numbers

As we did for converting a decimal number to a binary
number, to convert a decimal number to hexadecimal
number, we shall use repeated division and note the
remainder after each division. There were only two
possible remainders 0 and 1 when converting to
binary. In converting to base 16, however, there are
16 possible remainders.
812310 is converted to hexadecimal in the table
below. This method is called the calculator method.

Division

Remainder

Hex

0.6875 x 16 = 11

0.6875 x 16 = 11

0.9375 x 16 = 15

## Therefore, 812310 = 1FBB16 .

The conversion can be checked by converting 1FBB16
back to a decimal number.
1FBB = 1 x 4096 + 15 x 256 + 11 x 16 + 11 = 812310
Problem 1.2.4
Convert 78610 into a hexadecimal number and
check.
Converting Binary Numbers to Hexadecimal Numbers
As they increase in magnitude, binary numbers quickly
become unwieldy for those involved with their use in
computers. The five digit decimal number 83 472 in binary
is 1 0100 0110 0001 0000. It can be seen that a 0 or 1
can easily be dropped or added.It is easy to convert binary
numbers to their equivalent hexadecimal form. For this
reason, binary numbers when used with computers are

LSD

MSD

Example 1.2.3
To convert a binary number such as 1 0100 0110 0001
0000 above to hexadecimal, convert each group of 4 digits
beginning with the LSD into hex.
Binary
Number
Grouped
into 4's

Equivalent
1
Hex Digit

0100

0110

0001

0000

## It follows then that the 1 0100 0110 0001 00002 = 1461016

Problem 1.2.5
Show that 10 1011 00012 = 2B116

## Converting Hexadecimal Numbers to Binary Numbers

To convert a hexadecimal number to a binary number,
we reverse the above procedure.
Example 1.2.4
To convert the hexadecimal number 9F216 to binary,
each hex digit is converted into binary form.
9F216 = 1001

1111

00102 .

Problems 1.2.6
a) Convert hexadecimal 2BF9 to its binary equivalent.
b) Convert binary 110011100001 to its hexadecimal
equivalent.
Although numbers in a computer are stored in binary
form, the hex representation is usually used. The hex
representation of a byte requires only two digits and
the hex representation of two bytes (a word) requires
only 4 digits in hex compared to 16 digits in binary.

## The table below gives the decimal and hex

representation for all the ASCII codes from 0 to 127.

Source:
http://www.satoamerica.com/technical/techtips/asciihe
x.html

## 1. What is the base of each of the following number

systems:
a) decimal number system
b) binary number
system