# Digital Number Systems - Introduction

We will review the following 4 widely used number systems:
Decimal Number System (base-10)
Binary Number System (base-2)
Octal Number System (base-8)
Hexadecimal Number System (base-16)

## Decimal Number System

In our everyday life we use decimal number system.

Its base is 10 because decimal number system has 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

Example: 1510, 16210, 201310, 254.6510, 12.1234510 etc.

### We have used 10 as subscript to define that it is a base-10 number system.

#### Explanation:

Let's take a number 2013
Position (basepower) ->
Thousands (103)
Hundreds (102)
Tens (101)
Ones (100)
Number ->2013

Now we will rewrite the number by taking each digit and their corresponding positions.
(2 x 103) + (0 x 102) + (1 x 101) + (3 x 100)
= 2000 + 0 + 10 + 3
= 2013

Another example: -12.345
Position (basepower) ->
|
Tens (101)
|
Ones (100)
|
Tenths (10-1)
|
Hundredths (10-2)
|
Thousandths (10-3)
Number ->
|
1
|
2|3
|
4
|
5

Let's rewrite the number again by taking each digit and their corresponding positions.
-[ (1 x 101) + (2 x 100) + (3 x 10-1) + (4 x 10-2) + (5 x 10-3) ]
= -[ 10 + 2 + 0.3 + 0.04 + 0.005 ]
= -12.345

## Binary Number System

Its base is 2 because binary number system has only 2 digits: 0, 1.

Computers use binary number system because it can read/store data using ON/OFF charge.

Example: 102, 1112, 10112, 1101.0012 etc.

## Octal Number System

Its base is 8 because octal number system has 8 digits: 0, 1, 2, 3, 4, 5, 6, 7.

When a word consists of a number of bits divisible by 3, for example in an ancient system of 18-bits word size or 9-bits word size, or for a UNIX file permission, octal number system is used.

Example: 108, 1118, 10568, 2734.0778 etc.

## Hexadecimal Number System

Its base is 16 because hexadecimal number system has 10 digits and 6 letters (total 16 characters): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
The decimal representation of the last 6 hexadecimal characters are: A16 = 1010, B16 = 1110, C16 = 1210, D16 = 1310, E16 = 1410, F16 = 1510.

When a word consists of a number of bits divisible by 4, hexadecimal number system is used. In reality it is widely used by computer scientists and programmers because it is a more human-friendly representation of a binary-coded value.

Example: 1016, 1A9F16, DE75.CB16 etc.