basic number operations
1. What Basic Operations Are (beyond addition)
For binary/octal/hex, the four operations are addition, subtraction, multiplication, division — but exam focuses on binary addition/subtraction (already covered addition, now subtraction via complements, multiplication as repeated addition, division as repeated subtraction). This topic is the complement to binary addition.
2. Binary Subtraction — Two Methods
A. Direct binary subtraction (borrow): like decimal but borrow is 2.
0-0=0, 1-0=1, 1-1=0, 0-1=1 borrow 1 (borrow makes 10₂=2, 2-1=1)
Example: 1010 -0111: LSB 0-1 needs borrow: 10-1=1 borrow1, next 1-1- borrow? Actually 1-1-1borrow? Let's do 1010-0111=0011? 10-7=3=0011 ✓
B. Via complements (preferred for hardware): use 1's and 2's complement (covered in signed representation topics).
- 1's complement subtraction: , with end-around carry (add carry back).
- 2's complement subtraction (standard):
where
, discard final carry if any. This is how ALU does subtraction.
For octal/hex, subtraction similar but borrow is 8/16.
3. Multiplication / Division (brief)
- Multiplication: shift-and-add:
etc.
- Division: repeated subtraction / shift.
Example:
shift left one.
4. Worked Examples
(a) Binary subtraction 1011 -0101 (11-5=6=0110): 1011-0101=0110 ✓
Direct: 1-1=0,1-0=1,0-1 borrow ⇒10-1=1? Actually step: LSB 1-1=0, next 1-0=1, next 0-1 borrow 1 ⇒1, next 1-0- borrow? 1-0-1borrowed? 0 ⇒0 ⇒0110 ✓
(b) Using 2's complement 4-bit: 1011-0101 =1011 +1011 (2's of 0101 is 1011) =1011+1011=10110 discard carry ⇒0110 ✓
(c) Octal subtraction 17₈ -07₈ =10₈ (15-7=8=10₈) ✓
(d) Hex: 1A -0F =0B? 26-15=11=0B₁₆ ✓
5. Exam Points
- Show subtraction via borrow and via 2's complement — 5-7 marks, very frequent (often ask to subtract using 2's complement).
- Mention multiplication as shift-and-add — 3-5 marks, frequent.
- Give octal/hex subtraction example — 3-5 marks, frequent.