Error Detection Using Cyclic Redundancy Check (CRC): Principle, Modulo-2 Division, and Worked Example
Error Detection Using Cyclic Redundancy Check (CRC): Principle, Modulo-2 Division, and Worked Example
Cyclic Redundancy Check CRC is an error-detecting code constructed from a generator polynomial . The core principle is polynomial long division over modulo-2 arithmetic (so subtraction is XOR, with no carries/borrows). Modulo-2 division is used to compute a remainder that is appended to the data, forming a transmitted codeword. At the receiver, the same division is performed; if the remainder is nonzero, an error is detected. This “nonzero remainder” property is central to CRC’s detection capability.
A generator of degree implies CRC appends exactly redundant bits (the remainder length) to the dataword. Generator polynomial defines the code structure; Remainder determines the appended checksum bits.
Polynomial model for CRC
Map a binary string to a polynomial over :
- bit string
- addition/subtraction uses XOR (coefficients reduced mod 2)
Then:
- Data polynomial: from the dataword.
- Multiply by (append zeros): .
- Compute remainder when dividing by :
- Transmitted codeword polynomial:
At the receiver, the receiver divides the received bits interpreted as by . If the received codeword was correct (i.e., no errors), then: So any error pattern that yields a nonzero remainder will be detected because:
CRC Explained (Polynomial & Remainder Check)
Key terms to anchor the idea
- Dataword
- Generator polynomial
- Remainder
- Transmitted codeword
Visualizing the CRC division flow
Compute the transmitted codeword for CRC using modulo-2 division
- 1Step 1
Dataword =
1101011011and generator (degree ). CRC appends zeros before division. - 2Step 2
corresponds to bits
10101(coefficients for are ). - 3Step 3
Append 4 zeros:
1101011011→1101011011 0000(total length 14). - 4Step 4
Use XOR subtraction (no carries). Divide
11010110110000by10101to obtain remainder of 4 bits. - 5Step 5
Transmitted bits = original dataword + remainder (4 bits).
Worked example (CRC codeword)
1) Inputs
- Dataword:
1101011011 - Generator polynomial:
- Degree:
- Generator bit pattern (divisor):
10101(since and and have coefficient 1)
So we append 4 zeros to the dataword:
- bits:
11010110110000
2) Modulo-2 long division to find remainder
We divide 11010110110000 by 10101 using XOR “subtraction” at each step when the leading bit is 1.
Carrying out the long division yields the final remainder:
- =
0100
Therefore the transmitted CRC codeword is:
- Transmitted codeword = dataword + remainder
So the transmitted codeword is:
11010110110100
(Here || means concatenation.)
3) Verify at the receiver: division should give remainder 0
The receiver takes the received bits (assume no alteration) interpreted as and divides by $G(x)=10101` again.
Because CRC construction guarantees is exactly divisible by , we have:
In binary remainder terms:
- Divide
11010110110100by10101 - Receiver remainder =
0000
Hence:
- The receiver concludes no error detected.
type="tip" title="Why appending zeros works" content="Because has degree , the remainder of dividing by always has degree < . That remainder is exactly bits, so appending zeros makes room to insert the computed parity bits."
type="warning" title="CRC is error-detecting, not error-correcting" content="If an error pattern happens to be a multiple of , the remainder could still be 0 and the CRC would not detect it. This is rare for good generator polynomials, but not impossible."
CRC transmitter-to-receiver lifecycle
Append zeros
1. Sender preparationExtend to by appending zeros."
Compute remainder
2. Sender computationDivide by to obtain ."
Form codeword
3. Sender transmissionTransmit (dataword + remainder bits)."
Divide received word
4. Receiver checkingCompute . If remainder is 0 → accept, else → detect error."
Bit roles in the CRC codeword (this example)
Lengths and placement of fields for r = 4.
Receiver detection logic (no-bit-altered case)
Knowledge Check
In CRC, how is the remainder computed?