Table of Contents
Understanding Error Detection at the Physical Layer
Error detection is about recognizing when bits have been altered while traveling across a transmission medium. At the physical layer, bits can flip from 0 to 1 or from 1 to 0 because of noise, interference, weak signals, or faulty cables and connectors. Error detection techniques do not fix the medium itself, and in most practical networks the actual detection and correction are implemented by higher layers. However, to understand how reliable communication is built above imperfect physical media, you need to know the basic ideas behind error detection.
This chapter focuses on how errors are detected in the bit stream, not how they are corrected or retransmitted. That logic belongs to higher layers such as the data link and transport layers, which are covered later.
Types of Transmission Errors
When bits are transmitted, several kinds of errors can occur. The simplest way to think about them is to imagine what happens to a sequence of bits as they pass through a noisy wire or a weak wireless signal.
A single bit error occurs when only one bit in a data block is flipped. For example, a sent sequence of 10110010 becomes 10110000 because the second bit from the right changed from 1 to 0. Single bit errors are relatively rare on well designed, high quality links.
A burst error affects a sequence of bits in a row. For example, 10110010 might be received as 10000010 if several bits in the middle are changed. Burst errors are common, especially on real physical media where noise can hit for a short period of time and disturb multiple bits in one go.
There are also no error situations, where the received bits match exactly what was sent. Error detection mechanisms must correctly recognize this case as valid.
Many error detection methods are designed with burst errors in mind, because they usually cause more trouble and are more likely than perfectly isolated single bit flips.
Basic Idea of Redundancy
Error detection relies on redundancy. Redundancy means adding extra bits to the original data that carry no new information by themselves but help detect if something went wrong during transmission.
A sender takes the original data bits and computes some additional check bits from them. The sender then transmits both data bits and check bits together. The receiver uses the same rule to recompute check information from the received data and compares it with the check bits that came along the line.
If the values match, the receiver assumes that no error has occurred. If they differ, the receiver knows that at least one bit has been corrupted.
Error detection always requires extra bits that are derived from the data. These extra bits are not payload data, but redundant information used to check for corruption.
This idea of redundancy is central to all the specific schemes described next: parity bits, checksums, and cyclic redundancy checks.
Parity Bits
Parity is one of the simplest forms of error detection. A parity bit is a single bit appended to a block of data bits to indicate whether the number of 1s in the block is even or odd.
There are two main kinds of parity: even parity and odd parity.
With even parity, the parity bit is chosen so that the total number of 1s in the data bits plus the parity bit is even. For example, if the data is 1011, there are three 1s, which is odd. To make the total even, the sender sets the parity bit to 1, resulting in 1011 1. The receiver counts the number of 1s and verifies that it is even.
With odd parity, the parity bit is set so that the total number of 1s is odd. Using the same data 1011, the total is already odd, so the parity bit would be 0 to keep it odd, producing 1011 0.
A single parity bit can reliably detect any odd number of bit errors in the protected block. It cannot detect an error pattern that flips an even number of bits.
This limitation is important. If two bits are flipped during transmission, the total count of 1s may remain even or odd correctly, so the parity check will pass. For this reason parity is very simple but also relatively weak. It is sufficient for simple links or as a first rough check, but not for robust networking where stronger mechanisms are preferred.
Checksums
A checksum is a more advanced method that uses arithmetic over groups of bits or bytes, rather than counting individual 1s. The sender treats the data in chunks, for example 8 bit bytes or 16 bit words, adds them together using ordinary binary addition, and then transmits the result as a checksum value.
The receiver performs the same calculation on the received data chunks and compares the result with the checksum that came with the data. If the two values differ, an error is detected.
In many real world protocols, a checksum may be computed using 1s complement arithmetic or may include some final inversion of bits. The specific details differ from one protocol to another, but the core idea is always that all the data is combined into a single short summary value that is sensitive to changes in the data.
As a very simple conceptual example, imagine that data is divided into four 8 bit bytes: $D_1, D_2, D_3, D_4$. The sender computes
$$
S = D_1 + D_2 + D_3 + D_4
$$
using modular arithmetic on 8 bit numbers, and then sends $S$ along with the data. The receiver recomputes the same sum and checks if it matches $S$.
Checksums provide better detection of many common error patterns than a single parity bit, but they are not perfect. There are distinct data patterns that can produce the same checksum value. When this happens the error is not detected. The design of a checksum function aims to make such collisions unlikely for the kinds of errors expected on the link.
Checksums are often used at layers above the physical layer, but the concept is general and applies whenever you want an inexpensive numeric summary of some data.
Cyclic Redundancy Check (CRC)
A cyclic redundancy check, commonly called CRC, is a very widely used and powerful error detection technique. CRCs are used in many link layer technologies, including Ethernet frames. CRCs are designed to detect typical physical layer errors very reliably, especially burst errors up to a certain length.
While checksums rely on simple addition, CRC relies on arithmetic in a special form of binary polynomial division. The math can appear complex at first glance, but at an intuitive level, the steps are:
- The sender treats the data bits as a very long binary number, or equivalently as coefficients of a binary polynomial.
- The sender chooses a fixed generator polynomial $G(x)$. This polynomial is agreed on by all devices using this CRC method.
- The sender divides the data polynomial by $G(x)$ using a special form of binary division, and uses the remainder as the CRC value.
- The sender appends this CRC remainder to the original data bits and transmits the whole sequence.
The receiver performs the same polynomial division on the received data bits and CRC bits combined. If there are no errors, the result of division by $G(x)$ yields a remainder of zero.
In a CRC scheme, valid data plus CRC always produces a zero remainder when divided by the generator polynomial. A nonzero remainder at the receiver indicates detected bit errors.
One of the reasons CRC is so popular is its strong error detection capabilities. The choice of generator polynomial determines what patterns of errors are guaranteed to be detected. A well chosen CRC can detect all single bit errors, all double bit errors, all odd numbers of bit errors, and all burst errors up to a specified length.
For example, a CRC with $r$ check bits can often guarantee detection of all burst errors of length $r$ or less. Longer burst errors are also detected with very high probability, although not with complete certainty.
In practice, devices implement CRC calculations with efficient hardware shift registers and XOR operations, not with slow long division. This makes CRC suitable for very high speed links that handle large amounts of traffic.
Error Detection vs Error Correction
Error detection is about noticing that corruption has occurred. Error correction is about actually fixing the corrupted data. At the physical and link layers, error detection is very common, while full error correction is more selective.
Some systems only detect errors and then rely on higher layers to ask for retransmission. For example, a data link protocol might drop a frame with a bad CRC and expect the sender to resend it after a timeout or a negative acknowledgment.
Other systems use forward error correction, where enough redundancy is added so that the receiver can reconstruct the original data even when some bits are wrong, without asking for retransmission. Forward error correction is useful on channels where retransmission is expensive or impossible, such as long distance satellite links.
Even when full correction is not used, strong error detection like CRC is crucial because it protects upper layers from silently corrupted data. A packet with a wrong checksum or CRC is normally discarded before it reaches application level logic.
Reliability and Overhead Trade off
All error detection schemes add overhead. More check bits mean more reliable detection, but also more bandwidth used and more processing required. Designers of physical and link layer protocols must balance the desired reliability with cost and speed.
A single parity bit adds only one bit of overhead but has limited detection capability. A 32 bit CRC adds much more redundancy, but detects a very wide range of errors and is suitable for large frames on fast networks.
Protocols choose their method and strength of error detection according to the characteristics of the transmission medium, expected error patterns, and performance requirements.
Where Error Detection Fits in the Network Stack
From the perspective of layering, error detection at the physical layer is about raw bits on the medium. However, in real networks, you usually encounter explicit mechanisms like parity, checksums, and CRCs in the protocols defined at the data link and transport layers, rather than in the purely physical layer specifications.
For example, Ethernet defines a frame check sequence at the end of each frame that is based on CRC. A damaged frame is discarded by the network interface before it is passed up. Higher level protocols, including those that run over routers and end hosts, then build their own reliability techniques assuming that lower level errors are either detected and removed or are so rare that they can be handled by retransmissions.
Error detection, even when not visible to end users, is a foundational building block that allows imperfect cables, fiber, and wireless signals to be used for dependable communication. Understanding how redundant bits help detect corruption prepares you for later chapters that explain how entire frames, packets, and streams are kept reliable across complex networks.