Number Representation in Complement Form
In mathematics and digital systems, the concept of a number’s complement is fundamental for understanding number representation, especially in contexts like subtraction and digital arithmetic. The complement of a number refers to the portion of a defined number space that is NOT occupied by the number itself. This concept is critical in various number systems, including decimal, binary, octal, and hexadecimal, and is widely used in computing for operations like subtraction and negative number representation.
Applications of Complement Representation
Complements are essential in digital systems for:
- Error Detection: Complements can help detect overflow or errors in arithmetic operations.
- Subtraction: Using complements, subtraction can be performed as addition, simplifying hardware design. For example, to compute \(\mathsf{A – B}\), calculate \(\mathsf{A + \left(r’s \textsf{ complement of } B\right)}\).
- Negative Numbers: In binary systems, the 2’s complement is used to represent negative numbers, enabling efficient arithmetic operations.
Understanding the Complement of a Number
Imagine a number system as a finite space, like a container with a fixed capacity. If a number occupies part of that space, its complement is the remaining unoccupied space. For example:
- Decimal Example: If the total space is 10, and the number is 4, the complement is the remaining space, which is (10 – 4 = 6). Thus, the complement of 4 is 6 in this context.
This idea extends to digital systems, where binary numbers dominate, but it also applies to other number systems like octal and hexadecimal. To represent complements systematically, two widely used methods exist:
- Diminished Radix (r-1)’s complement and
- Radix (r)’s complement,
where \(\mathsf{r}\) is the radix (base) of the number system.
Diminished Radix (r-1)’s Complement
(r-1)’s complement represents the complement relative to one less than the base raised to a certain power (e.g., \(\mathsf{10^n – 1}\) for decimal, \(\mathsf{2^n – 1}\) for binary). \(\mathsf{n}\) controls the total space and is equal to the number of digits in the number.
- 9’s Complement (Decimal Number System)
- 1’s Complement (Binary Number System)
- 7’s Complement (Octal Number System)
- 15’s Complement (Hexadecimal Number System)
How to Take (r-1)’s Complement of a Number?
- For each digit in the number:
- Subtract it from the highest single-digit value in that base (i.e., \(\mathsf{r-1}\))
- This gives the (r – 1)’s complement
Radix (r)’s Complement
r’s complement represents the full complement relative to the number system’s base raised to a certain power (e.g., \(\mathsf{10^n}\) for decimal, \(\mathsf{2^n}\) for binary). \(\mathsf{n}\) controls the total space and is equal to the number of digits in the number.
- 10’s Complement (Decimal Number System)
- 2’s Complement (Binary Number System)
- 8’s Complement (Octal Number System)
- 16’s Complement (Hexadecimal Number System)
How to Take r’s Complement of a Number?
- For each digit in the number:
- First, compute the (r – 1)’s complement as described above
- Then, add 1 to the result
- This gives the r ’s complement
For clarity, we’ll explore these methods across decimal (\(\mathsf{r=10}\)), binary (\(\mathsf{r=2}\)), octal (\(\mathsf{r=8}\)), and hexadecimal (\(\mathsf{r=16}\)) number systems, with detailed examples.