Solution (source code)

= Solution

The channel matrix has entries $M_{xy}=P(Y=y\mid X=x)$, with nonnegative entries and each row summing to one. For an input distribution $\pi$, it induces the joint law $P(X=x,Y=y)=\pi_xM_{xy}$. Its capacity in bits per use is
$$
\boxed{C=\max_\pi I(X;Y)},\qquad I(X;Y)=H(Y)-H(Y\mid X).
$$
On finite alphabets the maximum exists by <continuity> on the <compact> <probability simplex>.