Recall warm-up
- Internet checksum of the words 0x0001 and 0xFFFE?
Stuck? Peek at 2.2.3 The Internet checksum: compute and verify
- 16-bit words; checksum field = 0 while summing.
- Sum with 1's-complement addition (wrap carries); checksum = complement of the sum.
- Receiver: sum of all words + checksum = 0xFFFF → accept.
- Misses word reordering and compensating errors.
- d_min needed to correct 2 errors?
Stuck? Peek at 2.2.2 Hamming distance: detect d − 1, correct ⌊(d − 1)/2⌋
- d(x, y) = number of 1s in x ⊕ y; d_min = smallest over codeword pairs.
- Detect d_min − 1; correct ⌊(d_min − 1)/2⌋.
- Detect s needs d ≥ s + 1; correct t needs d ≥ 2t + 1.
- Hamming code: smallest r with 2ʳ ≥ m + r + 1.
- Remainder length when dividing by a 5-bit divisor (modulo 2)?
Stuck? Peek at 0.2.3 XOR, 1's complement addition and modulo-2 division
- AND (mask), OR, NOT (flip), XOR (1 where bits differ).
- a ⊕ a = 0, a ⊕ 0 = a, (a ⊕ k) ⊕ k = a.
- 1's complement = flip all bits; 1's-complement addition wraps the end carry back in.
- Modulo-2: + = − = XOR, no carries; bits ↔ polynomial.
- Mod-2 division: leading 1 → XOR divisor; leading 0 → XOR zeros; remainder = (divisor length − 1) bits.
The Hook
Every frame your laptop sends on a cable or over Wi-Fi ends with a short check value made by long division — not ordinary division, but the carry-free modulo-2 division you practised in Lesson 0.2.3. It is called the CRC (cyclic redundancy check), and it catches every burst of errors shorter than the check value. That is why the link layer uses it rather than parity or a checksum.
Predict First
The sender appends r bits so that the whole frame divides exactly (modulo 2) by an agreed (r + 1)-bit generator. The receiver divides again. What remainder should it get if nothing was damaged?
,Zero. The appended bits are exactly the remainder that makes the whole string a multiple of the generator. Any nonzero remainder means some bits changed.
Core Concept
Generator polynomial
| Bits | Polynomial | Degree r | CRC length |
|---|---|---|---|
| 1101 | x³ + x² + 1 | 3 | 3 bits |
| 10011 | x⁴ + x + 1 | 4 | 4 bits |
| 100000111 | x⁸ + x² + x + 1 | 8 | 8 bits |
Sender: append zeros, divide, attach remainder
- Append r zeros to the data (r = degree of G).
- Divide by G using modulo-2 division.
- Replace the r zeros with the r-bit remainder. Transmit data + remainder.
111101 ← quotient
1101 ) 100100000
1101 ← leading 1: XOR with divisor
----
1000
1101 ← leading 1: XOR with divisor
----
1010
1101 ← leading 1: XOR with divisor
----
1110
1101 ← leading 1: XOR with divisor
----
0110
0000 ← leading 0: XOR with zeros
----
1100
1101 ← leading 1: XOR with divisor
----
001 ← remainder (3 bits)Receiver check
Divide the whole received string by G. Remainder 0 → accept; otherwise → error detected. Mathematically, if the transmitted codeword is T and the error pattern is E (1s where bits flipped), the receiver sees T ⊕ E; since T divides exactly, the remainder is that of E alone. An error goes undetected exactly when E is a multiple of G.
What CRC catches
- All single-bit errors if G has at least two terms.
- All odd numbers of errors if G has (x + 1) as a factor.
- All bursts of length ≤ r (G of degree r with a constant term 1).
- Bursts of length r + 1 are missed with probability 2⁻⁽ʳ⁻¹⁾; longer bursts with probability 2⁻ʳ.
- All double-bit errors as long as G does not divide xᵏ + 1 for any k up to the frame length.
Putting it together
- CRC appends the r-bit remainder of (data · xʳ) ÷ G.
- The receiver accepts only a zero remainder.
- CRC catches all single-bit errors and all bursts up to r bits; it misses only multiples of G.
Visual
1100001110 ← quotient
10011 ) 11010111110000
10011 ← leading 1: XOR with divisor
-----
10011
10011 ← leading 1: XOR with divisor
-----
00001
00000 ← leading 0: XOR with zeros
-----
00011
00000 ← leading 0: XOR with zeros
-----
00111
00000 ← leading 0: XOR with zeros
-----
01111
00000 ← leading 0: XOR with zeros
-----
11110
10011 ← leading 1: XOR with divisor
-----
11010
10011 ← leading 1: XOR with divisor
-----
10010
10011 ← leading 1: XOR with divisor
-----
00010
00000 ← leading 0: XOR with zeros
-----
0010 ← remainder (4 bits)Worked Examples
Data 100100, generator 1101. Find the CRC and the transmitted bits.
Show the full solution
r = 3 → divide 100100000 by 1101 → remainder 001 → transmit 100100001.
Data 1101011111, G(x) = x⁴ + x + 1. Find the transmitted frame. The last bit flips on the way — is it detected?
Show the full solution
G = 10011, r = 4. Divide 11010111110000 → remainder 0010 → transmit 11010111110010. If the last bit flips, E = 1, which G does not divide → remainder ≠ 0 → detected.
With G = 10011, the transmitted frame 11010111110010 suffers the error pattern 00000000010011 (bits flipped where E has 1s). Is it detected? What general rule explains this?
Show the full solution
The received string is T ⊕ E. Its remainder equals the remainder of E. Here E is exactly G shifted to the right end, a multiple of G → remainder 0 → not detected. Rule: an error goes undetected iff the error pattern is a multiple of G. Since this E has burst length 5 = r + 1, it is in the small class of (r + 1)-bursts that can slip through.
GATE Traps
- Append r zeros, where r is the degree (generator length − 1), not the generator length.
- The transmitted frame is data followed by the remainder — not the quotient.
- Keep leading zeros in the remainder: 0010 has 4 bits.
- "Detects all bursts ≤ r" — a burst of exactly r + 1 is not guaranteed.
Memory Hook
"Pad with r zeros, divide, keep the remainder — the receiver wants zero."
Connect the Dots
Chapter 2.2 is complete: parity, Hamming distance, checksum and CRC. Our frames now arrive checked. Next (Ch 2.3): on a shared link, many nodes want to send — if two send at once, both frames are destroyed. Who should speak, and when?
Self-Test
- MCQ
Data 1010001101, G = 110101. The CRC is:
- 01110
- 1110
- 00111
- 10111
- NAT
G(x) = x⁸ + x² + x + 1. How many CRC bits are appended?
Write your answer before opening the key.
- MSQ
For a generator of degree r with constant term 1, which are always detected?
- All single-bit errors
- All bursts of length ≤ r
- All bursts of length r + 1
- Error patterns equal to G
- MCQ
Received 100100001 with G = 1101. The receiver:
- accepts (remainder 0)
- rejects (remainder ≠ 0)
- needs the quotient
- cannot check without the data length
- NAT
With G = 1101 and data 101110, how many bits are transmitted in total?
Write your answer before opening the key.
Rule Card
- G of degree r (r + 1 bits); append r zeros, divide modulo 2, send data + r-bit remainder.
- Receiver divides the whole frame: remainder 0 → accept.
- Undetected ⇔ error pattern E is a multiple of G.
- Catches: all single-bit errors (≥ 2 terms), all odd counts (x + 1 | G), all bursts ≤ r; (r+1)-bursts missed w.p. 2⁻⁽ʳ⁻¹⁾, longer 2⁻ʳ.
Concept Ledger
- CRC (cyclic redundancy check), FCS
- generator polynomial, degree r
- append r zeros
- receiver remainder test
- error pattern E; undetected iff G divides E
- burst detection guarantees
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- Sum = 0xFFFF; checksum = 0x0000.
- 5.
- 4 bits.
Self-test answers
- A — r = 5: append 5 zeros and divide → remainder 01110.
- B: Leading zero dropped: the CRC must have 5 bits.
- C: Arithmetic slip in the division.
- D: Arithmetic slip in the division.
- 8 — Degree 8 → 8 bits.
- AB — Single-bit errors and bursts up to r are guaranteed.
- C: Missed with probability 2⁻⁽ʳ⁻¹⁾.
- D: A multiple of G gives remainder 0 — undetected.
- A — That is exactly the codeword built from 100100; remainder 0.
- B: The remainder is 0.
- C: Only the remainder matters.
- D: Division of the whole string suffices.
- 9 — 6 data bits + 3 CRC bits = 9.
Flashcards
- How many zeros to append for CRC?
Reveal answer
r = degree of the generator. - When is an error missed by CRC?
Reveal answer
When the error pattern is a multiple of G. - Bursts always detected?
Reveal answer
Length ≤ r. - G = 10011: CRC bits?
Reveal answer
4.
Exam shortcuts
- CRC length = degree of G = (number of generator bits) − 1; append that many zeros. — always.
- Undetected ⇔ E is a multiple of G; bursts ≤ r are always caught. — G has a nonzero constant term (ends in 1).