Skip to main content

Importance of source coding; Shannon-Fano vs BCD (four symbols)

Short answer

Source coding reduces bit rate by giving short codes to probable symbols. With probabilities 0.5,0.25,0.125,0.125, Shannon-Fano achieves average length 1.75 bits/symbol, matching entropy, for 100% efficiency. BCD with 4 bits per symbol yields only 43.75% efficiency.

Explain the importance of source coding in digital communication system. A discrete memory less source emits four symbols with probabilities P = {0.125, 0.125, 0.25, 0.5}. If the output symbols are encoded using Shannon Fano code, find the Coding efficiency and compare the coding efficiency with that of BCD code.

Importance of source coding

Source coding removes redundancy from the source output so that each symbol is represented by as few bits as possible on average:

  • It reduces the bit rate, so less bandwidth, power and storage are needed.
  • It uses the symbol probabilities: likely symbols get short code words.
  • The best possible average length is the entropy HH; efficiency η=H/Lˉ\eta = H/\bar L shows how close a code comes.

Shannon–Fano code

P={0.125,0.125,0.25,0.5}P = \{0.125, 0.125, 0.25, 0.5\} for x1,x2,x3,x4x_1, x_2, x_3, x_4. In decreasing order: x4x_4 0.5, x3x_3 0.25, x1x_1 0.125, x2x_2 0.125. Splits: {0.5} | {0.25, 0.125, 0.125}; {0.25} | {0.125, 0.125}; {0.125} | {0.125}.

Symbolpip_iStep 1Step 2Step 3Codelil_i
x40.5001
x30.2510102
x10.1251101103
x20.1251111113

Entropy:

Symbolpip_ilog⁡2(1/pi)\log_2(1/p_i)pilog⁡2(1/pi)p_i\log_2(1/p_i)
x10.1253.00000.3750
x20.1253.00000.3750
x30.252.00000.5000
x40.51.00000.5000
Total11.7500
H=0.5(1)+0.25(2)+2(0.125)(3)=1.75 bits/symbolLˉSF=0.5(1)+0.25(2)+0.125(3)+0.125(3)=1.75 bits/symbolηSF=1.751.75=100%\begin{aligned} H &= 0.5(1) + 0.25(2) + 2(0.125)(3) = 1.75\ \text{bits/symbol} \\ \bar L_{SF} &= 0.5(1) + 0.25(2) + 0.125(3) + 0.125(3) = 1.75\ \text{bits/symbol} \\ \eta_{SF} &= \frac{1.75}{1.75} = 100\% \end{aligned}

Comparison with BCD

In BCD each symbol is sent as a 4-bit binary-coded-decimal word (0000, 0001, 0010, 0011), so Lˉ=4\bar L = 4:

ηBCD=1.754=43.75%\eta_{BCD} = \frac{1.75}{4} = 43.75\%
CodeLˉ\bar LEfficiency
Shannon–Fano1.75100 %
BCD (4 bits)443.75 %

Shannon–Fano reaches 100 % because all probabilities are powers of 12\frac12. (If "BCD" is read as the plain 2-bit binary code, η=1.75/2=87.5%\eta = 1.75/2 = 87.5\%; Shannon–Fano is still better.)

✓ Answer checked by Claude Opus 5.5 (high effort)

All Communication Systems chapter 6 questions →