Introduction to Positional Notation

By | 2016-09-17

In computing, you will come across various numbering systems such as binary and hexadecimal. These systems are known as positional notation, but with different bases. This guide will explain positional notation and show you how to convert from one system, such as hexadecimal, to another.

Positional Notation

You probably learned this in elementary school, but understanding how this works is important. The decimal system is a positional notation system with a base of 10. The base is how many numerals (the symbols representing numbers) there are in the system. Decimal has 10 numerals, 0 through 9. The binary system is base 2, and has two numerals, 0 and 1. Each position in a number has a place value that is determined by its relative position and its base For example the number 1 in binary and decimal mean the same thing. The number 10 does not. 10 in binary is 2 in decimal. 100 in binary is 4 in decimal. Notice how in binary that each place value is twice the value of the one to the right of it. Each place value is a multiple of its base. The table below should clarify this. The values in each row are the decimal value of the number in the top row. Notice how each place is a multiple of the base.

Number: 1000 100 10 1
Base 2 Value: 8 4 2 1
Base 10 Value: 1000 100 10 1
Base 16 Value: 4096 256 16 1

Converting to Decimal

Each place in any base is converted to decimal by multiplying each digit’s decimal value by the digit multiplied its place value. The place value is calculated by taking the base to the power of its position. Start with the far right position and an exponent of 0. Add one to the exponent as you move left. Once you are done multiplying all the digits by the place values, add them all up to get the decimal version. Let’s work through some examples.

Binary to Decimal Example

Let’s convert the four digit binary number to decimal:

1011

Step 1: Calculate the place values

There are four digits, so we have four place values: 20, 21, 22, and 23.

20 = 1       21 = 2       22 = 4       23 = 8

Step 2: Multiply each digit by it’s corresponding place value

1 x 8 = 8       0 x 4 = 0       1 x 2 = 2       1 x 1 = 1

Step 3: Add up the result

8 + 0 + 2 + 1 = 11

This table below should help clarify the relationship between the digits and place values.

1 0 1 1
23 = 8 22 = 4 21 = 2 20 = 1
1 x 8 = 8 0 x 4 = 0 1 x 2 = 2 1 x 1 = 1

Hexadecimal to Decimal Example

Now let’s convert a hexadecimal number to decimal:

2B40

Step 1: Calculate the place values

160 = 1       161 = 16       162 = 256       163 = 4096

Step 2: Multiply each digit by it’s corresponding place value

2 x 8192 = 4096       B (11) x 256 = 2816       4 x 16 = 64       0 x 1 = 0

Step 3: Add up the result

8192 + 2816 + 64 + 0 = 11072

2 B 4 0
23 = 4096 22 = 256 21 = 16 20 = 1
2 x 4096 = 8192 B (11) x 256 = 2816 4 x 16 = 64 0 x 1 = 0

Converting from Decimal

Method 1: Use Target Numbering System

The examples above can work if you don’t mind doing the operations in the numbering system you are converting to. For example, I will convert 123 in decimal to binary.

Notice how in the table the place values and exponents are in binary.

1 2 3
101010 = 1100100 10101 = 1010 10100 = 1
1 x 1100100 = 1100100 2 (10) x 1010 = 10100 3 (11) x 1 = 11

1100100 + 10100 + 11 = 1111011

Like most humans, I prefer to work in decimal, so I am going to show you a different way to do this.

Method 2: Divide by Place Values

Let’s convert 123 to binary again.

Step 1: Calculate Place Values

Find the place values of the target numbering system until you exceed the value you are converting:

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

Step 2: Drop the Largest Calculated Place Value

In this case, it is 27 = 128.

Step 3: Divide by the Place Values

Take the decimal number and divide it by the value of the largest place value. Find the remainder instead of any fractional values. The whole number portion is is the most significant digit of your number in the target system. Take the remainder and divide it by the next largest place value. Keep doing this until you run out of place values.

123 / 64 = 1 remainder 59
59 / 32 = 1 remainder 27
27 / 16 = 1 remainder 11
11 / 8 = 1 remainder 3
3 / 4 = 0 remainder 3
3 / 2 = 1 remainder 1
1 / 1 = 1 remainder 0

Result: 1111011

Method 2: A Hexadecimal Example

Let’s convert 123 to hexadecimal using method 2.

160 = 1       161 = 16       162 = 256

123 / 16 = 7 remainder 11
11 / 1 = 11 (B) remainder 0

Result: 7B

Shortcuts

There are a few shortcuts that make converting between certain numbering systems a lot easier.

Hexadecimal to/from Binary

A hexadecimal digit can be represented by four binary digits. Use this to your advantage when converting between hexadecimal and binary.

Hexadecimal to Binary

Let’s convert F70A3021 to binary.

Starting with the most significant digit, convert each digit to a four digit binary number and concatenate the results. I usually convert the hexadecimal value to decimal, then the decimal to binary. I have done it enough where I can do it in my head, so it doesn’t take me very long. You could also memorize the binary values for each hexadecimal digit.

F = 1111
7 = 0111
0 = 0000
A = 1010
3 = 0011
0 = 0000
2 = 0010
1 = 0001

Result: 1111 0111 0000 1010 0011 0000 0010 0001

Binary to Hexadecimal

Let’s convert 10110100101 to hexadecimal.

This shortcut is pretty much the same as hexadecimal to binary, just the opposite conversion.

For convenience purposes, break the decimal number into groups of four, starting with the least significant digit. When using pen and paper, I just draw a line between the groups of four digits.

101 1010 0101

Now convert each group of digits to hexadecimal and concatenate them.

101 = 5
1010 = A
0101 = 5

Result: 5A5

Octal to/from Binary

Octal to Binary

This works the same way as hexadecimal to binary. Instead of four binary digits representing a hexadecimal digit, you can represent an octal digit with three binary digits. Let’s convert the octal number 547 to binary.

5 = 101
4 = 100
7 = 111

Result: 101100111

Binary to Octal

As with binary to hexadecimal, divide the binary number into sections, starting with the least significant digit. Instead of four digit sections, use three digit sections. Let’s convert 11110101001 to octal.

11 110 101 001

11 = 3
110 = 6
101 = 5
001 = 1

Result: 3651

Helpful Resources

The calculators in most desktop environments can convert common number systems for you. This article shows you where it is in Windows. Just enter the number, then click the radio buttons towards the left next to convert between bases.

number.webmasters.sk has a handy web based tool that converts between various number systems for you.

Wikipedia has an interesting page on positional notation.
Purple Math has a series of guides covering number bases that might be helpful.

Discuss