Binary subtraction
Rules
0−0=0 · 1−0=1 · 1−1=0. For 0−1 you must borrow 1 from the column to the left: the current column becomes 10₂.
Step-by-step example
1010−0011=111
1
Column 0 from the right: bit 0 − bit 1, borrow in 0 → result 1, borrow out 1.
2
Column 1 from the right: bit 1 − bit 1, borrow in 1 → result 1, borrow out 1.
3
Column 2 from the right: bit 0 − bit 0, borrow in 1 → result 1, borrow out 1.
4
Column 3 from the right: bit 1 − bit 0, borrow in 1 → result 0, borrow out 0.
Practice
Progress: 0 / 5 — correct: 0
Calculate: 1011 − 1011
Column 0: borrow in 0, result bit 0, borrow out 0. Column 1: borrow in 0, result bit 0, borrow out 0. Column 2: borrow in 0, result bit 0, borrow out 0. Column 3: borrow in 0, result bit 0, borrow out 0.