Electronics and Communication Engineering‹›⌂ 0:00 studied

Module 7 · 11 min read · Free chapter

Information theory, channel capacity and error-control coding

In short

Entropy is the average information per symbol and sets the limit for compression; Huffman coding gets close to it. A channel's capacity is the highest rate at which errors can be made arbitrarily rare; for a noisy channel of bandwidth B it is B log₂(1 + S/N). Hamming codes correct single errors, and CRC detects burst errors in data frames.

What are you preparing for? We show the practice and previous year questions of your exam.

Start from zero: how much can a channel carry?

Engineers once believed that the only way to make a noisy link reliable was to slow it down: repeat each bit many times, and errors become rare, but the useful rate falls towards zero.

In 1948 Claude Shannon showed this was wrong. Every channel has a capacity, a maximum rate set by its bandwidth and noise. Below that rate, clever coding can make errors as rare as we like, without slowing to zero. Above it, nothing works.

Shannon also gave a way to measure information itself, the entropy of a source, which sets how far data can be compressed. Together these ideas founded information theory, which underlies ZIP files, mobile networks and deep-space links.

This chapter covers entropy and source coding, channel capacity, and the first practical error-control codes: Hamming codes and the CRC used in every Ethernet frame.

Why it matters. Entropy, Huffman coding, Shannon capacity and Hamming-code numericals are steady scorers in GATE EC and ESE papers.

Information and entropy

A message tells you more when it is surprising. "The sun rose today" tells you almost nothing, while "it snowed in Chennai" tells you a lot. Shannon measured the information in an event of probability pp as

I=log⁡21p bitsI = \log_2\frac{1}{p} \text{ bits}

A certain event, p=1p = 1, carries zero information. A fair coin toss, p=12p = \dfrac{1}{2}, carries exactly 1 bit.

A source emits symbols with probabilities p1,p2,…,pMp_1, p_2, \ldots, p_M. Its entropy is the average information per symbol:

H=∑i=1Mpilog⁡21pi bits/symbolH = \sum_{i=1}^{M} p_i \log_2\frac{1}{p_i} \text{ bits/symbol}

Entropy is largest when all symbols are equally likely, Hmax⁡=log⁡2MH_{\max} = \log_2 M. Any bias towards some symbols makes the source more predictable and lowers HH.

For a binary source with probabilities pp and 1−p1 - p, the binary entropy function is

H(p)=−plog⁡2p−(1−p)log⁡2(1−p)H(p) = -p\log_2 p - (1 - p)\log_2(1 - p)

It is 0 at p=0p = 0 and p=1p = 1, and peaks at 1 bit when p=12p = \dfrac{1}{2}. If the source emits rr symbols per second, its information rate is R=rHR = rH bits per second.

Worked example. A source emits four symbols with probabilities 12,14,18,18\dfrac{1}{2}, \dfrac{1}{4}, \dfrac{1}{8}, \dfrac{1}{8}. Then H=12(1)+14(2)+18(3)+18(3)=1.75H = \dfrac{1}{2}(1) + \dfrac{1}{4}(2) + \dfrac{1}{8}(3) + \dfrac{1}{8}(3) = 1.75 bits/symbol, less than the 2 bits of an equally likely source.

Why it matters. Entropy calculations are the most common information-theory questions, and they set the limit for the compression in the next section.

Source coding and Huffman codes

To send a source efficiently, give short codewords to common symbols and long ones to rare symbols, as Morse code does with E (a single dot). The average codeword length is

Lˉ=∑ipi li\bar{L} = \sum_i p_i\, l_i

where lil_i is the length of the codeword for symbol ii. Shannon's source coding theorem says no uniquely decodable code can do better than the entropy: Lˉ≥H\bar{L} \ge H. The coding efficiency is η=HLˉ\eta = \dfrac{H}{\bar{L}}.

A prefix code, in which no codeword is the start of another, can be decoded instantly without separators. Huffman coding builds the best possible prefix code:

  1. List the symbols by probability.
  2. Merge the two least likely into one node whose probability is their sum.
  3. Repeat until one node remains.
  4. Read each codeword by labelling the branches 0 and 1 from the root.

Worked example. For probabilities 12,14,18,18\dfrac{1}{2}, \dfrac{1}{4}, \dfrac{1}{8}, \dfrac{1}{8}, Huffman gives codewords 0, 10, 110 and 111. Then Lˉ=0.5(1)+0.25(2)+0.125(3)+0.125(3)=1.75\bar{L} = 0.5(1) + 0.25(2) + 0.125(3) + 0.125(3) = 1.75 bits, equal to HH, so η=100%\eta = 100\%. This happens whenever all probabilities are powers of 12\dfrac{1}{2}.

Shannon–Fano coding splits the list into two halves of nearly equal probability and repeats. It is simple but not always optimal.

Why it matters. "Build a Huffman code and find its efficiency" is one of the most frequent information-theory numericals in GATE and ESE.

Mutual information and channel capacity

A channel takes an input XX and gives an output YY, with some uncertainty because of noise. The conditional entropy H(X∣Y)H(X \mid Y) is the uncertainty left about the input after seeing the output. The information that actually got through is the mutual information:

I(X;Y)=H(X)−H(X∣Y)I(X;Y) = H(X) - H(X \mid Y)

It is never negative, and it is zero if the output tells nothing about the input. The channel capacity CC is the largest value of I(X;Y)I(X;Y) over all possible input probabilities.

The classic example is the binary symmetric channel (BSC). Each bit arrives correctly with probability 1−p1 - p and flipped with probability pp. Its capacity, reached with equally likely inputs, is

CBSC=1−H(p) bits per channel useC_{\mathrm{BSC}} = 1 - H(p) \text{ bits per channel use}

At p=0p = 0 the channel is perfect and C=1C = 1. At p=12p = \dfrac{1}{2} the output is pure chance and C=0C = 0. Interestingly, p=1p = 1 also gives C=1C = 1: every bit is flipped, so the receiver just inverts them.

Shannon's channel coding theorem says that if the information rate is below CC, codes exist that make the error probability as small as desired. Above CC, no code can.

Worked example. A BSC has p=0.1p = 0.1. Then H(0.1)≈0.469H(0.1) \approx 0.469, so C≈0.531C \approx 0.531 bits per use. At most about 53 useful bits can get through per 100 bits sent.

Why it matters. BSC capacity and the meaning of mutual information are standard GATE questions, and they explain why coding adds redundancy.

The Shannon–Hartley capacity

For a continuous channel of bandwidth BB with additive white Gaussian noise, Shannon found the capacity in closed form:

C=Blog⁡2(1+SN) bits per secondC = B\log_2\left(1 + \frac{S}{N}\right) \text{ bits per second}

Here SN\dfrac{S}{N} is the signal-to-noise power ratio as a plain number, with N=N0BN = N_0 B. The formula shows the two resources of communication. Capacity grows linearly with bandwidth but only logarithmically with power, so doubling power adds only about BB bits per second at high SNR.

Widening the bandwidth also lets in more noise. As BB grows without limit, capacity does not grow forever; it approaches

C∞=SN0log⁡2e≈1.44 SN0C_\infty = \frac{S}{N_0}\log_2 e \approx 1.44\,\frac{S}{N_0}

Writing S=EbCS = E_b C at the limit gives the famous Shannon limit: reliable communication at any rate needs EbN0≥ln⁡2≈0.693\dfrac{E_b}{N_0} \ge \ln 2 \approx 0.693, or about −1.6-1.6 dB. Modern turbo and LDPC codes, used in 4G and 5G, come within a fraction of a dB of this limit.

The ratio CB=log⁡2(1+SN)\dfrac{C}{B} = \log_2\left(1 + \dfrac{S}{N}\right) is the best possible spectral efficiency. It explains why high-order QAM is used only when SNR is high.

Worked example. A telephone channel has B=3.1B = 3.1 kHz and SNR 30 dB, which is 1,000. Then C=3100log⁡2(1001)≈3100×9.97≈30.9C = 3100\log_2(1001) \approx 3100 \times 9.97 \approx 30.9 kb/s. Dial-up modems at 33.6 kb/s were close to this limit.

Why it matters. Shannon–Hartley calculations, especially with dB-to-ratio conversion, appear in almost every GATE EC paper.

Error-control codes: Hamming codes and CRC

Shannon proved good codes exist; engineers had to build them. The simplest useful family is the linear block code. An (n,k)(n, k) code takes kk data bits and adds n−kn - k parity bits, each a modulo-2 sum of some data bits. The code rate is kn\dfrac{k}{n}.

The power of a code depends on its minimum Hamming distance dmin⁡d_{\min}, the fewest bit positions in which any two codewords differ. A code with distance dmin⁡d_{\min} can

detect up to dmin⁡−1 errors,correct up to t=⌊dmin⁡−12⌋ errors\text{detect up to } d_{\min} - 1 \text{ errors}, \qquad \text{correct up to } t = \left\lfloor \frac{d_{\min} - 1}{2} \right\rfloor \text{ errors}

Hamming codes have n=2m−1n = 2^m - 1 and k=n−mk = n - m for an integer m≥3m \ge 3, with dmin⁡=3d_{\min} = 3, so they correct any single error. The (7, 4) Hamming code adds 3 parity bits to 4 data bits, at rate 47\dfrac{4}{7}.

Decoding uses the parity-check matrix HH. The receiver computes the syndrome s=rHTs = rH^T from the received word rr. A zero syndrome means no error was detected. For a Hamming code, a non-zero syndrome equals the column of HH at the position of the error, so the receiver flips that bit.

For error detection on long frames, networks use the cyclic redundancy check (CRC). The message, treated as a polynomial and shifted left by rr bits, is divided modulo 2 by a generator polynomial g(x)g(x) of degree rr. The rr-bit remainder is appended.

The receiver divides again and checks for a zero remainder. A good CRC detects all single and double errors, all odd numbers of errors and all bursts of length rr or less. Ethernet uses a 32-bit CRC.

Worked example. A code has dmin⁡=5d_{\min} = 5. It can detect up to 4 errors or correct up to 2.

Why it matters. Detection and correction capability from dmin⁡d_{\min}, Hamming code parameters and syndrome decoding are routine GATE questions.

Descriptive lens

Written papers ask about this topic in four ways:

  1. Define information, entropy and information rate, and compute them for a given source.
  2. Construct a Huffman or Shannon–Fano code and find its efficiency and redundancy.
  3. Explain mutual information and channel capacity, for the binary symmetric channel and the AWGN channel, including the Shannon limit.
  4. Explain linear block codes, Hamming codes, syndrome decoding and CRC with an example.

Practice questions (our own, not previous-year questions).

  1. A source emits five symbols with probabilities 0.4, 0.2, 0.2, 0.1 and 0.1. Find its entropy, construct a Huffman code and find the coding efficiency. (15 marks)
  2. State the Shannon–Hartley theorem. Show that capacity approaches 1.44SN01.44\dfrac{S}{N_0} as bandwidth grows, and derive the Shannon limit on EbN0\dfrac{E_b}{N_0}. (15 marks)
  3. For the (7, 4) Hamming code, explain how a single error is located using the syndrome. Why is CRC preferred for error detection in data networks? (10 marks)

Answer plan for question 1.

  • Compute H=0.4log⁡22.5+2(0.2log⁡25)+2(0.1log⁡210)≈2.12H = 0.4\log_2 2.5 + 2(0.2\log_2 5) + 2(0.1\log_2 10) \approx 2.12 bits.
  • Merge 0.1 and 0.1 into 0.2, then two 0.2 nodes into 0.4, then the remaining 0.2 and the original 0.4 into 0.6, then 0.4 and 0.6.
  • Read the codeword lengths 2, 2, 2, 3 and 3 from the tree.
  • Find Lˉ=0.4(2)+0.2(2)+0.2(2)+0.1(3)+0.1(3)=2.2\bar{L} = 0.4(2) + 0.2(2) + 0.2(2) + 0.1(3) + 0.1(3) = 2.2 bits.
  • Conclude that η=2.122.2≈96%\eta = \dfrac{2.12}{2.2} \approx 96\%.

Quick revision

  • Information I=log⁡21pI = \log_2\dfrac{1}{p} bits, and entropy H=∑pilog⁡21piH = \sum p_i\log_2\dfrac{1}{p_i}.
  • Maximum entropy is log⁡2M\log_2 M for equally likely symbols; binary entropy peaks at 1 bit at p=12p = \dfrac{1}{2}.
  • Information rate is R=rHR = rH.
  • Source coding: Lˉ≥H\bar{L} \ge H and η=HLˉ\eta = \dfrac{H}{\bar{L}}; Huffman merges the two least likely symbols.
  • Mutual information I(X;Y)=H(X)−H(X∣Y)I(X;Y) = H(X) - H(X \mid Y); capacity is its maximum.
  • BSC capacity is 1−H(p)1 - H(p), zero at p=12p = \dfrac{1}{2}.
  • Shannon–Hartley: C=Blog⁡2(1+S/N)C = B\log_2(1 + S/N), tending to 1.44SN01.44\dfrac{S}{N_0} as B→∞B \to \infty.
  • Shannon limit: EbN0≥ln⁡2≈−1.6\dfrac{E_b}{N_0} \ge \ln 2 \approx -1.6 dB.
  • A code detects dmin⁡−1d_{\min} - 1 errors and corrects ⌊dmin⁡−12⌋\left\lfloor\dfrac{d_{\min} - 1}{2}\right\rfloor.
  • Hamming codes: n=2m−1n = 2^m - 1, k=n−mk = n - m, dmin⁡=3d_{\min} = 3; CRC detects bursts up to its degree.

Check yourself

Exam-style questions on this chapter. Pick an answer to see the explanation. 0 of 12 answered

  1. An event has probability 18\dfrac{1}{8}. The information it carries is:

  2. A source emits four symbols with probabilities 12,14,18,18\dfrac{1}{2}, \dfrac{1}{4}, \dfrac{1}{8}, \dfrac{1}{8}. Its entropy is:

  3. The entropy of a source with 16 equally likely symbols is:

  4. For probabilities 12,14,18,18\dfrac{1}{2}, \dfrac{1}{4}, \dfrac{1}{8}, \dfrac{1}{8}, the Huffman code has average length and efficiency:

  5. In Huffman coding, at each step the algorithm merges:

  6. The capacity of a binary symmetric channel with crossover probability 12\dfrac{1}{2} is:

  7. Mutual information I(X;Y)I(X;Y) equals:

  8. A channel has bandwidth 3.1 kHz and SNR 30 dB. Its Shannon capacity is about:

  9. As the bandwidth of an AWGN channel grows without limit at fixed signal power SS, the capacity:

  10. A block code has minimum Hamming distance 5. It can correct up to:

  11. A Hamming code with m=4m = 4 parity bits has block length nn and data bits kk equal to:

  12. A CRC with a generator polynomial of degree 16 is guaranteed to detect:

Previous year questions

Previous year questions for UPSC CSE will appear here once each one is checked word for word against the official question paper.

Learn with AI

A tutor that asks instead of telling, a partner that argues the other side, and this chapter told through your own district.

Tell the tutor what you are stuck on. It will guide you with questions and give the answer after a few tries.

🙋 Raise a doubt or feedback

Stuck somewhere, or spotted a mistake? Write to the ExamHike team. We usually reply within a day, and you will see the reply on My progress.

Log in to ask a doubt or send feedback →

Frequently asked questions

What is the Shannon limit?

Reliable communication at any rate needs E_b/N₀ of at least ln 2, about −1.6 dB; modern LDPC and turbo codes come close to it.

How many errors can a code correct?

With minimum distance d it corrects ⌊(d − 1)/2⌋ errors and detects d − 1; a Hamming code with d = 3 corrects one.

What is the capacity of a binary symmetric channel?

C = 1 − H(p) bits per use, where p is the flip probability; it is zero when p = 0.5.

When is Huffman coding 100% efficient?

When every symbol probability is a power of one half, so codeword lengths can equal log₂(1/p) exactly.

More in this module: Digital communication

Official sources

Facts in this chapter were checked against these official sources.

  1. GATE 2026 Electronics and Communication Engineering (EC) syllabus, IIT Guwahati
  2. NPTEL Digital Communication (IIT Kharagpur, 117105077): information theory, source coding, channel capacity and error-control codes