---
title: "Full subtractor using a 2×4 decoder"
subject: "Digital Logic"
chapter: 4
key: "semester_3/digital_logic:full-subtractor-2x4-decoder"
source: https://www.bctengineer.com/q/semester_3/digital_logic/full-subtractor-2x4-decoder
site: BCT Engineering
---

# Full subtractor using a 2×4 decoder

Digital Logic · Chapter 4: Data Processing Circuits

- Asked in: 2082 Shrawan, 4 marks
- Video: [Q. 4.29: Implement a full subtractor with a decoder and NAND gate. The subtractor inputs are A, B, C](https://www.youtube.com/watch?v=24d1EEKnziE) — Dr. Dhiman (Learn the art of problem solving) 
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/digital_logic/full-subtractor-2x4-decoder
- Whole chapter: https://www.bctengineer.com/md/semester_3/digital_logic/chapter-4

## Question

Realize a full-subtractor circuit using a single 2×4 decoder and necessary logic gates.

## Short answer

Apply A,B to a 2×4 decoder. OR decoder outputs to form A⊕B (from Y1,Y2) and A⊙B (from Y0,Y3). Then D = (A⊕B) ⊕ Bin, and Bout = Y1 + (A⊙B)·Bin using one XOR, one AND, and OR gates.

## Answer

A full subtractor computes $A - B - B_{in}$, giving difference $D$ and borrow $B_{out}$. A single 2×4 decoder has only two inputs, so feed it $A$ and $B$; its outputs are the minterms of $A, B$, and $B_{in}$ is combined with gates.

#### Truth table grouped by AB

| A | B | $B_{in}$ | D | $B_{out}$ |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |

| AB | Decoder line | D | $B_{out}$ |
|---|---|---|---|
| 00 | $Y_0$ | $B_{in}$ | $B_{in}$ |
| 01 | $Y_1$ | $B_{in}'$ | 1 |
| 10 | $Y_2$ | $B_{in}'$ | 0 |
| 11 | $Y_3$ | $B_{in}$ | $B_{in}$ |

#### Equations

$$
\begin{aligned} D &= (Y_1 + Y_2) \oplus B_{in} \\ B_{out} &= Y_1 + (Y_0 + Y_3)\,B_{in} \end{aligned}
$$

(Here $Y_1 + Y_2 = A \oplus B$ and $Y_0 + Y_3 = A \odot B$.)

```text
          +--------+
  A ----->| 2x4  Y0|---> E (OR)
  B ----->|      Y1|---> P (OR), Bout (OR)
          |      Y2|---> P (OR)
          |      Y3|---> E (OR)
          +--------+
  Y0, Y3 ---[OR]--- E  (= A xnor B)
  Y1, Y2 ---[OR]--- P  (= A xor B)
  P, Bin ---[XOR]------------------ D
  E, Bin ---[AND]--- E.Bin --+
  Y1 ------------------------+-[OR]-- Bout
```

Gates: 2 OR (2-input), 1 XOR, 1 AND, 1 OR.

**Check:** $A=0, B=1, B_{in}=1$: $Y_1 = 1$, $P = 1$, $D = 1 \oplus 1 = 0$, $B_{out} = 1$; indeed $0 - 1 - 1 = -2$, i.e. $D = 0$ with borrow 1. All 8 rows were verified.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. In the full subtractor using a 2x4 decoder, which signals go to the decoder inputs?
   A. A and Bin; B is combined with gates
   B. B and Bin; A is combined with gates
   C. A and B; Bin is combined with gates
   D. A, B and Bin together
   Answer: C. A 2x4 decoder has two inputs, so it decodes A and B and Bin is handled by extra gates. (Key point: Decoder inputs)

2. Which equation gives the difference D?
   A. D = (Y0 + Y3) xor Bin
   B. D = Y1 . Bin
   C. D = Y0 + Y3 + Bin
   D. D = (Y1 + Y2) xor Bin
   Answer: D. Y1 + Y2 equals A xor B, and D = A xor B xor Bin. (Key point: Difference equation)

3. Which equation gives Bout?
   A. Bout = Y1 + (Y0 + Y3).Bin
   B. Bout = Y2 + (Y1 + Y2).Bin
   C. Bout = Y0 + Y3
   D. Bout = (Y1 + Y2).Bin
   Answer: A. AB = 01 always borrows; AB = 00 or 11 borrows only if Bin = 1; AB = 10 never borrows. (Key point: Borrow equation)

4. For A=0, B=1, Bin=1 what are D and Bout?
   A. D = 1, Bout = 0
   B. D = 0, Bout = 1
   C. D = 1, Bout = 1
   D. D = 0, Bout = 0
   Answer: B. 0 - 1 - 1 = -2, which is difference 0 with a borrow of 1. (Key point: Worked check)

## Close variants set in other exams

- [Full subtractor using a 1:4 DEMUX](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Afull-subtractor-1to4-demux) — Digital Logic, chapter 4, asked 6×

## Related in Digital Logic

- [Full subtractor using decoder; combinational circuit](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Afull-subtractor-decoder-combinational) — Digital Logic, chapter 4
- [Full adder using a 2×4 decoder](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Afull-adder-2x4-decoder) — Digital Logic, chapter 4, asked 2×
- [Full adder using decoder; (57−43) by 2's complement](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Afull-adder-decoder-subtract) — Digital Logic, chapter 4
- [Full adder using a single 1:4 DEMUX](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Afull-adder-1to4-demux) — Digital Logic, chapter 4, asked 5×
- [Decoder; 2-to-4 decoder as a full adder](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Adecoder-2to4-full-adder) — Digital Logic, chapter 4
- [Full subtractor from half subtractors](https://www.bctengineer.com/question.md?key=semester_3%2Fdigital_logic%3Afull-subtractor-half-subtractors) — Digital Logic, chapter 5

## Related in other subjects

- [Short note: Logic gates](https://www.bctengineer.com/question.md?key=semester_1%2Fbasic_electrical_and_electronics_engineering%3Ashort-note-logic-gates) — Basic Electrical and Electronics Engineering, chapter 3
- [Choppers; single-phase full bridge inverter](https://www.bctengineer.com/question.md?key=semester_4%2Fadvanced_electronics%3Achoppers-full-bridge-inverter) — Advanced Electronics, chapter 7, asked 2×
- [Single-phase full converter, 10 A, α = 30°](https://www.bctengineer.com/question.md?key=semester_7%2Fpower_electronics%3Afull-converter-10a-30deg) — Power Electronics, chapter 2, asked 4×
