Universal Column Rules (Base b)
Addition
- Start at the least significant column (rightmost).
- Compute
s = top + bottom + carry. - Write
s mod bin the column. - Set
carry = ⌊s / b⌋and move left. - After the leftmost column, write any nonzero
carryin front.
Subtraction
- Start at the rightmost column.
- If
top < bottom, borrow 1 from the next column to the left. - Borrowing adds
bto the current top digit; decrement the next column by 1. - Compute
top − bottomand move left.
Borrow adds: Binary +2, Octal +8, Hex +16.
Decimal (Base 10)
Addition Example
carry: 1 1 1
3 9 8 7
+ 2 5 6 8
----------------
6 5 5 5 = 6,555₁₀
7+8=15 → write 5 carry 1; 8+6+1=15; 9+5+1=15; 3+2+1=6.
Subtraction Example
4 0 0 3
− 2 7 8 9
----------------
1 2 1 4 = 1,214₁₀
Borrow chains through zeros: thousands becomes 3, hundreds 9, tens 9, ones 13.
Binary (Base 2)
Rules
- Digits: 0 or 1 only.
- Carry when a column ≥ 2; write
sum mod 2, carry⌊sum/2⌋. - Borrow adds 2 to the current bit.
| a | b | carry-in | digit | carry-out |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Examples
Add: 101101₂ + 011011₂
101101
+ 011011
--------
1001000 = 72₁₀
Subtract: 101101₂ − 011011₂
101101
− 011011
--------
010010 = 18₁₀
Alternative: two’s complement of 011011₂ is 100101₂; add then drop overflow.
Octal (Base 8)
Rules
- Digits: 0–7 only.
- Carry when a column ≥ 8; write
sum mod 8, carry⌊sum/8⌋. - Borrow adds 8 to the current column.
Examples
Add: 753₈ + 246₈
7 5 3
+ 2 4 6
--------
1 2 2 1 = 1221₈
3+6=9→write1 carry1; 5+4+1=10→write2 carry1; 7+2+1=10→write2 carry1→leading 1.
Subtract: 1203₈ − 746₈
1 2 0 3
− 7 4 6
--------------
2 3 5 = 235₈
Borrow through the zero: ones 3<6→borrow→(11₈−6)=3; tens 7−4=3; hundreds 1<7→borrow from thousands.
Hexadecimal (Base 16)
Rules
- Digits: 0–9 and A–F (A=10, …, F=15).
- Carry when a column ≥ 16; write
sum mod 16, carry⌊sum/16⌋. - Borrow adds 16 to the current column.
| Dec | Hex | Dec | Hex | Dec | Hex | Dec | Hex |
|---|---|---|---|---|---|---|---|
| 10 | A | 11 | B | 12 | C | 13 | D |
| 14 | E | 15 | F | 16 | 10 | 17 | 11 |
Examples
Add: 3A7₁₆ + C9D₁₆
3 A 7
+ C 9 D
-----------
1 0 4 4 = 1044₁₆
7+D=20→write 4 carry1; A+9+1=20→write 4 carry1; 3+C+1=16→write 0 carry1→leading 1.
Subtract: F2B₁₆ − 8DE₁₆
F 2 B
− 8 D E
-----------
6 4 D = 64D₁₆
B(11)<E(14) → borrow: (11+16)−14=D; middle 1<D → borrow from F: (1+16)−13=4; top E−8=6.
Quick Checks & Tips
- Digit ranges: Binary 0–1, Octal 0–7, Decimal 0–9, Hex 0–9/A–F. Any out-of-range digit is an error.
- Verify by conversion: Convert operands and result to decimal to confirm correctness.
- Borrow across zeros: Chain the borrow left until you hit a nonzero digit (as in decimal and octal examples).
- Binary subtraction shortcut: Use two’s complement:
A − B = A + (¬B + 1)for a fixed bit width; drop overflow bit. - Hex sums ≥ 16: subtract 16 (0x10) and carry 1; remember A=10,…,F=15.