1) Why different bases?
- Binary matches digital hardware (bits: 0 or 1).
- Octal and Hex are compact ways to write long binary strings.
- Place value works the same as decimal: each position is a power of the base.
Place Value Pattern
| Base | Positions (right→left) |
|---|---|
| Binary (2) | 2⁰, 2¹, 2², 2³, … |
| Octal (8) | 8⁰, 8¹, 8², 8³, … |
| Hex (16) | 16⁰, 16¹, 16², 16³, … |
Digits Allowed
| Base | Digits |
|---|---|
| Binary | 0–1 |
| Octal | 0–7 |
| Hex | 0–9, A–F (A=10 … F=15) |
2) Counting Examples
Binary (base-2)
Carry when you reach 2 (just like carry at 10 in decimal).
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
| 8 | 1000 |
Octal (base-8)
Digits go 0–7, then carry.
| Decimal | Octal |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 7 | 7 |
| 8 | 10 |
| 9 | 11 |
| 15 | 17 |
| 16 | 20 |
Hexadecimal (base-16)
After 9 comes A(10), B(11), C(12), D(13), E(14), F(15), then 10.
| Decimal | Hex |
|---|---|
| 0 | 0 |
| 9 | 9 |
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
| 16 | 10 |
3) Conversions
Decimal → Any Base (Repeated Division)
- Divide by the base, record the remainder.
- Repeat on the quotient until it is 0.
- Read remainders from last to first.
Example: 45 (decimal) → binary
45 ÷ 2 = 22 r1 → 22 ÷ 2 = 11 r0 → 11 ÷ 2 = 5 r1 → 5 ÷ 2 = 2 r1 → 2 ÷ 2 = 1 r0 → 1 ÷ 2 = 0 r1
Answer:
45 ÷ 2 = 22 r1 → 22 ÷ 2 = 11 r0 → 11 ÷ 2 = 5 r1 → 5 ÷ 2 = 2 r1 → 2 ÷ 2 = 1 r0 → 1 ÷ 2 = 0 r1
Answer:
101101₂ Any Base → Decimal (Place Value)
Multiply each digit by its place value and sum.
Example:
2×16¹ + 15×16⁰ = 32 + 15 = 47
2F₁₆ → decimal2×16¹ + 15×16⁰ = 32 + 15 = 47
Binary ⇄ Octal (group by 3)
Group binary bits in 3s (from the right). Each group is one octal digit.
Example:
1101011₂ → group as 1 101 011 → pad to 001 101 011 → 1 5 3 → 153₈ Binary ⇄ Hex (group by 4)
Group binary bits in 4s (from the right). Each group is one hex digit.
Example:
1011 0110₂ → B6₁₆ 4) Arithmetic
Binary Addition
| a | b | sum | carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Example:
10101₂ + 00111₂ = 11100₂ Octal & Hex Addition
Add digit-wise. If a column ≥ base, write remainder and carry 1 to the next column.
Octal:
Hex:
57₈ + 26₈ = 105₈Hex:
2A₁₆ + 1F₁₆ = 49₁₆ Subtraction (Borrow)
Borough from the next higher place if needed (base-2, base-8, or base-16).
Binary:
Octal:
Hex:
10010₂ − 01101₂ = 00101₂Octal:
145₈ − 37₈ = 106₈Hex:
3C₁₆ − 1F₁₆ = 1D₁₆ Two’s Complement (for Subtraction)
- To negate a binary number: invert bits (one’s complement) then add 1.
- Add the negated value to perform subtraction.
- Discard final carry if it appears.
Example: Compute
Negate subtrahend:
Add:
01010101₂ − 00011010₂Negate subtrahend:
00011010 → 11100101 → 11100110Add:
01010101 + 11100110 = 1 00111011 → discard carry → 00111011₂ 5) Quick Reference
Powers
| k | 2^k | 8^k | 16^k |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 1 | 2 | 8 | 16 |
| 2 | 4 | 64 | 256 |
| 3 | 8 | 512 | 4096 |
| 4 | 16 | 4096 | 65536 |
6) Practice Problems
- Convert 93₁₀ to binary and hex.
- Convert 101111₂ to decimal and octal.
- Compute 110101₂ + 1110₂.
- Compute 7A₁₆ − 2F₁₆.
- Use two’s complement to evaluate 01001010₂ − 00110111₂.
Show Answers
- 93₁₀ = 1011101₂; 93₁₀ = 5D₁₆.
- 101111₂ = 47₁₀; group by 3 → 010 111 → 57₈.
- 110101₂ + 1110₂ = 110101₂ + 001110₂ = 1000011₂.
- 7A₁₆ − 2F₁₆ = (122₁₀ − 47₁₀) = 75₁₀ = 4B₁₆.
- 00110111 → one’s: 11001000 → plus 1: 11001001; 01001010 + 11001001 = 1 00010011 → discard carry → 00010011₂ (decimal 19).