1. Number Systems and Bases (2, 8, 10, 16)

Definition – Base (Radix)

The base (or radix) is a positive integer. A number in base has an integer part and a fractional part, separated by the radix point:

  • The base fixes the number of symbols: every digit satisfies .
  • Positional numbering: the digit at position is multiplied by (its weight).
  • Positions to the left of the point are ; to the right they are

Example – Decimal ()

Digits: .

Position43210.−1−2−3−4
Digit20461.0985

The Common Bases

SystemRadixSymbolsExample
Binary20, 1
Octal80 – 7
Decimal100 – 9
Hexadecimal160 – 9, A=10, B=11, C=12, D=13, E=14, F=15

⚠️ Base 16 needs 16 symbols but only 10 digits exist, so six letters A–F are added. A digit like “8” is illegal in octal, and “2” is illegal in binary.

Numbers 0 to 15 in Each Base

DecBinOctHex
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F

Powers of 2 and Unit Prefixes

PrefixBase 10Base 2 (bytes)
Kilo
Mega
Giga
Tera
Peta

So bytes and bytes.

Useful powers: ; ; .

⚠️ The slide prints as 125,899,906,842,624 — the leading “1,” is missing. The correct value is 1,125,899,906,842,624.


2. Conversion from Base to Base 10

Method – Expand by Weights

Multiply each digit by and add everything up (the definition formula, evaluated in decimal).

Example – Binary → Decimal

(Only the positions holding a 1 contribute.)

Example – Octal → Decimal

Example – Hexadecimal → Decimal

⚠️ Replace letters by their values before multiplying ().


3. Conversion from Base 10 to Base

Method – 3 Steps

  1. Convert the integer part (successive divisions by ).
  2. Convert the fractional part (successive multiplications by ).
  3. Concatenate the two results, putting the radix point between them.
flowchart LR
    A["X (base 10)"] --> B["Integer part"]
    A --> C["Fractional part"]
    B -->|"divide by r repeatedly<br/>keep remainders"| D["read remainders<br/>bottom → top"]
    C -->|"multiply by r repeatedly<br/>keep integer parts"| E["read integer parts<br/>top → bottom"]
    D --> F["Concatenate with radix point"]
    E --> F

3.1 Integer Part – Successive Divisions by

Why It Works

If , then

Dividing the quotient again gives remainder , and so on until the quotient is . The remainders are the base- digits in reverse order — the first remainder is the least significant digit.

Intro example in base 10: remainders → reading backwards gives 5216.

Example – → Octal

DivisionQuotientRemainder
3545 ← LSD
442
54
05 ← MSD

(matches the octal example of §2).

Example – → Binary

÷ 21457236189421
Remainder10001001

Read right-to-left (last remainder first): .

3.2 Fractional Part – Successive Multiplications by

Why It Works

If , then

The integer part of the product is ; keep multiplying the remaining fraction. The integer parts are the digits in normal order — the first one is the most significant (closest to the point). Stop when the fraction becomes 0.

Example – → Binary

StepProductInteger digit
1.251 ← MSD
0.50
1.01 ← LSD, fraction = 0 → stop

. Check: ✓

Example – → Binary (Full 3-Step)

  • Integer: remainders →
  • Fraction: → digits →
  • Concatenate:

Example – Infinite (Repeating) Fraction:

The fraction comes back, so the digits repeat forever:

⚠️ A finite decimal fraction can be an infinite binary fraction. In practice you stop after a fixed number of digits, which introduces a rounding error. Watch for a fractional part that repeats — that is the sign the expansion never ends.


4. Conversion Between Other Bases

4.1 General Method: Base → Base (2 Steps)

  1. Convert from base to base 10 (§2).
  2. Convert from base 10 to base (§3).

Example – → Octal

  1. r 3, r 3 → ; →

4.2 Shortcut: Base → Base (Grouping)

Applies to binary → octal (, since ) and binary → hex (, since ).

Procedure

  • Group the digits in blocks of , starting from the radix point:
    • integer part: from the point to the left;
    • fractional part: from the point to the right.
  • Pad with 0s at the outer ends if needed.
  • Replace each group by one base- symbol.

Example – Binary → Hex

Example – Binary → Octal

flowchart TB
    subgraph "Binary → Hex: group by 4 from the point"
    direction LR
    A["0010"] --> A2["2"]
    B["1011"] --> B2["B"]
    C["0001"] --> C2["1"]
    P["."] --> P2["."]
    D["0101"] --> D2["5"]
    E["0100"] --> E2["4"]
    end

⚠️ Padding zeros go on the left of the integer part and the right of the fractional part. Padding the fraction on the left (e.g. writing as ) changes its value.

4.3 Shortcut: Base → Base (Expansion)

Replace each digit by its -digit base- equivalent (keep leading zeros inside each group), then drop zeros at the outer ends.

Example – Octal → Binary ()

Example – Hex → Binary ()

4.4 Octal ↔ Hexadecimal (Through Binary)

Go through binary rather than decimal: expand to binary, then regroup. This is easier than going through base 10.

Example – Octal → Hex

⚠️ This slide’s title says , but the worked digits use . The result is correct for .

Example – Hex → Octal

Summary of Methods

From → ToMethod
Base → 10Sum of digit × weight
10 → base Integer: ÷ , remainders read backwards · Fraction: × , integer parts read forwards
→ (general)Go through base 10
2 → 8 / 16Group 3 / 4 bits from the point
8 / 16 → 2Expand each digit into 3 / 4 bits
8 ↔ 16Go through binary

Exercises: none assigned in this chapter’s slides — practise by redoing the worked conversions above (e.g. , ).