1.4 NUMBER SYSTEM, BINARY ARITHMETIC AND BASE CONVERSION

 

1.4.1 What is a Number System?

A number system is a method of representing numbers using a specific set of symbols and rules.

We use different number systems in mathematics and computing.

Common Number Systems

There are four important number systems in computer science:

  1. Decimal Number System
  2. Binary Number System
  3. Octal Number System
  4. Hexadecimal Number System

1.4.2 Base or Radix

The base (or radix) of a number system tells us how many different digits/symbols are used in that system.

Number SystemBaseDigits Used
Decimal100–9
Binary20, 1
Octal80–7
Hexadecimal160–9, A–F

Easy Trick

Decimal = 10

Binary = 2

Octal = 8

Hexadecimal = 16


1.4.3 Decimal Number System

The decimal number system has a base of 10.

It uses ten digits:

0 1 2 3 4 5 6 7 8 9

It is the number system we commonly use in everyday life.

Example

583

The value of each digit depends on its position.

5 × 10² + 8 × 10¹ + 3 × 10⁰
= 5 × 100 + 8 × 10 + 3 × 1

= 500 + 80 + 3

= 583

1.4.4 Positional Number System

Most number systems used in computing are positional number systems.

This means that the value of a digit depends on:

  1. The digit itself
  2. Its position
  3. The base of the number system

General Form

For a number:

dₙ dₙ₋₁ ... d₂ d₁ d₀

Its value is:

dₙ × baseⁿ + ... + d₂ × base² + d₁ × base¹ + d₀ × base⁰

1.4.5 Binary Number System

The binary number system has a base of 2.

It uses only two digits:

0 and 1

Computers use binary because digital electronic circuits can conveniently represent two states, such as:

0 → OFF / LOW
1 → ON / HIGH

Example

101101₂

The subscript tells us that the number is binary.


1.4.6 Bit and Byte

Bit

Bit = Binary Digit

A bit can have only two values:

0 or 1

It is the smallest basic unit of digital information.

Byte

A byte consists of:

1 Byte = 8 bits

Example

10101100

This contains 8 bits = 1 byte.


1.4.7 Binary Place Values

Binary uses powers of 2.

From right to left:

2⁰   2¹   2²   2³   2⁴   2⁵   2⁶   2⁷
 1    2    4    8   16   32   64   128

Example

Consider:

101101₂

Write the place values:

  1    0    1    1    0    1
  ↓    ↓    ↓    ↓    ↓    ↓
 32   16    8    4    2    1

Now multiply:

1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1

= 32 + 0 + 8 + 4 + 0 + 1

= 45

Therefore:

101101₂ = 45₁₀


1.4.8 Octal Number System

The octal number system has a base of 8.

It uses:

0 1 2 3 4 5 6 7

Digits 8 and 9 are not used in octal.

Example

725₈

Its decimal value is:

7×8² + 2×8¹ + 5×8⁰

= 7×64 + 2×8 + 5×1

= 448 + 16 + 5

= 469

Therefore:

725₈ = 469₁₀


1.4.9 Hexadecimal Number System

The hexadecimal number system has a base of 16.

It uses:

0–9 and A–F

Hexadecimal Digits

DecimalHexadecimal
00
11
22
33
44
55
66
77
88
99
10A
11B
12C
13D
14E
15F

Example

2F₁₆

Convert to decimal:

2×16¹ + F×16⁰

F = 15

= 2×16 + 15×1

= 32 + 15

= 47

Therefore:

2F₁₆ = 47₁₀


1.4.10 Why Does Computer Use Binary?

Computers are electronic digital systems.

Electronic circuits can easily distinguish between two states.

For example:

Low voltage  → 0
High voltage → 1

Therefore, binary is convenient for representing:

  • Data
  • Instructions
  • Numbers
  • Characters
  • Images
  • Audio
  • Video

Simple Idea

Real World
    ↓
Computer
    ↓
Binary
    ↓
0 and 1

⭐ 1.4.11 Comparison of Number Systems

Number SystemBaseDigits
Binary20, 1
Octal80–7
Decimal100–9
Hexadecimal160–9, A–F

Remember:

B O D H = 2, 8, 10, 16

Binary → Octal → Decimal → Hexadecimal


1.4.12 Base Conversion

Base conversion means changing a number from one number system to another without changing its actual value.

Common conversions include:

  1. Binary → Decimal
  2. Decimal → Binary
  3. Binary → Octal
  4. Octal → Binary
  5. Binary → Hexadecimal
  6. Hexadecimal → Binary
  7. Decimal → Octal
  8. Decimal → Hexadecimal
  9. Octal → Decimal
  10. Hexadecimal → Decimal

1.4.13 Binary to Decimal Conversion

To convert binary to decimal:

Steps

  1. Write the binary number.
  2. Assign powers of 2 from right to left.
  3. Multiply each binary digit by its place value.
  4. Add the results.

Example

Convert:

101101₂ → ?₁₀

Step 1: Write place values

1    0    1    1    0    1
↓    ↓    ↓    ↓    ↓    ↓
32   16    8    4    2    1

Step 2: Multiply

1×32 = 32
0×16 = 0
1×8  = 8
1×4  = 4
0×2  = 0
1×1  = 1

Step 3: Add

32 + 8 + 4 + 1 = 45

Therefore:

101101₂ = 45₁₀


1.4.14 Decimal to Binary Conversion

The most common method is the repeated division by 2 method.

Example

Convert:

45₁₀ → ?₂

Divide repeatedly by 2:

45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5  remainder 1
5  ÷ 2 = 2  remainder 1
2  ÷ 2 = 1  remainder 0
1  ÷ 2 = 0  remainder 1

Now read the remainders from bottom to top:

1 0 1 1 0 1

Therefore:

45₁₀ = 101101₂

Important Rule

Decimal → Binary = Divide by 2 repeatedly and read remainders from bottom to top.


1.4.15 Another Decimal to Binary Example

Convert:

25₁₀ → Binary
25 ÷ 2 = 12 R1
12 ÷ 2 = 6  R0
6  ÷ 2 = 3  R0
3  ÷ 2 = 1  R1
1  ÷ 2 = 0  R1

Read bottom to top:

11001

Therefore:

25₁₀ = 11001₂


1.4.16 Binary to Octal Conversion

The easiest method is to group binary digits into groups of 3, starting from the right.

Example

Convert:

101101₂ → Octal

Group into 3:

101 101

Convert each group:

101 = 5
101 = 5

Therefore:

101101₂ = 55₈

Useful Table

BinaryOctal
0000
0011
0102
0113
1004
1015
1106
1117

1.4.17 Octal to Binary Conversion

For octal → binary, convert each octal digit into 3 binary bits.

Example

Convert:

55₈ → Binary
5 = 101
5 = 101

Therefore:

55₈ = 101101₂

Easy Rule

1 Octal digit = 3 Binary bits


1.4.18 Binary to Hexadecimal Conversion

For binary → hexadecimal, group binary digits into groups of 4, starting from the right.

Example

Convert:

101101₂ → Hexadecimal

First add leading zeros if necessary:

0010 1101

Now convert:

0010 = 2
1101 = D

Therefore:

101101₂ = 2D₁₆


1.4.19 Binary to Hexadecimal Table

BinaryHex
00000
00011
00102
00113
01004
01015
01106
01117
10008
10019
1010A
1011B
1100C
1101D
1110E
1111F

Easy Rule

1 Hexadecimal digit = 4 Binary bits


1.4.20 Hexadecimal to Binary

Convert each hexadecimal digit into 4 binary bits.

Example

Convert:

2D₁₆ → Binary
2 = 0010
D = 1101

Therefore:

2D₁₆ = 00101101₂

Leading zeros may be omitted when appropriate:

101101₂

1.4.21 Decimal to Octal Conversion

Use repeated division by 8.

Example

Convert:

125₁₀ → Octal
125 ÷ 8 = 15 R5
15 ÷ 8  = 1  R7
1 ÷ 8   = 0  R1

Read remainders from bottom to top:

175

Therefore:

125₁₀ = 175₈


1.4.22 Decimal to Hexadecimal Conversion

Use repeated division by 16.

Example

Convert:

254₁₀ → Hexadecimal
254 ÷ 16 = 15 R14
15 ÷ 16  = 0  R15

Now:

14 = E
15 = F

Read from bottom to top:

FE

Therefore:

254₁₀ = FE₁₆


1.4.23 Octal to Decimal Conversion

Multiply each digit by the corresponding power of 8.

Example

Convert:

175₈ → Decimal
1×8² + 7×8¹ + 5×8⁰

= 1×64 + 7×8 + 5×1

= 64 + 56 + 5

= 125

Therefore:

175₈ = 125₁₀


1.4.24 Hexadecimal to Decimal Conversion

Multiply each digit by the corresponding power of 16.

Example

Convert:

2D₁₆ → Decimal

Remember:

D = 13

Therefore:

2×16¹ + 13×16⁰

= 2×16 + 13×1

= 32 + 13

= 45

Therefore:

2D₁₆ = 45₁₀


⭐ 1.4.25 Base Conversion Shortcut

Remember these two important relationships:

Binary ↔ Octal

3 Binary bits = 1 Octal digit

Binary ↔ Hexadecimal

4 Binary bits = 1 Hexadecimal digit

Therefore:

Binary → Octal
Group 3 bits

Binary → Hex
Group 4 bits

This is much faster than converting through decimal.


1.4.26 Binary Arithmetic

Computers perform arithmetic internally using binary numbers.

The main binary arithmetic operations are:

  1. Binary Addition
  2. Binary Subtraction
  3. Binary Multiplication
  4. Binary Division

1.4.27 Binary Addition

Binary addition has four basic rules:

ABSumCarry
0000
0110
1010
1101

The most important rule is:

1 + 1 = 10₂

This means:

Sum = 0
Carry = 1

Example: Binary Addition

Add:

   1011
 + 0110
 -------

From right to left:

1 + 0 = 1

1 + 1 = 10
→ write 0, carry 1

0 + 1 + 1 = 10
→ write 0, carry 1

1 + 0 + 1 = 10
→ write 0, carry 1

Final result:

   1011
 + 0110
 -------
  10001

Therefore:

1011₂ + 0110₂ = 10001₂

Check in decimal:

11 + 6 = 17

and:

10001₂ = 17₁₀

Correct.


1.4.28 Binary Subtraction

Basic rules:

ABDifferenceBorrow
0000
1010
1100
0111

The important case is:

0 - 1

We need to borrow from the next higher bit.


Example

Subtract:

   1101
 - 0011
 -------

Result:

   1101
 - 0011
 -------
   1010

Therefore:

1101₂ − 0011₂ = 1010₂

Check:

13 − 3 = 10

and:

1010₂ = 10₁₀

1.4.29 Binary Multiplication

Binary multiplication is very simple because:

0 × 0 = 0
0 × 1 = 0
1 × 0 = 0
1 × 1 = 1

Example

Multiply:

     101
   ×  11
   ------
     101
    101
   ------
    1111

Therefore:

101₂ × 11₂ = 1111₂

Check:

5 × 3 = 15

and:

1111₂ = 15₁₀

1.4.30 Binary Division

Binary division follows the same basic principle as decimal long division.

Example

1100₂ ÷ 10₂

Since:

12 ÷ 2 = 6

Therefore:

1100₂ ÷ 10₂ = 110₂

1.4.31 Binary Arithmetic Summary

OperationImportant Rule
Addition1 + 1 = 10
Subtraction0 − 1 requires borrow
Multiplication1 × 1 = 1
DivisionSame basic concept as decimal division

1.4.32 Complements

Complements are important in computer arithmetic, especially for subtraction and signed number representation.

The two important binary complements are:

  1. One's Complement
  2. Two's Complement

1.4.33 One's Complement

To find the one's complement:

Change every 0 to 1 and every 1 to 0.

Example

Original:
10110010

One's Complement:
01001101

Rule

0 → 1
1 → 0

1.4.34 Two's Complement

To find two's complement:

Step 1

Find one's complement.

Step 2

Add 1.

Example

Find two's complement of:

00000101

One's complement:

11111010

Add 1:

11111010
+       1
---------
11111011

Therefore:

Two's complement = 11111011

Easy Trick

Two's Complement = One's Complement + 1


1.4.35 Binary Subtraction Using Two's Complement

Two's complement can be used to perform subtraction using addition.

Example

Calculate:

7 − 3

Using 4-bit binary:

7 = 0111
3 = 0011

Find two's complement of 3:

0011

One's complement:

1100

Add 1:

1101

Now add:

  0111
+ 1101
------
1 0100

Discard the extra carry:

0100

Therefore:

0100₂ = 4₁₀

So:

7 − 3 = 4


1.4.36 Signed and Unsigned Numbers

Binary numbers can be represented as:

Unsigned

All bits represent the magnitude.

For n bits, unsigned representation can represent:

0 to 2ⁿ − 1

Example

For 4 bits:

0 to 15

Signed

Signed representation allows both positive and negative numbers.

A common method is two's complement.

For an n-bit two's complement representation, the range is:

−2ⁿ⁻¹ to 2ⁿ⁻¹ − 1

Example: 8-bit

−128 to +127

1.4.37 Overflow

Overflow occurs when the result of an arithmetic operation is too large to be represented using the available number of bits.

Example

Using 4-bit unsigned numbers:

1111₂ = 15

If we add:

0001₂ = 1

Then:

1111
+0001
-----
10000

But 4 bits cannot represent 10000.

Therefore, overflow occurs.


1.4.38 Binary Fraction

Binary numbers can also have fractional parts.

Binary fractions use negative powers of 2.

2⁻¹ = 1/2
2⁻² = 1/4
2⁻³ = 1/8
2⁻⁴ = 1/16

Example

Convert:

0.101₂ → Decimal
1×2⁻¹ + 0×2⁻² + 1×2⁻³

= 1/2 + 0 + 1/8

= 0.5 + 0.125

= 0.625

Therefore:

0.101₂ = 0.625₁₀


1.4.39 Decimal Fraction to Binary

For a decimal fraction, repeatedly multiply the fractional part by 2 and record the integer part.

Example

Convert:

0.625₁₀ → Binary
0.625 × 2 = 1.25  → 1
0.25  × 2 = 0.50  → 0
0.50  × 2 = 1.00  → 1

Read the integer parts from top to bottom:

101

Therefore:

0.625₁₀ = 0.101₂


1.4.40 Binary Coded Decimal — BCD

BCD = Binary Coded Decimal

In BCD, each decimal digit is represented separately using 4 bits.

Example

Decimal:

59

Convert each digit separately:

5 = 0101
9 = 1001

Therefore:

59₁₀ = 0101 1001 (BCD)

Important

BCD is not the same as converting the entire decimal number directly into binary.

For example:

59 decimal in normal binary = 111011

But:

59 in BCD = 0101 1001

1.4.41 Binary vs BCD

BinaryBCD
Represents the whole number in base 2Represents each decimal digit separately
59 → 11101159 → 0101 1001
More compactUses more bits for many numbers
Used internally for general binary computationUseful where decimal digit representation is important

1.4.42 Why Octal and Hexadecimal Are Used

Long binary numbers are difficult for humans to read.

For example:

111111101010110100101101

This is difficult to remember.

Hexadecimal makes it shorter:

FEAD2D

Because:

1 hexadecimal digit represents 4 binary bits.

Similarly:

1 octal digit represents 3 binary bits.

Uses of Hexadecimal

  • Memory addresses
  • Machine-level programming
  • Debugging
  • Color codes
  • Networking
  • Digital electronics

⭐ 1.4.43 Important Conversion Table

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

⭐ 1.4.44 Conversion Methods — Quick Chart

                 BASE CONVERSION
                       │
        ┌──────────────┼──────────────┐
        ↓              ↓              ↓
     Binary          Decimal       Hexadecimal
        │              │              │
        ↓              ↓              ↓
      Octal        Repeated        4-bit groups
   3-bit groups    division

Remember:

Binary → Decimal

Multiply by powers of 2 and add.

Decimal → Binary

Divide repeatedly by 2.

Binary → Octal

Group 3 bits.

Octal → Binary

Convert each digit to 3 bits.

Binary → Hex

Group 4 bits.

Hex → Binary

Convert each digit to 4 bits.

Decimal → Octal

Divide repeatedly by 8.

Decimal → Hex

Divide repeatedly by 16.


⭐ 1.4.45 Common Mistakes Students Make

Mistake 1: Reading remainders in the wrong direction

For:

Decimal → Binary/Octal/Hexadecimal

Read remainders:

Bottom → Top


Mistake 2: Using 8 or 9 in octal

Incorrect:

128₈

Because octal only uses:

0–7

Mistake 3: Forgetting hexadecimal values

Remember:

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Mistake 4: Wrong grouping

For:

Binary → Octal

Group:

3 bits

For:

Binary → Hexadecimal

Group:

4 bits


Mistake 5: Confusing BCD with Binary

For example:

25 in Binary = 11001

But:

25 in BCD = 0010 0101

They are different representations.


⭐ 1.4.46 Important Exam Questions

Very Important Long Questions

  1. What is a number system? Explain different types of number systems.
  2. Explain decimal, binary, octal and hexadecimal number systems.
  3. What is radix/base? Explain with examples.
  4. Why does a computer use the binary number system?
  5. Explain positional number systems.
  6. Explain binary number system with suitable examples.
  7. What is base conversion? Explain different methods of base conversion.
  8. Convert binary numbers into decimal numbers with proper steps.
  9. Convert decimal numbers into binary numbers using repeated division.
  10. Explain binary-to-octal and octal-to-binary conversion.
  11. Explain binary-to-hexadecimal and hexadecimal-to-binary conversion.
  12. Explain decimal-to-octal and octal-to-decimal conversion.
  13. Explain decimal-to-hexadecimal and hexadecimal-to-decimal conversion.
  14. What is binary arithmetic? Explain binary addition, subtraction, multiplication and division.
  15. Explain one's complement and two's complement.
  16. Explain subtraction using two's complement.
  17. What is overflow in binary arithmetic?
  18. Explain signed and unsigned binary numbers.
  19. What is BCD? Explain with an example.
  20. Differentiate between binary and BCD representation.

📝 1.4.47 Practice Questions

Try solving these yourself.

A. Binary → Decimal

  1. 1010₂
  2. 11001₂
  3. 101101₂
  4. 1110011₂
  5. 10011010₂

B. Decimal → Binary

  1. 15₁₀
  2. 25₁₀
  3. 45₁₀
  4. 64₁₀
  5. 100₁₀

C. Binary → Octal

  1. 101101₂
  2. 111001₂
  3. 1101011₂

D. Binary → Hexadecimal

  1. 101101₂
  2. 11110000₂
  3. 10101111₂

E. Binary Arithmetic

  1. 1010 + 1101
  2. 1111 + 0001
  3. 1101 − 0011
  4. 101 × 11
  5. 1100 ÷ 10

🧠 1.4.48 Quick Revision — One Page

Number System

A method of representing numbers using a set of symbols and rules.

Base/ Radix

Number of symbols used in a number system.

Decimal

Base 10 → 0–9

Binary

Base 2 → 0, 1

Octal

Base 8 → 0–7

Hexadecimal

Base 16 → 0–9, A–F


Binary

1 bit = 0 or 1

1 byte = 8 bits


Binary → Decimal

Multiply by powers of 2 and add.

Decimal → Binary

Repeated division by 2; read remainders bottom to top.

Binary → Octal

Group 3 bits.

Octal → Binary

1 octal digit = 3 bits.

Binary → Hexadecimal

Group 4 bits.

Hexadecimal → Binary

1 hexadecimal digit = 4 bits.


Binary Addition

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10

Binary Multiplication

0 × 0 = 0
0 × 1 = 0
1 × 0 = 0
1 × 1 = 1

One's Complement

Change 0 → 1 and 1 → 0

Two's Complement

One's Complement + 1

Overflow

Result cannot be represented with the available number of bits.

BCD

Each decimal digit is represented separately using 4 bits.


🎯 1.4.49 Exam Shortcut

If you get a numerical question on number-system conversion, first identify the direction:

Decimal → Other
        ↓
Repeated Division

Other → Decimal
        ↓
Place Values + Multiplication

Binary → Octal
        ↓
Group 3 bits

Octal → Binary
        ↓
3 bits per digit

Binary → Hex
        ↓
Group 4 bits

Hex → Binary
        ↓
4 bits per digit

Post a Comment

0 Comments