ITNE2003 Lab Tutorial 2

ITNE2003 
Install, Configure, Operate and Troubleshoot Medium-Sized Networks 
Lab Tutorial – 2 of Lesson - 2
Victorian Institute of technology

Counting System Tutorial

Base 10 System (Decimal)

To get a good understanding of other number systems, let’s begin with a familiar topic - the base 10 system. In order to represent the base 10 system, we need 10 different symbols. The symbols we use of course are the digits 0 through 9. If we were to write a value using base 10, it would look like the following:

301810

The subscript 10 has been placed on the end of the value so that there is no doubt that we are working with a base 10 value.

Breaking the value apart one digit at a time, the 8 is in the 1s position and is equal to 8 x 100, or simply 8 x 1 (anything to the 0th power is 1); the 1 is in the 10s position and is equal to 1 x 101, or 10; the 0 is in the 100s position and is equal to 0 x 102, or 0 x 100; and the 3 is in the 1000s position and is equal to 3 x 103, or 3 x 1000. Note that starting on the right, the powers start at 0 and increment by 1 for every place we move to the left.

Base 2 System (Binary)

The binary system or base 2 system uses only 2 symbols - 0 and 1. If we were to write a binary number, it might look like the following:

10010101001012

Starting again with the right-most digit, we have a 1 in the 1s position, or 1 x 20 which is equal to 1 x 1; the next digit 0 is in the 2s position and is 0 x 21; the next digit 1 is in the 4s position and is equal to 1 x 22 or 1 x 4; the next digit 0 is in the 8s position and is equal to 0 x 23, or 0 x 8, and so on. Notice how the positions start with 1 on the right-most bit and proceed to double for each next position - 1, 2, 4, 8, 16, 32, 64, 128, and so on. This corresponds to 20, 21, 22, 23, 24, 25, 26, and 27.

Thus, the binary number 100102

is equal to (starting from the left) 16 + 0 + 0 + 2 + 0, or 18 in decimal. The binary number 10111012

is equal to 64 + 0 + 16 + 8 + 4 + 0 + 1, or 93 in decimal.

Base 16 Number System (Hexadecimal)

The binary number system can generate some pretty long strings of 1s and 0s for relatively small equivalent decimal values. For example, decimal 16492 is equal to binary 100000001101100. Many people and computer systems often like to work with a notation that is more compact but still closely resembles binary. One choice is the base 16 number system, or hexadecimal. Following the same thread of logic, the base 16 number system needs 16 symbols. The first ten symbols can be the common digits 0 through 9, but what to use for the remaining six symbols? We will use the symbols A, B, C, D, E, and F. Thus we use the symbols 0 - F, which are equivalent to the following decimal and binaryvalues:

Hexadecimal

Decimal

Binary

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

If we were to write a hexadecimal number as the following:

C 2 A B16

we would have the following equivalent decimal value: C x 163, or 1210 x 4096; 2 x 162, or 2 x 256; A x 161, or 1010 x 16; and B x 160, or 1110 x 1. The resulting decimal value would be 49835.

The neat thing about hexadecimal and binary is how easy it is to translate one form into the other. For example, if we have the hexadecimal value C2AB from above, we can easily convert it to binary by simply replacing each hex digit with the corresponding 4-bit binary equivalent. C = 11002

2 = 00102

  • = 10102
  • = 10112

The resulting binary value would be 1100 0010 1010 10112.

Conversely, to convert a binary value to hexadecimal, simply group the binary number in groups of 4 digits (starting from the right) and convert each 4-digit group into its equivalent hexadecimal value.

For example, the binary value: 111 1000 1010 1001 0011 0101 11002 equals 78A935C16

Conversion from One Number System to Another

We have already seen how to do some number conversions. Binary to hexadecimal and hexadecimal to binary are straightforward. We have also seen how to convert binary to decimal. Start at the right side of the binary number and count in powers of 2. The right-most binary digit is in the 1s position, the next binary digit is in the 2s position, then the 4s position, the 8s position, and so on.

Converting from decimal to binary is also straight-forward. One simple paper and pencil method[1] is to take the decimal number and repeatedly divide it by 2, keeping track of the integer remainder. For example, lets convert the decimal value 57 to binary using this method.

____

  • ) 57

28 with a remainder of 1 (now divide 28 by 2)

14 with a remainder of 0

7 with a remainder of 0

  • with a remainder of 1 1 with a remainder of 1
    • with a remainder of

Now take all the remainders starting with the last one and write your binary number:

  • 1 1 0 0 12

Is this the correct binary value? Check it. The left-most bit equals 32, the next bit equals 16, the next bit equals 8, and the right-most bit equals 1. 32 + 16 + 8 + 1 = 57.

You can also convert decimal to hexadecimal in a similar fashion (repeatedly divide by 16 and keep track of the integer remainders) but it might be easier to convert the decimal number to binary first, then simply convert the binary number to hexadecimal.

Sample Problems

  1. Write the binary equivalent of decimal
  2. Write the binary equivalent of decimal
  3. Write the hexadecimal equivalent of binary
  4. Write the hexadecimal equivalent of binary
  5. Write the decimal equivalent of binary
  6. Write the decimal equivalent of binary
  7. Write the binary equivalent of hexadecimal
  8. Write the binary equivalent of hexadecimal

[1] There are of course calculators that can do all these conversions. But if the calculator is not handy, you should be able to perform simple conversions either in your head or on paper and pencil.