Binary Math

Feb 19, 2025

Lecture on IP Subnetting and Binary Calculations

Introduction to Binary

  • Binary uses two numbers: 0 and 1.
  • Each 0 or 1 is known as a bit.
  • Byte consists of 8 bits, sometimes called an octet.

Conversion Chart for Binary to Decimal

  • Important for converting between binary and decimal.
  • Start with 1 on the right, and double moving left:
    • 1, 2, 4, 8, 16, 32, 64, 128, etc.
  • Useful for binary to decimal conversions.

Binary to Decimal Conversion Examples

Example 1: Binary 00000010

  • Conversion chart: 1, 2, 4, 8, 16, 32, 64, 128
  • Only binary 1 in column 2, so 2 in decimal.
  • Result: 2 in decimal.

Example 2: Binary 10000010

  • Conversion chart used.
  • Binary 1s in columns 128 and 2.
  • Sum: 128 + 2 = 130 in decimal.

Example 3: Binary 11111111

  • All positions have binary 1.
  • Sum: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255 in decimal.

Decimal to Binary Conversion Example

Example: Decimal 154

  • Start with a conversion chart.
  • Determine positions of binary 1 by checking column sums:
    • 128 is less than 154: binary 1.
    • 128 + 16 (144) is less than 154: binary 1.
    • 128 + 16 + 8 (152) is less than 154: binary 1.
    • 128 + 16 + 8 + 2 = 154: binary 1.
  • Result: 10011010 in binary.

Understanding Binary Length and Decimal Range

  • With 8 bits, can convert numbers from 0 to 255.
  • More bits increase possible decimal options:
    • 2 bits: 4 outcomes (0, 1, 2, 3)
    • 3 bits: 8 outcomes
    • 4 bits: 16 outcomes
    • 5 bits: 32 outcomes
    • 6 bits: 64 outcomes
    • 7 bits: 128 outcomes

Powers of Two

  • Each binary place represents a power of two:
    • $2^0 = 1$
    • $2^1 = 2$
    • $2^2 = 4$
    • $2^3 = 8$, etc.
  • Increasing the power increases the maximum decimal value.

Conclusion

  • Understanding binary and its conversions is crucial for IP subnetting and network calculations.
  • Practice converting to solidify understanding of binary and decimal relationships.