You are on page 1of 12

Chapter Four

Numbering
System

92

Importance of this chapter


A number is a mathematical object used to count, measure, and label. The
original examples are the natural numbers 1, 2, 3, and so forth. A notational
symbol that represents a number is called a numeral. In addition to their use
in counting and measuring, numerals are often used for labels (as with
telephone numbers), for ordering (as with serial numbers), and for codes (as
with ISBNs). In common usage, the term number may refer to a symbol, a
word, or a mathematical abstraction.
Computers run on binary, which is a different numbering system than we
regularly use which is 10-base or Decimal. By not understanding numbering
systems, it'll be harder to understand how computers work.In computer
sciences, you use numbering systems when working with arrays, without a
numbering system you would not be able to keep track of what is going
on.Numbering systems are highly vital to security codes. Number theory is
tightly linked to cryptography, which uses (in internet security mainly)
modulus arithmetic and prime number factorization. So, based on this and
many others it can be established that the understanding of numbering
systems is very essential.
Outcome of this chapter
1. Understand the base
2. How the each of the four numbering system works
3. How to convert from one numbering system to other

4.1. Understanding the Base


A computer can understand positional number system where there are only a
few symbols called digits and these symbols represent different values
depending on the position they occupy in the number.
A value of each digit in a number can be determined using
The digit
The position of the digit in the number
The base of the number system (where base is defined as the total
number of digits available in the number system).
Formula, Numberb= [dn,,d2,d1,d0] = anbn + an-1bn-1 + + a1b1 + a0b0
Where, d: digits
a: digits e.g. 0,1,2,3,4,.
b: Base of the number
93

Example, lets assume 278 is a base-10 number then how do we get the
value 278?
Solution: N = 278, b = 10 (base 10) => decimal numbers, symbols: 0, 1, 2,
3, 4, 5, 6, 7, 8, 9 (10 different symbols). N = 278 => n = 2;a2 = 2; a1 = 7; a0
=8
Thus, 27810 = (2 x 102) + (7 x 101) + (8 x 100).
4.2. Number System
4.2.1.

Base-10 or Decimal Numbers

Our everyday number system is a Base-10 system. The Base-10 number


system is known as the decimal systemand has 10 digits to show all numbers
i.e. 0,1,2,3,4,5,6,7,8,9using place value and a decimal point to
separatewhole numbers from decimal fractions. By now you know the
formula for calculating the value or how the number is created using the
place value. We write this numbers in this way 42 10. As you can see 42 is the
value and 10 is the base of the number.
4.2.2.

Binary Numbers

Binary numbers is a base-2 number system. By the name you might have
guessed that this number system only works with two digits. And youll be
right if you have done so. The two numbers that are used in this system are
0 and 1. For example, 101102. Now it also works with the same formula and
the counting system that we use for decimal.There is no 2,3,4,5,6,7,8 or 9 in
Binary!How do we Count using Binary?
0
We start at 0
1
Then 1
???
But then there is no symbol for 2 ... what do we do?
In Decimal Systeml how do we count?
0
Start at 0
...
Count 1,2,3,4,5,6,7,8, and then...
9
This is the last digit in Decimal
10
So we start back at 0 again, but add 1 on the left
The same thing is done in Binary
0
Start at 0
1
Then 1
10
Now start back at 0 again, but add 1 on the left
11
1 more
???
But NOW what ... ?
What happens in Decimal?
99
When we run out of digits, we ...
94

100

start back at 0 again, but add 1 on the left

And that is what we do in binary


0
Start at 0
1
Then 1
10
Start back at 0 again, but add 1 on the left
11
100
start back at 0 again, and add one to the number on the left...
But that number is already at 1 so it also goes back to 0 and 1 is added 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
1001
And so on!

4.2.3.

Octal Numbers

Octal is another numbering system with lessdigits to use than our


conventional decimal numbering system. Octal numbers are Base Eight
numbers meaning eight digits are used to represent all the values. They are
0, 1, 2, 3, 4, 5, 6, and 7. When we count up one from the 7, we need a new
placement to represent what we call 8 since an 8 doesn't exist in Octal. So,
after 7 is 10. And the previous method that we have discussed in Binary
Numbers is to follow.
Octal

0 1 2 3 4 5 6 7 10 11

12

17 20

30

77 100

Decima
l

0 1 2 3 4 5 6 7 8

10

15 16

24

63 64

Just like how we used powers of ten in decimal and powers of two in binary,
to determine the value of a number we will use powers of 8 since this is Base
Eight. Example of Octal numbers 36238, 2578etc.

4.2.4.

Hexadecimal Numbers

95

The hexadecimal system is Base Sixteen. As its base suggests, this


numbering system uses sixteen digits to represent numbers. Unlike binary
and octal, hexadecimal has six additional digits that it uses beyond the
conventional ones found in decimal. But what comes after 9? 10 is not a
single digit but two Fortunately, the convention is that once additional
symbols are needed beyond the normal ten, letters are to be used. So, in
hexadecimal, the total list of symbols to use is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,
C, D, E, and F. When counting in hexadecimal, you count 0, 1, 2, and so on.
However, when you reach 9, you go directly to A. Then, you count B, C, D, E,
and F. In other words, A is "ten" in "regular" numbers, B is "eleven", C is
"twelve", D is "thirteen", E is "fourteen", and "F" is fifteen. It is this use of
letters for digits that makes hexadecimal numbers look so odd at first. But
what is next? We are out of symbols! When we run out of symbols, we create
a new digit placement and move on. So after F is 10. You count further until
you reach 19. After 19, the next number is 1A. This goes on forever.
9 A B C D E F 1 11
1 1 1 1C 9F A0
Hexadeci
0
9 A B
mal
9 1 1 1 1 1 1 1 17
2 2 2 28
15 16
Decimal
0 1 2 3 4 5 6
5 6 7
9
0
Digits are explained as powers of 16 as its Base is 16.Example, 11AB 16,
ADF16, 119216 etc.
Exercise:
1. What is Numbering System?
2. Distinguish between binary and decimal numbering system
3. What is Hexadecimal Numbering System
4. Find the base of the following numbers
a. 1610
e. 9610
i.
b. 1816
f. 25A16
j.
c. 1110102
g. 7816
k.
d. 1508
h. 1116
l.

10101008
35608
75710
12316

m.
n.
o. 4.3. Conversion
p. It is important to know that 364 8 is not equal to the 36410. This is
just like how a 102 is certainly not 1010. 102is equal to 210. 108is
96

equal to 810. How on earth do we know this? What is 20 8 or 38F16


and how do we find out? Here is why it is important to
understand how the number systems work. By using base
number and a few techniques, it becomes possible to turn any
number to any number.
q. 4.3.1. Decimal to Any Number

1.
2.
3.

1.
2.
3.

r. In order to convert a decimal number to binary these three steps


are neededDivide the decimal number by the base of the number you want to
convert and take its remainder
The process is repeated until it produces the result of 0
The resulting number is obtained by taking the remainder from the
bottom to the top
s. Example, 5310 to Binary=>53 / 2 = 26 remainder 1
t.
u. => 26 / 2 = 13 remainder 0
v. => 13 / 2 = 6 remainder 1
w. =>6 / 2 = 3 remainder 0
x. =>3 / 2 = 1 remainder 1
y. =>1 / 2 = 0 remainder 1
z. = 1101012 (6 bits) [taking all the remainders from bottom to up
and writing it from left to right]
aa.
For fractions the following steps should be done
Multiply the decimal number by 2 and take 1 or 0 depending on what is
left before decimal point
The process is repeated until it produces the result of 0
The binary number is obtained by taking the 1s or 0s
ab.
Example, 0.8110
ac.=> 0.81 x 2 = 1.62 taking 1
ad.
=>0.62 x 2 = 1.24 taking 1
ae.
=>0.24 x 2 = 0.48 taking 0
af. =>0.48 x 2 = 0.96 taking 0
ag.
=>0.96 x 2 = 1.92 taking 1
ah.
=>0.92 x 2 = 1.84 taking 1
ai. = 0.1100112(Approximate) [taking 1s and 0s from top to bottom
and writing it from left to right]
aj.
ak.
So, Converting 20.2510 will be
al. 20
am.
=> 20 / 2 = 10 remainder 0
an.
=> 10 / 2 = 5 remainder 0
ao.
=> 5 / 2 = 2 remainder 1
ap.
=> 2 / 2 = 1 remainder 0
97

aq.
=> 1 / 2 = 0 remainder 1
ar. =101002
as.And 0.25
at. => 0.25 x 2 = 0.50 taking 0
au.
=> 0.50 x 2 = 1.00 taking 1
av.=0.012
aw.
Thus, 20.2510 = 10100.012
ax.
ay. Exercises:
az.Convert the following numbers to Binary, Octal and Hexadecimal
1. 10.2510
5. 89.9110
9. 45.5510
2. 4.6910
6. 756.1210
10.
87.7910
3. 1008.2410
7. 11.1310
4. 51.3610
8. 48.8310
11.
12.
13.
14.
15.
4.3.2. Any Number to Decimal
16.
In order to convert any number you have to use the formula we
have discussed in Understanding the Base. For the convenience
here is the example for you,
17.
N = anbn + an-1bn-1 + + a1b1 + a0b0
18.
Where:
19.
N: Decimal Equivalent
20.
b: base
21.
ai: i-th digit
22.
so, 100012= 1x24 + 0x23 + 0x22 + 0x21 + 1x20 = 16 + 0 + 0 + 0
+ 1 = 1710
23.
16A16 = 1x162 + 6x161 + A(10)x160 = 256 + 96 + 10 = 36210
24.
7218 = 7x82 + 2x81 + 1x80 = 448 + 16 + 1 = 46510
25.
26.
Exercises:
27.
Convert the following number to Decimal
1. 17816
5. FAF16
9. 1101010102
2. 11011012
6. DEF16
10.
111118
3. 3328
7. 77916
11.
1010.112
4. FFA16
8. 3148
12.
FF.FF16
13.
14.
15.
16.
4.3.3. Binary and Octal
98

17.
Theorem: If base R1 is the integer power of other base, R 2, i.e. R1
d
= R2 e.g.8 = 23. Every group of d digits in R2 (e.g. 3 digits)is equivalent
to 1 digit in the R1 base.
18.
From the theorem, assume thatR1 = 8 (base-8) octal and R 2 = 2
(base-2) binaryfrom the theorem above, R1 = R2d as 8 = 23. So, 3 digits
in base-2 (binary) is equivalent to 1 digit in base-8 (octal).So, in order
to use it in full notion the following table can be created
19.
20.

Binary

21.
l

Octa

22.

000

23.

24.

001

25.

26.

010

27.

28.

011

29.

30.

100

31.

32.

101

33.

34.

110

35.

36.

111

37.

38.
39.
Converting 101112 is like
1. At first make group of three digits starting from the right. If in last the
digits cant be rounded up to three add 0 to the left.
2. Replace each group accordingly with the help of the table
3. Sequence the numbers as the groups are created
40.
So, there will be two groups
41.
010111 replacing each group with their designated value from
table we get 2 7
42.
Thus, 101112 = 278
43.
44.
In the same way if we want to convert 278 then
1. Replace each digit with its equivalent three digits
2. After joining the numbers if any 0s are left at the leftmost erase them
45.
So, 2 is replaced by 010 and 7 is replaced by 111
46.
Thus the number becomes 010111 and removing the leftmost
zero as it bears no value the answer becomes 101112.
47.
48.
Exercise:
99

1. Convert the following numbers to Octal


a. 101112
e. 11112
b. 10101002
f. 11010102
c. 11001012
g. 11111002
d. 111112
h. 10101012
2. Convert the following numbers to Binary
a. 778
e. 1248
b. 6728
f. 1118
c. 4538
g. 758
d. 3318
h. 75.118
k.
l.
m.
n.
o. 4.3.4. Binary and Hexadecimal

i. 101.1102
j. 111.1101
02
i. 9.1348
j. 7.1138

p. Theorem: If base R1 is the integer power of other base, R 2, i.e. R1


= R2de.g.8 = 24. Every group of d digits in R 2 (e.g. 4 digits)is
equivalent to 1 digit in the R1 base.
q. From the theorem, assume thatR1 = 16 (base-16) octal and R 2 =
2 (base-2) binaryfrom the theorem above, R1 = R2d as 8 = 24. So,
4 digits in base-2 (binary) is equivalent to 1 digit in base-16
(hexadecimal).So, in order to use it in full notion the following
table can be created
r. Binary

s. Hex
adec
imal

t. 0000

u. 0

v. 0001

w. 1

x. 0010

y. 2

z. 0011

aa.
3

ab.
100

ac.4

ad.
101

ae.
5

af. 0110

ag.
100

6
ah.
111

2.
3.

1.
2.

ai. 7

aj. 1000

ak.
8

al. 1001

am.
9

an.
010

ao.
A

ap.
011

aq.
B

ar. 1100

as.C

at. 1101

au.
D

av.1110

aw.
E

ax.
111
1.

ay. F

az.
ba.
Converting 10011112 is like
At first make group of four digits starting from the right. If in last the
digits cant be rounded up to three add 0 to the left.
Replace each group accordingly with the help of the table
Sequence the numbers as the groups are created
bb.
So, there will be two groups
bc.
01001111 replacing each group with their designated
value from table we get 4 F
bd.
Thus, 10011112 = 4F16
be.
bf. In the same way if we want to convert 4F16 then
Replace each digit with its equivalent three digits
After joining the numbers if any 0s are left at the leftmost erase them
bg.
So, 4 is replaced by 0100 and F is replaced by 1111
bh.
Thus the number becomes 01001111 and removing the
leftmost zero as it bears no value the answer becomes 10011112.
bi.
101

bj. Exercise:
1. Convert the following numbers to Octal
a. 101112
e. 11112
b. 10101002
f. 11010102
c. 11001012
g. 11111002
d. 111112
h. 10101012
2. Convert the following numbers to Binary
a. 1AF16
e. 14516
b. ABC16
f. 7816
c. DF1216
g. 91516
d. FFF16
h. 1EF3816

i. 101.1102
j. 111.1101
02
i. AF.FFF16
j. 11.BCD16

102

k.
l.

You might also like