📚 Number System – Quantitative Aptitude (IIT‑JEE / Competitive Exam)
Goal – Understand all number systems, conversion procedures, and key properties that are frequently tested in competitive exams.
Scope – Decimal, binary, octal, hexadecimal, negative numbers (two’s complement), floating‑point, and useful tricks.
1. Positional Notation
| Symbol | Value | Example | Value in Decimal |
|---|---|---|---|
d_n d_{n-1} … d_1 d_0 (base 10) |
∑ d_k·10^k |
321 = 3·10² + 2·10¹ + 1·10⁰ | 321 |
b_n b_{n-1} … b_1 b_0 (base B) |
∑ b_k·B^k |
101₁₀ = 1·2² + 0·2¹ + 1·2⁰ | 5 |
General formula
For a number x written in base B with digits a_k a_{k-1} … a_0:
[ x_B = \sum_{i=0}^{k} a_i , B^{,i} ]
Key point:
- Digits in base B must satisfy (0 \le a_i < B).
- The rightmost digit is the units place (B⁰).
2. Converting Between Bases
2.1. From any base to Decimal
Apply the positional formula above.
Example
110101₂ → Decimal
(1·2^5 + 1·2^4 + 0·2^3 + 1·2^2 + 0·2^1 + 1·2^0 = 32+16+4+1 = 53)
2.2. From Decimal to any base
Method – Successive division by the target base.
| Step | Operation | Remainder (digit) |
|---|---|---|
| 1 | (N ÷ B) | (r_0) |
| 2 | Quotient of step 1 ÷ B | (r_1) |
| … | … | … |
| Last | Quotient < B | (r_m) |
The number in base B is r_m r_{m-1} … r_0.
Example
53 (decimal) → Binary
(53 ÷ 2 = 26) rem 1
(26 ÷ 2 = 13) rem 0
(13 ÷ 2 = 6) rem 1
(6 ÷ 2 = 3) rem 0
(3 ÷ 2 = 1) rem 1
(1 ÷ 2 = 0) rem 1
→ 110101₂.
2.3. Direct conversion between non‑decimal bases
Use two steps: base B → Decimal → base C; or use repeated division by C on the original representation (if you can perform division in base C).
Example
110101₂ → Octal
First convert to decimal: 53
Then 53 ÷ 8 = 6 rem 5 ⇒ 65₈.
3. Properties & Tricky Points
| Property | Explanation | Example |
|---|---|---|
| Even/Odd | In any base, a number is even iff its lowest‑order digit is even. | 101₂ (5) → odd (1) |
| Divisibility by (B-1) | Sum of digits divisible by B‑1 → number divisible by B‑1. | 123₁₀ → sum=6 → divisible by 9. |
| Divisibility by (B+1) | Alternating sum of digits divisible by B+1 → number divisible by B+1. | 123₁₀ → (1-2+3)=2 → not divisible by 11. |
| Negative numbers (two’s complement) | Represent by inverting all bits + 1. | -5 in 8‑bit: invert 00000101 → 11111010; add 1 → 11111011. |
| Fractional conversion | Multiply fractional part by base and take integer part as next digit. | 0.625₁₀ in binary: (0.625·2=1.25) → 1; fractional part 0.25 → (0.25·2=0.5) → 0; (0.5·2=1) → 1 → 0.101₂. |
| Leading zeros | Do not affect value but may be required for fixed‑width representations. | 001₃ = 1. |
| Overflow in fixed‑width | e.g., in 4‑bit two’s complement, range is ([-8,7]). | 1001₁₀ (9) → 1001 two’s complement → -7. |
4. Two’s Complement – Negative Numbers
4.1. Representation
For an n‑bit word:
- Positive numbers: same as binary representation.