Bursts and polynomials
A spike of interference does not flip one lone bit. It lasts a while, so it flips a run of neighbouring bits: a burst. Here one click flips 3 bits in a row. A single parity bit misses any even number of flips.
Read the 8 message bits as coefficients of powers of x: 11010011 is x⁷ + x⁶ + x⁴ + x + 1. Sender and receiver agree on a generator G = 1011, that is x³ + x + 1. It has degree 3.
Sender: compute the CRC
G has degree 3, so the check will be 3 bits long. The sender appends 3 zeros: 11010011000. That is the message times x³, and the zeros hold the place where the check bits will go.
Now divide by G the binary way. Wherever the leftmost bit still left is 1, line G up under it and XOR: equal bits give 0, different give 1. No carries, no borrows. Zeros are skipped. 5 XORs clear the message.
What is left in the last 3 places is the remainder, 011: the CRC. The XORs only wiped a working copy; the sender still has the message. The CRC takes the place of the zeros: the frame is 11010011 011.
Receiver: check it
The sender puts all 11 bits on the cable: 11010011 then 011. In mod 2, adding the remainder is the same as subtracting it, so the frame is an exact multiple of G. Anything else will not be.
The receiver divides all 11 bits by the same G, check bits included. A clean frame is a multiple of G, so the remainder is 000. Accept. The receiver never needs a second copy of the message.
Now the burst flips bits 4, 5 and 6. The receiver gets 11011101011. It divides as before and is left with 100, not 000. Reject: the frame is thrown away and sent again.
Why it works, and its limits
Received = frame + error E; the frame divides by G, so only E matters. A burst of up to 3 bits is E = xⁱ·B, B of degree below 3. G has degree 3 and a +1 term, so it cannot divide that. Caught.
A burst of 4 bits can be G itself, shifted. Here E = 1011 at bit 5: the remainder is 000 and the bad frame is accepted. Trying every burst: 1 in 4 of length 4 slips, 1 in 8 of longer ones.
CRC in code and in Ethernet
A Python integer holds the bits; Python counts bit i from the right, as the power xⁱ. Shifting left by 3 appends the zeros. Walk from bit 10 (lamp 0) to bit 3; where a bit is 1, XOR in G. Left: 0b11, the CRC.
Ethernet does exactly this with a degree-32 generator (0x04C11DB7): 32 check bits per frame. It catches every burst up to 32 bits long. Real CRC-32 also starts from all ones and inverts the result; Python's zlib.crc32 computes it.
The working
# step 1/12 · bursts
line: +1 V = bit 1, −1 V = bit 0
one bit every 1 µs
sent 11010011011
received 11011101011
^^^ bits 4, 5, 6 flipped
burst = errors packed close together
(scratches, lightning, a motor switching on)
parity: 2 flips cancel out, unseen
Every bit in the figure comes from the model: the message 11010011, the generator 1011 (x³ + x + 1, listed as CRC-3-GSM), the remainder 011 and both bursts are computed, and the bar chart is made by trying every burst of each length at every position in the 11-bit frame. The line plot is an example: polar NRZ (+1 V for a 1, −1 V for a 0) at one bit per microsecond, with an interference click modelled as a decaying oscillation. The receiver reads each bit in the middle of its slot.