Number Systems
Understanding Decimal, Hexadecimal, Octal, and Binary number systems
Introduction to Number Systems
A number system is a method of representing numbers using a set of symbols and rules. Different number systems use different bases (also called radixes) to represent values. The base of a number system determines how many unique digits are available and how positions are valued.
The most common number systems in mathematics and computing are:
- Decimal (Base 10): Used in everyday mathematics and commerce
- Binary (Base 2): Foundation of all digital computers
- Octal (Base 8): Used in Unix file permissions and legacy systems
- Hexadecimal (Base 16): Used in programming and color codes
Each digit's position in a number system represents a power of the base. For example, in decimal (base 10), the number 325 means \(\displaystyle 3 \times 10^2 + 2 \times 10^1 + 5 \times 10^0\).
Decimal Number System (Base 10)
The decimal system is the most familiar number system used in everyday life. It uses base 10, meaning each position represents a power of 10.
The decimal system uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 to represent all numbers. Each position has a value that is a power of 10.
Decimal Place Values
\(\displaystyle 1000s = 10^3\), \(\displaystyle 100s = 10^2\), \(\displaystyle 10s = 10^1\), \(\displaystyle 1s = 10^0\)
Example: Decimal Breakdown
The decimal number 4527 can be written as:
\(\displaystyle 4527 = 4 \times 10^3 + 5 \times 10^2 + 2 \times 10^1 + 7 \times 10^0\)
\(\displaystyle = 4000 + 500 + 20 + 7\)
Decimal numbers can also represent fractional values using a decimal point. For example, \(\displaystyle 45.27 = 4 \times 10^1 + 5 \times 10^0 + 2 \times 10^{-1} + 7 \times 10^{-2}\).
Binary Number System (Base 2)
The binary system is the foundation of all modern digital computers and electronic devices. It uses only two digits: 0 and 1.
The binary system uses only the digits 0 and 1 to represent all numbers. Each position represents a power of 2. Each binary digit is called a bit.
Binary Place Values
\(\displaystyle 2^7 = 128\), \(\displaystyle 2^6 = 64\), \(\displaystyle 2^5 = 32\), \(\displaystyle 2^4 = 16\), \(\displaystyle 2^3 = 8\), \(\displaystyle 2^2 = 4\), \(\displaystyle 2^1 = 2\), \(\displaystyle 2^0 = 1\)
Example: Binary to Decimal Conversion
The binary number 1011 in decimal:
\(\displaystyle 1011_2 = 1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0\)
\(\displaystyle = 8 + 0 + 2 + 1 = 11_{10}\)
Applications of Binary
- Computer Architecture: All data in computers is stored and processed as binary
- Logic Gates: Digital circuits use binary (on/off, true/false)
- Network Protocols: IP addresses and data transmission use binary representations
- Memory Storage: Bits are the fundamental unit of computer memory
Octal Number System (Base 8)
The octal system uses base 8 and was historically important in computing, though it is less common today than hexadecimal.
The octal system uses the digits 0, 1, 2, 3, 4, 5, 6, 7 to represent numbers. Each position represents a power of 8.
Octal Place Values
\(\displaystyle 8^3 = 512\), \(\displaystyle 8^2 = 64\), \(\displaystyle 8^1 = 8\), \(\displaystyle 8^0 = 1\)
Example: Octal to Decimal Conversion
The octal number 752 in decimal:
\(\displaystyle 752_8 = 7 \times 8^2 + 5 \times 8^1 + 2 \times 8^0\)
\(\displaystyle = 7 \times 64 + 5 \times 8 + 2 \times 1 = 448 + 40 + 2 = 490_{10}\)
Applications of Octal
- Unix File Permissions: Octal notation for read/write/execute permissions (e.g., 755)
- Legacy Systems: Used in older computer architectures
- Binary Grouping: Each octal digit represents exactly 3 binary digits
Each octal digit corresponds to 3 binary digits. For example, binary 101110 = octal 56 (because 101 = 5 and 110 = 6).
Hexadecimal Number System (Base 16)
The hexadecimal system (often called "hex") uses base 16 and is widely used in programming, web design, and computer science.
The hexadecimal system uses sixteen symbols: 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15). Each position represents a power of 16.
Hexadecimal Digits
0 1 2 3 4 5 6 7 8 9 A(10) B(11) C(12) D(13) E(14) F(15)
Hexadecimal Place Values
\(\displaystyle 16^3 = 4096\), \(\displaystyle 16^2 = 256\), \(\displaystyle 16^1 = 16\), \(\displaystyle 16^0 = 1\)
Example: Hexadecimal to Decimal Conversion
The hexadecimal number 2AF in decimal:
\(\displaystyle 2AF_{16} = 2 \times 16^2 + A \times 16^1 + F \times 16^0\)
\(\displaystyle = 2 \times 256 + 10 \times 16 + 15 \times 1 = 512 + 160 + 15 = 687_{10}\)
Applications of Hexadecimal
- Color Codes: Web colors are represented as hex (e.g., #FF5733)
- Memory Addressing: Computer memory addresses use hexadecimal
- Programming: Assembly language and low-level programming
- Data Representation: Compact representation of binary data
- MAC Addresses: Network device addresses use hex notation
Each hexadecimal digit corresponds to exactly 4 binary digits. For example, binary 11011110 = hex DE (because 1101 = D and 1110 = E).
Number System Comparison
| System | Base | Digits Used | Decimal Example | Representation |
|---|---|---|---|---|
| Decimal | 10 | 0-9 | \(255\) | \(255_{10}\) |
| Binary | 2 | 0-1 | 255 (decimal) | \(11111111_2\) |
| Octal | 8 | 0-7 | 255 (decimal) | \(377_8\) |
| Hexadecimal | 16 | 0-9, A-F | 255 (decimal) | \(FF_{16}\) or 0xFF |
Number System Conversions
Conversion Examples
Decimal to Binary
2510
Divide repeatedly by 2:
25 ÷ 2 = 12 r 1
12 ÷ 2 = 6 r 0
6 ÷ 2 = 3 r 0
3 ÷ 2 = 1 r 1
1 ÷ 2 = 0 r 1
Result: 110012
Decimal to Hexadecimal
25510
Divide repeatedly by 16:
255 ÷ 16 = 15 r 15
15 ÷ 16 = 0 r 15
15 = F in hex
Result: FF16
Binary to Hexadecimal
110101102
Group by 4 bits:
1101 = D
0110 = 6
Result: D616
Common Mistakes to Avoid
WRONG: Writing 101 without specifying if it's binary or decimal ✗
RIGHT: Specify the base: \(101_2 = 5_{10}\) or \(101_{10}\) ✓
WRONG: Using the digit 8 in octal (octal only has 0-7) ✗
RIGHT: Octal uses only digits 0-7 ✓
WRONG: \(1010_2 = 10_{10}\) (forgot to use powers of 2) ✗
RIGHT: \(1010_2 = 1×2^3 + 0×2^2 + 1×2^1 + 0×2^0 = 10_{10}\) ✓
|
|