Skip to main content

Importance of source coding; Shannon-Fano vs fixed length (seven symbols)

Short answer

Source coding saves bandwidth by assigning shorter codes to frequent symbols. With an eight-symbol corrected source (adding p=0.2), entropy H = 2.6640 bits/symbol. Fixed-length (3 bits) gives 88.80% efficiency, 11.20% redundancy; Shannon-Fano yields 2.72 bits/symbol, 97.94% efficiency, 2.06% redundancy.

Discuss the importance of source coding in Digital Communication system. A DMS emits one of the seven symbol with probabilities P = [0.25, 0.2, 0.15, 0.08, 0.07, 0.03, 0.02]. Find the coding efficiency, Code Redundancy for both Shannon-Fano coding and Fixed Length Coding and compare result.

Importance of source coding

Source coding is the efficient representation of the source output in bits, by removing redundancy, so that the average number of bits per symbol Lˉ\bar L is as close as possible to the entropy HH.

  • Reduces bit rate: fewer bits per symbol means a lower transmission rate for the same information.
  • Saves bandwidth and power: a lower bit rate needs less channel bandwidth and less transmitted energy; storage space is also saved (ZIP, MP3, JPEG).
  • Uses symbol statistics: frequent symbols get short code words and rare symbols long code words (variable-length coding), as in Morse code.
  • Approaches the entropy limit: Shannon's source coding theorem says Lˉ≥H\bar L \ge H; good codes (Huffman, Shannon–Fano) reach close to HH.
  • Unique decodability: prefix codes (no code word is a prefix of another) can be decoded without separators.
  • Leaves room for channel coding: the bits saved can be used for error-control redundancy.

Numerical

The seven listed probabilities add to only 0.80, so a value is missing from the printed question. The same source appears in another IOE question as P={0.25,0.2,0.2,0.15,0.08,0.07,0.03,0.02}P = \{0.25, 0.2, 0.2, 0.15, 0.08, 0.07, 0.03, 0.02\} (a second 0.2 added), which adds to 1, so this set is used below. A fixed-length code needs 3 bits whether there are 7 or 8 symbols.

Entropy:

Symbolpip_ilog⁡2(1/pi)\log_2(1/p_i)pilog⁡2(1/pi)p_i\log_2(1/p_i)
x10.252.00000.5000
x20.22.32190.4644
x30.22.32190.4644
x40.152.73700.4105
x50.083.64390.2915
x60.073.83650.2686
x70.035.05890.1518
x80.025.64390.1129
Total12.6640
H=2.6640 bits/symbolH = 2.6640\ \text{bits/symbol}

(a) Shannon–Fano coding (first split {0.25, 0.2} = 0.45 vs 0.55):

Symbolpip_iStep 1Step 2Step 3Step 4Step 5Step 6Codelil_i
x10.2500002
x20.201012
x30.210102
x40.151101103
x50.08111011104
x60.0711110111105
x70.031111101111106
x80.021111111111116
Lˉ=0.25(2)+0.2(2)+0.2(2)+0.15(3)+0.08(4)+0.07(5)+0.03(6)+0.02(6)=0.5+0.4+0.4+0.45+0.32+0.35+0.18+0.12=2.72 bits/symbolηSF=2.66402.72=97.94%,γSF=1−η=2.06%\begin{aligned} \bar L &= 0.25(2)+0.2(2)+0.2(2)+0.15(3)+0.08(4)+0.07(5)+0.03(6)+0.02(6) \\ &= 0.5+0.4+0.4+0.45+0.32+0.35+0.18+0.12 = 2.72\ \text{bits/symbol} \\ \eta_{SF} &= \frac{2.6640}{2.72} = 97.94\%, \qquad \gamma_{SF} = 1-\eta = 2.06\% \end{aligned}

(b) Fixed-length coding: Lˉ=⌈log⁡28⌉=3\bar L = \lceil\log_2 8\rceil = 3 bits/symbol.

ηFL=2.66403=88.80%,γFL=11.20%\eta_{FL} = \frac{2.6640}{3} = 88.80\%, \qquad \gamma_{FL} = 11.20\%

Comparison

MethodLˉ\bar LEfficiencyRedundancy
Shannon–Fano2.7297.94 %2.06 %
Fixed length388.80 %11.20 %

Shannon–Fano coding saves 3−2.72=0.283 - 2.72 = 0.28 bits/symbol (about 9.3 %) over fixed-length coding, because it gives short code words to the frequent symbols. Fixed-length coding is simpler and needs no code table, but wastes bits when probabilities are unequal.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 6 questions →