💻

Understanding Binary and Decimal Conversions

Apr 23, 2025

Lecture Notes: IP Subnetting and Binary Calculations

Introduction to Binary Numbers

  • Binary System: A numbering system using two digits, 0 and 1.
    • Each digit is called a bit.
    • Byte/Octet: A group of 8 bits.
  • Importance: Essential for understanding IP subnetting and conversions between decimal and binary.

Creating a Binary-Decimal Conversion Chart

  • Chart Construction:
    1. Start with 1 on the right.
    2. Double each subsequent number moving left:
      • 1, 2, 4, 8, 16, 32, 64, 128, etc.
    3. Can extend beyond 128 to 256, 512, etc.
  • Purpose: Used for conversions between binary and decimal.

Binary to Decimal Conversion

  • Example 1: Binary 00000010
    • Conversion chart: 1, 2, 4, 8, 16, 32, 64, 128
    • Only the 2 position has a 1.
    • Sum: 2 (Decimal)
  • Example 2: Binary 10000010
    • 1s in 128 and 2 positions.
    • Sum: 128 + 2 = 130 (Decimal)
  • Example 3: Binary 11111111
    • 1s in all positions.
    • Sum: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 (Decimal)

Decimal to Binary Conversion

  • Example: Decimal 154 to Binary
    • Use conversion chart, starting from the largest value.
    • Check if each value is less than or equal to the remaining decimal number:
      • 128 fits (1), 64 does not (0), 32 does not (0), 16 fits (1), 8 fits (1), 4 does not (0), 2 fits (1), 1 does not (0)
    • Binary result: 10011010

Increasing Bit and Decimal Options

  • Binary Expansion:
    • More bits = more decimal possibilities.
    • Examples:
      • 2 bits: 4 outcomes (00, 01, 10, 11) → Decimal: 0-3
      • 3 bits: 8 outcomes
      • 4 bits: 16 outcomes
      • 5 bits: 32 outcomes
      • 6 bits: 64 outcomes
      • 7 bits: 128 outcomes
      • 8 bits: 256 outcomes
  • Power of Two:
    • Fundamental concept for understanding binary.
    • Examples:
      • 2^0 = 1
      • 2^1 = 2
      • 2^2 = 4
      • 2^3 = 8

Conclusion

  • Mastery of binary-decimal conversions is crucial for IP subnetting.
  • Understanding and using the conversion chart effectively aids in accurate calculations and understanding of network configurations.