Solution (source code)

= Solution

Let the <probability> of the first input be $t$. The two equal output probabilities are $(2+t)/6$, and the third is $s=(1-t)/3$. Writing $h_2$ for the <binary entropy function>, the output <Shannon entropy>[entropy] is $h_2(s)+(1-s)$, while the <conditional entropy> is $t+(1-t)\log_2 3$. Therefore
$$
I(t)=h_2(s)-s\log_2(27/4),\qquad0\leq s\leq\frac13.
$$
The derivative with respect to $s$ is
$$
\log_2\frac{1-s}{s}-\log_2\frac{27}4,
$$
and the second derivative is $-1/(\ln2\,s(1-s))<0$ in the interior. Thus the unique stationary point is the global maximum. It occurs at $s=4/31$, so
$$
\boxed{P_X=(19/31,12/31)}.
$$
The capacity itself is $\boxed{C=\log_2(31/27)}$. The maximization is over $t$, not over arbitrary output distributions; $s=(1-t)/3$ keeps the feasible outputs explicit.