Solution (source code)

= Solution

For any finite <contingent claim> $C$ measurable at the final date in the natural binomial tree, <backward induction> gives
$$
\boxed{V_j=B_j\mathbb E_Q[C/B_N\mid\mathcal F_j].}
$$
At a node with stock $S_j$, let $V_{j+1}^u,V_{j+1}^d$ be its two successor values. Hold, during the next period,
$$
\boxed{\Delta_j=\frac{V_{j+1}^u-V_{j+1}^d}{S_j(u-d)},\qquad
\psi_j=\frac{uV_{j+1}^d-dV_{j+1}^u}{(u-d)B_{j+1}}.}
$$
The stock and bank holdings reproduce both successor values and cost $\Delta_jS_j+\psi_jB_j=R^{-1}[qV_{j+1}^u+(1-q)V_{j+1}^d]=V_j$. Rebalancing at every node is self-financing, and terminal value is $C$. Thus every such claim is replicated and the no-arbitrage price is unique.