Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-345

Capacity of Cascaded BSCs

Problem

Two binary symmetric channels with crossover probabilities p1 and p2 are used in series. Return the capacity in bits of the equivalent channel, whose combined crossover probability is p1(1-p2) + p2(1-p1) and whose capacity is 1 - H2(p). Assume probabilities lie in [0, 1].

Hint

Flipping twice is equivalent to a single flip with the combined probability.

Test cases

case 1
in: [0.1,0.2]
expected: 0.17325362750738216
case 2
in: [0,0.3]
expected: 0.1187091007693073
case 3
in: [0.5,0.5]
expected: 0
case 4
in: [0,0]
expected: 1
case 5
in: [1,0.4]
expected: 0.02904940554533142
Starter codePython
import math
def cascaded_bsc_capacity(p1, p2):
    # Your code here
    pass

5 test cases · run your code against them in the editor