Number System - Exam-Oriented Notes

Number System - Exam-Oriented Notes

1. Introduction to Number Systems

A Computer Number System is a method used to represent numbers within a computer [1]. These systems are crucial for how computers store and process data.

  • Every number in a number system has a base (or radix) [1].
  • Positional Number Systems are primarily employed in computers, where the position of a digit determines its value [1].

Types of Positional Number Systems used in Computers [1]

  • Binary Number System (Base 2): Uses only two digits: 0 and 1. This is the fundamental language of computers.
  • Octal Number System (Base 8) : Uses eight digits: 0-7. It is often used as a shorthand for binary numbers because three binary digits can represent one octal digit.
  • Decimal Number System (Base 10) : This is the everyday number system we use, with digits 0-9.
  • Hexa-Decimal Number System (Base 16) : Uses sixteen symbols: 0-9 and A-F. The letters A, B, C, D, E, F represent decimal values 10, 11, 12, 13, 14, 15 respectively [2]. This system is commonly used in computing for memory addresses and data representation due to its concise representation of binary data (four binary digits represent one hexadecimal digit).

2. Number System Conversions (Key for Exams!)

Mastering conversions between different number systems is essential for competitive exams. The sources heavily emphasize these conversions, including examples for fractional numbers.

2.1. Binary to Decimal Conversion

To convert a binary number to a decimal number, multiply each binary digit by its corresponding power of 2 and sum the results. The powers of 2 start from 20 for the rightmost digit (before the decimal point) and increase for digits to the left [1, 3].

Example 1: Convert (11110)2 to Decimal [1, 3]
Step 1: Write down the binary number: 1   1   1   1   0
Step 2: Assign powers of 2 to each digit from right to left, starting with 20:
        24   23   22   21   20
Step 3: Calculate the value of each power of 2:
        16   8   4   2   1
Step 4: Multiply each binary digit by its corresponding power of 2 and sum:
        (1 * 16) + (1 * 8) + (1 * 4) + (1 * 2) + (0 * 1)
        = 16 + 8 + 4 + 2 + 0
Step 5: Sum the results:
        = (30)10
Thus, (11110)2 = (30)10.

2.2. Decimal to Binary Conversion

There are two main methods for whole numbers:

  1. Repeated Division by 2 : Divide the decimal number repeatedly by 2, noting down the remainders at each step. The binary equivalent is formed by reading the remainders from bottom to top [4].
  2. Using Powers of 2: Identify the largest power of 2 less than or equal to the decimal number, place a '1' in that position, subtract the power, and repeat for the remainder until zero. Place '0' for powers of 2 not used [3, 5].
Example 2: Convert (25)10 to Binary [3, 5]
Using the Powers of 2 method:
Powers of 2: ... 32   16   8   4   2   1
Step 1: The largest power of 2 less than or equal to 25 is 16 (24). So, place 1 under 16.
        16   8   4   2   1
        1
Step 2: Remaining value = 25 - 16 = 9.
Step 3: The largest power of 2 less than or equal to 9 is 8 (23). Place 1 under 8.
        16   8   4   2   1
        1   1
Step 4: Remaining value = 9 - 8 = 1.
Step 5: The largest power of 2 less than or equal to 1 is 1 (20). Place 1 under 1.
        16   8   4   2   1
        1   1   0   0   1   (Place 0 for powers of 2 not used)
Thus, (25)10 = (11001)2.

2.3. Octal to Binary Conversion

To convert an octal number to a binary number, convert each octal digit into its 3-bit binary equivalent [6].

Example 3: Convert (537)8 to Binary [6]
Step 1: Convert each octal digit to its 3-bit binary equivalent:
        5 = 101
        3 = 011
        7 = 111
Step 2: Combine the binary equivalents:
        (101 011 111)2
Thus, (537)8 = (101011111)2.

2.4. Binary to Octal Conversion

To convert a binary number to an octal number, group the binary digits into sets of three starting from the right (add leading zeros if necessary) and then convert each 3-bit group into its octal equivalent [7, 8].

Example 4: Convert (1010111100)2 to Octal [7]
Step 1: Group binary digits into sets of three from right to left (add leading zero to the leftmost group if needed):
        1   010   111   100
Step 2: Convert each group to its octal equivalent:
        001 (for the leftmost '1') = 1
        010 = 2
        111 = 7
        100 = 4
Step 3: Combine the octal digits:
        (1274)8
Thus, (1010111100)2 = (1274)8.

2.5. Hexadecimal to Binary Conversion

To convert a hexadecimal number to a binary number, convert each hexadecimal digit into its 4-bit binary equivalent [2]. Remember the decimal values for A-F: A=10, B=11, C=12, D=13, E=14, F=15 [2].

Example 5: Convert (5AD)16 to Binary [2]
Step 1: Convert each hexadecimal digit to its 4-bit binary equivalent:
        5 = 0101
        A (decimal 10) = 1010
        D (decimal 13) = 1101
Step 2: Combine the binary equivalents:
        (0101 1010 1101)2
Thus, (5AD)16 = (010110101101)2.

2.6. Binary to Hexadecimal Conversion

To convert a binary number to a hexadecimal number, group the binary digits into sets of four starting from the right (add leading zeros if necessary) and then convert each 4-bit group into its hexadecimal equivalent [2].

Example 6: Convert (1010101101001)2 to Hexadecimal [2]
Step 1: Group binary digits into sets of four from right to left (add leading zeros if needed):
        0001   0101   0110   1001
Step 2: Convert each group to its hexadecimal equivalent:
        0001 = 1
        0101 = 5
        0110 = 6
        1001 = 9
Step 3: Combine the hexadecimal digits:
        (1569)16
Thus, (1010101101001)2 = (1569)16.

2.7. Inter-Base Conversions (e.g., Octal to Hexadecimal, Hexadecimal to Octal)

For conversions between Octal and Hexadecimal (or any other non-decimal bases), it is generally easiest to convert to binary as an intermediate step, then from binary to the target base [5, 8].

Example 7: Convert (46)8 to Hexadecimal [5, 8]
Step 1: Convert Octal to Binary (each digit to 3-bit binary):
        4 = 100
        6 = 110
        Combined Binary: (100110)2
Step 2: Convert Binary to Hexadecimal (group into 4-bit sets from right, add leading zeros):
        0010   0110
        0010 = 2
        0110 = 6
Step 3: Combine the hexadecimal digits:
        (26)16
Thus, (46)8 = (26)16.

2.8. Decimal to Octal Conversion

To convert a decimal number to an octal number, perform repeated division by 8. Collect the remainders from bottom to top [4].

Example 8: Convert (1234)10 to Octal [4]
1234 ÷ 8 = 154 with a remainder of 2
154 ÷ 8 = 19 with a remainder of 2
19 ÷ 8 = 2 with a remainder of 3
2 ÷ 8 = 0 with a remainder of 2
Reading remainders from bottom to top yields: (2322)8
Thus, (1234)10 = (2322)8.

2.9. Decimal to Hexadecimal Conversion

To convert a decimal number to a hexadecimal number, perform repeated division by 16. Collect the remainders from bottom to top, using hexadecimal symbols A-F for decimal values 10-15 [9].

Example 9: Convert (1234)10 to Hexadecimal [9]
1234 ÷ 16 = 77 with a remainder of 2
77 ÷ 16 = 4 with a remainder of 13 (which is **'D'** in hexadecimal)
4 ÷ 16 = 0 with a remainder of 4
Reading remainders from bottom to top yields: (4D2)16
Thus, (1234)10 = (4D2)16.

2.10. Octal to Decimal Conversion

To convert an octal number to a decimal number, multiply each octal digit by its corresponding power of 8 and sum the results. The powers of 8 start from 80 for the rightmost digit [10].

Example 10: Convert (125)8 to Decimal [10]
(1 × 82) + (2 × 81) + (5 × 80)
= (1 × 64) + (2 × 8) + (5 × 1)
= 64 + 16 + 5
= (85)10
Thus, (125)8 = (85)10.

2.11. Hexadecimal to Decimal Conversion

To convert a hexadecimal number to a decimal number, multiply each hexadecimal digit (using its decimal equivalent for A-F) by its corresponding power of 16 and sum the results. The powers of 16 start from 160 for the rightmost digit [10, 11].

Example 11: Convert (CAFE)16 to Decimal [10, 11]
C (12)   A (10)   F (15)   E (14)
(12 × 163) + (10 × 162) + (15 × 161) + (14 × 160)
= (12 × 4096) + (10 × 256) + (15 × 16) + (14 × 1)
= 49152 + 2560 + 240 + 14
= (51966)10
Thus, (CAFE)16 = (51966)10.

3. Fractional Number Conversions

3.1. Binary Fraction to Decimal

For the fractional part (digits after the decimal point), multiply each binary digit by its corresponding negative power of 2 (2-1, 2-2, etc.) and sum the results [11-13].

Example 12: Convert (0.1011)2 to Decimal [12]
(1 × 2-1) + (0 × 2-2) + (1 × 2-3) + (1 × 2-4)
= (1 × 0.5) + (0 × 0.25) + (1 × 0.125) + (1 × 0.0625)
= 0.5 + 0 + 0.125 + 0.0625
= (0.6875)10
Thus, (0.1011)2 = (0.6875)10.
Example 13: Convert (1101.1011)2 to Decimal [13]
Convert the whole part (1101)2 = (13)10 (as demonstrated in previous whole number conversions).
Convert the fractional part (0.1011)2 = (0.6875)10 (from Example 12).
Combine: (13.6875)10
Thus, (1101.1011)2 = (13.6875)10.

3.2. Decimal Fraction to Binary

For the fractional part, repeatedly multiply the fractional part by 2. Collect the integer part (0 or 1) before the decimal point at each step. Read the integer parts from top to bottom [14, 15]. Stop when the fractional part becomes 0 or when the desired precision is reached.

Example 14: Convert (0.375)10 to Binary [14, 15]
0.375 × 2 = 0.750   (Integer part: 0)
0.750 × 2 = 1.500   (Integer part: 1)
0.500 × 2 = 1.000   (Integer part: 1)
Reading integer parts from top to bottom: (0.011)2
Thus, (0.375)10 = (0.011)2.
Example 15: Convert (23.15)10 to Binary [14]
Convert the whole part (23)10:
(23)10 = (10111)2.
Convert the fractional part (0.15)10:
0.15 × 2 = 0.30   (Integer part: 0)
0.30 × 2 = 0.60   (Integer part: 0)
0.60 × 2 = 1.20   (Integer part: 1)
0.20 × 2 = 0.40   (Integer part: 0)
0.40 × 2 = 0.80   (Integer part: 0)
0.80 × 2 = 1.60   (Integer part: 1) - The fractional part (0.60) repeats, so the binary representation will be a repeating fraction.
The fractional part is approximately (0.001001...)2.
Combine: (10111.001001...)2.

3.3. Decimal Fraction to Octal (or other bases like Ternary)

Similar to decimal to binary fraction conversion, but multiply by the target base (e.g., 8 for Octal, 3 for Ternary) [10].

Example 16: Convert (0.37)10 to Octal [10]
0.37 × 8 = 2.96   (Integer part: 2)
0.96 × 8 = 7.68   (Integer part: 7)
0.68 × 8 = 5.44   (Integer part: 5)
Reading integer parts from top to bottom: (0.275...)8
Thus, (0.37)10 = (0.275...)8 (for three digits of precision).

4. Binary Arithmetic

The sources explicitly mention Binary Addition Rule and Binary Subtraction Rule [16]. While the subtraction examples provided simplify by converting to decimal for verification [12], a proper understanding of the procedural binary arithmetic rules is crucial for exams.

4.1. Binary Addition Rules

Binary addition follows these simple rules (sum and carry to the next position):

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0 (with a carry of 1)
  • 1 + 1 + 1 (with an incoming carry) = 1 (with a **carry of 1**)
Example 17: Add (1011)2 + (110)2
    1 0 1 1
+     0 1 1 0
-----
    **1 0 0 0 1** (Result)

*Working from right to left:*
1 + 0 = 1 (sum = 1, carry = 0)
1 + 1 = 0 (sum = 0, carry = 1)
0 + 1 + carry(1) = 0 (sum = 0, carry = 1)
1 + 0 + carry(1) = 0 (sum = 0, carry = 1)
The final carry (1) becomes the leftmost digit.
Thus, (1011)2 + (110)2 = (10001)2.

4.2. Binary Subtraction Rules

Binary subtraction follows these rules (difference and borrow from the next position):

  • 0 - 0 = 0
  • 1 - 0 = 1
  • 1 - 1 = 0
  • 0 - 1 = 1 (with a **borrow of 1** from the next higher position, effectively making the current bit 210 or 102)
Example 18: Subtract (1010)2 - (101)2 [12]
(The source provides a shortcut by converting to decimal: 10 - 5 = 5, then converting 5 back to binary: 101. Below is the procedural binary subtraction.)
  1 0 1 0
-   0 1 0 1
-----
    0 1 0 1 (Result)

Working from right to left:
- Rightmost position: 0 - 1. We need to borrow. The '1' at the (21) position becomes '0'. The '0' at (20) becomes '10' (binary for 2). So, 10 - 1 = 1.
- Next position (21): Original '1' became '0'. So, 0 - 0 = 0.
- Next position (22): 0 - 1. We need to borrow. The '1' at the (23) position becomes '0'. The '0' at (22) becomes '10'. So, 10 - 1 = 1.
- Leftmost position (23): Original '1' became '0'. So, 0 - 0 = 0.
Combining the results: (0101)2.
Thus, (1010)2 - (101)2 = (101)2.

5. Conceptual Questions & Key Facts

The sources include conceptual questions that are important for quick recall in exams [2, 17].

  • Hexadecimal Values A-F: A=10, B=11, C=12, D=13, E=14, F=15 [2].
  • Valid Hexadecimal Numbers: Hexadecimal digits range from 0-9 and A-F [17]. Any number containing letters outside this range (e.g., 'G') would be invalid. For example, "BEG" is not a valid hexadecimal number because 'G' is not a hexadecimal digit [17].
  • Largest Two-Digit Hexadecimal Number: This is (FF)16, as 'F' represents the largest single hexadecimal digit [17].
  • Use of Octal Numbers: Octal numbers are often used when binary numbers are too long , providing a more compact representation (since three binary digits equal one octal digit) [17].