๐ŸŽ“ Learning Journey ยท Topic 1.5 ยท Cornerstone

Your journey through Compression

Lossy vs lossless, run-length encoding, and the six verbatim examiner traps that catch students year after year. Seven stages from theory to mastery. Click any stage card to dive in โ€” or continue where you left off.

Your progress

Where you are in Topic 1.5

0 / 7Stages visited
0 / 7Checklist items
0Vault entries
๐ŸŽฏ Recommended next stage

Start with Book Notes

Read the theory and terminology to get grounded.

The 7 stages

Choose any stage

Green cards are stages you've already visited. Grey cards are new territory. Click any card to jump straight to that stage.

Mistakes

Mistakes

Notes

Notes

Progress

Stats

0%Accuracy
0Answered
0Streak
Bookmarks

Bookmarks

Knowledge Vault 2.0

Knowledge Vault

Add entry

Category
Confidence
Title
Info

Entries

๐Ÿงช Exam Mode ON
๐Ÿ“š Topic 1.5 ยท Data Representation ยท Lab

Compression Lab โ€” lossy vs lossless

Why we compress data, the difference between lossy and lossless, and how run-length encoding shrinks a file.

๐Ÿงช Cambridge Exam Mode ON โ€” hints hidden, feedback delayed, model answers locked until marking.
ยง1 ยท Topic overview

What is Topic 1.5?

Data compression means reducing the size of a file. This makes it faster to transmit and takes up less storage space. Compression comes in two types: lossy (some data is permanently removed and the original cannot be recovered) and lossless (all data is preserved and the original can be reconstructed).

For lossless, Cambridge specifically require you to know run-length encoding (RLE) โ€” a technique that replaces runs of identical data with a single value and a count. This is the ONE compression method students need to describe by name and by example.

This is one of the most heavily marked topics on Paper 1. Every recent session has 5โ€“8 marks on compression. Most lost marks are for confusing "type" with "example", or writing generic definitions when the question asks about a specific context.

ยง2 ยท Learning objectives

By the end of 1.5 you canโ€ฆ

  • Define file compression as the process of reducing file size
  • State the two types: lossy and lossless
  • Distinguish "type" (lossy/lossless) from "example" (MP3, JPEG, PNG, ZIP)
  • Explain lossy: some data is permanently removed โ€” original cannot be recovered
  • Explain lossless: all data is preserved โ€” original can be reconstructed
  • Describe run-length encoding (RLE) as a lossless technique that replaces repeated patterns with a value and a count
  • Apply RLE to a simple example (e.g. "AAAABBB" โ†’ "4A3B")
  • State the benefits: less storage space, faster transmission
  • Justify which type to use in a given scenario, tied to the context of the question
ยง3 ยท Key terminology

Cambridge-approved terms

TermDefinition
File compressionThe process of reducing the size of a file (general definition โ€” applies to both lossy and lossless).
Lossy compressionA type of compression where some data is permanently removed. The original file cannot be recovered.
Lossless compressionA type of compression where all original data is preserved. The original file can be reconstructed.
Run-length encoding (RLE)A lossless technique that replaces runs of identical data with a value and a count.
Type (of compression)Lossy OR lossless โ€” the two categories.
Example (of compression)MP3, JPEG, PNG, ZIP โ€” specific file formats or methods. NOT the same as "type".
ยง4 ยท Core theory

The tables you must know cold

Lossy vs Lossless

FeatureLossyLossless
Data removed?Yes โ€” permanentlyNo โ€” all data kept
Original recoverable?NoYes
File size reductionVery large (much smaller)Moderate (smaller, but less than lossy)
QualityReduced โ€” may show pixelation, blurring, or lower audio fidelityIdentical to original
Use casesPhotos, music, video (small size matters more than perfection)Text, code, executables, medical images (data integrity is critical)
Examples of formatsJPEG (images), MP3 (audio), MPEG (video)PNG, GIF (images), FLAC (audio), ZIP, RLE (files)

Rule of thumb: if losing any data would break the file (e.g. a program, a spreadsheet, a document), use lossless. If a small quality drop is acceptable and file size matters more (e.g. streaming music), use lossy.

Run-length encoding (RLE) โ€” the method

StepWhat to do
1Scan the data for runs โ€” sequences of the same value repeated.
2Replace each run with a pair: count (how many times) + value.
3Result: shorter file, same information. Original can be reconstructed by expanding each pair.

RLE works best on data with long runs of the same value โ€” e.g. simple images with large blocks of a single colour, or text with many repeated characters. It works poorly on data with lots of variety.

Benefits of compression

BenefitWhy
Less storage spaceSmaller file โ†’ fits more files on the same disk.
Faster transmissionSmaller file โ†’ less data to send โ†’ arrives faster.
Lower bandwidth useLess data over the network โ†’ cheaper / more available.
ยง5 ยท Worked examples

Watch each one done step by step

Worked example 1 ยท RLE on a text string

Apply RLE to the string AAAABBBCCDAA.

Scan for runs of identical characters: AAAA โ†’ run of 4 As โ†’ "4A" BBB โ†’ run of 3 Bs โ†’ "3B" CC โ†’ run of 2 Cs โ†’ "2C" D โ†’ run of 1 D โ†’ "1D" AA โ†’ run of 2 As โ†’ "2A" Encoded output: 4A3B2C1D2A Original: 12 characters Encoded: 10 characters (count+letter pairs) Compression: file is smaller AND fully reversible.

Worked example 2 ยท RLE on image pixel data

An image row contains 10 white pixels, 4 red, 6 white. Encode using RLE.

10 white, 4 red, 6 white RLE: 10W 4R 6W Original: 20 pixel values stored one after the other RLE: 3 count+value pairs This is why RLE works well on simple graphics with large areas of a single colour โ€” like logos or line art. It works poorly on photographs (too much variety).

Worked example 3 ยท Justifying lossless in context

"A doctor sends an X-ray image by email. Explain why lossless compression is used."

Model answer: Lossless compression is used because all the original data must be preserved. In an X-ray, losing any data (e.g. through lossy compression) could remove important diagnostic detail โ€” for example, small features that indicate a fracture or tumour. Lossless allows the file to be smaller for emailing while ensuring the doctor sees exactly what was originally captured. Key: TIE JUSTIFICATION TO CONTEXT (X-ray โ†’ diagnostic detail). Do NOT just describe what lossless is.
ยง6 ยท Common misconceptions

Traps that cost marks every session

Trap ยท Giving an "example" when the question asks for a "type"

This is the #1 compression mistake year after year. Type means lossy or lossless. Example means MP3, JPEG, PNG, ZIP. Read the question โ€” if it says "type", write lossy or lossless. Never write "MP3" when asked for a type.

Cited: 2024 examiner report โ€” verbatim: "Many candidates were able to give two correct types of compression. Some candidates gave examples of file types or formats, for example JPEG, rather than types of compression."

Trap ยท Defining ALL compression as "removing data"

"Removing data" only describes lossy. If the question asks what file compression is in general, the correct definition is "reducing the size of a file". Lossless compression does NOT remove data โ€” it reorganises it.

Cited: 2024 examiner report โ€” verbatim: "Some candidates focused on a particular kind of compression rather that compression in general. For example, stating that it is when data is permanently removed from the file. This would not be true in all examples of file compression."

Trap ยท Saying "ZIP" or a file format when asked for a compression METHOD

ZIP is a file format, not a compression method. Cambridge want the METHOD by name โ€” for lossless, that's run-length encoding (RLE). Say "RLE" and then describe how it identifies and encodes repeated patterns.

Cited: 2025 examiner report โ€” verbatim: "Some candidates gave a file type or identified zip folders which are not a method of compression."

Trap ยท Saying a compressed file is "easier" to send

Compressed = FASTER, not EASIER. The process is the same either way; for the user, an uncompressed file is if anything simpler (no unzipping). Use words like "faster to transmit", "less bandwidth", "less storage" โ€” never "easier".

Cited: 2022 examiner report โ€” verbatim: "A common misunderstanding is that a compressed file is 'easier' to send. Easier indicates that there are fewer steps for the user to follow. The process is the same whether the file is compressed, or not compressed."

Trap ยท Describing what lossy IS instead of WHY it's not suitable

When Cambridge ask "why is lossy not suitable HERE?" they want a justification tied to the scenario, not a definition. Bad: "lossy removes data permanently". Good: "lossy would remove detail from the X-ray that the doctor needs to see clearly to make a diagnosis".

Cited: 2024 examiner report โ€” verbatim: "Many candidates just provided a description of what lossy or lossless compression is rather than providing information about why lossy is not suitable."

Trap ยท Generic answer that ignores the context (e.g. describing text compression when the question is about an image)

If the question specifies an image, describe how RLE finds runs of pixels of the same colour. If it's a text file, describe how it finds repeated patterns of characters/words. Match your answer to the file type in the question.

Cited: 2025 examiner report โ€” verbatim: "Many candidates gave a very generic response about a generic file and did not relate their response to the context given in the question. For example, many candidates explained how lossless compression would reduce the size of a text file, by finding repeating words."
ยง7 ยท Cambridge exam focus

Mark-scheme templates

These are the exact phrasings Cambridge accept. Learn them.

"File compression reduces the size of a file" โ€” the GENERAL definition
"The two types are lossy and lossless" โ€” the TYPES (not examples)
"Lossy compression permanently removes some data; the original cannot be recovered" โ€” lossy definition
"Lossless compression preserves all data; the original can be reconstructed" โ€” lossless definition
"Run-length encoding (RLE) is a lossless method that replaces runs of identical data with a value and a count" โ€” RLE definition
"Compression allows the file to be transmitted faster / take less storage space" โ€” benefits
"Lossless is suitable HERE because [tie to context: no data loss / diagnostic detail preserved / text integrity intact]" โ€” justification pattern
Never write: MP3/JPEG when asked for "type" ยท "easier to send" ยท "removes data" as general compression ยท ZIP as a compression method
ยง8 ยท Quick knowledge check

Check yourself โ€” tap to reveal (0/6)

Answer these in your head, then tap to see the model answer. Aim for 5 or 6 right before moving on.

Q1 ยท Define file compression (in general).
Reducing the size of a file. That's the general definition. Not "removing data" โ€” that only applies to lossy.
Q2 ยท Name the two types of compression.
Lossy and lossless. NOT MP3 or JPEG โ€” those are examples, not types.
Q3 ยท What is the key difference between lossy and lossless?
Lossy permanently removes some data (original cannot be recovered). Lossless preserves all data (original can be reconstructed).
Q4 ยท Encode AAAABBBCCDAA using RLE.
4A3B2C1D2A โ€” each run replaced with count + value.
Q5 ยท A doctor emails an X-ray. Which type of compression is used and why?
Lossless โ€” because all diagnostic detail must be preserved. Lossy might remove features that show a fracture or tumour. Tie your justification to the scenario, don't just define lossless.
Q6 ยท Give two benefits of compressing a file.
1. The file takes up less storage space. 2. The file can be transmitted faster (less data to send).
๐Ÿš€ Ready for the rest
If you can answer 5 of the 6 knowledge checks above, you're ready to move on. Tap ๐ŸŽ“ Learn for the interactive theory, then ๐ŸŽฎ Activities for the Lossy-or-Lossless sorter and the RLE Challenge.

What is compression?

๐Ÿ“ฆ

Definition

Data compression reduces the file size by reducing the number of bits needed to represent the data.

โš  Trap: Don't just say "the data is reduced" โ€” say file size is reduced. Don't give an example (lossy, MP3) when asked to define compression. (Mar 2022, Nov 2024)

Why compress files?

ReasonDetail
Less storageTakes up less space on disk/server
Faster transmissionLess data to upload/download โ€” quicker
Less bandwidthUses less network capacity
Email limitsEmail services restrict attachment file sizes
Less data usageImportant for mobile users with limited data
โš  Trap: Don't say compression makes files "easier" to send. It makes them faster to send. The process is identical โ€” the file is just smaller. (Mar 2022)

Lossy vs Lossless

โšก Lossy

Permanently removes data โ€” cannot be recovered.

Reduces quality (pixelation, blurring, lower audio quality).

Produces smaller files than lossless.

Used when some quality loss is acceptable.

Examples: JPEG, MP3

Bridge: Like a photocopy of a photocopy โ€” still recognisable, but detail is lost forever.

โœ… Lossless

Reduces file size without losing any data.

All original data can be recovered exactly.

Produces larger files than lossy (but smaller than original).

Used when exact data must be preserved.

Examples: PNG, ZIP, RLE

Bridge: Like a vacuum bag โ€” everything is still there, just squashed smaller.

โš  Trap: When asked for a compression type, answer "lossy" or "lossless" โ€” NOT a format like MP3 or JPEG. Those are file formats, not types. (Jun 2023, Nov 2024)
โš  Trap: Always link your lossy/lossless choice to the specific scenario in the question. Generic answers don't earn marks. (Jun 2025)

Run-Length Encoding (RLE)

The main lossless compression method on the Cambridge syllabus.

How RLE works

1. Scan the data for repeating sequences (runs of the same value).

2. Replace each run with a (count, value) pair.

3. The compressed data uses far fewer bits.

Before: B B B B B R R R G G G G G G B B After: (5,B) (3,R) (6,G) (2,B) 16 values โ†’ 4 pairs = much smaller!
โš  Trap: PNG and ZIP are file formats, not compression methods. RLE is a method. (Mar 2025)

Quick check

Compression makes files _____ to send.

Easier
Faster
Harder
Safer

Activity 1 โ€” Lossy or Lossless?

Which type of compression is best for this scenario?

Press New Question.

Activity 2 โ€” Spot the Mistake

Press New Question.

Activity 3 โ€” RLE Challenge

Encode this sequence using RLE (count,value) pairs.

Press New Question.

Adaptive practice

Press New Question.

Cambridge-style questions

Press New Question.

Review quiz

Press New.

Exam traps

โš  1: Define compression as reducing file size. Don't just say "data is reduced." (Mar 2022)
โš  2: Compression = faster to send, NOT "easier." (Mar 2022)
โš  3: Type = lossy/lossless. Format = JPEG/MP3/PNG. Don't mix them. (Jun 2023)
โš  4: Link lossy/lossless choice to the specific scenario. Generic answers lose marks. (Jun 2025)
โš  5: RLE is a method. PNG/ZIP are formats, not methods. (Mar 2025)
โš  6: Read carefully: storage benefits โ‰  transmission benefits. Answer what's asked. (Nov 2024)

Memory triggers

๐Ÿง  "Vacuum bag vs photocopy"

Lossless = vacuum bag (everything preserved). Lossy = photocopy (detail lost each time).

๐Ÿง  "Faster not easier"

Every time you write "easier to send" cross it out and write "faster to transmit."

๐Ÿง  "RLE = count + value"

Scan for runs of the same thing โ†’ store (how many, what). That's it.

Mastery Map

Checkpoints

[ ] Define compression accurately
[ ] Give 3+ reasons for compression
[ ] Explain lossy (permanent, quality loss, smaller)
[ ] Explain lossless (no loss, exact recovery)
[ ] Choose lossy/lossless for a given scenario
[ ] Name RLE as a lossless method
[ ] Describe how RLE works (count + value)
[ ] Avoid "easier" trap
[ ] Type vs format distinction
[ ] Cambridge exam confidence
Developer Panel