VM-LEARNING /class.xi ·track.cs ·ch-1-5 session: 2026_27
$cd ..

~/Number Systems

root@vm-learning ~ $ open ch-1-5
UNIT 1 ▪ CHAPTER 5
05
Number Systems
Binary · Octal · Decimal · Hexadecimal · Conversions
Computers are electronic devices built from circuits that can be in only two states — ON (1) or OFF (0). So at the deepest level every piece of data — a letter, a photo, a movie — is stored as a long sequence of 0s and 1s. To make this convenient for humans we group these bits and read them in four different number systems. This chapter explains those four systems, how to convert between them, and how alphabets & symbols themselves are turned into numbers using encoding schemes like ASCII, ISCII and Unicode.
Key idea: A number system is simply a way of writing numbers using a fixed set of symbols (digits). The count of symbols it uses is called the base (or radix). The four number systems you must know are:
  • Binary (base 2) — digits 0, 1 — used inside the computer.
  • Octal (base 8) — digits 0–7.
  • Decimal (base 10) — digits 0–9 — used by humans in daily life.
  • Hexadecimal (base 16) — digits 0–9 and A–F — used to write memory addresses & colour codes.
Learning Outcome 1: Identify and describe the binary, octal, decimal and hexadecimal number systems.

5.1 Why do Computers Use Binary?

A computer is built from billions of tiny electronic switches called transistors. A transistor has only two states — either it is conducting current (ON) or it is not (OFF). We represent these two states with the two digits 1 and 0. Any information the computer handles — numbers, letters, sounds, images — must first be expressed using just these two digits. That is why binary is the native language of every computer.

Why do we still need octal and hexadecimal? Long binary strings are hard for humans to read — 01100101 11111111 is a mouthful. Grouping binary digits by 3s gives octal; grouping by 4s gives hexadecimal. Both are just shorter ways of writing the same binary value.

5.2 Positional Value & Base

In any number system, each digit's value depends on its position. The rightmost digit is multiplied by base0, the next by base1, and so on. So in decimal, the number 375 actually means:

37510 = 3 × 102 + 7 × 101 + 5 × 100 = 300 + 70 + 5

The same rule applies to every other base — we just replace 10 with the appropriate base. This is called the positional weight of a digit.

Positional weights (right → left): Weight of each position (from the right) Decimal (base 10): 10³ = 1000 10² = 100 10¹ = 10 10⁰ = 1 Binary (base 2): 2³ = 8 2² = 4 2¹ = 2 2⁰ = 1 Octal (base 8): 8³ = 512 8² = 64 8¹ = 8 8⁰ = 1 Hex (base 16): 16³ = 4096 16² = 256 16¹ = 16 16⁰ = 1 Rightmost digit always has weight 1 (base⁰). Each step left multiplies weight by the base.

5.3 The Four Number Systems at a Glance

SystemBaseDigits UsedExampleWhere you see it
Binary20, 110112Inside all digital circuits, RAM, network signals.
Octal80, 1, 2, 3, 4, 5, 6, 7178Unix/Linux file permissions (chmod 755).
Decimal100 – 919710Everyday human counting.
Hexadecimal160 – 9, A, B, C, D, E, F1A16Memory addresses, HTML colour codes (#FF5733), MAC addresses.
We write the base as a small subscript to avoid confusion — 102 means "one-zero base two" (= 2 in decimal), while 1010 means ordinary "ten". When the base is obvious from context it is often omitted.

5.4 Equivalent Values — Counting 0 to 15

The easiest way to get a feel for all four systems is to count side-by-side from 0 to 15:

DecimalBinary (4-bit)OctalHexadecimal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012A
11101113B
12110014C
13110115D
14111016E
15111117F
Memorise this table! It is the "multiplication table" of computer science. Once you know these 16 rows, converting between bases becomes almost mental.
Learning Outcome 2: Convert numbers between binary, octal, decimal and hexadecimal.

5.5 Converting from Decimal to Another Base

Rule: divide the decimal number repeatedly by the target base. Write down the remainders each time. When the quotient becomes 0, stop. The answer is the remainders read bottom to top.

5.5.1 Decimal → Binary (÷ 2)

Convert 2510 to binary.
25 ÷ 2 = 12 remainder 1   ← LSB (least significant bit)
12 ÷ 2 = 6  remainder 0
 6 ÷ 2 = 3  remainder 0
 3 ÷ 2 = 1  remainder 1
 1 ÷ 2 = 0  remainder 1   ← MSB (most significant bit)

Read remainders bottom-to-top:  11001

∴ 25₁₀ = 11001₂
Verify: 1·16 + 1·8 + 0·4 + 0·2 + 1·1 = 25. ✓

5.5.2 Decimal → Octal (÷ 8)

Convert 15710 to octal.
157 ÷ 8 = 19 remainder 5
 19 ÷ 8 = 2  remainder 3
  2 ÷ 8 = 0  remainder 2

Read bottom-to-top:  235

∴ 157₁₀ = 235₈
Verify: 2·64 + 3·8 + 5·1 = 128 + 24 + 5 = 157. ✓

5.5.3 Decimal → Hexadecimal (÷ 16)

Convert 25410 to hexadecimal.
254 ÷ 16 = 15 remainder 14  →  E
 15 ÷ 16 = 0  remainder 15  →  F

Read bottom-to-top:  FE

∴ 254₁₀ = FE₁₆
Verify: 15·16 + 14·1 = 240 + 14 = 254. ✓ Remember: in hex, 10–15 map to A, B, C, D, E, F.

5.6 Converting to Decimal from Another Base

Rule: multiply each digit by its positional weight (baseposition) and add the results.

5.6.1 Binary → Decimal

Convert 101102 to decimal.
Position:   4   3   2   1   0
Digit:      1   0   1   1   0
Weight:    16   8   4   2   1

Value = 1·16 + 0·8 + 1·4 + 1·2 + 0·1
      = 16 + 0 + 4 + 2 + 0
      = 22

∴ 10110₂ = 22₁₀

5.6.2 Octal → Decimal

Convert 3478 to decimal.
Value = 3·8² + 4·8¹ + 7·8⁰
      = 3·64 + 4·8 + 7·1
      = 192 + 32 + 7
      = 231

∴ 347₈ = 231₁₀

5.6.3 Hexadecimal → Decimal

Convert 2AF16 to decimal.
Digits in decimal:  2, A=10, F=15

Value = 2·16² + 10·16¹ + 15·16⁰
      = 2·256 + 10·16 + 15·1
      = 512 + 160 + 15
      = 687

∴ 2AF₁₆ = 687₁₀

5.7 Binary ⇄ Octal (group of 3 bits)

Because 23 = 8, every 3 binary digits correspond to exactly one octal digit. So conversion between the two is just a matter of grouping.

5.7.1 Binary → Octal

Starting from the right, split the binary number into groups of 3. Pad the leftmost group with leading zeros if required. Replace each group with its octal equivalent.

Convert 11010112 to octal.
1101011
Group from right, padding left with 0:
  001   101   011
   1     5     3

∴ 1101011₂ = 153₈

5.7.2 Octal → Binary

Replace each octal digit with its 3-bit binary equivalent.

Convert 2478 to binary.
Octal:   2      4      7
Binary:  010    100    111

∴ 247₈ = 010100111₂  (leading zero optional: 10100111₂)

5.8 Binary ⇄ Hexadecimal (group of 4 bits)

Because 24 = 16, every 4 binary digits correspond to exactly one hexadecimal digit. Same idea, different group size.

5.8.1 Binary → Hexadecimal

Convert 1101101012 to hexadecimal.
110110101
Group from right, padding left with 0:
  0001   1011   0101
   1      B      5

∴ 110110101₂ = 1B5₁₆

5.8.2 Hexadecimal → Binary

Convert 3AF16 to binary.
Hex:     3         A         F
Binary:  0011      1010      1111

∴ 3AF₁₆ = 001110101111₂

5.9 Octal ⇄ Hexadecimal (via Binary)

There is no direct short-cut between octal and hex — the two groupings don't line up. The usual route is through binary: convert octal → binary → hex (or hex → binary → octal).

Convert 3758 to hexadecimal.
Step 1 — Octal → Binary (each digit to 3 bits):
  3    7    5
  011  111  101   →  011111101₂

Step 2 — Regroup into 4-bit chunks (from right) for hex:
  0000  1111  1101     (pad leading zeros)
   0     F     D

∴ 375₈ = FD₁₆

5.10 Conversion Map — Summary Diagram

All conversion routes — no crossings: DECIMAL base 10 · digits 0–9 BINARY base 2 · digits 0, 1 OCTAL base 8 · digits 0–7 HEXADECIMAL base 16 · digits 0–9, A–F Dec → Bin: ÷ 2 ↑ Bin → Dec: Σ bᵢ · 2ⁱ Bin ↔ Oct: group of 3 bits Bin ↔ Hex: group of 4 bits Dec → Oct: ÷ 8 ↑ Oct → Dec: Σ dᵢ · 8ⁱ Dec → Hex: ÷ 16 ↑ Hex → Dec: Σ dᵢ · 16ⁱ Oct ↔ Hex: no direct — via binary ↑ = read remainders bottom-up · Σ dᵢ · bⁱ = sum of each digit × (base)^position · i starts at 0 from the right.
Conversion formula matrix — how to go from row to column
From ↓ \ To → Decimal (10) Binary (2) Octal (8) Hexadecimal (16)
Decimal Repeatedly ÷ 2; read remainders bottom-up Repeatedly ÷ 8; read remainders bottom-up Repeatedly ÷ 16; read remainders bottom-up (10–15 = A–F)
Binary Σ bᵢ · 2ⁱ
(sum of each bit × 2position)
Group bits in 3s from the right; each group = 1 octal digit Group bits in 4s from the right; each group = 1 hex digit
Octal Σ dᵢ · 8ⁱ Replace each octal digit with its 3-bit binary form Via binary → Oct → Bin → Hex
Hexadecimal Σ dᵢ · 16ⁱ Replace each hex digit with its 4-bit binary form Via binary → Hex → Bin → Oct
Reading the Σ formula. If a number has digits dn-1 … d2 d1 d0 (rightmost digit is position 0) in base b, then its decimal value is

Value = dn-1·bn-1  +  …  +  d2·b2  +  d1·b1  +  d0·b0
Example (hex): 2AF16 → 2·162 + 10·161 + 15·160 = 512 + 160 + 15 = 687.

📌 Quick Revision — Chapter 5 at a Glance

  • Computers use binary because every transistor is either ON (1) or OFF (0).
  • Base/Radix = number of distinct digits — Binary 2, Octal 8, Decimal 10, Hex 16.
  • Positional value: value = digit × baseposition.
  • Hex digits A–F = decimal 10–15.
  • Decimal → base N: divide by N, read remainders bottom-to-top.
  • Base N → Decimal: Σ dᵢ · Nⁱ.
  • Binary ↔ Octal: group of 3 bits = 1 octal digit.
  • Binary ↔ Hex: group of 4 bits = 1 hex digit.
  • Octal ↔ Hex: no direct — always via binary.
🧠Practice Quiz — test yourself on this chapter