TExcelTAD
Home › Information Theory › The Binary Symmetric Channel

The Binary Symmetric Channel

The binary symmetric channel (BSC) is the workhorse model of information theory: each bit is flipped independently with probability ff. It is simple enough to analyse exactly and realistic enough to describe hard-decision decoding on radio links, memory errors and many other systems.

The model

Q=[1−fff1−f]Q = \begin{bmatrix} 1 - f & f \\ f & 1 - f \end{bmatrix}

The output is Y=X⊕NY = X \oplus N, where NN is a noise bit with P(N=1)=fP(N = 1) = f, independent of XX.

python · try it yourself
import numpy as np

rng = np.random.default_rng(0)
f = 0.1
x = rng.integers(0, 2, 1_000_000)
y = x ^ (rng.random(x.size) < f)
print("measured flip rate:", round(float(np.mean(x != y)), 4))
print("P(Y=1):", round(float(y.mean()), 4))
measured flip rate: 0.1
P(Y=1): 0.4999

Mutual information through a BSC

With input distribution P(X=1)=pP(X = 1) = p, the output has P(Y=1)=p(1−f)+(1−p)fP(Y = 1) = p(1 - f) + (1 - p)f, and since the noise is independent of the input,

I(X;Y)=H(Y)−H(Y∣X)=H2(p(1−f)+(1−p)f)−H2(f)I(X; Y) = H(Y) - H(Y \mid X) = H_2(p(1 - f) + (1 - p)f) - H_2(f)

H(Y∣X)=H2(f)H(Y \mid X) = H_2(f) whatever was sent: the channel always adds H2(f)H_2(f) bits of uncertainty. H(Y)H(Y) is largest when YY is uniform, which happens for p=12p = \frac{1}{2}. So the capacity is

CBSC=1−H2(f)C_{\text{BSC}} = 1 - H_2(f)
python · try it yourself
import numpy as np

def H2(p):
    return 0.0 if p in (0, 1) else float(-p * np.log2(p) - (1 - p) * np.log2(1 - p))

f = 0.1
for p in [0.0, 0.1, 0.3, 0.5, 0.7]:
    py1 = p * (1 - f) + (1 - p) * f
    print(f"P(X=1) = {p:.1f}: I(X;Y) = {H2(py1) - H2(f):.4f} bits")
print("capacity 1 - H2(f) =", round(1 - H2(f), 4))
P(X=1) = 0.0: I(X;Y) = 0.0000 bits
P(X=1) = 0.1: I(X;Y) = 0.2111 bits
P(X=1) = 0.3: I(X;Y) = 0.4558 bits
P(X=1) = 0.5: I(X;Y) = 0.5310 bits
P(X=1) = 0.7: I(X;Y) = 0.4558 bits
capacity 1 - H2(f) = 0.531

Capacity as a function of the noise

python · try it yourself
import numpy as np

def H2(p):
    return 0.0 if p in (0, 1) else float(-p * np.log2(p) - (1 - p) * np.log2(1 - p))

for f in [0.0, 0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 0.8, 1.0]:
    C = 1 - H2(f)
    print(f"f = {f:4.2f}: C = {C:.4f}  {'#' * int(round(40 * C))}")
f = 0.00: C = 1.0000  ########################################
f = 0.01: C = 0.9192  #####################################
f = 0.05: C = 0.7136  #############################
f = 0.10: C = 0.5310  #####################
f = 0.20: C = 0.2781  ###########
f = 0.30: C = 0.1187  #####
f = 0.50: C = 0.0000
f = 0.80: C = 0.2781  ###########
f = 1.00: C = 1.0000  ########################################
  • At f=0.5f = 0.5 the output is independent of the input: capacity 0.
  • At f=1f = 1 the channel always flips, which is as good as a perfect channel: just invert the output.
  • Even a small error rate costs a lot: f=0.01f = 0.01 already takes 8% of the capacity.

Hard and soft decisions

A BSC often arises from thresholding a continuous signal: send ±1\pm 1, add Gaussian noise, and decide by the sign. The flip probability is f=Φ(−1σ)f = \Phi(-\frac{1}{\sigma}), where Φ\Phi is the standard normal CDF. Keeping the continuous value ("soft decision") preserves more information than the sign alone (The Gaussian Channel), and modern decoders use soft values (Sum-Product (Belief Propagation) Decoding).

python · try it yourself
import numpy as np
from scipy.stats import norm

for sigma in [0.5, 0.8, 1.0]:
    f = norm.cdf(-1 / sigma)
    H2 = -f * np.log2(f) - (1 - f) * np.log2(1 - f)
    print(f"sigma = {sigma}: f = {f:.4f}, hard-decision capacity {1 - H2:.4f}")
sigma = 0.5: f = 0.0228, hard-decision capacity 0.8434
sigma = 0.8: f = 0.1056, hard-decision capacity 0.5133
sigma = 1.0: f = 0.1587, hard-decision capacity 0.3689

In software

  • x ^ (rng.random(n) < f) simulates a BSC on a NumPy array of bits.
  • Measured bit error rates in hardware are reported as BER; a BER of 10−310^{-3} corresponds to f=0.001f = 0.001 and capacity 1−H2(0.001)≈0.9891 - H_2(0.001) \approx 0.989.

Exercises

Exercise 1: Capacity

What is the capacity of a BSC with f=0.25f = 0.25?

Answer

About 0.189 bits per use.

Solution

H2(0.25)=0.25log⁡24+0.75log⁡243=0.5+0.311=0.811H_2(0.25) = 0.25 \log_2 4 + 0.75 \log_2 \frac{4}{3} = 0.5 + 0.311 = 0.811, so C=0.189C = 0.189.

Exercise 2: Symmetry

Why do the BSCs with ff and 1−f1 - f have the same capacity?

Answer

Inverting the output turns one into the other.

Solution

The receiver can flip every output bit. Also H2(f)=H2(1−f)H_2(f) = H_2(1 - f).

Exercise 3: Find f for a target capacity (code)

What flip probability f<0.5f < 0.5 gives capacity exactly 0.5?

Answer

About 0.110.

Solution
python · try it yourself
import numpy as np
from scipy.optimize import brentq

H2 = lambda p: -p * np.log2(p) - (1 - p) * np.log2(1 - p)
print(round(brentq(lambda f: 1 - H2(f) - 0.5, 1e-9, 0.5), 4))
0.11

A rate-1/2 code can work reliably on a BSC only if ff is below this value.

Test yourself

The capacity of a BSC with flip probability f is…

  1. 1−H2(f)1 - H_2(f)
  2. 1−f1 - f
  3. H2(f)H_2(f)
  4. 12\frac{1}{2}

A BSC with f = 0.5 has capacity…

  1. 0
  2. 0.5
  3. 1
  4. it depends on the input

Which input distribution achieves the capacity of a BSC?

  1. uniform
  2. always send 0
  3. P(X=1) = f
  4. P(X=1) = 1 - f