Solution (source code)

= Solution
{c}

Put $A=a+s>1$ and $B=b+n-s>1$ as in part (a), and let $F_{A,B}$ be the <cumulative distribution function> of the <beta distribution> $\operatorname{Beta}(A,B)$. The two endpoint equations are
$$
\boxed{\begin{aligned}
F_{A,B}(\theta_2)-F_{A,B}(\theta_1)&=0.95,\\
\theta_1^{A-1}(1-\theta_1)^{B-1}
&=\theta_2^{A-1}(1-\theta_2)^{B-1}.
\end{aligned}}
$$
The first equation fixes the <posterior probability>, and the second makes the two endpoint <posterior densities> equal. Their admissible ordering is
$$
0<\theta_1<\frac{A-1}{A+B-2}<\theta_2<1.
$$
To justify sufficiency and uniqueness, the <derivative> of the logarithm of the <posterior density> is
$$
\frac{A-1}{\theta}-\frac{B-1}{1-\theta},
$$
which is positive below $m=(A-1)/(A+B-2)$ and negative above it. Thus the <posterior density> increases strictly to its unique <mode> and decreases strictly thereafter, vanishing at both ends. Each density threshold $k$ between zero and the maximum determines exactly one endpoint on each side of $m$. The <probability> between these endpoints decreases continuously and strictly from one to zero as $k$ increases, so exactly one threshold gives 0.95. This is the <beta highest posterior density endpoint characterization>.