Now include a borrow coming in from the previous (lower) column, Bin. We compute A−B−Bin.
A
B
Bin
A−B−Bin
D
Bout
0
0
0
0
0
0
0
0
1
−1
1
1
0
1
0
−1
1
1
0
1
1
−2
0
1
1
0
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
0
1
1
1
−1
1
1
Why the D column is XOR of three? The difference bit is 1 whenever an odd number of the three inputs are 1 (check: rows with 1,1,1 or a single 1 give D=1). Odd-parity of three bits is three-input XOR.
D=A⊕B⊕Bin
Deriving Bout algebraically (this mirrors the full-adder carry derivation). Group the Bout=1 rows using the two-stage idea. Do the subtraction as two half-subtracts:
First A−B: produces intermediate diff d1=A⊕B and borrow b1=AˉB.
Then d1−Bin: produces final D=d1⊕Bin and borrow b2=d1Bin.
A borrow is needed overall if either subtract borrowed: Bout=b1+b2.
Bout=AˉB+(A⊕B)Bin
Simplify A⊕B=AB+AˉBˉ, so:
Bout=AˉB+(AB+AˉBˉ)Bin
A neater standard SOP form (verify from the truth table) is:
Q: For FS with A=1,B=0,Bin=1, what are D and Bout?
Forecast:1−0−1=0, no borrow.
Verify:D=1⊕0⊕1=0 ✓, Bout=1ˉ⋅0+1ˉ⋅1+0⋅1=0 ✓.
Recall Feynman: explain to a 12-year-old
Imagine you have candies in stacked jars. Top jar has some, bottom jar has some, and you must take the bottom amount away from the top. If the top jar doesn't have enough, you run upstairs and borrow one big bundle (worth 2 candies in binary) from the next jar up — but now that upper jar owes one back, and that "owes one" note is the borrow-out. The difference bit is just whatever candies are left in the current jar. That's all a subtractor does: leftover candies (difference) and the "I owe upstairs" note (borrow).
Dekho, subtractor basically adder ka ulta bhai hai. Jaise addition mein hum "carry" upar bhejte hain, waise hi subtraction mein jab upar wala digit chhota ho jaye to hum next column se "borrow" karte hain — school wala ghatana yaad karo, jab 5−3 mein upar se ek udhaar leke aate the. Yehi udhaar hardware mein borrow bit ban jaata hai. Half subtractor sirf do bits A−B karta hai: difference D=A⊕B (bilkul adder ke sum jaisa), aur borrow Bout=AˉB — yani borrow tabhi hota hai jab top bit A=0 ho aur B=1 ho.
Sabse common galti yehi hai ki log borrow ko AB likh dete hain, kyunki adder ka carry AB hota hai aur diff toh same XOR hai. Par bhai, borrow ke liye top bit ka broke hona zaroori hai (yani A=0), isliye bar A ke upar lagta hai: AˉB. Row A=0,B=1 ko hamesha check karke confirm karo.
Full subtractor mein ek extra Bin (pichle column se aaya udhaar) aata hai. Difference ban jaata hai teen-input XOR: D=A⊕B⊕Bin, aur borrow Bout=AˉB+(A⊕B)Bin — full adder ke carry jaisa hi skeleton, bas A pe bar lag gaya.
Asli maza yeh hai: real processors alag subtractor banate hi nahi. Wo 2's complement trick use karte hain — A−B=A+Bˉ+1. Matlab B ke saare bits invert karo aur adder ka carry-in 1 set kar do. Ek control line se ek hi circuit adder bhi aur subtractor bhi ban jaata hai. Yeh 80/20 point hai — isko pakka yaad rakho, exam aur real design dono mein kaam aayega.