Solution (source code)

= Solution

An arbitrage is a portfolio with nonpositive initial cost, nonnegative terminal payoff <almost surely> and a positive payoff with positive <probability>, allowing unused initial cash to be invested in the riskless asset. Equivalently it is a zero-cost portfolio with those terminal properties. An <equivalent martingale measure> $Q$ has the same <null sets> as the physical <measure> and satisfies $E_Q[S_1^i]=(1+r)S_0^i$ for every traded asset, with appropriate integrability.

For an agent with differentiable increasing concave utility and an optimal portfolio, let $W^*$ be its terminal wealth. The <first-order conditions> for variations in risky holdings are $E[U'(W^*)(S_1^i-(1+r)S_0^i)]=0$. If $U'(W^*)>0$ and integrable, normalize it to the <probability density> $Z=U'(W^*)/E[U'(W^*)]$. The <first-order conditions> make $Q$ with $dQ=Z\,dP$ an <equivalent martingale measure>. A small additional payoff $H$ then has marginal price
$$
\boxed{p(H)=\frac{E[U'(W^*)H]}{(1+r)E[U'(W^*)]}=\frac{E_QH}{1+r}.}
$$
This follows by setting the <first variation> of expected utility for buying a small claim at price $p$ equal to zero.