Information Theory and Digital Communications: Entropy, Capacity, PCM, Detection and Coding

The second half of Section 7 of the Electronics and Communication Engineering paper is the part that decides how a modern link is designed, and it is held together by a single question asked twice. Information theory asks it in the abstract: given a source and a channel, what is the least you can spend and the most you can send? The answers are entropy H, which is the floor under any source code, and channel capacity C, which is the ceiling over any reliable rate — and Shannon's contribution was to prove that both are achievable and that nothing beyond them is. Digital communications asks the same question concretely, one block at a time. PCM turns a waveform into bits and pays a quantisation-noise price of 6.02 dB per bit. DPCM notices that consecutive speech samples are strongly correlated and refuses to send what the receiver could have predicted. The modulation schemes — ASK, PSK, FSK, QAM — differ only in how far apart they put their signal points for a given energy, and once you have that distance every bit-error rate in the section is one Q-function away. The matched filter is the receiver that maximises that distance in the presence of noise, and MAP and ML detection are the two rules for deciding what was sent — identical when the symbols are equally likely, and not otherwise. Intersymbol interference is what happens when the pulses are packed tighter than Nyquist allows, and Hamming codes and CRC are what you do about the errors that survive. The thread worth holding onto is that every one of these blocks is spending or saving one of three currencies — power, bandwidth, and complexity — and every design question in this section is asking which one you are willing to spend.

Entropy and Source Coding: the Floor, and How Close You Get to It

The information in a symbol of probability p is I = log₂(1/p) bits — a definition, but a well-motivated one, because it is the only function that makes the information in two independent events add. Entropy is the average of that over the source: H = −Σ p_i log₂ p_i bits per symbol. Three properties fix its meaning. It is zero when one symbol has probability 1 (a source that always says the same thing tells you nothing). It is maximum at log₂ M when all M symbols are equally likely (uncertainty is greatest when you have no reason to favour any outcome). And it is the lower bound on the average length of any uniquely decodable code for that source — which is the statement that makes entropy an engineering quantity rather than a philosophical one. That bound comes with a matching construction, so the two halves of source coding are: entropy tells you what is possible, and Huffman coding gets you there or very close.

⚠️ Huffman hits the entropy exactly — but only when the probabilities are powers of a half
Take a four-symbol source with probabilities {0.5, 0.25, 0.125, 0.125}. The entropy is 0.5(1) + 0.25(2) + 0.125(3) + 0.125(3) = 1.75 bits/symbol. Huffman merges the two smallest repeatedly and produces codewords 0, 10, 110, 111, with average length 0.5(1) + 0.25(2) + 0.125(3) + 0.125(3) = 1.75 bits. Efficiency exactly 100 per cent, redundancy exactly zero. Check Kraft's inequality on those lengths: 2⁻¹ + 2⁻² + 2⁻³ + 2⁻³ = 1 — equality, which is the signature of a code with no slack in it. Now change the probabilities to {0.4, 0.3, 0.2, 0.1}, which look no less friendly. The entropy is 1.8464 bits/symbol. Huffman merges 0.1 + 0.2 = 0.3, then the two 0.3s into 0.6, then 0.6 + 0.4, giving lengths {1, 2, 3, 3} and an average of 0.4(1) + 0.3(2) + 0.2(3) + 0.1(3) = 1.9 bits. Efficiency 1.8464/1.9 = 97.2 per cent, redundancy 2.8 per cent, and Huffman is now provably not achieving the entropy. The reason is structural and not a defect of the algorithm: a codeword length must be a whole number of bits, and −log₂ 0.4 = 1.32 is not. Huffman is optimal among integer-length codes, which is a different and weaker claim than reaching H. The standard cure is to code blocks rather than symbols: the entropy of the n-th extension is nH, so the average length per original symbol satisfies H ≤ L_n/n < H + 1/n, and coding pairs already halves the excess. The trap in exams is a question that asks for the efficiency and expects 100 per cent because the candidate has only ever seen dyadic examples; the giveaway is a probability that is not a power of one half.
  • Kraft's inequality Σ 2^(−l_i) ≤ 1 is necessary and sufficient for a set of lengths to be realisable by a prefix-free code. If a question offers lengths summing to more than 1, no such code exists, whatever the probabilities.
  • Prefix-free implies uniquely decodable, and Huffman codes are always prefix-free because every symbol lands on a leaf of the merge tree. A code that is uniquely decodable but not prefix-free exists but needs lookahead, and gains nothing in length.
  • Huffman codewords are not unique; their lengths effectively are. Swapping the 0 and 1 labels at any merge, or breaking a tie between equal probabilities the other way, gives a different code with the same average length — so an answer that differs from the printed one in the bit patterns is still right if L matches.
  • Shannon–Fano is not Huffman and is not always optimal. It splits the sorted list into near-equal halves top-down; Huffman merges bottom-up. On many sources they agree, and where they differ Huffman's average length is never longer.

Mutual Information and the Channel Capacity Theorem

A channel takes an input X and delivers an output Y that is not always X. The quantity that measures how much of X survives is the mutual information I(X;Y) = H(X) − H(X|Y) — the uncertainty about the input, minus the uncertainty that remains after you have seen the output. It is symmetric, I(X;Y) = I(Y;X) = H(Y) − H(Y|X), which is worth knowing because one of the two forms is always the easier to compute. It is zero when input and output are independent, and equal to H(X) when the channel is noiseless. Channel capacity is then defined as the maximum of I(X;Y) over all input distributions: C = max_(p(x)) I(X;Y), in bits per channel use. The maximisation matters — capacity is a property of the channel alone, and finding it means choosing the best possible way to drive that channel. The channel coding theorem is the payoff: for any rate R < C there exist codes with arbitrarily small error probability, and for R > C there are none. Note what it does not say. It gives no construction, and it says nothing about delay or complexity, both of which grow as you approach C.

🎯 A channel that always lies is perfect; a channel that flips one bit in ten costs you half
For a binary symmetric channel with crossover probability p, the capacity is C = 1 − H(p) bits per use, where H(p) = −p log₂ p − (1−p) log₂(1−p). Put p = 0.1: H(0.1) = 0.1(3.3219) + 0.9(0.15200) = 0.3322 + 0.1368 = 0.4690, so C = 0.5310 bits per use. Ten per cent bit errors have cost you 47 per cent of the channel. Now try the extremes and watch the shape of 1 − H(p). At p = 0 capacity is 1, as it must be. At p = 0.5 capacity is zero — the output is statistically independent of the input, and no code, however long, can do anything with it. And at p = 1 capacity is back to 1, because a channel that inverts every bit is perfectly reliable: invert the output and you have the input. That last case is worth dwelling on, because it makes the point that capacity measures unpredictability, not error rate. A channel that is wrong in a known way is not a noisy channel at all. Compare a different impairment of the same nominal severity, the binary erasure channel, which loses a bit with probability α but tells you when it has: C = 1 − α, so at α = 0.1 capacity is 0.9 against the BSC's 0.531. Knowing which bits were lost is worth 0.37 bits per use — nearly twice the surviving capacity — and it is the reason a system that can flag its own failures is designed differently from one that cannot, and the reason erasure decoding is cheaper than error decoding in the coding section below.

For a continuous channel of bandwidth B limited by additive white Gaussian noise, the capacity is the Shannon–Hartley result C = B log₂(1 + S/N) bit/s. Two readings of it are examinable. Read left to right and it prices bandwidth against power: a 3 kHz telephone channel at an SNR of 30 dB, that is S/N = 1000, has C = 3000 × log₂(1001) = 3000 × 9.967 = 29.9 kbit/s — which is why voiceband modems stalled just above that figure and why anything faster needed a wider channel rather than a better modem. Read the other way and it shows the two are not interchangeable. Capacity grows linearly with bandwidth but only logarithmically with power, so doubling B roughly doubles C while doubling S adds only about one bit per hertz. And bandwidth cannot be traded without limit either, because widening B at fixed transmitted power admits more noise: as B → ∞, C tends to 1.44 S/N₀, and the corresponding limit on energy per bit is Eb/N₀ ≥ ln 2 = 0.693, that is −1.59 dB. That number is the Shannon limit, and it is the floor no modulation and no code will ever get under.

PCM and DPCM: 6 dB per Bit, and How to Avoid Sending What Is Predictable

Pulse code modulation is three operations in a row: sample at f_s ≥ 2W, quantise each sample to one of L = 2ⁿ levels, and encode the level as n bits. The bit rate is R_b = n f_s, and for telephone speech with W = 4 kHz, f_s = 8 kHz and n = 8, that is the familiar 64 kbit/s. Sampling is exact — the sampling theorem promises perfect reconstruction if f_s ≥ 2W and the signal is band-limited — so the only irreversible loss in PCM is quantisation. Model it as noise. A uniform quantiser of step Δ rounds each sample to within ±Δ/2, and if the error is taken as uniformly distributed over that interval its mean square is Δ²/12. That is the quantisation noise power, and it depends on the step size and on nothing else — not on the signal, not on the sampling rate.

🧠 Where 6.02n + 1.76 comes from, and what the 1.76 is quietly assuming
Derive it once and you never mis-state it. Let the quantiser span ±V in L = 2ⁿ steps, so Δ = 2V/L and the noise power is Δ²/12 = 4V²/(12L²) = V²/(3L²). Now choose the signal. For a full-scale sinusoid of amplitude V, the signal power is V²/2, so SQNR = (V²/2)/(V²/3L²) = 1.5 L² = 1.5 × 2^(2n). In decibels, 10 log₁₀ 1.5 + 20n log₁₀ 2 = 1.76 + 6.02n dB. At n = 8 that is 49.9 dB; at n = 9 it is 55.9 dB. The 6.02n term is universal and the 1.76 is not — it is the signature of the full-scale-sinusoid assumption, and the convention must be stated. Take instead a signal uniformly distributed over the full range: its power is V²/3 (not V²/2), and SQNR = L² = 2^(2n), that is 6.02n dB with no additive term, so 48.2 dB at n = 8. A real speech signal, which spends most of its time well below full scale, does worse still, and the gap is the reason companding exists: a µ-law or A-law characteristic compresses large amplitudes before a uniform quantiser and expands them after, which is equivalent to using fine steps where the signal usually is and coarse steps where it rarely goes. The engineering consequence of 6.02n is worth stating plainly: each extra bit buys 6 dB and costs f_s bit/s. Going from 8 to 9 bits on telephone speech buys 6 dB of SQNR and costs 8 kbit/s, taking the rate from 64 to 72 kbit/s — and that exchange rate, 6 dB per 8 kbit/s, is the whole of PCM design.

Differential PCM attacks the redundancy that PCM ignores. Successive samples of speech or video are strongly correlated, so a great deal of each sample is predictable from the ones before it — and sending a predictable quantity is spending bits on nothing. DPCM predicts each sample from past reconstructed samples (reconstructed, not original, so that encoder and decoder track each other exactly and errors do not accumulate), and quantises only the prediction error. Because the error has a smaller variance than the signal, the same quantiser step gives a better SQNR — or equivalently, fewer bits give the same SQNR. Take a first-order predictor on a source with adjacent-sample correlation coefficient ρ = 0.9. The optimal predictor is x̂[n] = ρ x[n−1], and the residual variance is σ_e² = σ_x²(1 − ρ²) = 0.19 σ_x². The prediction gain is therefore 10 log₁₀(1/0.19) = 7.21 dB, and at 6.02 dB per bit that is 1.20 bits per sample saved — so 8-bit PCM quality is reached at about 6.8 bits, and the 64 kbit/s link becomes about 54 kbit/s for the same perceived quality. Push the predictor order up and the gain grows; delta modulation is the limiting case with a one-bit quantiser and a very high sampling rate, which trades quantisation noise for two new defects — slope overload when the signal rises faster than Δf_s, and granular noise when it is nearly flat.

ASK, PSK, FSK and QAM: Constellations Written as Coordinates

Every digital modulation in the syllabus is a choice of points in a signal space, and once you write the points down as coordinates the rest is geometry. The basis is one or two orthonormal carriers — φ₁(t) = √(2/T) cos 2πf_c t and, where needed, φ₂(t) = √(2/T) sin 2πf_c t — and a symbol is a pair of numbers giving how much of each. Distances in that space are measured in √(energy), and the single number that controls error rate is the minimum distance d_min between any two points, because the noise does not care which two points you are confusing. The table below gives the four schemes as coordinates, with everything expressed in units of √E_b so that they can be compared at equal energy per bit — the only fair comparison, and the one every question makes.

Constellations as coordinates, all in units of √Eb, with the resulting bit error rate
SchemeSignal points (a₁, a₂) in √Ebd_min in √EbCoherent BER, and its value at Eb/N₀ = 10 dB
BPSK (2-PSK), 1 bit/symbol(+1, 0) and (−1, 0)2.000Q(√(2Eb/N₀)) = 3.87 × 10⁻⁶
QPSK (4-QAM), 2 bits/symbol, Gray-coded(±1, ±1) — all four sign combinations2.000 — the same as BPSKQ(√(2Eb/N₀)) = 3.87 × 10⁻⁶, at twice the bit rate
Coherent BFSK, 1 bit/symbol, orthogonal(1, 0) and (0, 1)1.414 = √2Q(√(Eb/N₀)) = 7.83 × 10⁻⁴ — 3 dB worse
Coherent ASK / OOK, 1 bit/symbol(0, 0) and (√2, 0) — average energy is Eb1.414 — same as BFSKQ(√(Eb/N₀)) = 7.83 × 10⁻⁴
16-QAM, 4 bits/symbol, Gray-coded(±0.632, ±0.632), (±0.632, ±1.897), (±1.897, ±0.632), (±1.897, ±1.897)1.2650.75 Q(√(0.8 Eb/N₀)) = 1.75 × 10⁻³
🎯 QPSK is free and 16-QAM is not: the arithmetic of the constellation
Work the 16-QAM coordinates out and the whole comparison becomes visible without a picture. A square 16-QAM constellation has both coordinates drawn from {±a, ±3a}, sixteen points in all. The mean of the squared coordinate is (a² + a² + 9a² + 9a²)/4 = 5a² on each axis, so the average symbol energy is E_s = 10a². Four bits per symbol means E_s = 4E_b, so a² = 0.4 E_b and a = 0.632√E_b; the outer coordinate is 3a = 1.897√E_b, which is where the table's numbers come from. The nearest neighbours are 2a apart, so d_min = 1.265√E_b. Compare BPSK's d_min = 2√E_b. The squared-distance ratio is (1.265)²/(2)² = 1.6/4 = 0.4, a penalty of 10 log₁₀(1/0.4) = 3.98 dB — and sure enough the standard BER expressions differ by exactly that: BPSK has Q(√(2Eb/N₀)) and 16-QAM has Q(√(0.8 Eb/N₀)), and 2/0.8 = 2.5 = 3.98 dB. So 16-QAM sends four bits per symbol instead of one and pays about 4 dB for it. Now do the same arithmetic for QPSK and something different happens. Its points are (±1, ±1) in √E_b, so E_s = 2E_b for two bits — and the nearest neighbours, which differ in one coordinate only, are 2√E_b apart, identical to BPSK. QPSK therefore carries twice the bits in the same bandwidth at exactly the same bit error rate and the same energy per bit, which is as close to a free lunch as this subject offers. The mechanism is that QPSK is two independent BPSK signals on orthogonal carriers, and orthogonality means they do not interfere. The lesson generalises: doubling the constellation size is free only while you can add a new orthogonal dimension, and costs about 4 dB per factor of four once you are packing more points into the dimensions you already have. One caveat that questions test: the QPSK symbol error rate is about twice the bit error rate, because a symbol error usually corrupts one of its two bits — Gray coding is what makes 'usually one' true rather than 'on average one and a half'.

Two practical points close this section. First, non-coherent detection removes the need for a carrier phase reference and costs a little performance: non-coherent BFSK has P_b = ½ e^(−Eb/2N₀), which at Eb/N₀ = 10 dB gives 3.37 × 10⁻³ against the coherent 7.83 × 10⁻⁴ — a factor of four in error rate, about 1 dB in required energy, in exchange for deleting the carrier recovery loop entirely. Second, bandwidth efficiency is what QAM is bought for. A scheme with M points carries log₂ M bits per symbol, so at a fixed symbol rate the bit rate scales as log₂ M while the bandwidth does not move at all — the bandwidth is set by the symbol rate, and that is the subject of the next section. The whole family therefore lies on one trade curve: BPSK and QPSK are power-efficient and bandwidth-hungry; 16-QAM and above are bandwidth-efficient and power-hungry, and which end of the curve a system sits on is decided by whether spectrum or transmitter power is the scarcer resource.

Bandwidth and Intersymbol Interference: the Nyquist Criterion

Pulses sent at a symbol rate R_s through a channel of finite bandwidth spread in time, so each pulse still has energy at the instants when its neighbours are being sampled. That leakage is intersymbol interference, and it is not a noise — it is a deterministic, signal-dependent error that gets worse as you send faster and cannot be removed by increasing power. The Nyquist criterion for zero ISI states the condition for escape: the overall pulse must be zero at every sampling instant other than its own, and the minimum bandwidth in which such a pulse can exist is B = R_s/2, the Nyquist bandwidth. Equivalently, a channel of bandwidth B supports at most R_s = 2B symbols per second without ISI. The pulse that achieves the bound exactly is the sinc, whose spectrum is a brick wall of width R_s/2 and whose zero crossings fall precisely on the neighbouring sampling instants.

⚠️ The ideal sinc pulse is the one shape nobody uses, and the reason is timing
The sinc pulse meets the Nyquist criterion with the least possible bandwidth, so it looks like the obvious choice, and it is never used. Two reasons, and both are about robustness rather than theory. Its spectrum is a perfect rectangle, which requires an unrealisable filter — infinitely sharp, infinitely long impulse response. And its tails decay only as 1/t, so the ISI contributed by distant symbols falls off very slowly; sample one instant late and you no longer land on the zero crossings, and the residual contributions from hundreds of neighbouring symbols add up rather than cancel. The ideal pulse has zero ISI at exactly the right instant and unbounded ISI at any other, which makes it exquisitely sensitive to timing jitter — the worst possible property for a real receiver. The engineering answer is the raised-cosine pulse, which buys back robustness by using more bandwidth: B = (R_s/2)(1 + α) with roll-off factor α between 0 and 1. At α = 0 it is the sinc; at α = 1 it is twice the Nyquist bandwidth, with tails that decay as 1/t³ and a spectrum with no discontinuity to synthesise. Numbers: at R_s = 2 Msym/s and α = 0.25, the bandwidth is 1 × 1.25 = 1.25 MHz, and carrying 16-QAM at 4 bits per symbol that is 8 Mbit/s in 1.25 MHz, a spectral efficiency of 6.4 bit/s/Hz. Sanity-check that against Shannon: 6.4 bit/s/Hz requires S/N ≥ 2^(6.4) − 1 = 83.4, that is 19.2 dB, so such a link is possible but needs a good channel — and it needs coding as well, since 16-QAM at that SNR is nowhere near error-free. The eye pattern is how ISI is measured in practice: overlay many symbol periods of the received waveform and the vertical opening at the sampling instant is the noise margin, the horizontal opening is the timing margin, and increasing α widens both at the cost of spectrum. A closed eye means ISI, not noise, and no amount of extra power will open it.

The Matched Filter, and MAP against ML Detection

Given a known pulse s(t) of duration T buried in white noise of two-sided PSD N₀/2, which linear filter maximises the signal-to-noise ratio at the sampling instant? The answer is the matched filter, whose impulse response is the time-reversed pulse, h(t) = s(T − t), and whose output at t = T is ∫₀ᵀ r(t)s(t) dt — the correlation of the received waveform with the known pulse. Two things about the result are worth stating precisely because both are examined. The maximum achievable ratio is SNR_max = 2E/N₀, where E = ∫s²(t)dt is the pulse energy — note that it depends on the energy only, and not on the pulse shape at all, so a rectangle, a triangle and a raised cosine of equal energy all perform identically. And the convention matters: this 2E/N₀ assumes N₀/2 is the two-sided PSD, and the same physical noise expressed as a one-sided N₀ gives the same number. A filter matched to the wrong pulse, or sampled at the wrong instant, does worse, and the amount by which it does worse is computable.

🧠 30 dB from the matched filter, 27 dB from half of it — the loss is exactly 3 dB
Take a rectangular pulse of amplitude A = 1 V and duration T = 1 µs, so its energy across 1 Ω is E = A²T = 10⁻⁶ J, in white noise of two-sided PSD N₀/2 = 10⁻⁹ W/Hz, that is N₀ = 2 × 10⁻⁹. Compute the correlator output directly rather than quoting the formula. The signal component is ∫₀ᵀ s²(t)dt = E = 10⁻⁶. The noise component is a zero-mean Gaussian of variance (N₀/2)∫₀ᵀ s²(t)dt = (N₀/2)E = 10⁻⁹ × 10⁻⁶ = 10⁻¹⁵. So SNR = E²/[(N₀/2)E] = 2E/N₀ = 2 × 10⁻⁶/(2 × 10⁻⁹) = 1000, that is 30.0 dB ✓, which agrees with the formula and, more usefully, shows why the formula is what it is. Now damage the receiver in the most instructive way: integrate over only the first half of the pulse. The signal component halves to E/2, but so does the noise variance, to (N₀/2)(E/2), so SNR = (E/2)²/[(N₀/2)(E/2)] = E/N₀ = 500, that is 27.0 dB. Exactly 3 dB lost, for exactly half the energy collected — and that clean result is the practical statement of the theorem: the matched filter's job is to collect all the signal energy, and any energy you fail to collect is lost decibel-for-decibel. Two corollaries. Sampling at the wrong instant is a partial-overlap version of the same loss. And this is why the correlator and the integrate-and-dump receiver are the same circuit for a rectangular pulse: with s(t) constant over the interval, correlating with it is integrating.

The matched filter reduces the received waveform to one number; the detector then decides which symbol was sent. Maximum a posteriori (MAP) detection chooses the symbol with the greatest posterior probability P(s_i | r), which by Bayes' rule means maximising p(r | s_i) P(s_i) — the likelihood weighted by the prior. Maximum likelihood (ML) detection drops the prior and maximises p(r | s_i) alone. MAP is optimal in the sense of minimising the probability of error, always. ML is optimal only when the priors are equal, in which case the two rules are identical because the common factor P(s_i) does not affect which likelihood is largest. That equivalence is why ML gets used almost everywhere in practice — source coding has already made the symbols nearly equiprobable — and why a question that gives you unequal priors is testing whether you noticed. Geometrically, MAP moves the decision threshold: for binary antipodal signalling the threshold sits at r_th = (σ²/2√E) ln[P(0)/P(1)] rather than at zero, biased towards the more likely symbol, so that the receiver requires more evidence before declaring the rare one.

🎯 Unequal priors, worked out: MAP cuts the errors by a quarter
Take binary antipodal signalling with points at −√E and +√E, E = 1, in noise of variance σ² = N₀/2 = 0.5 — that is Eb/N₀ = 1, or 0 dB, chosen so the arithmetic stays readable. Let the priors be unequal: P(0) = 0.8, P(1) = 0.2. The ML receiver puts its threshold at zero and gets P_e = Q(√(2Eb/N₀)) = Q(√2) = Q(1.4142) = 0.07865, the same whichever symbol was sent. The MAP threshold is r_th = (0.5/2) ln(0.8/0.2) = 0.25 × 1.38629 = 0.34657, shifted towards the likely symbol. Its error probability has to be computed as a weighted sum, because the two symbols now have different error probabilities. Given 0 was sent the mean is −1 and an error needs r > 0.34657, which is (0.34657 + 1)/0.70711 = 1.9042 standard deviations away, so Q(1.9042) = 0.02844. Given 1 was sent the mean is +1 and an error needs r < 0.34657, which is (1 − 0.34657)/0.70711 = 0.9241 standard deviations, so Q(0.9241) = 0.17773. Weighting: P_e = 0.8(0.02844) + 0.2(0.17773) = 0.02276 + 0.03555 = 0.05829. MAP: 0.0583. ML: 0.0787. A 26 per cent reduction in errors, from moving one threshold and transmitting nothing extra. Read the individual numbers and the mechanism is plain: the rare symbol's own error probability has gone up sharply, from 7.9 to 17.8 per cent, and the common symbol's has come down from 7.9 to 2.8 — MAP has deliberately sacrificed the accuracy of the rare event to protect the frequent one, and because the frequent one happens four times as often, the average wins. That is the whole idea, and it also tells you when MAP is not worth the trouble: as the priors approach equality the threshold shift goes to zero and the gain vanishes.

Fundamentals of Error Correction: Hamming Codes and CRC

A block code takes k message bits and appends redundancy to make n transmitted bits, at rate k/n. Its power to detect and correct is governed by one number, the minimum Hamming distance d_min, meaning the fewest bit positions in which any two distinct codewords differ. From it, two counts follow directly: the code detects up to d_min − 1 errors, and corrects up to ⌊(d_min − 1)/2⌋. The reasoning is spatial. To detect t errors, no t-bit corruption of a codeword may land on another codeword. To correct t errors, the corrupted word must still be nearer to the sent codeword than to any other, which needs twice the separation. So detection is cheap and correction is expensive, and a code can be operated either way — d_min = 4 corrects one error, or detects three, but not both at full strength simultaneously.

🧠 The (7,4) Hamming syndrome IS the error position, in binary
Lay out a (7,4) Hamming codeword in the classical order, with parity bits in the power-of-two positions: position 1 = p₁, 2 = p₂, 3 = d₁, 4 = p₃, 5 = d₂, 6 = d₃, 7 = d₄. Each parity bit covers the positions whose binary index contains its own bit: p₁ covers {1,3,5,7}, p₂ covers {2,3,6,7}, p₃ covers {4,5,6,7}. Encode the message d = 1011. Then p₁ = d₁ ⊕ d₂ ⊕ d₄ = 1⊕0⊕1 = 0, p₂ = d₁ ⊕ d₃ ⊕ d₄ = 1⊕1⊕1 = 1, p₃ = d₂ ⊕ d₃ ⊕ d₄ = 0⊕1⊕1 = 0, giving the codeword 0110011. Verify all three parities on it: {1,3,5,7} = 0⊕1⊕0⊕1 = 0 ✓, {2,3,6,7} = 1⊕1⊕1⊕1 = 0 ✓, {4,5,6,7} = 0⊕0⊕1⊕1 = 0 ✓. Now corrupt position 5, so the receiver sees 0110111. Recompute the three parity checks: s₁ = 0⊕1⊕1⊕1 = 1, s₂ = 1⊕1⊕1⊕1 = 0, s₃ = 0⊕1⊕1⊕1 = 1. Read the syndrome as the binary number (s₃ s₂ s₁) = 101 = 5 — and 5 is exactly the corrupted position. That is not a coincidence but the reason the parity bits were put in power-of-two positions in the first place, and it is why decoding a Hamming code needs no table: compute three parities, read them as a number, flip that bit. State the bit order explicitly, because (s₁ s₂ s₃) read the other way gives 1 and points at the wrong bit — the convention is that the check covering the highest-weight index is the most significant syndrome bit. Now the part worth remembering as a warning. Corrupt two positions, 5 and 6, so the receiver sees 0110101. The syndrome comes out s₁ = 1, s₂ = 1, s₃ = 0, that is 011 = 3 — and the decoder confidently flips position 3, which was never wrong. A single-error-correcting code fed two errors does not fail gracefully; it manufactures a third. d_min = 3 for the (7,4) code, so two errors are beyond it, and the standard fix is the extended (8,4) code with one overall parity bit added: d_min rises to 4, and the decoder can now tell a single error (correctable) from a double error (flagged, not corrected). That combination has a name — SEC-DED, single error correcting, double error detecting — and it is what memory ECC uses for exactly this reason.

A cyclic redundancy check is error detection only, and its whole mechanism is polynomial division modulo 2. Treat the message as the coefficients of a polynomial M(x), choose a generator G(x) of degree r, shift the message up by r bits (which is multiplying by xʳ), divide by G(x) using XOR in place of subtraction, and transmit the message with the r-bit remainder appended. The transmitted frame is then exactly divisible by G(x), so the receiver simply divides again: a zero remainder means accept, anything else means a detected error. What makes CRC worth its arithmetic is the guarantee list that follows from the choice of G(x). A generator with more than one term detects every single-bit error. A generator with a non-zero constant term detects every burst of length r or less, which matters because real channel errors arrive in bursts rather than independently. A generator that has (x + 1) as a factor detects every odd-weight error pattern. And a primitive generator of degree r detects all double-bit errors within a frame of 2ʳ − 1 bits.

🧠 One CRC worked end to end, and then checked at the receiver
Message M = 1101011011, generator G = 10011, which is x⁴ + x + 1 and so r = 4. Append four zeros to get the dividend 11010110110000 and divide by XOR, bringing down one bit at a time. Start with the first five bits 11010; XOR 10011 to get 01001. Bring down the next bit: 10011; XOR to get 00000. Bring down 1: 00001, leading zero so no XOR. Then 0: 00010. Then 1: 00101. Then 1: 01011. Then 0: 10110; XOR 10011 to get 00101. Then 0: 01010. Then 0: 10100; XOR to get 00111. Then the last 0: 01110. The remainder is the low four bits, 1110, so the transmitted frame is M with the CRC appended: 11010110111110. Now do the receiver's job, which is the same division on the whole frame. Running it through gives a remainder of 0000 ✓, and that zero is the entire accept test. Two things worth extracting. The check is not a comparison against a stored value — the frame itself is now a multiple of G(x), and the receiver never needs to know what the original remainder was, which is why CRC costs the receiver a shift register and nothing more. And note that this particular G(x) = x⁴ + x + 1 does not have (x + 1) as a factor: substituting x = 1 gives 1 + 1 + 1 = 1, not zero. So it detects all single errors, all bursts of length 4 or less, and all double errors within a 15-bit frame, but it does not guarantee detection of every odd-weight pattern — the standard generators used in practice, such as CRC-16 and CRC-32, are deliberately chosen with (x + 1) as a factor precisely to add that guarantee. Reading which guarantees a given generator does and does not carry is a favourite one-mark question, and it is answered by factorising G(x), not by memorising a list.
Detect against correct: what a given d_min buys, with the coding cost
CodeRate k/nd_minDetects / corrects, and the failure mode beyond it
Single parity bit, (n, n−1)(n−1)/n — nearly 12Detects 1, corrects 0. Blind to every even-weight error.
Hamming (7,4)4/7 = 0.5713Corrects 1 or detects 2. Two errors make it create a third.
Extended Hamming (8,4), SEC-DED4/8 = 0.5004Corrects 1 and flags 2 as uncorrectable — no silent third error.
CRC with G(x) = x⁴ + x + 110/14 = 0.714 for this frameDetection onlyAll bursts ≤ 4, all doubles in 15 bits. Corrects nothing — needs a retransmission.

Exam Craft: the Conventions That Decide the Number

More marks are lost in this half of Section 7 to unstated conventions than to genuine ignorance, because most of the results are ratios and a ratio can be defined two ways. The EC paper's structure — 65 questions, 100 marks, 180 minutes, with General Aptitude at 10 questions for 15 marks — leaves under three minutes a question on average, and a candidate who has to reason out whether Eb/N₀ or SNR was meant has already spent that budget. So settle the conventions in advance. The marking asymmetry then decides your policy on the ones you cannot settle: a wrong MCQ costs one third of the question's value, so an MCQ narrowed to two options is worth taking and a four-way guess is not, while MSQ and NAT carry no negative marking, so every numerical-answer question is worth an attempt even from a bound rather than a full solution.

Six conventions in this chapter, each of which changes a printed answer
QuantityConvention used hereThe other reading, and what it does to the number
Noise densityTwo-sided N₀/2; matched-filter SNR = 2E/N₀One-sided N₀ gives the same physical answer; a stray factor of 2 usually means the two were mixed
Eb/N₀ vs SNREb/N₀ — energy per bit, so all schemes compare fairlyEs/N₀ is log₂M times larger — 16-QAM's Es/N₀ is 6 dB above its Eb/N₀
PCM SQNR1.76 + 6.02n dB, assuming a full-scale sinusoidA uniformly distributed full-range signal gives 6.02n dB — 1.76 dB lower
Error rateBit error rate P_bSymbol error rate is about log₂M × P_b for Gray coding — twice P_b for QPSK
Bandwidth of a digital linkB = (R_s/2)(1 + α) for raised cosineSome texts quote R_s(1 + α) for the passband width — a factor of 2
Hamming syndrome bit order(s₃ s₂ s₁) as the binary position — gave 5 for an error at 5Reading (s₁ s₂ s₃) gives 1 and points at the wrong bit entirely
ℹ️ The chain from bits to decibels, in the order a question walks it
Most multi-part questions in this half of the section walk the same chain, and knowing its order turns a hard question into five easy ones. Source to bits: entropy H gives the floor, Huffman gives the achievable L, efficiency is H/L. Waveform to bits: f_s ≥ 2W and n bits give R_b = n f_s, with SQNR = 1.76 + 6.02n dB for a full-scale sinusoid. Bits to symbols: R_s = R_b/log₂M. Symbols to bandwidth: B = (R_s/2)(1 + α), so spectral efficiency is R_b/B. Bandwidth and power to a ceiling: check R_b ≤ B log₂(1 + S/N), and if the required efficiency needs more SNR than the link has, no modulation will save it. Energy to error rate: Eb/N₀ into the scheme's Q-function, then P_b into the coding requirement. Working forward along that chain also gives you free consistency checks: a spectral efficiency above what Shannon permits at the stated SNR means an arithmetic error somewhere upstream, and a BER that comes out above 0.5 means a sign or a square root has gone the wrong way.

Key takeaways

  • Entropy is the floor and Huffman only sometimes reaches it. {0.5, 0.25, 0.125, 0.125} has H = 1.75 and Huffman gives exactly 1.75 — 100 per cent. {0.4, 0.3, 0.2, 0.1} has H = 1.8464 and Huffman gives 1.9 — 97.2 per cent, because codeword lengths must be whole bits. Block coding closes the gap as 1/n.
  • Capacity measures unpredictability, not error rate. A BSC at p = 0.1 has C = 0.531, at p = 0.5 has C = 0 and at p = 1 has C = 1 again. An erasure channel at α = 0.1 keeps C = 0.9, so knowing which bits were lost is worth 0.37 bits per use over not knowing.
  • PCM costs 6.02 dB per bit and DPCM buys some of it back. 1.76 + 6.02n dB assumes a full-scale sinusoid, giving 49.9 dB at n = 8 and 64 kbit/s for 4 kHz speech. A first-order predictor at ρ = 0.9 gains 10 log(1/0.19) = 7.21 dB, that is 1.20 bits per sample saved.
  • Write the constellation as coordinates and every BER follows from d_min. BPSK (±1, 0) and QPSK (±1, ±1) in √Eb both have d_min = 2, so both give 3.87 × 10⁻⁶ at 10 dB — QPSK at twice the rate for free. 16-QAM has d_min = 1.265, a 3.98 dB penalty, and 1.75 × 10⁻³ at the same 10 dB.
  • The matched filter's only job is to collect all the energy: SNR_max = 2E/N₀, independent of pulse shape, with N₀/2 two-sided. A 1 V, 1 µs pulse in N₀/2 = 10⁻⁹ W/Hz gives 1000, i.e. 30 dB; integrate over only half the pulse and you get 500, exactly 3 dB less.
  • MAP beats ML exactly when the priors are unequal. At Eb/N₀ = 0 dB with P(0) = 0.8, the ML threshold at zero gives P_e = 0.0787; the MAP threshold at +0.347 gives 0.0583, a 26 per cent reduction, by sacrificing the rare symbol's accuracy to protect the common one.
  • ISI is a bandwidth problem, not a power problem. Zero-ISI needs B ≥ R_s/2; raised cosine gives B = (R_s/2)(1 + α), so 2 Msym/s at α = 0.25 occupies 1.25 MHz and 16-QAM over it reaches 6.4 bit/s/Hz — which Shannon says needs at least 19.2 dB of SNR. A closed eye never opens with more power.
  • Hamming's syndrome is the error position; CRC's zero remainder is the accept test. For (7,4) with d = 1011 the codeword is 0110011, and an error at bit 5 gives syndrome 101 = 5. Two errors give 011 and the decoder creates a third — which is why SEC-DED exists. M = 1101011011 with G = 10011 gives CRC 1110 and a frame that divides exactly.

Practice questions (8)

Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.

  1. Four sets of binary codeword lengths are proposed for a four-symbol source. Which set cannot be realised by any prefix-free code at all?

    1. 1, 2, 3, 4
    2. 2, 2, 3, 3
    3. 1, 3, 3, 3
    4. 1, 2, 2, 2
    Show answer

    Answer: D — 1, 2, 2, 2

    Kraft's inequality says a set of lengths is realisable by a prefix-free code exactly when the sum of 2 raised to minus each length is at most one. For 1, 2, 2, 2 the sum is 0.5 + 0.25 + 0.25 + 0.25 = 1.25, which exceeds one, so no such code exists whatever the probabilities happen to be. The other three all pass: 1, 2, 3, 4 sums to 0.9375, the set 2, 2, 3, 3 sums to 0.75 and the set 1, 3, 3, 3 sums to 0.875, so each is realisable and each wastes a little code space. The trap is that the rejected set looks the most economical of the four, since its longest codeword is only two bits, but a length-1 codeword has already claimed half the code space and each length-2 codeword claims a quarter, so three of them cannot fit in the half that is left.
  2. A memoryless source emits four symbols with probabilities 0.5, 0.2, 0.2 and 0.1, and is encoded by a binary Huffman code built by repeatedly merging the two least likely items. What coding efficiency does the resulting code achieve?

    1. 97.8 %
    2. 88.0 %
    3. 100 %
    4. 102.2 %
    Show answer

    Answer: A — 97.8 %

    The entropy is 0.5 log2(2) + 0.2 log2(5) + 0.2 log2(5) + 0.1 log2(10) = 0.5 + 0.4644 + 0.4644 + 0.3322 = 1.761 bits per symbol. Building the Huffman tree, 0.1 and one 0.2 merge to 0.3, that node merges with the other 0.2 to give 0.5, and the two halves merge at the root, so the codeword lengths are 1, 2, 3 and 3 and the average length is 0.5(1) + 0.2(2) + 0.2(3) + 0.1(3) = 1.8 bits. Efficiency is 1.761/1.8 = 97.8 per cent. The tempting 100 per cent assumes Huffman always reaches the entropy, which happens only when every probability is a power of one half; here log2 of 0.2 is not a whole number and integer codeword lengths cannot match it. The value 88.0 per cent compares the entropy against a fixed-length two-bit code, and 102.2 per cent inverts the ratio, which no efficiency can ever exceed one hundred.
  3. A 10-bit uniform quantiser spans the whole range of its input, and the input applied to it is a signal uniformly distributed across that entire range rather than a full-scale sinusoid. What signal-to-quantisation-noise ratio results?

    1. 61.96 dB
    2. 58.44 dB
    3. 60.20 dB
    4. 30.10 dB
    Show answer

    Answer: C — 60.20 dB

    Let the quantiser span plus and minus V in L = 2^n steps, so the step is 2V/L and the quantisation noise power is (2V/L)^2/12 = V^2/(3 L^2). A signal uniformly distributed over the full range has mean-square value V^2/3, so the ratio is exactly L^2 = 2^(2n) and in decibels it is 20 n log(2) = 6.02 n, which for n = 10 is 60.20 dB. The tempting 61.96 dB adds the familiar 1.76 dB, but that term is not universal: it is 10 log(1.5) and is the signature of the full-scale sinusoid assumption, whose mean-square value is V^2/2 rather than V^2/3. The value 58.44 dB subtracts the same 1.76 dB instead of leaving it out, and 30.10 dB uses 3.01 dB per bit, which is the power-ratio figure and not the amplitude one.
  4. An antipodal scheme sends one of two points, at -2 and at +2 on a single axis, and the sample arriving at the detector carries added Gaussian noise of variance 2. The two points are not chosen with equal frequency: the one at -2 is sent nine times out of ten. Where should the detector put its decision threshold if the chance of a wrong decision is to be as small as possible?

    1. 0
    2. 1.099
    3. 2.197
    4. 0.549
    Show answer

    Answer: B — 1.099

    The maximum a posteriori rule compares the likelihood weighted by the prior, and for two Gaussians of equal variance sitting symmetrically at minus and plus a, the resulting threshold is (sigma^2 / (2a)) ln(P_0/P_1). Here a = 2, sigma^2 = 2 and the prior ratio is 9, so the threshold is (2/4) x 2.197 = 1.099, shifted towards the less likely point so that the decision region belonging to the common symbol is enlarged. The tempting 0 is the maximum likelihood threshold, which is optimal only when the two priors are equal and here needlessly gives away accuracy on the symbol that is sent nine times out of ten. The value 2.197 is the logarithm of the prior ratio alone, with the noise variance and the signal amplitude both left out, and 0.549 halves the correct value a second time.
  5. In a (7,4) Hamming code the parity bits occupy positions 1, 2 and 4; the first checks positions 1, 3, 5 and 7, the second checks 2, 3, 6 and 7, and the third checks 4, 5, 6 and 7. A received word fails the first and second parity checks and passes the third. Which bit position is in error?

    1. 3
    2. 6
    3. 2
    4. 5
    Show answer

    Answer: A — 3

    Each parity bit covers exactly those positions whose binary index carries its own weight, so a failed check sets the corresponding bit of the syndrome and the syndrome read as a binary number is the position in error. The third check has weight 4, the second weight 2 and the first weight 1; here the third passes and the other two fail, so the syndrome is 0, 1, 1, that is 3. Checking directly, position 3 has binary index 011 and is indeed covered by the first and second checks and not by the third. The tempting 6 comes from reading the three syndrome bits in the opposite order, taking the first check as the most significant, and it points at a position that is covered by the second and third checks rather than the first and second.
  6. A binary block code has a minimum Hamming distance of 7 between any two of its codewords. If it is used purely for correction, what is the largest number of bit errors in one codeword that it can always correct?

    1. 6
    2. 7
    3. 4
    4. 3
    Show answer

    Answer: D — 3

    To correct t errors the corrupted word must still be closer to the codeword that was sent than to any other, which needs the minimum distance to exceed twice t, so t is the integer part of (d_min - 1)/2 = 6/2 = 3. The tempting 6 is the detection capability d_min - 1, which is a different and weaker requirement: detection only asks that no t-bit corruption of a codeword land exactly on another codeword, whereas correction asks for twice that separation so the nearest-codeword decision is unambiguous. A code of this distance can therefore detect six errors or correct three, but not both at once, and the choice is made by the decoder rather than by the code. The value 7 quotes the distance itself and 4 rounds (d_min - 1)/2 upwards instead of down.
  7. A link is operated first with BPSK and then with Gray-coded QPSK, at the same energy per bit and with the same raised-cosine pulse shaping and symbol rate. Which of the following statements comparing the two are correct?

    1. The two constellations have the same minimum distance in units of the square root of the energy per bit, so they give the same bit error probability.
    2. QPSK delivers twice the bit rate of BPSK in the same bandwidth.
    3. QPSK needs 3 dB more energy per bit than BPSK for the same bit error probability.
    4. The symbol error probability of QPSK is one half of its bit error probability.
    Show answer

    Answer: A — The two constellations have the same minimum distance in units of the square root of the energy per bit, so they give the same bit error probability.; B — QPSK delivers twice the bit rate of BPSK in the same bandwidth.

    Written as coordinates in units of the square root of the energy per bit, BPSK sits at plus and minus one on a single axis and QPSK at the four sign combinations of plus and minus one on two axes. Both therefore have a minimum distance of 2, and since the noise does not care which two points are being confused, both give the same bit error probability. QPSK carries two bits per symbol against BPSK's one, so at the same symbol rate and hence the same bandwidth it delivers twice the bit rate, which is why QPSK is described as free. The claim of a 3 dB penalty is what makes 16-QAM and higher orders expensive, and it does not apply here: the penalty appears only when the constellation is packed tightly enough for the minimum distance to shrink. And with Gray coding a symbol error usually corrupts just one of the two bits, so the symbol error probability is about twice the bit error probability, not half of it.
  8. A designer wants a link to deliver 6 bits per second in every hertz of channel bandwidth. By the Shannon-Hartley bound, what is the smallest signal-to-noise power ratio that could possibly support that, on an additive white Gaussian noise channel?

    1. 36
    2. 12
    3. 63
    4. 64
    Show answer

    Answer: C — 63

    The capacity per unit bandwidth is C/B = log2(1 + S/N), so requiring 6 bits per second per hertz gives 1 + S/N = 2^6 = 64 and hence S/N = 63, about 18.0 dB. The tempting 64 is 2 raised to the spectral efficiency with the one left in place rather than subtracted, and it is the commonest slip because the added one looks like a detail next to a power of two; it matters more at low efficiencies than at high ones, but it is never correct to omit. The value 36 multiplies the efficiency by six instead of exponentiating, and 12 doubles it. Note also the direction of the trade this number illustrates: capacity grows only logarithmically with power, so each further bit per second per hertz roughly doubles the signal-to-noise ratio required.