Understanding Number Systems and Compression Techniques


1. Introduction to Number Systems

In computing, data is represented in different number systems (or bases), depending on the context. The most common systems are:

Number SystemBaseDigits UsedExample
Binary20, 11010
Denary (Decimal)100–942
Hexadecimal160–9, A–F2F
  • Binary: Used by all digital devices.
  • Denary: What humans use daily.
  • Hexadecimal: Programmer-friendly shorthand for binary.

2. Binary (Base-2)

Binary only uses 0 and 1. Each digit is called a bit.
8 bits = 1 byte.

Computers use binary because internal components (transistors) operate in two states:

  • ON (1)
  • OFF (0)

Binary to Denary Conversion

Each binary digit represents a power of 2, starting from the right.

Example: Convert 1011 to decimal.

Bit Position3210
Binary Digit1011
Calculation1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11

3. Denary (Base-10)

The standard system for humans. Uses digits 0–9.

Denary to Binary Conversion

Divide the number by 2 repeatedly. Record remainders.

Example: Convert 13 to binary.

DivisionQuotientRemainder
13 ÷ 261 (LSB)
6 ÷ 230
3 ÷ 211
1 ÷ 201 (MSB)

Binary = 1101


4. Hexadecimal (Base-16)

Hex uses digits 0–9 and A–F (A = 10, F = 15).

Why use hex?

  • Shorter than binary
  • Easier to read/debug
  • Maps directly to binary (1 hex digit = 4 bits)

Hexadecimal to Denary Example

Convert 2F to decimal:

DigitPositionValue
216¹2×16 = 32
F=1516⁰15×1 = 15

Total = 32 + 15 = 47

Binary to Hex Conversion

Split into 4-bit nibbles.

Binary: 110101101101 0110
1101 = D, 0110 = 6
Hex: D6


5. Quick Conversion Table

DenaryBinary (8-bit)Hex
0000000000
5000001015
1000001010A
1500001111F
25511111111FF

6. Why Do Programmers Use Hexadecimal?

1. Compact Representation

Binary: 1101001110101101
Hex: D3AD

2. Easy to Read

Common in memory addresses, color codes (#FF5733), machine-level debugging.

3. Direct Binary Mapping

Each hex digit maps to exactly 4 bits, making conversion straightforward.

4. Historical Use

Hex has long been used in assembly language and low-level systems for simplicity.


7. Compression Techniques: Lossy vs. Lossless

With large files (images, audio, video), compression helps reduce file size.

What Is Compression?

Compression reduces the number of bits needed to store or transmit data. This:

  • Saves storage space
  • Reduces transfer time
  • Optimizes performance

Two Main Types:

TypeData LossCommon Use Cases
LosslessNoneText, code, PNGs
LossySome data discardedPhotos, music, video

Lossless Compression

Original data is preserved. Can be decompressed to the exact original.

Common Techniques:

  • Run-Length Encoding (RLE)
    Example: "AAAABBBCC""4A3B2C"
  • Huffman Coding
    Frequently used characters get shorter binary codes.

File Formats:

.zip, .png, .flac, .gif


Lossy Compression

Data is permanently removed. Ideal when perfect accuracy isn’t needed.

Techniques:

  • JPEG – Compresses image detail
  • MP3 – Removes inaudible frequencies
  • MP4 – Drops unnecessary video frames

File Formats:

.jpg, .mp3, .mp4, .avi


8. File Size Calculations

Understanding file sizes helps explain why compression is needed.

Image File Size:

Formula:
File Size = Width × Height × Colour Depth

Example:
1920 × 1080 @ 24 bits =
1920 × 1080 × 24 = 49,766,400 bits ≈ 5.96 MB


Audio File Size:

Formula:
File Size = Sample Rate × Bit Depth × Channels × Duration

Example:
44,100 Hz, 16-bit, stereo, 60 sec =
44100 × 16 × 2 × 60 = 84,672,000 bits ≈ 10.58 MB


9. Bitmap vs. Vector Images

FeatureBitmap ImagesVector Images
StructurePixelsShapes & paths
ScalingPixelates on zoomScales without loss
Common UsesPhotosLogos, diagrams
File Types.bmp, .jpg, .png.svg, .pdf, .eps

Bitmap Example: A photo becomes blurry when zoomed.
Vector Example: A logo stays crisp on a billboard.


10. Summary & Key Takeaways

  • Binary is how computers store data (1s and 0s).
  • Denary is our everyday numbering system.
  • Hexadecimal is a compact, programmer-friendly way to represent binary.
  • Lossless compression preserves original data—used for accuracy.
  • Lossy compression reduces file size significantly—used for media.
  • You should be able to convert between systems, understand file size formulas, and explain bitmap vs vector images.

Final Thought:

Hex is like “shorthand binary”—compact, human-friendly, and efficient.
Compression makes modern media and storage practical.

Below is a detailed presentation for this chapter. Use it to study from slides.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top