1101 − 0110 — binary arithmetic
introborrowing across a zero
Answer
0111
Why this example is worth doing
Direct binary subtraction with borrows, which most courses teach before the two's complement method. The awkward case is borrowing across a 0, where the borrow propagates further left, and the tool shows the modified digits above the minuend. The page then shows the same subtraction done by adding the two's complement, so the two methods can be compared on one problem rather than in separate chapters.
Try your own input in the Binary arithmetic. Add, subtract, multiply and divide in binary with every carry and borrow shown.
How the answer is reached
1101 - 0110 (4-bit, unsigned)
| operand | bits | hex | unsigned | signed |
|---|---|---|---|---|
| A | 1101 | 0xD | 13 | -3 |
| B | 0110 | 0x6 | 6 | 6 |
Method A — borrow propagation.
| row | 3 | 2 | 1 | 0 |
|---|---|---|---|---|
| borrow in | 1 | 1 | 0 | 0 |
| A | 1 | 1 | 0 | 1 |
| - B | 0 | 1 | 1 | 0 |
| result | 0 | 1 | 1 | 1 |
C = 0 · V = 1 · N = 0 · Z = 0
Method B — add the two’s complement of B, then discard the final carry.
NOT B1001
NOT B + 11010— the two’s complement of B
| row | 3 | 2 | 1 | 0 |
|---|---|---|---|---|
| carry in | 0 | 0 | 1 | 1 |
| A | 1 | 1 | 0 | 1 |
| + B | 1 | 0 | 0 | 1 |
| result | 0 | 1 | 1 | 1 |
carry in 1 · carry out 1 (discarded)
reading the final carry1: no borrow, A >= B as unsigned
signed-3 - 6 = -9, kept as 7— V = 1: the signed answer is wrong
Both methods are shown because curricula grade different ones. The final carry of method B is always the complement of the borrow-out of method A.