Introduction to Subtraction as Addition
In digital systems, subtraction is not performed using the traditional “borrowing” method taught in childhood, known as the standard subtraction algorithm. This method is complex and slow for digital computations. Instead, digital systems leverage the complement method for the subtraction of unsigned numbers, where the subtrahend (the number being subtracted) is represented in its complement form and added to the minuend (the number from which subtraction occurs). The result typically consists of a “whole” part (representing the base or modulus) and a “difference” part, where the whole part is discarded to obtain the final result. This approach simplifies subtraction by utilizing efficient addition algorithms, significantly speeding up computations in digital hardware.
The Complexity of Traditional Subtraction
The standard subtraction algorithm, often taught in elementary school, is intricate and time-consuming, especially for digital systems. Consider the example of subtracting 9 from 200 (i.e., 200 โ 9):
- Units place: The units digit of 200 is 0, which is less than 9, so direct subtraction is not possible. We must borrow from the tens place.
- Tens place: The tens digit is also 0, so it cannot lend directly. It must borrow from the hundreds place.
- Hundreds place: The hundreds digit is 2. Borrowing 1 hundred leaves 1 hundred, and the tens place receives 10 tens (or 100). The tens place then lends 1 ten to the units place, becoming 9 tens, while the units place becomes 10.
- Subtraction process:
- Units: 10 โ 9 = 1
- Tens: 9 โ 0 = 9
- Hundreds: 1 โ 0 = 1
- Result: The difference is 191.
This process requires sequential borrowing, tracking remainders, and handling each digit individually, making it inefficient for digital systems. The borrowing mechanism introduces complexity, as each place value may depend on higher place values, creating a cascade of operations. In contrast, digital systems use addition-based methods to streamline subtraction.
Diagram illustrating 200 (minuend) โ 9 (subtrahend), showing the borrowing process with arrows indicating the lending of 1 hundred to the tens place and 1 ten to the units place, resulting in 191 is shown here.
Overview of the Subtraction of Unsigned Numbers Through Addition and Complements
The complement method transforms subtraction into addition by using either the radix complement (also called the r’s complement) or the diminished radix complement ((rโ1)’s complement). A complement represents the “remaining space” needed to complete a number up to a power of the radix (e.g., 10 for decimal, 2 for binary). For a number B in base \(\mathsf{r}\) with \(\mathsf{n}\) digits, the radix complement is calculated as \(\mathsf{r^n-B}\), and the diminished radix complement is \(\mathsf{\left(r^n-1\right)-B}\).
When subtracting \(\mathsf{B}\) from \(\mathsf{A}\)A (i.e., \(\mathsf{A-B}\)), the complement method works as follows:
- Compute the complement of the subtrahend \(\mathsf{B}\).
- Add this complement to the minuend \(\mathsf{A}\).
- The result is typically of the form \(\mathsf{A + (r^n โ B) = r^n + (A โ B)}\), where \(\mathsf{r^n}\) represents the “whole” part (a power of the radix, such as \(\mathsf{10^n}\) in decimal or \(\mathsf{2^n}\) in binary).
- Discard the whole part (\(\mathsf{r^n}\)), and the remaining part is the difference (\(\mathsf{A-B}\)).
This method avoids borrowing, making it faster and more suitable for digital circuits, which are optimized for addition.
The following diagrams show:
- \(\mathsf{A}\) sample space with \(\mathsf{A}\) (minuend) as filled boxes.
- \(\mathsf{B}\) (subtrahend) as filled boxes in the same sample space.
- The complement of \(\mathsf{B, \left(r^n-B\right)}\) as the remaining unfilled boxes.
- The addition of \(\mathsf{A}\) and the complement of \(\mathsf{B}\), resulting in a full sample space (\(\mathsf{r^n}\)) plus additional boxes representing the difference \(\mathsf{A-B}\), with the full sample space crossed out to indicate it is discarded.)
Subtraction of Unsigned Numbers
In this section, you will learn how to subtract unsigned numbers using the radix complement (r’s complement) and diminished radix complement ((rโ1)’s complement) methods in both decimal and binary number systems. Building on the skills developed in calculating complements, you will master subtraction as an addition process. Key concepts include: