This Unit

Resources

Lecture Material

 

     Lecture Notes

Number Systems

The electronic components used in computer systems can usually be in one of two physical states which can be represented by a number 0 or 1.  These are also the numbers of the binary system.  This is why it is convenient for a computer to use the binary number system, rather than the more familiar denary number system.  The hexadecimal and octal number systems are also commonly used in computer systems.   These notes look at the binary and hexadecimal number systems in more detail.

Binary Number System

Hexadecimal Number Systems


Number Base and Place Value

    Number Base

The denary number system has ten symbols, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.  The binary system only has two symbols, 0 and 1.  The base of a number system is the number of different symbols it uses.  Thus, the denary system is also referred to as base 10 and the binary number system as base 2.

    Place Value

The position of a number symbol in relation to other number symbols is very important.  The value of a symbol entirely depends on it's position.  This is referred to as place value.  In the denary system, each place is weighted by a power of ten.  We have 100 which is units, 101 which is tens, 102 which is hundreds and so on.  Let's illustrate this idea with a table.

103 102 101 10 . 10-1 10-2  10-3
thousands hundreds tens units decimal point tenths hundredths thousandths 

1

2

3

4

4 3 2 1
1 2 3

The number 123410 can be expresses as 1 thousand + 2 hundreds + 3 tens +  4 units.  

This is an entirely different number value to 432110 which is 4 thousands + 3 hundreds + 2 tens + 1 unit.  So symbol position is all important.  

What about 0.123.  This can be expressed as no units + 1 tenth + 2 hundredths + 3 thousandths or 0 + 1/10 + 2/100 + 3/1000.

Note: 100 is actually equal to 1.  Any number raised to the power of 0 is equal to 1.  The fractional part of a number is also determined by place value, except the power is a negative number, e.g. 10-1 means tenths.

        

Now, what about other number systems?  

The binary number system has two symbols, 0 and 1  

A binary number such as 102 also has a value depending upon the positioning of the symbols.  Now however, each place is weighted by a power of two and not a power of ten like the denary system.  We have 20 which is units, 21 which is twos, 22 which is fours and so on.  A place value table for the binary system would look like...

23 22 21 2 . 2-1 2-2  2-3
8 4 2 1 decimal point half quarter eighth 

1

0

So, the binary number 102 means 1 two + 0 units.  

You should note the binary number 102 is definitely not the same as the number 1010 in the denary system.  We will see how to convert a number such as 102 to denary later on.

~Now try the activity~

Activity A

  1. Add four more columns to the left of the place value table and write in the correct powers of two.

  2. We know that  23 = 2 * 2 * 2 = 8.  Convert the following powers of 2 in the same way

  1. 24,25,26,27

  1. Add the values calculated in 2a. to your column headings.

  2. Place the following in the correct position in your binary table

    1. 1 sixty four + 1 eight + 1 unit

    2. 1 one hundred and twenty eight + 1 eight + 1 unit

What about the hexadecimal number system?  

The hexadecimal number system has sixteen symbols; I will list them later.  So the base of the hexadecimal system is 16.  Thus, each place is weighted by a power of sixteenA place value table for the hexadecimal system would look like...

163 162 161 16 . 16-1 16-2  16-3
4096 256 16 1 decimal point sixteenth 1/256 1/4096 

1

0

So, the hexadecimal number 1016 means 1 sixteen +  0 units.  

Again, this number 1016 is not the same as the number 1010 in the denary system.  We will see how to convert the number to denary later on.

~Now try the activity~

Activity B

  1. Draw up a place value table for the octal number system

  2. Place the following in the correct position in your octal table

  1. 5 sixty fours + 2 eights + 3 units

  2. 7 five hundred and twelve's + 3 eights + 6 units

   

Binary Number System

The binary symbols are 1 and 0.   Each digit in a binary system is known as a binary digit or bit.  An example of a binary number is 101102.  

We have already looked at a place value table for the binary number system.  Let's have another look. The table below is similar to the previous table but I have left out fractional place values and extended the left place values.

27 26 25 24 23 22 21 2
128 64 32 16 8 4 2 1

1

0

1

1

0

    Binary to Denary Conversion

How do we converting a number such as 101102 to denary?  

Well 101102 is equivalent to 1×16 + 0×8 +1×4 + 1×2 + 0×1.  Which is 16 + 4 + 2 = 2210.  

So to convert a binary number to denary, all we do is multiply each binary digit by it's place value and add them all together.

Here are a few more examples.

011011012 = 0×128 + 1×64 + 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 = 64 + 32 + 8 + 4 + 1 = 10910

100100012 = 1×128 + 0×64 + 0×32 + 1×16 + 0×8 + 0×4 + 0×2 + 1×1 = 128 + 16 + 8 + 1 = 15310

00011102 = 0×128 + 0×64 + 0×32 + 1×16 + 1×8 + 1×4 + 1×2 + 0×1 = 16 + 8 + 4 + 2 = 3010

~Now try the activity~

Activity C

  1. Convert the following binary numbers to denary

  1. 11001012

  2. 01110002
  3. 00011012
  4. 110000012

    Denary to Binary Conversion

How do we convert a denary number to binary?  

There are a few ways of doing this.  The simplest way is to use the binary place value table.

As an example, suppose we want to convert as 1210 to binary?  

Looking at the place value table, the nearest place value less than or equal to 12 is 8.  So we can write a 1 below this place value.  

However, 12 minus 8 leaves a remainder of 4.   The nearest place value less than or equal to 4 is 4.  So we can write a 1 below this place value too.   There is no remainder.  

Now we have to fill in any empty place values with zeros, except those to the left of the leftmost digit 1 .  

So, 1210 is equivalent to 11002 

27 26 25 24 23 22 21 2
128 64 32 16 8 4 2 1

1

1

0

0

= 1210

Here is another example.  Let's convert 6510 to binary?  

Looking at the place value table, the nearest place value less than or equal to 67 is 64.  So we can write a 1 below this place value.  

However, 67 minus 64 leaves a remainder of 3.   The nearest place value less than or equal to 3 is 2.  So we can write a 1 below the 2 place value.   

Now 3 minus 2 leaves a remainder of 1.  The nearest place value less than or equal to 1 is 1.  So we can write a 1 below this place value.  

Now we have to fill in any empty place values with zeros, except those to the left of the leftmost digit 1 .  

So, 6710 is equivalent to 10000112 

27 26 25 24 23 22 21 2
128 64 32 16 8 4 2 1

1

0

0

0

0

1

1

= 6710

~Now try the activity~

Activity D

  1. Convert the following denary numbers to binary

  1. 12910

  2. 4010
  3. 10110
  4. 25310

  1. Extend the following table to include the denary numbers 2 to 9 and the binary equivalents.

Base10 Base2
0 0000
1 0001

 


Hexadecimal Number System

The hexadecimal number system has a base of sixteen.  There are 16 symbols.  These are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.  The six letters A to F are used instead of the denary numbers 10 to 15. 

So, how do we convert a hexadecimal number to denary and binary?

    Hex to Denary Conversion

Suppose we have the hexadecimal number 3A16.

161

16
16 1

3

A

Well 3A16 is equivalent to 3×16 + A×1.  Which is 48 + (10×1) = 5810.  

So to convert a hexadecimal number to denary, all we do is multiply each hexadecimal digit by it's place value and add them all together.

Here are a few more examples.

B316 = B×16 + 3×1 = (11×16) + 3 = 17910

5F16 = 5×16 + F×1 = 80 + 15 = 9510

CD16 = C×16 + D×1 = 12×16 + 13×1 = 8510

~Now try the activity~

Activity E

  1. Convert the following hexadecimal numbers to denary

  1. AB16

  2. 5E16
  3. C016
  4. FF16

    Denary to Hex Conversion

How do we convert a denary number to hexadecimal?  Using a place value table, this is similar to converting a denary number to binary.  

As an example, suppose we want to convert as 3510 to hexadecimal?  

Looking at the place value table, the nearest place value less than or equal to 35 is 1635 divided by 16 is 2 leaving a remainder of 3.  So we can write a 2 below the place value of 16.  

Now, considering the remainder of 3.  The nearest place value less than or equal to 3 is 1.  Since we need 3 amounts of 1 we can write a 3 below the place value of 1.   There is no remainder.  

So, 3510 is equivalent to 2316 

161

16
16 1

2

3

= 3510

~Now try the activity~

Activity F

  1. Convert the following denary numbers to hexadecimal

  1. 12910

  2. 4010
  3. 10110
  4. 25310

  1. Extend the following table to include the hexadecimal numbers 2 to F and the binary equivalents.

Base16 Base2
0 0000
1 0001

  Why bother with Hexadecimal?

Quite often it is convenient for programmers to write a computer's binary code in octal or hexadecimal.  Converting octal or hexadecimal numbers to binary is easier than converting denary to binary.  Hexadecimal is used in preference to octal because computers organise memory in groups of 8 bits (bytes) and these can be conveniently divided into groups of four bits (nibbles).  

Four bits is easily coded in hexadecimal form.

 


That's it!!

 

 Site Home

Unit Home  

This Unit 

Unit Information

Overview

Assessment

Syllabus

Assignments

Scheme of Work

Resources

Information

Blackboard

Learning Center

Reading

Utilities

Links

Lecture Materials

Tutorials & Notes

Activities

Quizzes

Site Home Top Unit Home

ADR 2002