Fixed-capital quadratic hedge in a one-period market (source code)

= Fixed-capital quadratic hedge in a one-period market
{title2=$\theta(v)=G^{-1}\bigl[\operatorname{Cov}(Y,H)+(\mathbb EH-v)\mathbb EY\bigr]$}

For a discounted <contingent claim> $H$ and gain vector $Y$, fix initial capital $v$ and minimize $\mathbb E(H-v-\theta^TY)^2$. Differentiation gives the <least-squares normal equations> $G\theta=\mathbb E[Y(H-v)]$, where $G=\mathbb E[YY^T]$ is assumed invertible. This gives the displayed hedge. Optimizing capital as well instead centers the gains and uses their <covariance matrix>: $\theta^*=\operatorname{Cov}(Y)^{-1}\operatorname{Cov}(Y,H)$ and $v^*=\mathbb EH-(\theta^*)^T\mathbb EY$. Fixing the initial capital is therefore a different quadratic problem.