Nepedia
Back to Discover
Fluent Reader
💻

Subtractor

technology Maturity 7-9 Next article →

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.

Half Subtractor Vektor
Half Subtractor Vektor

You can design a subtractor like an adder. An adder is a circuit that adds numbers together. Subtractors are very important for electronic math. They help machines solve problems quickly.

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.

Half subtractor using NAND
Half subtractor using NAND

A borrow out happens if the subtrahend is larger. The circuit uses logic gates to find the answer. It uses an XOR gate for the difference. It uses an AND gate for the borrow.

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.

Full-sub-Fixed
Full-sub-Fixed

The full subtractor gives two outputs too. These are the difference and the borrow out. It is used for multi-bit number calculations. This makes it more powerful than a half subtractor.

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.

Half Subtractor Vektor
Half Subtractor Vektor

This helps the circuit find the correct difference. The circuit follows specific rules for every bit. It ensures the math stays accurate every time.

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.

Full-sub-Fixed
Full-sub-Fixed

It is a clever way to build a machine. It makes electronic math much more efficient.

346 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (3)
File:Half Subtractor Vektor.svg
Half Subtractor Vektor.svg
File:Half subtractor using NAND.jpg
Half subtractor using NAND.jpg
File:Full-sub-Fixed.svg
Full-sub-Fixed.svg
More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

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.