IT Essentials Lecture 3: Number Systems
Introduction to Numbering Systems
Definition: A numbering system is a way to represent numbers in different bases.
Common Systems:
- Binary (Base-2)
- Octal (Base-8)
- Decimal (Base-10)
- Hexadecimal (Base-16)
Decimal Number System (Base-10)
- Digits Used:
0~9 - Structure: Each digit represents a power of 10.
- Example: Decimal
527 - Usage: Standard system used in everyday life for counting and arithmetic.
Decimal to Binary Conversion Example
To convert a decimal number to binary:
- Divide the number by 2.
- Write down the quotient and remainder.
- Repeat with the quotient until it reaches 0.
- The binary number is the remainders read in reverse order.
Example: Convert Decimal 13 to Binary
remainder 1remainder 0remainder 1remainder 1
Binary: 1101
Binary Number System (Base-2)
- Digits Used:
0,1 - Structure: Each digit in a binary number represents a power of 2, with the rightmost digit representing
, the next , and so on. - Example: Convert Binary
101to Decimal. - Usage: Binary is essential for computers, as digital circuits operate in two states (on/off).
Binary Positional Notation
- Definition: Positional notation means each digit represents a different value depending on its position.
- Example Calculation:
- Binary Number:
1100 0000 - Calculation:
- Binary Number:
Hexadecimal Number System (Base-16)
- Digits Used:
0~9,A=10,B=11,C=12,D=13,E=14,F=15 - Structure: Each digit represents a power of 16.
- Usage: Widely used in programming, particularly for color codes in web design (e.g.,
#FF5733) and memory addresses.
Octal Number System (Base-8)
- Digits Used:
0~7 - Structure: Each digit represents a power of 8.
- Historical Context: Used as a shorthand for binary in computing, though hexadecimal is more common today.
Conversions Between Number Systems
Binary to Decimal Conversion
- Each binary digit represents a power of 2.
- Multiply each binary digit by its positional power of 2 and add the results.
Decimal to Binary Conversion: Subtraction Method
- Start with the largest power of 2 less than or equal to the number.
- Subtract that power of 2, write a
1in its position. - If the power of 2 is greater than the remainder, write
0.
Example: Convert Decimal 168 to Binary:
-> 1in128position.-> 1in32position.-> 1in8position.
Binary: 1010 1000
Decimal to Octal Conversion
- Divide the decimal number by 8.
- Write down the remainder.
- Repeat until the quotient is 0.
- Read the remainders in reverse order.
Example: Convert Decimal 65 to Octal:
Remainder 1 Remainder 0 Remainder 1
Octal: 101
Decimal to Hexadecimal Conversion
- Divide by 16.
- Record quotient and remainder.
- Continue dividing until quotient is 0.
- Convert remainders above 9 to hexadecimal digits (e.g., 10 = A).
Example: Decimal 255 to Hexadecimal:
Remainder 15 (F) Remainder 15 (F)
Hexadecimal: FF
Octal to Binary Conversion
- Convert each octal digit to its 3-digit binary equivalent.
Example: Octal 57 -> Binary 101 111.
Binary to Octal Conversion
- Group binary digits into sets of three from the right.
- Convert each group to its octal equivalent.
Example: Binary 110 101 011 -> Octal 653.
Hexadecimal to Binary Conversion
- Convert each hexadecimal digit to its 4-bit binary equivalent.
Example: Hexadecimal 2A3 -> Binary 0010 1010 0011.
Binary to Hexadecimal Conversion
- Group binary digits into sets of four.
- Convert each group to hexadecimal.
Example: Binary 0001 1010 1101 -> Hexadecimal 1AD.
Summary
- Binary: A base-2 system using
0and1, essential for computing. - Decimal: Base-10 system, standard in everyday life.
- Hexadecimal: Base-16, using
0~9andA~F, used in IPv6 and MAC addresses. - Conversions:
- Binary <-> Decimal <-> Hexadecimal: Often requires intermediate binary representation.
- Decimal <-> Octal <-> Hexadecimal: Follow division methods or positional notation.