Some parts in computers do math.
Computers use tiny parts to do math.
Computers use digital circuits to do math. One type of circuit is a subtractor. It is used to take numbers away.
A half subtractor is a simple part. It works with two bits. These are the inputs. One input is the minuend. The other is the subtrahend. The circuit gives two outputs. One is the difference. The other is the borrow out. A borrow out happens if the second bit is bigger. 
Sometimes math needs more bits. A full subtractor is used for this. It works with three bits. It uses the two main bits. It also uses a borrow in. This borrow in comes from a previous step. The full subtractor finds the difference and a new borrow out.
In a full subtractor, a borrow out is set if the second bit is bigger. This is like how we subtract on paper. If we borrow, we add 2 to the current digit. This helps the circuit find the right answer.
Computers use digital circuits to do math. A subtractor is a special circuit that performs subtraction. It works with binary numbers. These are numbers made of bits.
There are two main types of subtractors. The first type is a half subtractor. It works with two bits. One bit is the minuend. The other bit is the subtrahend. This circuit has two outputs. One output is the difference. The other is the borrow out. 
A full subtractor is a more advanced circuit. It handles three input bits at once. It uses the minuend and the subtrahend. It also uses a borrow in. This borrow in comes from a previous bit position.
Working with a full subtractor is like doing math on paper. When you borrow in a decimal system, you add 10. In a binary circuit, you add 2. This happens when a borrow out is generated. The borrow out is set if the subtrahend is larger.
Many circuits use a special trick called two's complement notation. This allows a circuit to use an adder for subtraction. It only costs a small amount to do this. You just add a selector to the carry-in. You also invert the second operand. This links subtraction to addition in a smart way.
In the world of electronics, a subtractor is a digital circuit designed to perform subtraction. It works by processing binary numbers, which are composed of bits. These circuits are essential for arithmetic logic, allowing machines to calculate differences between values. Interestingly, a subtractor can be designed using a very similar approach to a binary adder. While an adder combines values, a subtractor handles the removal of one value from another. This process is a fundamental building block for how computers handle math.
To understand how the mechanism works, we must look at the specific bits involved. In a general calculation for multi-bit numbers, three bits are used for each position. The first is the minuend, which is the number being subtracted from. The second is the subtrahend, which is the number being taken away. The third is the borrow in, which comes from a less significant bit position. These inputs result in two specific outputs: the difference bit and the borrow out bit.
A simple version of this circuit is called a half subtractor. This is a combinational circuit used to subtract exactly two bits. It takes the minuend and the subtrahend as its only inputs. The circuit produces a difference bit and a borrow out signal. The borrow out is specifically set when the subtrahend is greater than the minuend. This signal tells the next digit in a larger calculation that it needs to borrow. 
Logic gates drive the operation of the half subtractor. The difference bit is calculated using an exclusive or (XOR) gate. This gate produces a 1 if the inputs are different and a 0 if they are the same. The borrow out is determined by an AND gate. This gate only outputs a 1 if the subtrahend is 1 and the minuend is 0. This specific logic ensures the circuit follows the rules of binary subtraction accurately.
A more complex version is the full subtractor. This circuit is necessary for multi-bit subtraction because it can handle three input bits. In addition to the minuend and the subtrahend, it accepts a borrow in. This borrow in represents a value taken from a previous, less significant digit. The full subtractor then generates its own difference and borrow out bits.
The full subtractor follows a specific mathematical process. When a borrow in occurs, it is subtracted from the minuend along with the subtrahend. The formula for this operation is D = X ⊕ Y ⊕ Bin. If a borrow out must be generated, it means the combined value of the subtrahend and borrow in is larger than the minuend. In this case, a value of 2 is added to the current digit. This is very similar to decimal subtraction, where you add 10 when you borrow from the next column.
Engineers often use a clever method to make these circuits more efficient. Instead of building separate subtraction hardware, they use two's complement notation. This notation allows a standard binary adder to perform subtraction. To do this, the circuit only needs to invert the second operand. It also requires an addition/subtraction selector connected to the carry-in. This method is used because it comes at only a small cost to the circuit design.
By combining these elements, digital systems can perform complex arithmetic. The relationship between adders and subtractors shows how different mathematical operations can be linked. Whether using a simple half subtractor or a full subtractor, the logic remains consistent. These circuits allow for the precise, high-speed calculations required by all modern electronic technology.
🖼️ Images & Media (3)
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
What is Nepedia?
A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.