2.5 Binary Arithmetic
Binary Addition
Binary addition follows similar rules to decimal addition but is simpler since it only involves two digits (0 and 1).
Rules of Binary Addition
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Example: Add 10112 and 11012
1111 (carry)
1011
+ 1101
-----
11000
Verification:
10112 = 1110
11012 = 1310
11 + 13 = 24
110002 = 2410
Binary Subtraction
Binary subtraction can be performed using two methods: direct subtraction and two's complement method.
Method 1: Direct Subtraction
| A | B | Difference | Borrow |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
Example: Subtract 10012 from 11012
1101
-1001
----
100
Verification:
11012 = 1310
10012 = 910
13 - 9 = 4
1002 = 410
Method 2: Two's Complement
For computers, subtraction is often performed using two's complement:
- Find the two's complement of the subtrahend (number being subtracted)
- Add this to the minuend (number being subtracted from)
- Discard any carry out of the leftmost bit
Binary Multiplication
Binary multiplication is simpler than decimal multiplication since it only involves multiplying by 0 or 1.
Example: Multiply 1012 by 112
101
× 11
-----
101 (101 × 1)
101 (101 × 1, shifted left)
-----
1111
Verification:
1012 = 510
112 = 310
5 × 3 = 15
11112 = 1510
Binary Division
Binary division follows the same long division method as decimal division.
Example: Divide 11012 by 102
110.1
--------
10 ) 1101.0
-10
--
10
-10
--
010
-10
--
0
Verification:
11012 = 1310
102 = 210
13 ÷ 2 = 6.5
110.12 = 6.510