Binary Values and Number Systems

Section 1: Introduction

Module Goals

  • Distinguish among categories of numbers
  • Describe positional notation
  • Convert numbers in other bases to base 10
  • Convert base-10 numbers to numbers in other bases
  • Describe the relationship among bases 2, 8, and 16
  • Explain the importance to computing of bases that are powers of 2

This module aims to provide a thorough understanding of binary values and number systems. By the end of this module, you will be able to distinguish between different categories of numbers, understand and apply positional notation, and perform conversions between various number bases. Additionally, you will learn about the significance of bases that are powers of 2 in computing.

Section 2: Categories of Numbers

Natural Numbers

Natural numbers are zero and any number obtained by repeatedly adding one to it. They are the most basic category of numbers and are used for counting.

Examples:

  • 100 (one hundred)

  • 0 (zero)

  • 45645 (forty-five thousand six hundred forty-five)

  • 32 (thirty-two)

Natural numbers are often denoted by the symbol \(\mathbb{N}\).

Negative Numbers

Negative numbers are values less than 0, indicated with a minus sign. They represent quantities that are less than nothing, often used in contexts like temperature, financial debt, and elevations below sea level.

Examples:

  • -24 (negative twenty-four)

  • -1 (negative one)

  • -45645 (negative forty-five thousand six hundred forty-five)

  • -32 (negative thirty-two)

Negative numbers are essential in various real-world applications, such as representing losses or deficits.

Integers

Integers include all natural numbers and their negative counterparts. They do not include fractions or decimals, making them whole numbers that can be positive, negative, or zero.

Examples:

  • 249 (positive integer)

  • 0 (zero, which is neither positive nor negative)

  • -45645 (negative integer)

  • -32 (negative integer)

Integers are denoted by the symbol \(\mathbb{Z}\).

Rational Numbers

Rational numbers are numbers that can be expressed as the quotient or fraction of two integers, where the numerator is an integer and the denominator is a non-zero integer. They include integers, finite decimals, and repeating decimals.

Examples:

  • -249 (an integer, which is also a rational number)

  • -1 (an integer, which is also a rational number)

  • 0 (an integer, which is also a rational number)

  • \[\frac{3}{7}\] (a fraction, which is a rational number)

  • \[\frac{-2}{5}\] (a negative fraction, which is a rational number)

  • 0.75 (a finite decimal, which is a rational number)

  • 0.333… (a repeating decimal, which is a rational number)

Rational numbers are denoted by the symbol \(\mathbb{Q}\).

Irrational Numbers

Irrational numbers cannot be expressed as a simple fraction. They have non-repeating, non-terminating decimal expansions. These numbers are often encountered in geometry, such as the length of the diagonal of a square or the circumference of a circle.

Examples:

  • \[\pi \approx 3.14159\] (the ratio of the circumference of a circle to its diameter)

  • \[\sqrt{2} \approx 1.41421\] (the length of the diagonal of a square with side length 1)

  • \[e \approx 2.71828\] (the base of the natural logarithm)

  • \[\phi \approx 1.61803\] (the golden ratio)

Irrational numbers are denoted by the symbol \(\mathbb{I}\).

Section 3: Positional Notation

Concept of Positional Notation

Positional notation is a method of representing or encoding numbers. The position of each digit in a number determines its value. This system is also known as place-value notation.

In positional notation, the value of a digit is determined by:

  1. The digit itself.

  2. The position of the digit in the number.

  3. The base of the number system.

Base 10 Example

In the decimal system (base 10), each position represents a power of 10. For example, the number 642 in base 10 can be expanded as:

\[ 642_{10} = 6 \times 10^2 + 4 \times 10^1 + 2 \times 10^0 \]

Breaking it down:

  • \(6 \times 10^2 = 600\)

  • \(4 \times 10^1 = 40\)

  • \(2 \times 10^0 = 2\)

So, \[642_{10} = 600 + 40 + 2\].

General Formula for Positional Notation

The general formula for positional notation in any base \(R\) is:

\[ d_n \times R^{n-1} + d_{n-1} \times R^{n-2} + \ldots + d_2 \times R^1 + d_1 \times R^0 \]

Where:

  • \(d\) is the digit in the \(i\)-th position.

  • \(R\) is the base of the number system.

  • \(n\) is the number of digits in the number.

Example with Different Base

Let’s consider the number 642 in base 13. Using the positional notation formula:

\[ 642_{13} = 6 \times 13^2 + 4 \times 13^1 + 2 \times 13^0 \]

Breaking it down:

  • \(6 \times 13^2 = 6 \times 169 = 1014\)

  • \(4 \times 13^1 = 4 \times 13 = 52\)

  • \(2 \times 13^0 = 2 \times 1 = 2\)

So, \[642_{13} = 1014 + 52 + 2 = 1068_{10}\].

This example shows how the value of a number changes when the base changes, illustrating the importance of understanding positional notation.

Section 4: Number Bases

Binary (Base 2)

Binary is the simplest number system that uses only two digits: 0 and 1. Each digit in a binary number is called a bit. Binary is the foundation of all modern computing systems.

Examples:

  • \[101_2\] (binary) = \[1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 4 + 0 + 1 = 5_{10}\] (decimal)

  • \[1101_2\] (binary) = \[1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 8 + 4 + 0 + 1 = 13_{10}\] (decimal)

Octal (Base 8)

Octal is a base-8 number system that uses eight digits: 0 to 7. It is often used in computing as a more compact representation of binary numbers.

Examples:

  • \[642_8\] (octal) = \[6 \times 8^2 + 4 \times 8^1 + 2 \times 8^0 = 384 + 32 + 2 = 418_{10}\] (decimal)

  • \[157_8\] (octal) = \[1 \times 8^2 + 5 \times 8^1 + 7 \times 8^0 = 64 + 40 + 7 = 111_{10}\] (decimal)

Hexadecimal (Base 16)

Hexadecimal is a base-16 number system that uses sixteen digits: 0 to 9 and A to F, where A represents 10, B represents 11, and so on up to F, which represents 15. Hexadecimal is widely used in computing and digital electronics.

Examples:

  • \[DEF_{16}\] (hexadecimal) = \[D \times 16^2 + E \times 16^1 + F \times 16^0 = 13 \times 256 + 14 \times 16 + 15 \times 1 = 3328 + 224 + 15 = 3567_{10}\] (decimal)

  • \[1A3_{16}\] (hexadecimal) = \[1 \times 16^2 + A \times 16^1 + 3 \times 16^0 = 1 \times 256 + 10 \times 16 + 3 \times 1 = 256 + 160 + 3 = 419_{10}\] (decimal)

Section 5: Conversions Between Bases

Conversion from Base 2, 8, 16 to Base 10 using Expansion Method

Binary to Decimal

To convert a binary number to decimal, use the expansion method by multiplying each bit by (2) raised to the power of its position, starting from 0 on the right.

Example: Convert (1101110_2) to decimal.

\[ 1101110_2 = 1 \times 2^6 + 1 \times 2^5 + 0 \times 2^4 + 1 \times 2^3 + 1 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 \]

Breaking it down: - (1 ^6 = 64) - (1 ^5 = 32) - (0 ^4 = 0) - (1 ^3 = 8) - (1 ^2 = 4) - (1 ^1 = 2) - (0 ^0 = 0)

So, (1101110_2 = 64 + 32 + 0 + 8 + 4 + 2 + 0 = 110_{10}).

Octal to Decimal

To convert an octal number to decimal, use the expansion method by multiplying each digit by (8) raised to the power of its position, starting from 0 on the right.

Example: Convert (642_8) to decimal.

\[ 642_8 = 6 \times 8^2 + 4 \times 8^1 + 2 \times 8^0 \]

Breaking it down: - (6 ^2 = 384) - (4 ^1 = 32) - (2 ^0 = 2)

So, (642_8 = 384 + 32 + 2 = 418_{10}).

Hexadecimal to Decimal

To convert a hexadecimal number to decimal, use the expansion method by multiplying each digit by (16) raised to the power of its position, starting from 0 on the right. Remember that hexadecimal digits A to F represent values 10 to 15.

Example: Convert (DEF_{16}) to decimal.

\[ DEF_{16} = D \times 16^2 + E \times 16^1 + F \times 16^0 \]

Breaking it down: - (D = 13), so (13 ^2 = 3328) - (E = 14), so (14 ^1 = 224) - (F = 15), so (15 ^0 = 15)

So, (DEF_{16} = 3328 + 224 + 15 = 3567_{10}).

Conversion from Base 10 to Base 2, 8, 16 using Recursive Division

Decimal to Binary

To convert a decimal number to binary, use the recursive division method by repeatedly dividing the number by 2 and recording the remainders.

Example: Convert (198_{10}) to binary.

  1. (198 = 99) remainder (0)
  2. (99 = 49) remainder (1)
  3. (49 = 24) remainder (1)
  4. (24 = 12) remainder (0)
  5. (12 = 6) remainder (0)
  6. (6 = 3) remainder (0)
  7. (3 = 1) remainder (1)
  8. (1 = 0) remainder (1)

Reading the remainders from bottom to top, (198_{10} = 11000110_2).

Decimal to Octal

To convert a decimal number to octal, use the recursive division method by repeatedly dividing the number by 8 and recording the remainders.

Example: Convert (198_{10}) to octal.

  1. (198 = 24) remainder (6)
  2. (24 = 3) remainder (0)
  3. (3 = 0) remainder (3)

Reading the remainders from bottom to top, (198_{10} = 306_8).

Decimal to Hexadecimal

To convert a decimal number to hexadecimal, use the recursive division method by repeatedly dividing the number by 16 and recording the remainders.

Example: Convert (3567_{10}) to hexadecimal.

  1. (3567 = 222) remainder (15) (F)
  2. (222 = 13) remainder (14) (E)
  3. (13 = 0) remainder (13) (D)

Reading the remainders from bottom to top, (3567_{10} = DEF_{16}).

Conversion among Base 2, 8, 16 using Grouping Method

Binary to Octal

To convert a binary number to octal, group the binary digits into sets of three, starting from the right, and then convert each group to its octal equivalent.

Example: Convert (10101011_2) to octal.

  1. Group the binary digits: (10) (101) (011)
  2. Convert each group: (10_2 = 2_8), (101_2 = 5_8), (011_2 = 3_8)

So, (10101011_2 = 253_8).

Binary to Hexadecimal

To convert a binary number to hexadecimal, group the binary digits into sets of four, starting from the right, and then convert each group to its hexadecimal equivalent.

Example: Convert (10101011_2) to hexadecimal.

  1. Group the binary digits: (1010) (1011)
  2. Convert each group: (1010_2 = A_{16}), (1011_2 = B_{16})

So, (10101011_2 = AB_{16}).

Octal to Binary

To convert an octal number to binary, convert each octal digit to its 3-bit binary equivalent.

Example: Convert (253_8) to binary.

  1. Convert each digit: (2_8 = 010_2), (5_8 = 101_2), (3_8 = 011_2)

So, (253_8 = 10101011_2).

Hexadecimal to Binary

To convert a hexadecimal number to binary, convert each hexadecimal digit to its 4-bit binary equivalent.

Example: Convert (AB_{16}) to binary.

  1. Convert each digit: (A_{16} = 1010_2), (B_{16} = 1011_2)

So, (AB_{16} = 10101011_2).

Section 5: Conversions Between Bases

Conversion from Base 2, 8, 16 to Base 10 using Expansion Method

Binary to Decimal

To convert a binary number to decimal, use the expansion method by multiplying each bit by \(2\) raised to the power of its position, starting from 0 on the right.

Example: Convert \(1101110_2\) to decimal.

\[ 1101110_2 = 1 \times 2^6 + 1 \times 2^5 + 0 \times 2^4 + 1 \times 2^3 + 1 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 \]

Breaking it down:

  • \(1 \times 2^6 = 64\)

  • \(1 \times 2^5 = 32\)

  • \(0 \times 2^4 = 0\)

  • \(1 \times 2^3 = 8\)

  • \(1 \times 2^2 = 4\)

  • \(1 \times 2^1 = 2\)

  • \(0 \times 2^0 = 0\)

So, \(1101110_2 = 64 + 32 + 0 + 8 + 4 + 2 + 0 = 110_{10}\).

Additional Examples:

  1. Convert \(10101_2\) to decimal: \[ 10101_2 = 1 \times 2^4 + 0 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 16 + 0 + 4 + 0 + 1 = 21_{10} \]

  2. Convert \(111000_2\) to decimal: \[ 111000_2 = 1 \times 2^5 + 1 \times 2^4 + 1 \times 2^3 + 0 \times 2^2 + 0 \times 2^1 + 0 \times 2^0 = 32 + 16 + 8 + 0 + 0 + 0 = 56_{10} \]

Octal to Decimal

To convert an octal number to decimal, use the expansion method by multiplying each digit by \(8\) raised to the power of its position, starting from 0 on the right.

Example: Convert \(642_8\) to decimal.

\[ 642_8 = 6 \times 8^2 + 4 \times 8^1 + 2 \times 8^0 \]

Breaking it down:

  • \(6 \times 8^2 = 384\)

  • \(4 \times 8^1 = 32\)

  • \(2 \times 8^0 = 2\)

So, \(642_8 = 384 + 32 + 2 = 418_{10}\).

Additional Examples:

  1. Convert \(157_8\) to decimal: \[ 157_8 = 1 \times 8^2 + 5 \times 8^1 + 7 \times 8^0 = 64 + 40 + 7 = 111_{10} \]

  2. Convert \(731_8\) to decimal: \[ 731_8 = 7 \times 8^2 + 3 \times 8^1 + 1 \times 8^0 = 448 + 24 + 1 = 473_{10} \]

Hexadecimal to Decimal

To convert a hexadecimal number to decimal, use the expansion method by multiplying each digit by \(16\) raised to the power of its position, starting from 0 on the right. Remember that hexadecimal digits A to F represent values 10 to 15.

Example: Convert \(DEF_{16}\) to decimal.

\[ DEF_{16} = D \times 16^2 + E \times 16^1 + F \times 16^0 \]

Breaking it down:

  • \(D = 13\), so \(13 \times 16^2 = 3328\)

  • \(E = 14\), so \(14 \times 16^1 = 224\)

  • \(F = 15\), so \(15 \times 16^0 = 15\)

So, \(DEF_{16} = 3328 + 224 + 15 = 3567_{10}\).

Additional Examples:

  1. Convert \(1A3_{16}\) to decimal: \[ 1A3_{16} = 1 \times 16^2 + A \times 16^1 + 3 \times 16^0 = 1 \times 256 + 10 \times 16 + 3 \times 1 = 256 + 160 + 3 = 419_{10} \]

  2. Convert \(B4F_{16}\) to decimal: \[ B4F_{16} = B \times 16^2 + 4 \times 16^1 + F \times 16^0 = 11 \times 256 + 4 \times 16 + 15 \times 1 = 2816 + 64 + 15 = 2895_{10} \]

Conversion from Base 10 to Base 2, 8, 16 using Recursive Division

Decimal to Binary

To convert a decimal number to binary, use the recursive division method by repeatedly dividing the number by 2 and recording the remainders.

Example: Convert \(198_{10}\) to binary.

  1. \(198 \div 2 = 99\) remainder \(0\)

  2. \(99 \div 2 = 49\) remainder \(1\)

  3. \(49 \div 2 = 24\) remainder \(1\)

  4. \(24 \div 2 = 12\) remainder \(0\)

  5. \(12 \div 2 = 6\) remainder \(0\)

  6. \(6 \div 2 = 3\) remainder \(0\)

  7. \(3 \div 2 = 1\) remainder \(1\)

  8. \(1 \div 2 = 0\) remainder \(1\)

Reading the remainders from bottom to top, \(198_{10} = 11000110_2\).

Additional Examples:

  1. Convert \(45_{10}\) to binary:

    1. \(45 \div 2 = 22\) remainder \(1\)
    2. \(22 \div 2 = 11\) remainder \(0\)
    3. \(11 \div 2 = 5\) remainder \(1\)
    4. \(5 \div 2 = 2\) remainder \(1\)
    5. \(2 \div 2 = 1\) remainder \(0\)
    6. \(1 \div 2 = 0\) remainder \(1\)

    Reading the remainders from bottom to top, \(45_{10} = 101101_2\).

  2. Convert \(123_{10}\) to binary:

    1. \(123 \div 2 = 61\) remainder \(1\)
    2. \(61 \div 2 = 30\) remainder \(1\)
    3. \(30 \div 2 = 15\) remainder \(0\)
    4. \(15 \div 2 = 7\) remainder \(1\)
    5. \(7 \div 2 = 3\) remainder \(1\)
    6. \(3 \div 2 = 1\) remainder \(1\)
    7. \(1 \div 2 = 0\) remainder \(1\)

    Reading the remainders from bottom to top, \(123_{10} = 1111011_2\).

Decimal to Octal

To convert a decimal number to octal, use the recursive division method by repeatedly dividing the number by 8 and recording the remainders.

Example: Convert \(198_{10}\) to octal.

  1. \(198 \div 8 = 24\) remainder \(6\)

  2. \(24 \div 8 = 3\) remainder \(0\)

  3. \(3 \div 8 = 0\) remainder \(3\)

Reading the remainders from bottom to top, \(198_{10} = 306_8\).

Additional Examples:

  1. Convert \(123_{10}\) to octal:

    1. \(123 \div 8 = 15\) remainder \(3\)
    2. \(15 \div 8 = 1\) remainder \(7\)
    3. \(1 \div 8 = 0\) remainder \(1\)

    Reading the remainders from bottom to top, \(123_{10} = 173_8\).

  2. Convert \(456_{10}\) to octal:

    1. \(456 \div 8 = 57\) remainder \(0\)
    2. \(57 \div 8 = 7\) remainder \(1\)
    3. \(7 \div 8 = 0\) remainder \(7\)

    Reading the remainders from bottom to top, \(456_{10} = 710_8\).

Decimal to Hexadecimal

To convert a decimal number to hexadecimal, use the recursive division method by repeatedly dividing the number by 16 and recording the remainders.

Example: Convert \(3567_{10}\) to hexadecimal.

  1. \(3567 \div 16 = 222\) remainder \(15\) (F)

  2. \(222 \div 16 = 13\) remainder \(14\) (E)

  3. \(13 \div 16 = 0\) remainder \(13\) (D)

Reading the remainders from bottom to top, \(3567_{10} = DEF_{16}\).

Additional Examples:

  1. Convert \(255_{10}\) to hexadecimal:

    1. \(255 \div 16 = 15\) remainder \(15\) (F)
    2. \(15 \div 16 = 0\) remainder \(15\) (F)

    Reading the remainders from bottom to top, \(255_{10} = FF_{16}\).

  2. Convert \(1023_{10}\) to hexadecimal:

    1. \(1023 \div 16 = 63\) remainder \(15\) (F)
    2. \(63 \div 16 = 3\) remainder \(15\) (F)
    3. \(3 \div 16 = 0\) remainder \(3\)

    Reading the remainders from bottom to top, \(1023_{10} = 3FF_{16}\).

Conversion among Base 2, 8, 16 using Grouping Method

Binary to Octal

To convert a binary number to octal, group the binary digits into sets of three, starting from the right, and then convert each group to its octal equivalent.

Example: Convert \(10101011_2\) to octal.

  1. Group the binary digits: \(10\) \(101\) \(011\)

  2. Convert each group: \(10_2 = 2_8\), \(101_2 = 5_8\), \(011_2 = 3_8\)

So, \(10101011_2 = 253_8\).

Additional Examples:

  1. Convert \(110110_2\) to octal:

    1. Group the binary digits: \(110\) \(110\)
    2. Convert each group: \(110_2 = 6_8\), \(110_2 = 6_8\)

    So, \(110110_2 = 66_8\).

  2. Convert \(1001011_2\) to octal:

    1. Group the binary digits: \(1\) \(001\) \(011\)
    2. Convert each group: \(1_2 = 1_8\), \(001_2 = 1_8\), \(011_2 = 3_8\)

    So, \(1001011_2 = 113_8\).

Binary to Hexadecimal

To convert a binary number to hexadecimal, group the binary digits into sets of four, starting from the right, and then convert each group to its hexadecimal equivalent.

Example: Convert \(10101011_2\) to hexadecimal.

  1. Group the binary digits: \(1010\) \(1011\)

  2. Convert each group: \(1010_2 = A_{16}\), \(1011_2 = B_{16}\)

So, \(10101011_2 = AB_{16}\).

Additional Examples:

  1. Convert \(110110_2\) to hexadecimal:

    1. Group the binary digits: \(0011\) \(0110\)
    2. Convert each group: \(0011_2 = 3_{16}\), \(0110_2 = 6_{16}\)

    So, \(110110_2 = 36_{16}\).

  2. Convert \(1001011_2\) to hexadecimal:

    1. Group the binary digits: \(0100\) \(1011\)
    2. Convert each group: \(0100_2 = 4_{16}\), \(1011_2 = B_{16}\)

    So, \(1001011_2 = 4B_{16}\).

Octal to Binary

To convert an octal number to binary, convert each octal digit to its 3-bit binary equivalent.

Example: Convert \(253_8\) to binary.

  1. Convert each digit: \(2_8 = 010_2\), \(5_8 = 101_2\), \(3_8 = 011_2\)

So, \(253_8 = 10101011_2\).

Additional Examples:

  1. Convert \(157_8\) to binary:

    1. Convert each digit: \(1_8 = 001_2\), \(5_8 = 101_2\), \(7_8 = 111_2\)

    So, \(157_8 = 001101111_2\).

  2. Convert \(731_8\) to binary:

    1. Convert each digit: \(7_8 = 111_2\), \(3_8 = 011_2\), \(1_8 = 001_2\)

    So, \(731_8 = 111011001_2\).

Hexadecimal to Binary

To convert a hexadecimal number to binary, convert each hexadecimal digit to its 4-bit binary equivalent.

Example: Convert \(AB_{16}\) to binary.

  1. Convert each digit: \(A_{16} = 1010_2\), \(B_{16} = 1011_2\)

So, \(AB_{16} = 10101011_2\).

Additional Examples:

  1. Convert \(1A3_{16}\) to binary:

    1. Convert each digit: \(1_{16} = 0001_2\), \(A_{16} = 1010_2\), \(3_{16} = 0011_2\)

    So, \(1A3_{16} = 000110100011_2\).

  2. Convert \(B4F_{16}\) to binary:

    1. Convert each digit: \(B_{16} = 1011_2\), \(4_{16} = 0100_2\), \(F_{16} = 1111_2\)

    So, \(B4F_{16} = 101101001111_2\).

Section 6: Arithmetic in Binary

Addition in Binary

Binary addition follows the same principles as decimal addition but is simpler because it only involves two digits: 0 and 1. The possible outcomes for binary addition are:

  • \(0 + 0 = 0\)

  • \(0 + 1 = 1\)

  • \(1 + 0 = 1\)

  • \(1 + 1 = 10\) (which is 0 with a carry of 1)

Example:

Add \(1011_2\) and \(1101_2\).

Section 7: Counting in Power-of-2 Bases

Counting in bases that are powers of 2, such as binary (base 2), octal (base 8), and hexadecimal (base 16), follows similar principles to counting in decimal (base 10) but with different digit ranges and place values.

Binary (Base 2)

Binary uses only two digits: 0 and 1. Each place value represents a power of 2.

Example: Counting from 0 to 15 in binary:

Decimal: 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
Binary:  0  1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111

Octal (Base 8)

Octal uses eight digits: 0 to 7. Each place value represents a power of 8.

Example: Counting from 0 to 15 in octal:

Decimal: 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
Octal:   0  1  2  3  4  5  6  7 10 11 12 13 14 15 16 17

Hexadecimal (Base 16)

Hexadecimal uses sixteen digits: 0 to 9 and A to F, where A represents 10, B represents 11, and so on up to F, which represents 15. Each place value represents a power of 16.

Example: Counting from 0 to 15 in hexadecimal:

Decimal:     0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
Hexadecimal: 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F

Relationship Among Bases 2, 8, and 16

Bases 2, 8, and 16 are closely related because they are all powers of 2. This relationship makes it easy to convert numbers between these bases using grouping methods.

Binary to Octal

Group binary digits into sets of three, starting from the right, and convert each group to its octal equivalent.

Example: Convert \(10101011_2\) to octal:

Binary:  10101011
Groups:  10 101 011
Octal:   2  5   3

So, \(10101011_2 = 253_8\).

Binary to Hexadecimal

Group binary digits into sets of four, starting from the right, and convert each group to its hexadecimal equivalent.

Example: Convert \(10101011_2\) to hexadecimal:

Binary:  10101011
Groups:  1010 1011
Hex:     A    B

So, \(10101011_2 = AB_{16}\).

Octal to Binary

Convert each octal digit to its 3-bit binary equivalent.

Example: Convert \(253_8\) to binary:

Octal:  2  5  3
Binary: 010 101 011

So, \(253_8 = 10101011_2\).

Hexadecimal to Binary

Convert each hexadecimal digit to its 4-bit binary equivalent.

Example: Convert \(AB_{16}\) to binary:

Hex:    A    B
Binary: 1010 1011

So, \(AB_{16} = 10101011_2\).

Section 8: Binary Numbers and Computers

Bits and Bytes

In computing, data is represented using binary numbers. The smallest unit of data in a computer is called a bit, which can have a value of either 0 or 1. A group of 8 bits is called a byte.

Example:

A byte can represent 256 different values, from \(00000000_2\) (0 in decimal) to \(11111111_2\) (255 in decimal).

Example:

Binary:  00000000  00000001  00000010  00000011  ...  11111110  11111111
Decimal: 0         1         2         3         ...  254        255

Word Length in Computers

The word length of a computer refers to the number of bits it can process at one time. Common word lengths are 32 bits and 64 bits. The word length determines the amount of data the computer can handle and the size of the memory addresses it can use.

Example:

A 32-bit computer can address \(2^{32}\) memory locations, which is approximately 4.29 billion locations. A 64-bit computer can address \(2^{64}\) memory locations, which is an extremely large number, far exceeding the current needs of most applications.

Example: - 32-bit word length: \(2^{32} = 4,294,967,296\) memory locations - 64-bit word length: \(2^{64} = 18,446,744,073,709,551,616\) memory locations

Importance of Binary in Computing

Binary is fundamental to computing because it is a simple and reliable way to represent data and perform calculations. Digital circuits, which form the basis of computer hardware, use binary signals to represent and manipulate data. The use of binary allows computers to perform complex operations using simple, reliable components.

Example:

A simple binary addition operation in a computer:

  1010  (10 in decimal)
+ 0111  (7 in decimal)
------
 10001  (17 in decimal)

This example shows how binary arithmetic is used in computer operations.

Section 9: Summary

In this module, we have explored various aspects of binary values and number systems. Here is a recap of the core concepts covered:

Categories of Numbers

  • Natural Numbers: Zero and any number obtained by repeatedly adding one to it.
  • Negative Numbers: Values less than zero, indicated with a minus sign.
  • Integers: All natural numbers and their negative counterparts.
  • Rational Numbers: Numbers that can be expressed as the quotient of two integers.
  • Irrational Numbers: Numbers that cannot be expressed as a simple fraction and have non-repeating, non-terminating decimal expansions.

Positional Notation

  • Positional notation is a method of representing numbers where the position of each digit determines its value.
  • The base of a number system determines the number of different digit symbols and the values of digit positions.
  • Examples of positional notation in different bases were provided, including base 10 and base 13.

Number Bases

  • Binary (Base 2): Uses two digits (0 and 1). Fundamental to computing.
  • Octal (Base 8): Uses eight digits (0 to 7). Often used as a more compact representation of binary numbers.
  • Hexadecimal (Base 16): Uses sixteen digits (0 to 9 and A to F). Widely used in computing and digital electronics.

Conversions Between Bases

  • Conversion from Base 2, 8, 16 to Base 10: Using the expansion method.
  • Conversion from Base 10 to Base 2, 8, 16: Using the recursive division method.
  • Conversion among Base 2, 8, 16: Using the grouping method.

Arithmetic in Binary

  • Addition in Binary: Follows the same principles as decimal addition but involves only two digits (0 and 1).
  • Subtraction in Binary: Follows the same principles as decimal subtraction, with borrowing when necessary.

Counting in Power-of-2 Bases

  • Counting in binary, octal, and hexadecimal.
  • Relationship among bases 2, 8, and 16, and how to convert between them using grouping methods.

Binary Numbers and Computers

  • Bits and Bytes: The smallest unit of data in a computer is a bit, and a group of 8 bits is called a byte.
  • Word Length in Computers: Refers to the number of bits a computer can process at one time, commonly 32 bits or 64 bits.
  • Importance of Binary in Computing: Binary is fundamental to computing because it is a simple and reliable way to represent data and perform calculations.

Section 10: Exercises

Categories of Numbers

  1. Identify whether the following numbers are natural, negative, integer, rational, or irrational:

    • \(-5\)

    • \(\frac{7}{3}\)

    • \(\sqrt{3}\)

    • \(0\)

    • \(42\)

  2. Provide three examples of irrational numbers and explain why they are irrational.

  3. Classify the following numbers as either rational or irrational:

    • \(\pi\)

    • \(\frac{22}{7}\)

    • \(\sqrt{2}\)

    • \(0.75\)

  4. Explain the difference between rational and irrational numbers with examples.

Positional Notation

  1. Expand the number \(753_{10}\) using positional notation.

  2. Convert \(3A7_{16}\) to its decimal equivalent using positional notation.

  3. Write the number \(642_{13}\) in expanded form using positional notation.

  4. Explain how the base of a number system affects the value of each digit in positional notation.

Number Bases

  1. Convert the following binary numbers to decimal:
    • \(10101_2\)

    • \(110110_2\)

  2. Convert the following octal numbers to decimal:
    • \(745_8\)

    • \(123_8\)

  3. Convert the following hexadecimal numbers to decimal:
    • \(1F4_{16}\)

    • \(B3_{16}\)

  4. Explain the significance of using bases higher than 10 in computing.

Conversions Between Bases

  1. Convert the following decimal numbers to binary using recursive division:
    • \(45_{10}\)

    • \(123_{10}\)

  2. Convert the following decimal numbers to octal using recursive division:
    • \(198_{10}\)

    • \(456_{10}\)

  3. Convert the following decimal numbers to hexadecimal using recursive division:
    • \(255_{10}\)

    • \(1023_{10}\)

  4. Convert the following binary numbers to octal using grouping method:
    • \(10101011_2\)

    • \(110110_2\)

Arithmetic in Binary

  1. Add the following binary numbers:

    • \(1010_2 + 0111_2\)

    • \(1111_2 + 0001_2\)

  2. Subtract the following binary numbers:

    • \(1010_2 - 0110_2\)

    • \(1000_2 - 0011_2\)

  3. Explain the process of binary addition with an example.

  4. Explain the process of binary subtraction with an example.

Counting in Power-of-2 Bases

  1. Count from 0 to 15 in binary, octal, and hexadecimal.

  2. Convert the following binary numbers to octal and hexadecimal:

    • \(110101_2\)

    • \(100111_2\)

  3. Explain the relationship among bases 2, 8, and 16.

  4. Describe how to convert a binary number to its octal and hexadecimal equivalents using grouping methods.

Binary Numbers and Computers

  1. How many different values can a byte represent?

  2. Explain the significance of word length in computers and provide examples of 32-bit and 64-bit word lengths.

  3. Describe the importance of binary in computing.

  4. Provide an example of a binary addition operation in a computer and explain the steps involved.

Section 11: Exercises - Answers

Categories of Numbers

  1. Identify whether the following numbers are natural, negative, integer, rational, or irrational:
    • ( -5 ) (Negative, Integer, Rational)
    • ( ) (Rational)
    • ( ) (Irrational)
    • ( 0 ) (Natural, Integer, Rational)
    • ( 42 ) (Natural, Integer, Rational)
  2. Provide three examples of irrational numbers and explain why they are irrational.
    • (): It cannot be expressed as a simple fraction and has a non-repeating, non-terminating decimal expansion.
    • (): It cannot be expressed as a simple fraction and has a non-repeating, non-terminating decimal expansion.
    • (e): The base of the natural logarithm, which cannot be expressed as a simple fraction and has a non-repeating, non-terminating decimal expansion.
  3. Classify the following numbers as either rational or irrational:
    • () (Irrational)
    • () (Rational)
    • () (Irrational)
    • (0.75) (Rational)
  4. Explain the difference between rational and irrational numbers with examples.
    • Rational numbers can be expressed as the quotient of two integers (e.g., (), (0.5), (-2)). Irrational numbers cannot be expressed as a simple fraction and have non-repeating, non-terminating decimal expansions (e.g., (), ()).

Positional Notation

  1. Expand the number ( 753_{10} ) using positional notation. \[ 753_{10} = 7 \times 10^2 + 5 \times 10^1 + 3 \times 10^0 = 700 + 50 + 3 \]

  2. Convert ( 3A7_{16} ) to its decimal equivalent using positional notation. \[ 3A7_{16} = 3 \times 16^2 + A \times 16^1 + 7 \times 16^0 = 3 \times 256 + 10 \times 16 + 7 \times 1 = 768 + 160 + 7 = 935_{10} \]

  3. Write the number ( 642_{13} ) in expanded form using positional notation. \[ 642_{13} = 6 \times 13^2 + 4 \times 13^1 + 2 \times 13^0 = 6 \times 169 + 4 \times 13 + 2 \times 1 = 1014 + 52 + 2 = 1068_{10} \]

  4. Explain how the base of a number system affects the value of each digit in positional notation.

    • The base of a number system determines the number of different digit symbols and the values of digit positions. For example, in base 10, each position represents a power of 10, while in base 2, each position represents a power of 2.

Number Bases

  1. Convert the following binary numbers to decimal:
    • ( 10101_2 ) \[ 10101_2 = 1 \times 2^4 + 0 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 16 + 0 + 4 + 0 + 1 = 21_{10} \]
    • ( 110110_2 ) \[ 110110_2 = 1 \times 2^5 + 1 \times 2^4 + 0 \times 2^3 + 1 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 = 32 + 16 + 0 + 4 + 2 + 0 = 54_{10} \]
  2. Convert the following octal numbers to decimal:
    • ( 745_8 ) \[ 745_8 = 7 \times 8^2 + 4 \times 8^1 + 5 \times 8^0 = 448 + 32 + 5 = 485_{10} \]
    • ( 123_8 ) \[ 123_8 = 1 \times 8^2 + 2 \times 8^1 + 3 \times 8^0 = 64 + 16 + 3 = 83_{10} \]
  3. Convert the following hexadecimal numbers to decimal:
    • ( 1F4_{16} ) \[ 1F4_{16} = 1 \times 16^2 + F \times 16^1 + 4 \times 16^0 = 1 \times 256 + 15 \times 16 + 4 \times 1 = 256 + 240 + 4 = 500_{10} \]
    • ( B3_{16} ) \[ B3_{16} = B \times 16^1 + 3 \times 16^0 = 11 \times 16 + 3 \times 1 = 176 + 3 = 179_{10} \]
  4. Explain the significance of using bases higher than 10 in computing.
    • Bases higher than 10, such as hexadecimal, are used in computing because they provide a more compact representation of binary numbers. This makes it easier to read and write large binary values, which are common in computer memory addresses and machine code.

Conversions Between Bases

  1. Convert the following decimal numbers to binary using recursive division:
    • ( 45_{10} )

      1. (45 = 22) remainder (1)
      2. (22 = 11) remainder (0)
      3. (11 = 5) remainder (1)
      4. (5 = 2) remainder (1)
      5. (2 = 1) remainder (0)
      6. (1 = 0) remainder (1)

      Reading the remainders from bottom to top, (45_{10} = 101101_2).

    • ( 123_{10} )

      1. (123 = 61) remainder (1)
      2. (61 = 30) remainder (1)
      3. (30 = 15) remainder (0)
      4. (15 = 7) remainder (1)
      5. (7 = 3) remainder (1)
      6. (3 = 1) remainder (1)
      7. (1 = 0) remainder (1)

      Reading the remainders from bottom to top, (123_{10} = 1111011_2).

  2. Convert the following decimal numbers to octal using recursive division:
    • ( 198_{10} )

      1. (198 = 24) remainder (6)
      2. (24 = 3) remainder (0)
      3. (3 = 0) remainder (3)

      Reading the remainders from bottom to top, (198_{10} = 306_8).

    • ( 456_{10} )

      1. (456 = 57) remainder (0)
      2. (57 = 7) remainder (1)
      3. (7 = 0) remainder (7)

      Reading the remainders from bottom to top, (456_{10} = 710_8).

  3. Convert the following decimal numbers to hexadecimal using recursive division:
    • ( 255_{10} )

      1. (255 = 15) remainder (15) (F)
      2. (15 = 0) remainder (15) (F)

      Reading the remainders from bottom to top, (255_{10} = FF_{16}).

    • ( 1023_{10} )

      1. (1023 = 63) remainder (15) (F)
      2. (63 = 3) remainder (15) (F)
      3. (3 = 0) remainder (3)

      Reading the remainders from bottom to top, (1023_{10} = 3FF_{16}).

  4. Convert the following binary numbers to octal using grouping method:
    • ( 10101011_2 )

      1. Group the binary digits: (10) (101) (011)
      2. Convert each group: (10_2 = 2_8), (101_2 = 5_8), (011_2 = 3_8)

      So, (10101011_2 = 253_8).

    • ( 110110_2 )

      1. Group the binary digits: (110) (110)
      2. Convert each group: (110_2 = 6_8), (110_2 = 6_8)

      So, (110110_2 = 66_8).

  5. Convert the following binary numbers to hexadecimal using grouping method:
    • ( 10101011_2 )

      1. Group the binary digits: (1010) (1011)
      2. Convert each group: (1010_2 = A_{16}), (1011_2 = B_{16})

      So, (10101011_2 = AB_{16}).

    • ( 1001011_2 )

      1. Group the binary digits: (0100) (1011)
      2. Convert each group: (0100_2 = 4_{16}), (1011_2 = B_{16})

      So, (1001011_2 = 4B_{16}).

  6. Convert the following octal numbers to binary:
    • ( 253_8 )

      1. Convert each digit: (2_8 = 010_2), (5_8 = 101_2), (3_8 = 011_2)

      So, (253_8 = 10101011_2).

    • ( 157_8 )

      1. Convert each digit: (1_8 = 001_2), (5_8 = 101_2), (7_8 = 111_2)

      So, (157_8 = 001101111_2).

  7. Convert the following hexadecimal numbers to binary:
    • ( AB_{16} )

      1. Convert each digit: (A_{16} = 1010_2), (B_{16} = 1011_2)

      So, (AB_{16} = 10101011_2).

    • ( 1A3_{16} )

      1. Convert each digit: (1_{16} = 0001_2), (A_{16} = 1010_2), (3_{16} = 0011_2)

      So, (1A3_{16} = 000110100011_2).

Arithmetic in Binary

  1. Add the following binary numbers:
    • ( 1010_2 + 0111_2 )

        1010
      + 0111
      ------
       10001
    • ( 1111_2 + 0001_2 )

        1111
      + 0001
      ------
       10000
  2. Subtract the following binary numbers:
    • ( 1010_2 - 0110_2 )

        1010
      - 0110
      ------
        0100
    • ( 1000_2 - 0011_2 )

        1000
      - 0011
      ------
        0101
  3. Explain the process of binary addition with an example.
    • Binary addition follows the same principles as decimal addition but is simpler because it only involves two digits: 0 and 1. The possible outcomes for binary addition are:

      • (0 + 0 = 0)
      • (0 + 1 = 1)
      • (1 + 0 = 1)
      • (1 + 1 = 10) (which is 0 with a carry of 1)

      Example: Add (1011_2) and (1101_2).

        1011
      + 1101
      ------
       11000

      Step-by-step:

      1. (1 + 1 = 10) (write down 0, carry 1)
      2. (1 + 0 + 1 = 10) (write down 0, carry 1)
      3. (0 + 1 + 1 = 10) (write down 0, carry 1)
      4. (1 + 1 = 10) (write down 0, carry 1)
      5. Write down the carry 1 at the leftmost position.

      So, (1011_2 + 1101_2 = 11000_2).

  4. Explain the process of binary subtraction with an example.
    • Binary subtraction follows the same principles as decimal subtraction. The possible outcomes for binary subtraction are:

      • (0 - 0 = 0)
      • (1 - 0 = 1)
      • (1 - 1 = 0)
      • (0 - 1 = 1) (with a borrow of 1 from the next higher bit)

      Example: Subtract (1101_2) from (10111_2).

        10111
      - 01101
      -------
        01010

      Step-by-step:

      1. (1 - 1 = 0)
      2. (1 - 0 = 1)
      3. (1 - 1 = 0)
      4. (0 - 1 = 1) (borrow 1 from the next higher bit)
      5. (1 - 1 = 0)

      So, (10111_2 - 01101_2 = 01010_2).

Counting in Power-of-2 Bases

  1. Count from 0 to 15 in binary, octal, and hexadecimal.
    • Binary:

      Decimal: 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
      Binary:  0  1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111
    • Octal:

      Decimal: 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
      Octal:   0  1  2  3  4  5  6  7 10 11 12 13 14 15 16 17
    • Hexadecimal:

      Decimal:     0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
      Hexadecimal: 0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
  2. Convert the following binary numbers to octal and hexadecimal:
    • ( 110101_2 )
      • Octal: Group the binary digits: (110) (101)

        Binary:  110 101
        Octal:   6   5

        So, (110101_2 = 65_8).

      • Hexadecimal: Group the binary digits: (0110) (0101)

        Binary:  0110 0101
        Hex:     6    5

        So, (110101_2 = 65_{16}).

    • ( 100111_2 )
      • Octal: Group the binary digits: (100) (111)

        Binary:  100 111
        Octal:   4   7

        So, (100111_2 = 47_8).

      • Hexadecimal: Group the binary digits: (0100) (0111)

        Binary:  0100 0111
        Hex:     4    7

        So, (100111_2 = 47_{16}).

  3. Explain the relationship among bases 2, 8, and 16.
    • Bases 2, 8, and 16 are closely related because they are all powers of 2. This relationship makes it easy to convert numbers between these bases using grouping methods. For example, each octal digit corresponds to three binary digits, and each hexadecimal digit corresponds to four binary digits.
  4. Describe how to convert a binary number to its octal and hexadecimal equivalents using grouping methods.
    • To convert a binary number to octal, group the binary digits into sets of three, starting from the right, and then convert each group to its octal equivalent.
    • To convert a binary number to hexadecimal, group the binary digits into sets of four, starting from the right, and then convert each group to its hexadecimal equivalent.

Binary Numbers and Computers

  1. How many different values can a byte represent?
    • A byte, which consists of 8 bits, can represent (2^8 = 256) different values, ranging from (00000000_2) (0 in decimal) to (11111111_2) (255 in decimal).
  2. Explain the significance of word length in computers and provide examples of 32-bit and 64-bit word lengths.
    • The word length of a computer refers to the number of bits it can process at one time. Common word lengths are 32 bits and 64 bits. The word length determines the amount of data the computer can handle and the size of the memory addresses it can use.
      • A 32-bit computer can address (2^{32}) memory locations, which is approximately 4.29 billion locations.
      • A 64-bit computer can address (2^{64}) memory locations, which is an extremely large number, far exceeding the current needs of most applications.
  3. Describe the importance of binary in computing.
    • Binary is fundamental to computing because it is a simple and reliable way to represent data and perform calculations. Digital circuits, which form the basis of computer hardware, use binary signals to represent and manipulate data. The use of binary allows computers to perform complex operations using simple, reliable components.
  4. Provide an example of a binary addition operation in a computer and explain the steps involved.
    • Example: Add (1010_2) and (0111_2).

        1010
      + 0111
      ------
       10001

      Step-by-step:

      1. (0 + 1 = 1)
      2. (1 + 1 = 10) (write down 0, carry 1)
      3. (0 + 1 + 1 = 10) (write down 0, carry 1)
      4. (1 + 0 + 1 = 10) (write down 0, carry 1)
      5. Write down the carry 1 at the leftmost position.

      So, (1010_2 + 0111_2 = 10001_2).